From 76f441dcab698d96d636c5bb7f1ce02497a7243c Mon Sep 17 00:00:00 2001 From: Flow <958079825@qq.com> Date: Sat, 26 Jul 2025 15:39:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=82=E8=80=83=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/admin/pft/PftController.java | 24 ++++ .../admin/pftdata/PftdataController.java | 17 +++ .../thresholds/ThresholdsController.java | 105 ++++++++++++++++ .../thresholds/vo/ThresholdsGroupRespVO.java | 24 ++++ .../thresholds/vo/ThresholdsItemRespVO.java | 37 ++++++ .../thresholds/vo/ThresholdsPageReqVO.java | 30 +++++ .../admin/thresholds/vo/ThresholdsRespVO.java | 41 ++++++ .../thresholds/vo/ThresholdsSaveReqVO.java | 34 +++++ .../dal/dataobject/pftdata/PftdataDO.java | 3 +- .../dataobject/thresholds/ThresholdsDO.java | 58 +++++++++ .../system/dal/mysql/pft/PftMapper.java | 24 ++++ .../mysql/thresholds/ThresholdsMapper.java | 44 +++++++ .../module/system/service/pft/PftService.java | 24 ++++ .../system/service/pft/PftServiceImpl.java | 33 +++++ .../service/pftdata/PftdataService.java | 10 ++ .../service/pftdata/PftdataServiceImpl.java | 23 ++++ .../service/thresholds/ThresholdsService.java | 70 +++++++++++ .../thresholds/ThresholdsServiceImpl.java | 119 ++++++++++++++++++ .../mapper/thresholds/ThresholdsMapper.xml | 12 ++ .../src/main/resources/application.yaml | 1 + 20 files changed, 731 insertions(+), 2 deletions(-) create mode 100644 yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/thresholds/ThresholdsController.java create mode 100644 yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/thresholds/vo/ThresholdsGroupRespVO.java create mode 100644 yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/thresholds/vo/ThresholdsItemRespVO.java create mode 100644 yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/thresholds/vo/ThresholdsPageReqVO.java create mode 100644 yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/thresholds/vo/ThresholdsRespVO.java create mode 100644 yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/thresholds/vo/ThresholdsSaveReqVO.java create mode 100644 yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/thresholds/ThresholdsDO.java create mode 100644 yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/thresholds/ThresholdsMapper.java create mode 100644 yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/thresholds/ThresholdsService.java create mode 100644 yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/thresholds/ThresholdsServiceImpl.java create mode 100644 yudao-module-system/src/main/resources/mapper/thresholds/ThresholdsMapper.xml diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/pft/PftController.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/pft/PftController.java index 721e426..cd9066e 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/pft/PftController.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/pft/PftController.java @@ -26,6 +26,7 @@ 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.pft.vo.*; +import cn.iocoder.yudao.module.system.controller.admin.patientinfo.vo.patientinfoRespVO; import cn.iocoder.yudao.module.system.dal.dataobject.pft.PftDO; import cn.iocoder.yudao.module.system.service.pft.PftService; @@ -94,4 +95,27 @@ public class PftController { BeanUtils.toBean(list, PftRespVO.class)); } + @PostMapping("/insertPftPatientData") + @Operation(summary = "批量插入肺功能患者基础信息") + public CommonResult insertPftPatientData(@RequestBody List patientInfoList) { + pftService.insertPftPatientData(patientInfoList); + return success(true); + } + + @PutMapping("/updatePftAnalysis") + @Operation(summary = "根据examid更新肺功能分析结果") + @Parameter(name = "examid", description = "检查ID", required = true) + @Parameter(name = "analysisResult", description = "分析结果", required = true) + public CommonResult updatePftAnalysis(@RequestParam("examid") String examid, + @RequestParam("analysisResult") String analysisResult) { + return success(pftService.updatePftAnalysis(examid, analysisResult)); + } + + @GetMapping("/getPftAnalysis") + @Operation(summary = "根据examid查询肺功能分析结果") + @Parameter(name = "examid", description = "检查ID", required = true) + public CommonResult getPftAnalysis(@RequestParam("examid") String examid) { + return success(pftService.getPftAnalysis(examid)); + } + } \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/pftdata/PftdataController.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/pftdata/PftdataController.java index a5bff8b..2349faa 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/pftdata/PftdataController.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/pftdata/PftdataController.java @@ -94,4 +94,21 @@ public class PftdataController { BeanUtils.toBean(list, PftdataRespVO.class)); } + @GetMapping("/getByExamidAndRegid") + @Operation(summary = "根据检查ID和患者ID获取肺功能数据") + public CommonResult getPftdataByExamidAndRegid(@RequestParam("examid") String examid, @RequestParam("regid") String regid) { + PftdataDO pftdata = pftdataService.getPftdataByExamidAndRegid(examid, regid); + return success(BeanUtils.toBean(pftdata, PftdataRespVO.class)); + } + + @PutMapping("/saveDiagnosisByExamidAndRegid") + @Operation(summary = "根据examid和regid保存诊断结论") + public CommonResult savePftdataDiagnosis(@RequestBody Map req) { + String examid = req.get("examid"); + String regid = req.get("regid"); + String diagnosis = req.get("diagnosis"); + pftdataService.savePftdataDiagnosis(examid, regid, diagnosis); + return success(true); + } + } \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/thresholds/ThresholdsController.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/thresholds/ThresholdsController.java new file mode 100644 index 0000000..1a0c588 --- /dev/null +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/thresholds/ThresholdsController.java @@ -0,0 +1,105 @@ +package cn.iocoder.yudao.module.system.controller.admin.thresholds; + +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +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 javax.validation.constraints.*; +import javax.validation.*; +import javax.servlet.http.*; +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.thresholds.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.thresholds.ThresholdsDO; +import cn.iocoder.yudao.module.system.service.thresholds.ThresholdsService; + +@Tag(name = "管理后台 - 指标设置") +@RestController +@RequestMapping("/system/thresholds") +@Validated +public class ThresholdsController { + + @Resource + private ThresholdsService thresholdsService; + + @PostMapping("/create") + @Operation(summary = "创建指标设置") + public CommonResult createThresholds(@Valid @RequestBody ThresholdsSaveReqVO createReqVO) { + return success(thresholdsService.createThresholds(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新指标设置") + public CommonResult updateThresholds(@Valid @RequestBody ThresholdsSaveReqVO updateReqVO) { + thresholdsService.updateThresholds(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除指标设置") + @Parameter(name = "id", description = "编号", required = true) + public CommonResult deleteThresholds(@RequestParam("id") Integer id) { + thresholdsService.deleteThresholds(id); + return success(true); + } + + @DeleteMapping("/delete-list") + @Parameter(name = "ids", description = "编号", required = true) + @Operation(summary = "批量删除指标设置") + public CommonResult deleteThresholdsList(@RequestParam("ids") List ids) { + thresholdsService.deleteThresholdsListByIds(ids); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得指标设置") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + public CommonResult getThresholds(@RequestParam("id") Integer id) { + ThresholdsDO thresholds = thresholdsService.getThresholds(id); + return success(BeanUtils.toBean(thresholds, ThresholdsRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得指标设置分页") + public CommonResult> getThresholdsPage(@Valid ThresholdsPageReqVO pageReqVO) { + PageResult pageResult = thresholdsService.getThresholdsPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, ThresholdsRespVO.class)); + } + + @GetMapping("/list-by-org") + @Operation(summary = "根据机构ID查询指标设置并按periodType分组") + @Parameter(name = "orgid", description = "机构ID", required = true, example = "1") + public CommonResult> getThresholdsByOrgIdGroupByPeriodType(@RequestParam("orgid") Integer orgid) { + List result = thresholdsService.getThresholdsByOrgIdGroupByPeriodType(orgid); + return success(result); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出指标设置 Excel") + @ApiAccessLog(operateType = EXPORT) + public void exportThresholdsExcel(@Valid ThresholdsPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = thresholdsService.getThresholdsPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "指标设置.xls", "数据", ThresholdsRespVO.class, + BeanUtils.toBean(list, ThresholdsRespVO.class)); + } + +} \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/thresholds/vo/ThresholdsGroupRespVO.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/thresholds/vo/ThresholdsGroupRespVO.java new file mode 100644 index 0000000..d48a572 --- /dev/null +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/thresholds/vo/ThresholdsGroupRespVO.java @@ -0,0 +1,24 @@ +package cn.iocoder.yudao.module.system.controller.admin.thresholds.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; + +@Schema(description = "管理后台 - 指标设置分组 Response VO") +@Data +public class ThresholdsGroupRespVO { + + @Schema(description = "时段类型", example = "全天") + private String periodType; + + @Schema(description = "该时段类型下的指标列表") + private List thresholdsList; + + public ThresholdsGroupRespVO() { + } + + public ThresholdsGroupRespVO(String periodType, List thresholdsList) { + this.periodType = periodType; + this.thresholdsList = thresholdsList; + } +} \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/thresholds/vo/ThresholdsItemRespVO.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/thresholds/vo/ThresholdsItemRespVO.java new file mode 100644 index 0000000..226c272 --- /dev/null +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/thresholds/vo/ThresholdsItemRespVO.java @@ -0,0 +1,37 @@ +package cn.iocoder.yudao.module.system.controller.admin.thresholds.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 指标设置项 Response VO") +@Data +@ExcelIgnoreUnannotated +public class ThresholdsItemRespVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "18680") + @ExcelProperty("主键") + private Integer id; + + @Schema(description = "机构ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "9106") + @ExcelProperty("机构ID") + private Integer orgid; + + @Schema(description = "指标类型", example = "收缩压") + @ExcelProperty("指标类型") + private String metrictype; + + @Schema(description = "最小值") + @ExcelProperty("最小值") + private Integer minValue; + + @Schema(description = "最大值") + @ExcelProperty("最大值") + private Integer maxValue; + + @Schema(description = "单位") + @ExcelProperty("单位") + private String unit; + +} \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/thresholds/vo/ThresholdsPageReqVO.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/thresholds/vo/ThresholdsPageReqVO.java new file mode 100644 index 0000000..450eaf0 --- /dev/null +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/thresholds/vo/ThresholdsPageReqVO.java @@ -0,0 +1,30 @@ +package cn.iocoder.yudao.module.system.controller.admin.thresholds.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; + +@Schema(description = "管理后台 - 指标设置分页 Request VO") +@Data +public class ThresholdsPageReqVO extends PageParam { + + @Schema(description = "机构ID", example = "9106") + private Integer orgid; + + @Schema(description = "时段类型", example = "2") + private String periodtype; + + @Schema(description = "指标类型", example = "1") + private String metrictype; + + @Schema(description = "最小值") + private Integer minValue; + + @Schema(description = "最大值") + private Integer maxValue; + + @Schema(description = "单位") + private String unit; + +} \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/thresholds/vo/ThresholdsRespVO.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/thresholds/vo/ThresholdsRespVO.java new file mode 100644 index 0000000..efb839f --- /dev/null +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/thresholds/vo/ThresholdsRespVO.java @@ -0,0 +1,41 @@ +package cn.iocoder.yudao.module.system.controller.admin.thresholds.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 指标设置 Response VO") +@Data +@ExcelIgnoreUnannotated +public class ThresholdsRespVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "18680") + @ExcelProperty("主键") + private Integer id; + + @Schema(description = "机构ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "9106") + @ExcelProperty("机构ID") + private Integer orgid; + + @Schema(description = "时段类型", example = "2") + @ExcelProperty("时段类型") + private String periodtype; + + @Schema(description = "指标类型", example = "1") + @ExcelProperty("指标类型") + private String metrictype; + + @Schema(description = "最小值") + @ExcelProperty("最小值") + private Integer minValue; + + @Schema(description = "最大值") + @ExcelProperty("最大值") + private Integer maxValue; + + @Schema(description = "单位") + @ExcelProperty("单位") + private String unit; + +} \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/thresholds/vo/ThresholdsSaveReqVO.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/thresholds/vo/ThresholdsSaveReqVO.java new file mode 100644 index 0000000..0afb52e --- /dev/null +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/thresholds/vo/ThresholdsSaveReqVO.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.module.system.controller.admin.thresholds.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 指标设置新增/修改 Request VO") +@Data +public class ThresholdsSaveReqVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "18680") + private Integer id; + + @Schema(description = "机构ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "9106") + @NotNull(message = "机构ID不能为空") + private Integer orgid; + + @Schema(description = "时段类型", example = "2") + private String periodtype; + + @Schema(description = "指标类型", example = "1") + private String metrictype; + + @Schema(description = "最小值") + private Integer minValue; + + @Schema(description = "最大值") + private Integer maxValue; + + @Schema(description = "单位") + private String unit; + +} \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/pftdata/PftdataDO.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/pftdata/PftdataDO.java index 8e6b745..752fdc1 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/pftdata/PftdataDO.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/pftdata/PftdataDO.java @@ -17,12 +17,11 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; @TableName("tb_pftdata") @KeySequence("tb_pftdata_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 @Data -@EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) @Builder @NoArgsConstructor @AllArgsConstructor -public class PftdataDO extends BaseDO { +public class PftdataDO{ /** * 主键ID diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/thresholds/ThresholdsDO.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/thresholds/ThresholdsDO.java new file mode 100644 index 0000000..ab15ed9 --- /dev/null +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/thresholds/ThresholdsDO.java @@ -0,0 +1,58 @@ +package cn.iocoder.yudao.module.system.dal.dataobject.thresholds; + +import lombok.*; +import java.util.*; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 指标设置 DO + * + * @author 艾康菲 + */ +@TableName("health_thresholds") +@KeySequence("health_thresholds_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ThresholdsDO { + /** + * 主键 + */ + @TableId + private Integer id; + /** + * 机构ID + */ + @TableField("orgid") + private Integer orgid; + /** + * 时段类型 + */ + @TableField("periodtype") + private String periodtype; + /** + * 指标类型 + */ + @TableField("metrictype") + private String metrictype; + /** + * 最小值 + */ + @TableField("min_value") + private Integer minValue; + /** + * 最大值 + */ + @TableField("max_value") + private Integer maxValue; + /** + * 单位 + */ + @TableField("unit") + private String unit; + + +} \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/pft/PftMapper.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/pft/PftMapper.java index df3264f..7d3871f 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/pft/PftMapper.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/pft/PftMapper.java @@ -8,6 +8,8 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.module.system.dal.dataobject.pft.PftDO; import org.apache.ibatis.annotations.Mapper; import cn.iocoder.yudao.module.system.controller.admin.pft.vo.*; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Update; /** * 肺功能患者 Mapper @@ -37,4 +39,26 @@ public interface PftMapper extends BaseMapperX { .orderByDesc(PftDO::getId)); } + /** + * 根据examid更新肺功能分析结果 + * + * @param examid 检查ID + * @param analysisResult 分析结果 + */ + @Update("UPDATE tb_pft SET analysisresult = #{analysisResult} WHERE examid = #{examid}") + void updateAnalysisByExamid(@Param("examid") String examid, @Param("analysisResult") String analysisResult); + + /** + * 根据examid查询肺功能分析结果 + * + * @param examid 检查ID + * @return 分析结果 + */ + default String selectAnalysisByExamid(String examid) { + PftDO pft = selectOne(new LambdaQueryWrapperX() + .eq(PftDO::getExamid, examid) + .select(PftDO::getAnalysisresult)); + return pft != null ? pft.getAnalysisresult() : null; + } + } \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/thresholds/ThresholdsMapper.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/thresholds/ThresholdsMapper.java new file mode 100644 index 0000000..d91fc99 --- /dev/null +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/thresholds/ThresholdsMapper.java @@ -0,0 +1,44 @@ +package cn.iocoder.yudao.module.system.dal.mysql.thresholds; + +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.thresholds.ThresholdsDO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import cn.iocoder.yudao.module.system.controller.admin.thresholds.vo.*; + +/** + * 指标设置 Mapper + * + * @author 艾康菲 + */ +@Mapper +public interface ThresholdsMapper extends BaseMapperX { + + default PageResult selectPage(ThresholdsPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(ThresholdsDO::getOrgid, reqVO.getOrgid()) + .eqIfPresent(ThresholdsDO::getPeriodtype, reqVO.getPeriodtype()) + .eqIfPresent(ThresholdsDO::getMetrictype, reqVO.getMetrictype()) + .eqIfPresent(ThresholdsDO::getMinValue, reqVO.getMinValue()) + .eqIfPresent(ThresholdsDO::getMaxValue, reqVO.getMaxValue()) + .eqIfPresent(ThresholdsDO::getUnit, reqVO.getUnit()) + .orderByDesc(ThresholdsDO::getId)); + } + + /** + * 根据机构ID查询指标设置并按periodType分组 + * + * @param orgId 机构ID + * @return 按periodType分组的指标设置列表 + */ + default List selectByOrgIdGroupByPeriodType(@Param("orgId") Integer orgId) { + return selectList(new LambdaQueryWrapperX() + .eq(ThresholdsDO::getOrgid, orgId) + .orderByAsc(ThresholdsDO::getPeriodtype)); + } + +} \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/pft/PftService.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/pft/PftService.java index 1149c6a..b9b8e82 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/pft/PftService.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/pft/PftService.java @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.service.pft; import java.util.*; import javax.validation.*; import cn.iocoder.yudao.module.system.controller.admin.pft.vo.*; +import cn.iocoder.yudao.module.system.controller.admin.patientinfo.vo.patientinfoRespVO; import cn.iocoder.yudao.module.system.dal.dataobject.pft.PftDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageParam; @@ -43,6 +44,29 @@ public interface PftService { */ void deletePftListByIds(List ids); + /** + * 批量插入肺功能患者基础信息 + * + * @param patientInfoList 患者信息列表 + */ + void insertPftPatientData(List patientInfoList); + + /** + * 根据examid更新肺功能分析结果 + * + * @param examid 检查ID + * @param analysisResult 分析结果 + * @return 是否成功 + */ + Boolean updatePftAnalysis(String examid, String analysisResult); + + /** + * 根据examid查询肺功能分析结果 + * @param examid 检查ID + * @return 分析结果 + */ + String getPftAnalysis(String examid); + /** * 获得肺功能患者 * diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/pft/PftServiceImpl.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/pft/PftServiceImpl.java index c66310b..9151561 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/pft/PftServiceImpl.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/pft/PftServiceImpl.java @@ -8,6 +8,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.*; import cn.iocoder.yudao.module.system.controller.admin.pft.vo.*; +import cn.iocoder.yudao.module.system.controller.admin.patientinfo.vo.patientinfoRespVO; import cn.iocoder.yudao.module.system.dal.dataobject.pft.PftDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageParam; @@ -66,6 +67,38 @@ public class PftServiceImpl implements PftService { pftMapper.deleteByIds(ids); } + @Override + public void insertPftPatientData(List patientInfoList) { + if (CollUtil.isNotEmpty(patientInfoList)) { + List pftDataList = new ArrayList<>(); + for (patientinfoRespVO patientInfo : patientInfoList) { + PftDO pft = new PftDO(); + pft.setRegid(patientInfo.getRegid()); + String examId = UUID.randomUUID().toString().replaceAll("-", ""); // 去除横线保持简洁 + pft.setExamid(examId); + pft.setName(patientInfo.getName()); + pft.setGender(patientInfo.getGender()); + pft.setOrgid(patientInfo.getOrgid()); + pft.setOrgname(patientInfo.getOrgname()); + pft.setStatus(0); // 默认状态:0申请中 + pftDataList.add(pft); + } + // 批量插入肺功能数据 + pftMapper.insertBatch(pftDataList); + } + } + + @Override + public Boolean updatePftAnalysis(String examid, String analysisResult) { + pftMapper.updateAnalysisByExamid(examid, analysisResult); + return true; + } + + @Override + public String getPftAnalysis(String examid) { + return pftMapper.selectAnalysisByExamid(examid); + } + private void validatePftExists(List ids) { List list = pftMapper.selectByIds(ids); if (CollUtil.isEmpty(list) || list.size() != ids.size()) { diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/pftdata/PftdataService.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/pftdata/PftdataService.java index 3594e67..13ff50b 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/pftdata/PftdataService.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/pftdata/PftdataService.java @@ -59,4 +59,14 @@ public interface PftdataService { */ PageResult getPftdataPage(PftdataPageReqVO pageReqVO); + /** + * 根据检查ID和患者ID获取肺功能数据 + */ + PftdataDO getPftdataByExamidAndRegid(String examid, String regid); + + /** + * 根据examid和regid保存诊断结论 + */ + void savePftdataDiagnosis(String examid, String regid, String diagnosis); + } \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/pftdata/PftdataServiceImpl.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/pftdata/PftdataServiceImpl.java index b90efb8..44e4b6d 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/pftdata/PftdataServiceImpl.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/pftdata/PftdataServiceImpl.java @@ -87,4 +87,27 @@ public class PftdataServiceImpl implements PftdataService { return pftdataMapper.selectPage(pageReqVO); } + @Override + public PftdataDO getPftdataByExamidAndRegid(String examid, String regid) { + return pftdataMapper.selectOne( + new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper() + .eq(PftdataDO::getExamid, examid) + .eq(PftdataDO::getRegid, regid) + ); + } + + @Override + public void savePftdataDiagnosis(String examid, String regid, String diagnosis) { + int updated = pftdataMapper.update( + null, + new com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper() + .eq(PftdataDO::getExamid, examid) + .eq(PftdataDO::getRegid, regid) + .set(PftdataDO::getDiagnosis, diagnosis) + ); + if (updated == 0) { + throw new RuntimeException("未找到对应的肺功能数据记录,无法保存诊断结论"); + } + } + } \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/thresholds/ThresholdsService.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/thresholds/ThresholdsService.java new file mode 100644 index 0000000..51f1b00 --- /dev/null +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/thresholds/ThresholdsService.java @@ -0,0 +1,70 @@ +package cn.iocoder.yudao.module.system.service.thresholds; + +import java.util.*; +import javax.validation.*; +import cn.iocoder.yudao.module.system.controller.admin.thresholds.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.thresholds.ThresholdsDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; + +/** + * 指标设置 Service 接口 + * + * @author 艾康菲 + */ +public interface ThresholdsService { + + /** + * 创建指标设置 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Integer createThresholds(@Valid ThresholdsSaveReqVO createReqVO); + + /** + * 更新指标设置 + * + * @param updateReqVO 更新信息 + */ + void updateThresholds(@Valid ThresholdsSaveReqVO updateReqVO); + + /** + * 删除指标设置 + * + * @param id 编号 + */ + void deleteThresholds(Integer id); + + /** + * 批量删除指标设置 + * + * @param ids 编号 + */ + void deleteThresholdsListByIds(List ids); + + /** + * 获得指标设置 + * + * @param id 编号 + * @return 指标设置 + */ + ThresholdsDO getThresholds(Integer id); + + /** + * 获得指标设置分页 + * + * @param pageReqVO 分页查询 + * @return 指标设置分页 + */ + PageResult getThresholdsPage(ThresholdsPageReqVO pageReqVO); + + /** + * 根据机构ID查询指标设置并按periodType分组 + * + * @param orgId 机构ID + * @return 按periodType分组的指标设置列表 + */ + List getThresholdsByOrgIdGroupByPeriodType(Integer orgId); + +} \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/thresholds/ThresholdsServiceImpl.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/thresholds/ThresholdsServiceImpl.java new file mode 100644 index 0000000..a9aad1d --- /dev/null +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/thresholds/ThresholdsServiceImpl.java @@ -0,0 +1,119 @@ +package cn.iocoder.yudao.module.system.service.thresholds; + +import cn.hutool.core.collection.CollUtil; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import cn.iocoder.yudao.module.system.controller.admin.thresholds.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.thresholds.ThresholdsDO; +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.thresholds.ThresholdsMapper; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.diffList; +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; + +/** + * 指标设置 Service 实现类 + * + * @author 艾康菲 + */ +@Service +@Validated +public class ThresholdsServiceImpl implements ThresholdsService { + + @Resource + private ThresholdsMapper thresholdsMapper; + + @Override + public Integer createThresholds(ThresholdsSaveReqVO createReqVO) { + // 插入 + ThresholdsDO thresholds = BeanUtils.toBean(createReqVO, ThresholdsDO.class); + thresholdsMapper.insert(thresholds); + // 返回 + return thresholds.getId(); + } + + @Override + public void updateThresholds(ThresholdsSaveReqVO updateReqVO) { + // 校验存在 + validateThresholdsExists(updateReqVO.getId()); + // 更新 + ThresholdsDO updateObj = BeanUtils.toBean(updateReqVO, ThresholdsDO.class); + thresholdsMapper.updateById(updateObj); + } + + @Override + public void deleteThresholds(Integer id) { + // 校验存在 + validateThresholdsExists(id); + // 删除 + thresholdsMapper.deleteById(id); + } + + @Override + public void deleteThresholdsListByIds(List ids) { + // 校验存在 + validateThresholdsExists(ids); + // 删除 + thresholdsMapper.deleteByIds(ids); + } + + private void validateThresholdsExists(List ids) { + List list = thresholdsMapper.selectByIds(ids); + if (CollUtil.isEmpty(list) || list.size() != ids.size()) { + } + } + + private void validateThresholdsExists(Integer id) { + if (thresholdsMapper.selectById(id) == null) { + } + } + + @Override + public ThresholdsDO getThresholds(Integer id) { + return thresholdsMapper.selectById(id); + } + + @Override + public PageResult getThresholdsPage(ThresholdsPageReqVO pageReqVO) { + return thresholdsMapper.selectPage(pageReqVO); + } + + @Override + public List getThresholdsByOrgIdGroupByPeriodType(Integer orgId) { + // 查询所有数据 + List allThresholds = thresholdsMapper.selectByOrgIdGroupByPeriodType(orgId); + + // 按periodType分组 + Map> groupedMap = new HashMap<>(); + for (ThresholdsDO threshold : allThresholds) { + String periodType = threshold.getPeriodtype(); + groupedMap.computeIfAbsent(periodType, k -> new ArrayList<>()).add(threshold); + } + + // 转换为响应VO + List result = new ArrayList<>(); + for (Map.Entry> entry : groupedMap.entrySet()) { + String periodType = entry.getKey(); + List thresholdsList = entry.getValue(); + + // 转换为ThresholdsItemRespVO列表(不包含periodtype字段) + List respVOList = BeanUtils.toBean(thresholdsList, ThresholdsItemRespVO.class); + + // 创建分组响应VO + ThresholdsGroupRespVO groupRespVO = new ThresholdsGroupRespVO(periodType, respVOList); + result.add(groupRespVO); + } + + return result; + } + +} \ No newline at end of file diff --git a/yudao-module-system/src/main/resources/mapper/thresholds/ThresholdsMapper.xml b/yudao-module-system/src/main/resources/mapper/thresholds/ThresholdsMapper.xml new file mode 100644 index 0000000..aa6b287 --- /dev/null +++ b/yudao-module-system/src/main/resources/mapper/thresholds/ThresholdsMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/yudao-server/src/main/resources/application.yaml b/yudao-server/src/main/resources/application.yaml index aacf992..d65574d 100644 --- a/yudao-server/src/main/resources/application.yaml +++ b/yudao-server/src/main/resources/application.yaml @@ -297,6 +297,7 @@ yudao: - tb_pftdata #忽略肺功能数据表 - tb_era #忽略电测听表 - tb_era_data #忽略电测听数据表 + - health_thresholds #忽略健康阈值表 ignore-caches: - user_role_ids - permission_menu_ids