diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/warning/WarningController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/warning/WarningController.java new file mode 100644 index 000000000..535b81910 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/warning/WarningController.java @@ -0,0 +1,96 @@ +package cn.iocoder.yudao.module.system.controller.admin.warning; + +import org.springframework.web.bind.annotation.*; + +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import java.util.*; +import java.io.IOException; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; + +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*; + +import cn.iocoder.yudao.module.system.controller.admin.warning.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.warning.WarningDO; +import cn.iocoder.yudao.module.system.service.warning.WarningService; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +@Tag(name = "管理后台 - 危急值记录") +@RestController +@RequestMapping("/system/warning") +@Validated +public class WarningController { + + @Resource + private WarningService warningService; + + @PostMapping("/create") + @Operation(summary = "创建危急值记录") + @PreAuthorize("@ss.hasPermission('system:warning:create')") + public CommonResult createWarning(@Valid @RequestBody WarningSaveReqVO createReqVO) { + return success(warningService.createWarning(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新危急值记录") + @PreAuthorize("@ss.hasPermission('system:warning:update')") + public CommonResult updateWarning(@Valid @RequestBody WarningSaveReqVO updateReqVO) { + warningService.updateWarning(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除危急值记录") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('system:warning:delete')") + public CommonResult deleteWarning(@RequestParam("id") String id) { + warningService.deleteWarning(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得危急值记录") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:warning:query')") + public CommonResult getWarning(@RequestParam("id") String id) { + WarningDO warning = warningService.getWarning(id); + return success(BeanUtils.toBean(warning, WarningRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得危急值记录分页") + @PreAuthorize("@ss.hasPermission('system:warning:query')") + public CommonResult> getWarningPage(@Valid WarningPageReqVO pageReqVO) { + PageResult pageResult = warningService.getWarningPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, WarningRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出危急值记录 Excel") + @PreAuthorize("@ss.hasPermission('system:warning:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportWarningExcel(@Valid WarningPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = warningService.getWarningPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "危急值记录.xls", "数据", WarningRespVO.class, + BeanUtils.toBean(list, WarningRespVO.class)); + } + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/warning/vo/WarningPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/warning/vo/WarningPageReqVO.java new file mode 100644 index 000000000..cb1f38366 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/warning/vo/WarningPageReqVO.java @@ -0,0 +1,57 @@ +package cn.iocoder.yudao.module.system.controller.admin.warning.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 危急值记录分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class WarningPageReqVO extends PageParam { + + @Schema(description = "机构ID", example = "13253") + private String orgId; + + @Schema(description = "检查ID,一人多个检查的检查id", example = "18705") + private String examId; + + @Schema(description = "登记ID :patientid ", example = "8680") + private String regId; + + @Schema(description = "上报机构id", example = "15352") + private String reportOrgId; + + @Schema(description = "上报机构名称", example = "芋艿") + private String reportorgName; + + @Schema(description = "上报医生") + private String reportDoctor; + + @Schema(description = "上报时间") + private LocalDateTime reportDate; + + @Schema(description = "危急值内容") + private String warningContent; + + @Schema(description = "危急值接收医生") + private String receiveDoctor; + + @Schema(description = "处理医生") + private String dealDoctor; + + @Schema(description = "确认时间") + private LocalDateTime checkDateTime; + + @Schema(description = "备注", example = "你说的对") + private String remark; + + @Schema(description = "危急值报告进程:Json格式") + private String warningProcess; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/warning/vo/WarningRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/warning/vo/WarningRespVO.java new file mode 100644 index 000000000..9daf4f070 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/warning/vo/WarningRespVO.java @@ -0,0 +1,72 @@ +package cn.iocoder.yudao.module.system.controller.admin.warning.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 危急值记录 Response VO") +@Data +@ExcelIgnoreUnannotated +public class WarningRespVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "26575") + @ExcelProperty("主键") + private String id; + + @Schema(description = "机构ID", example = "13253") + @ExcelProperty("机构ID") + private String orgId; + + @Schema(description = "检查ID,一人多个检查的检查id", example = "18705") + @ExcelProperty("检查ID,一人多个检查的检查id") + private String examId; + + @Schema(description = "登记ID :patientid ", example = "8680") + @ExcelProperty("登记ID :patientid ") + private String regId; + + @Schema(description = "上报机构id", example = "15352") + @ExcelProperty("上报机构id") + private String reportOrgId; + + @Schema(description = "上报机构名称", example = "芋艿") + @ExcelProperty("上报机构名称") + private String reportorgName; + + @Schema(description = "上报医生") + @ExcelProperty("上报医生") + private String reportDoctor; + + @Schema(description = "上报时间") + @ExcelProperty("上报时间") + private LocalDateTime reportDate; + + @Schema(description = "危急值内容") + @ExcelProperty("危急值内容") + private String warningContent; + + @Schema(description = "危急值接收医生") + @ExcelProperty("危急值接收医生") + private String receiveDoctor; + + @Schema(description = "处理医生") + @ExcelProperty("处理医生") + private String dealDoctor; + + @Schema(description = "确认时间") + @ExcelProperty("确认时间") + private LocalDateTime checkDateTime; + + @Schema(description = "备注", example = "你说的对") + @ExcelProperty("备注") + private String remark; + + @Schema(description = "危急值报告进程:Json格式") + @ExcelProperty("危急值报告进程:Json格式") + private String warningProcess; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/warning/vo/WarningSaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/warning/vo/WarningSaveReqVO.java new file mode 100644 index 000000000..578c31a0e --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/warning/vo/WarningSaveReqVO.java @@ -0,0 +1,55 @@ +package cn.iocoder.yudao.module.system.controller.admin.warning.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 危急值记录新增/修改 Request VO") +@Data +public class WarningSaveReqVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "26575") + private String id; + + @Schema(description = "机构ID", example = "13253") + private String orgId; + + @Schema(description = "检查ID,一人多个检查的检查id", example = "18705") + private String examId; + + @Schema(description = "登记ID :patientid ", example = "8680") + private String regId; + + @Schema(description = "上报机构id", example = "15352") + private String reportOrgId; + + @Schema(description = "上报机构名称", example = "芋艿") + private String reportorgName; + + @Schema(description = "上报医生") + private String reportDoctor; + + @Schema(description = "上报时间") + private LocalDateTime reportDate; + + @Schema(description = "危急值内容") + private String warningContent; + + @Schema(description = "危急值接收医生") + private String receiveDoctor; + + @Schema(description = "处理医生") + private String dealDoctor; + + @Schema(description = "确认时间") + private LocalDateTime checkDateTime; + + @Schema(description = "备注", example = "你说的对") + private String remark; + + @Schema(description = "危急值报告进程:Json格式") + private String warningProcess; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/warning/WarningDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/warning/WarningDO.java new file mode 100644 index 000000000..f0069c7ad --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/warning/WarningDO.java @@ -0,0 +1,96 @@ +package cn.iocoder.yudao.module.system.dal.dataobject.warning; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 危急值记录 DO + * + * @author 李晓东 + */ +@TableName("tb_warning") +@KeySequence("tb_warning_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class WarningDO extends BaseDO { + + /** + * 主键 + */ + @TableId(type = IdType.INPUT) + private String id; + /** + * 机构ID + */ + @TableField("orgId") + private String orgId; + /** + * 检查ID,一人多个检查的检查id + */ + @TableField("examId") + private String examId; + /** + * 登记ID :patientid + */ + @TableField("regId") + private String regId; + /** + * 上报机构id + */ + @TableField("reportOrgId") + private String reportOrgId; + /** + * 上报机构名称 + */ + @TableField("reportorgName") + private String reportorgName; + /** + * 上报医生 + */ + @TableField("reportDoctor") + private String reportDoctor; + /** + * 上报时间 + */ + @TableField("reportDate") + private LocalDateTime reportDate; + /** + * 危急值内容 + */ + @TableField("warningContent") + private String warningContent; + /** + * 危急值接收医生 + */ + @TableField("receiveDoctor") + private String receiveDoctor; + /** + * 处理医生 + */ + @TableField("dealDoctor") + private String dealDoctor; + /** + * 确认时间 + */ + @TableField("checkDateTime") + private LocalDateTime checkDateTime; + /** + * 备注 + */ + @TableField("remark") + private String remark; + /** + * 危急值报告进程:Json格式 + */ + @TableField("warningProcess") + private String warningProcess; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/warning/WarningMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/warning/WarningMapper.java new file mode 100644 index 000000000..72eba91f6 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/warning/WarningMapper.java @@ -0,0 +1,38 @@ +package cn.iocoder.yudao.module.system.dal.mysql.warning; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.system.dal.dataobject.warning.WarningDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.system.controller.admin.warning.vo.*; + +/** + * 危急值记录 Mapper + * + * @author 李晓东 + */ +@Mapper +public interface WarningMapper extends BaseMapperX { + + default PageResult selectPage(WarningPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(WarningDO::getOrgId, reqVO.getOrgId()) + .eqIfPresent(WarningDO::getExamId, reqVO.getExamId()) + .eqIfPresent(WarningDO::getRegId, reqVO.getRegId()) + .eqIfPresent(WarningDO::getReportOrgId, reqVO.getReportOrgId()) + .eqIfPresent(WarningDO::getReportorgName, reqVO.getReportorgName()) + .eqIfPresent(WarningDO::getReportDoctor, reqVO.getReportDoctor()) + .eqIfPresent(WarningDO::getReportDate, reqVO.getReportDate()) + .eqIfPresent(WarningDO::getWarningContent, reqVO.getWarningContent()) + .eqIfPresent(WarningDO::getReceiveDoctor, reqVO.getReceiveDoctor()) + .eqIfPresent(WarningDO::getDealDoctor, reqVO.getDealDoctor()) + .eqIfPresent(WarningDO::getCheckDateTime, reqVO.getCheckDateTime()) + .eqIfPresent(WarningDO::getRemark, reqVO.getRemark()) + .eqIfPresent(WarningDO::getWarningProcess, reqVO.getWarningProcess()) + .orderByDesc(WarningDO::getId)); + } + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/warning/WarningService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/warning/WarningService.java new file mode 100644 index 000000000..9960e5ea2 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/warning/WarningService.java @@ -0,0 +1,56 @@ +package cn.iocoder.yudao.module.system.service.warning; + +import java.util.*; +import cn.iocoder.yudao.module.system.controller.admin.warning.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.warning.WarningDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; + +import javax.validation.Valid; + +/** + * 危急值记录 Service 接口 + * + * @author 李晓东 + */ +public interface WarningService { + + /** + * 创建危急值记录 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + String createWarning(@Valid WarningSaveReqVO createReqVO); + + /** + * 更新危急值记录 + * + * @param updateReqVO 更新信息 + */ + void updateWarning(@Valid WarningSaveReqVO updateReqVO); + + /** + * 删除危急值记录 + * + * @param id 编号 + */ + void deleteWarning(String id); + + /** + * 获得危急值记录 + * + * @param id 编号 + * @return 危急值记录 + */ + WarningDO getWarning(String id); + + /** + * 获得危急值记录分页 + * + * @param pageReqVO 分页查询 + * @return 危急值记录分页 + */ + PageResult getWarningPage(WarningPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/warning/WarningServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/warning/WarningServiceImpl.java new file mode 100644 index 000000000..0aa67e927 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/warning/WarningServiceImpl.java @@ -0,0 +1,76 @@ +package cn.iocoder.yudao.module.system.service.warning; + +import cn.iocoder.yudao.framework.common.exception.ErrorCode; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import cn.iocoder.yudao.module.system.controller.admin.warning.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.warning.WarningDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; + +import cn.iocoder.yudao.module.system.dal.mysql.warning.WarningMapper; + +import javax.annotation.Resource; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; + +/** + * 危急值记录 Service 实现类 + * + * @author 李晓东 + */ +@Service +@Validated +public class WarningServiceImpl implements WarningService { + + @Resource + private WarningMapper warningMapper; + + @Override + public String createWarning(WarningSaveReqVO createReqVO) { + // 插入 + WarningDO warning = BeanUtils.toBean(createReqVO, WarningDO.class); + warningMapper.insert(warning); + // 返回 + return warning.getId(); + } + + @Override + public void updateWarning(WarningSaveReqVO updateReqVO) { + // 校验存在 + validateWarningExists(updateReqVO.getId()); + // 更新 + WarningDO updateObj = BeanUtils.toBean(updateReqVO, WarningDO.class); + warningMapper.updateById(updateObj); + } + + @Override + public void deleteWarning(String id) { + // 校验存在 + validateWarningExists(id); + // 删除 + warningMapper.deleteById(id); + } + + private void validateWarningExists(String id) { + if (warningMapper.selectById(id) == null) { + throw exception(new ErrorCode(999,"ID为空")); + } + } + + @Override + public WarningDO getWarning(String id) { + return warningMapper.selectById(id); + } + + @Override + public PageResult getWarningPage(WarningPageReqVO pageReqVO) { + return warningMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/warning/WarningMapper.xml b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/warning/WarningMapper.xml new file mode 100644 index 000000000..cbdc0e0b1 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/warning/WarningMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file