Bladeren bron

Merge remote-tracking branch 'origin/master_179_20250814' into master_179_20250814

xgb 1 week geleden
bovenliggende
commit
f6870cb853

+ 15 - 1
fs-admin/src/main/java/com/fs/medical/PhysicalExamReportController.java

@@ -4,6 +4,7 @@ import com.fs.common.annotation.RepeatSubmit;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.R;
 import com.fs.medical.domain.PhysicalExamReport;
+import com.fs.medical.param.PhysicalExamReportCompareDto;
 import com.fs.medical.param.PhysicalExamReportQueryDto;
 import com.fs.medical.service.PhysicalExamReportService;
 import com.github.pagehelper.PageHelper;
@@ -48,7 +49,20 @@ public class PhysicalExamReportController extends BaseController {
             return R.error("查询失败");
         }
     }
-
+    /**
+     * 对比报告
+     */
+    @ApiOperation("对比报告")
+    @PostMapping("/compareReport")
+    public R compareReport(@RequestBody PhysicalExamReportCompareDto reportCompareDto){
+        try {
+            Object result = physicalExamReportService.compareReport(reportCompareDto);
+            return R.ok().put("data", result);
+        } catch (Exception e) {
+            logger.error("体检报告对比失败", e);
+            return R.error("对比失败");
+        }
+    }
     /**
      * 分页查询体检报告列表(带筛选)
      */

+ 13 - 0
fs-service/src/main/java/com/fs/medical/domain/ReportIndicatorResult.java

@@ -31,6 +31,19 @@ public class ReportIndicatorResult {
      * 指标ID
      */
     private Long indicatorId;
+    /**
+     * 指标名称
+     */
+    private String indicatorName;
+    /**
+     * 参考范围
+     */
+    private String refRange;
+
+    /**
+     * 单位名称
+     */
+    private String unitName;
 
     /**
      * 检查数值

+ 9 - 1
fs-service/src/main/java/com/fs/medical/mapper/ReportIndicatorResultMapper.java

@@ -20,7 +20,15 @@ public interface ReportIndicatorResultMapper {
     /**
      * 根据报告ID查询所有指标结果
      */
-    @Select("SELECT * FROM fs_report_indicator_result WHERE report_id = #{reportId}")
+    @Select("SELECT rir.result_id,\n" +
+            "rir.report_id,\n" +
+            "rir.indicator_id,\n" +
+            "mi.indicator_name,\n" +
+            "concat(mi.reference_min,' ~ ',mi.reference_max) as ref_range,\n" +
+            "rir.test_value,rir.test_result,rir.is_abnormal,rir.remarks,rir.create_time,rir.update_time\n" +
+            "FROM fs_report_indicator_result  rir\n" +
+            "left join fs_medical_indicator mi\n" +
+            "on rir.indicator_id=mi.indicator_id and rir.report_id=#{reportId}")
     List<ReportIndicatorResult> listByReportId(@Param("reportId") Long reportId);
 
     /**

+ 16 - 0
fs-service/src/main/java/com/fs/medical/param/PhysicalExamReportCompareDto.java

@@ -0,0 +1,16 @@
+package com.fs.medical.param;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class PhysicalExamReportCompareDto implements Serializable {
+    private Long report1;
+    private Long report2;
+
+    /**
+     * 0 身体信息 1指标检查
+     */
+    private Integer type;
+}

+ 9 - 0
fs-service/src/main/java/com/fs/medical/service/PhysicalExamReportService.java

@@ -1,9 +1,11 @@
 package com.fs.medical.service;
 
 import com.fs.medical.domain.PhysicalExamReport;
+import com.fs.medical.param.PhysicalExamReportCompareDto;
 import com.fs.medical.param.PhysicalExamReportQueryDto;
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 体检报告服务接口
@@ -44,4 +46,11 @@ public interface PhysicalExamReportService {
      * 分页查询体检报告列表
      */
     List<PhysicalExamReport> selectPageList(PhysicalExamReportQueryDto queryDto);
+
+    /**
+     * 对比两份体检报告
+     * @param reportCompareDto 体检报告对比DTO
+     * @return 对比结果
+     */
+    Map<String, Object> compareReport(PhysicalExamReportCompareDto reportCompareDto);
 }

+ 168 - 11
fs-service/src/main/java/com/fs/medical/service/impl/PhysicalExamReportServiceImpl.java

@@ -7,17 +7,20 @@ import com.fs.common.utils.date.DateUtil;
 import com.fs.his.domain.FsAttachment;
 import com.fs.his.service.IFsAttachmentService;
 import com.fs.medical.domain.PhysicalExamReport;
+import com.fs.medical.domain.ReportIndicatorResult;
 import com.fs.medical.mapper.PhysicalExamReportMapper;
+import com.fs.medical.param.PhysicalExamReportCompareDto;
 import com.fs.medical.param.PhysicalExamReportQueryDto;
 import com.fs.medical.service.PhysicalExamReportService;
+import com.fs.medical.service.ReportIndicatorResultService;
 import com.fs.store.service.cache.IFsUserCacheService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
 import java.time.LocalDateTime;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 /**
  * 体检报告服务实现类
@@ -35,6 +38,9 @@ public class PhysicalExamReportServiceImpl implements PhysicalExamReportService
 
     @Autowired
     private ICompanyUserCacheService companyUserCacheService;
+    
+    @Autowired
+    private ReportIndicatorResultService reportIndicatorResultService;
 
     @Override
     public PhysicalExamReport getById(Long reportId) {
@@ -54,10 +60,10 @@ public class PhysicalExamReportServiceImpl implements PhysicalExamReportService
     @Override
     @Transactional(rollbackFor = Exception.class)
     public boolean save(PhysicalExamReport report) {
-        if (report.getCreateTime() == null){
+        if (report.getCreateTime() == null) {
             report.setCreateTime(LocalDateTime.now());
         }
-        boolean flag = physicalExamReportMapper.insert(report)>0;
+        boolean flag = physicalExamReportMapper.insert(report) > 0;
         if (flag) {
             createFile(report);
         }
@@ -66,11 +72,12 @@ public class PhysicalExamReportServiceImpl implements PhysicalExamReportService
 
     /**
      * 存储到我的附件
+     *
      * @param report
      */
     private void createFile(PhysicalExamReport report) {
         Long userId = report.getUserId();
-        if (userId == null){
+        if (userId == null) {
             return;
         }
         //更新文件夹
@@ -79,7 +86,7 @@ public class PhysicalExamReportServiceImpl implements PhysicalExamReportService
         String fileName = "体检报告";
         //查看文件夹是否存在
         FsAttachment folder = attachmentService.selectFsAttachmentByFolderName(folderName);
-        if (folder == null){
+        if (folder == null) {
             //新建文件
             folder = new FsAttachment();
             folder.setParentId(0L);
@@ -119,20 +126,170 @@ public class PhysicalExamReportServiceImpl implements PhysicalExamReportService
     public List<PhysicalExamReport> selectPageList(PhysicalExamReportQueryDto queryDto) {
         List<PhysicalExamReport> physicalExamReports = physicalExamReportMapper.selectPageList(queryDto);
         for (PhysicalExamReport physicalExamReport : physicalExamReports) {
-            if(ObjectUtils.isNotNull(physicalExamReport.getUserId())) {
+            if (ObjectUtils.isNotNull(physicalExamReport.getUserId())) {
                 String userNameById = fsUserCacheService.selectUserNameById(physicalExamReport.getUserId());
-                if(StringUtils.isNotBlank(userNameById)) {
+                if (StringUtils.isNotBlank(userNameById)) {
                     physicalExamReport.setUserName(userNameById);
                 }
             }
-            if(ObjectUtils.isNotNull(physicalExamReport.getCompanyUserId())) {
+            if (ObjectUtils.isNotNull(physicalExamReport.getCompanyUserId())) {
                 String userNameById = companyUserCacheService.selectCompanyUserNameUserById(physicalExamReport.getCompanyUserId());
-                if(StringUtils.isNotBlank(userNameById)) {
+                if (StringUtils.isNotBlank(userNameById)) {
                     physicalExamReport.setCompanyUserName(userNameById);
                 }
             }
         }
         return physicalExamReports;
     }
-}
 
+    @Override
+    public Map<String, Object> compareReport(PhysicalExamReportCompareDto reportCompareDto) {
+        Map<String, Object> result = new HashMap<>();
+
+        // 检查参数
+        if (reportCompareDto == null || reportCompareDto.getReport1() == null || reportCompareDto.getReport2() == null) {
+            result.put("success", false);
+            result.put("message", "参数不能为空");
+            return result;
+        }
+
+        // 获取两份报告
+        PhysicalExamReport report1 = physicalExamReportMapper.getById(reportCompareDto.getReport1());
+        PhysicalExamReport report2 = physicalExamReportMapper.getById(reportCompareDto.getReport2());
+
+        if (report1 == null || report2 == null) {
+            result.put("success", false);
+            result.put("message", "报告不存在");
+            return result;
+        }
+
+        // 设置基本信息
+        result.put("report1", report1);
+        result.put("report2", report2);
+        result.put("success", true);
+
+        // 根据类型进行对比
+        Integer type = reportCompareDto.getType();
+        if (type != null && type == 0) {
+            // 身体信息对比
+            Map<String, Object> bodyInfoComparison = compareBodyInfo(report1, report2);
+            result.put("comparison", bodyInfoComparison);
+        } else if (type != null && type == 1) {
+            // 指标检查对比
+            List<Map<String, Object>> indicatorComparison = compareIndicators(reportCompareDto.getReport1(), reportCompareDto.getReport2());
+            result.put("comparison", indicatorComparison);
+        }
+
+        return result;
+    }
+
+    /**
+     * 对比两份报告的身体信息
+     *
+     * @param report1 第一份报告
+     * @param report2 第二份报告
+     * @return 对比结果
+     */
+    private Map<String, Object> compareBodyInfo(PhysicalExamReport report1, PhysicalExamReport report2) {
+        Map<String, Object> comparison = new HashMap<>();
+
+        // 计算身高差异
+        if (report1.getHeight() != null && report2.getHeight() != null) {
+            BigDecimal heightDiff = report2.getHeight().subtract(report1.getHeight());
+            comparison.put("heightDiff", heightDiff);
+            comparison.put("heightChange", heightDiff.compareTo(BigDecimal.ZERO) > 0 ? "1" : "0");
+        }
+
+        // 计算体重差异
+        if (report1.getWeight() != null && report2.getWeight() != null) {
+            BigDecimal weightDiff = report2.getWeight().subtract(report1.getWeight());
+            comparison.put("weightDiff", weightDiff);
+            comparison.put("weightChange", weightDiff.compareTo(BigDecimal.ZERO) > 0 ? "1" : "0");
+        }
+
+        // 计算BMI差异
+        if (report1.getBmi() != null && report2.getBmi() != null) {
+            BigDecimal bmiDiff = report2.getBmi().subtract(report1.getBmi());
+            comparison.put("bmiDiff", bmiDiff);
+            comparison.put("bmiChange", bmiDiff.compareTo(BigDecimal.ZERO) > 0 ? "1" : "0");
+        }
+
+        // 计算腰围差异
+        if (report1.getWaistCircumference() != null && report2.getWaistCircumference() != null) {
+            BigDecimal waistDiff = report2.getWaistCircumference().subtract(report1.getWaistCircumference());
+            comparison.put("waistDiff", waistDiff);
+            comparison.put("waistChange", waistDiff.compareTo(BigDecimal.ZERO) > 0 ? "1" : "0");
+        }
+
+        // 计算胸围差异
+        if (report1.getChestCircumference() != null && report2.getChestCircumference() != null) {
+            BigDecimal chestDiff = report2.getChestCircumference().subtract(report1.getChestCircumference());
+            comparison.put("chestDiff", chestDiff);
+            comparison.put("chestChange", chestDiff.compareTo(BigDecimal.ZERO) > 0 ? "1" : "0");
+        }
+
+        return comparison;
+    }
+    
+    /**
+     * 对比两份报告的指标检查结果
+     *
+     * @param reportId1 第一份报告 ID
+     * @param reportId2 第二份报告 ID
+     * @return 对比结果列表
+     */
+    private List<Map<String, Object>> compareIndicators(Long reportId1, Long reportId2) {
+        List<Map<String, Object>> results = new ArrayList<>();
+        
+        // 获取两份报告的所有指标结果
+        List<ReportIndicatorResult> indicators1 = reportIndicatorResultService.listByReportId(reportId1);
+        List<ReportIndicatorResult> indicators2 = reportIndicatorResultService.listByReportId(reportId2);
+        
+        // 将第二份报告的指标按 indicatorId 进行索引,方便快速查找
+        Map<Long, ReportIndicatorResult> indicatorMap2 = new HashMap<>();
+        for (ReportIndicatorResult indicator : indicators2) {
+            if (indicator.getIndicatorId() != null) {
+                indicatorMap2.put(indicator.getIndicatorId(), indicator);
+            }
+        }
+        
+        // 处理每个指标的对比
+        for (ReportIndicatorResult indicator1 : indicators1) {
+            if (indicator1.getIndicatorId() == null) {
+                continue;
+            }
+            
+            // 查找第二份报告中对应的指标结果
+            ReportIndicatorResult indicator2 = indicatorMap2.get(indicator1.getIndicatorId());
+            
+            // 如果两份报告都有该指标,进行对比
+            if (indicator2 != null) {
+                Map<String, Object> comparison = new HashMap<>();
+                
+                // 指标名称和基本信息
+                comparison.put("indicatorId", indicator1.getIndicatorId());
+                comparison.put("indicatorName", indicator1.getIndicatorName());
+                comparison.put("unitName", indicator1.getUnitName());
+                comparison.put("refRange", indicator1.getRefRange());
+                
+                // 数值比较
+                comparison.put("value1", indicator1.getTestValue());
+                comparison.put("value2", indicator2.getTestValue());
+                
+                // 判断变化方向
+                String change = "0"; // 默认为"减少"
+                if (indicator1.getTestValue() != null && indicator2.getTestValue() != null) {
+                    int compareResult = indicator2.getTestValue().compareTo(indicator1.getTestValue());
+                    if (compareResult > 0) {
+                        change = "1"; // 增加
+                    }
+                }
+                comparison.put("change", change);
+                
+                results.add(comparison);
+            }
+        }
+        
+        return results;
+    }
+}

+ 4 - 1
fs-service/src/main/java/com/fs/todo/param/QueryTodoItemsParam.java

@@ -1,8 +1,10 @@
 package com.fs.todo.param;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 
 @Data
@@ -47,7 +49,8 @@ public class QueryTodoItemsParam implements Serializable {
     /**
      * 截止日期
      */
-    private LocalDateTime dueDate;
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private LocalDate dueDate;
 
     /**
      * 创建时间

+ 39 - 1
fs-service/src/main/java/com/fs/todo/service/impl/FsTodoItemsServiceImpl.java

@@ -39,7 +39,45 @@ public class FsTodoItemsServiceImpl implements FsTodoItemsService {
      */
     @Override
     public FsTodoItems getById(Long id) {
-        return fsTodoItemsMapper.selectById(id);
+        FsTodoItems fsTodoItem = fsTodoItemsMapper.selectById(id);
+        if(ObjectUtils.isNotNull(fsTodoItem.getStatus())){
+            String todoItemType = DictUtils.getDictLabel("todo_item_status", String.valueOf(fsTodoItem.getStatus()));
+            if(StringUtils.isNotBlank(todoItemType)) {
+                fsTodoItem.setStatusText(todoItemType);
+            }
+        }
+
+        if(ObjectUtils.isNotNull(fsTodoItem.getPriority())) {
+            String priority = DictUtils.getDictLabel("todo_priority", String.valueOf(fsTodoItem.getPriority()));
+            if(StringUtils.isNotBlank(priority)) {
+                fsTodoItem.setPriorityText(priority);
+            }
+        }
+
+        if(ObjectUtils.isNotNull(fsTodoItem.getCateId())) {
+            String cateText = DictUtils.getDictLabel("todo_item_type", String.valueOf(fsTodoItem.getCateId()));
+            if(StringUtils.isNotBlank(cateText)) {
+                fsTodoItem.setCateText(cateText);
+            }
+        }
+
+        // 执行者
+        if(ObjectUtils.isNotNull(fsTodoItem.getAssigneeId())) {
+            String executorName = companyUserCacheService.selectCompanyUserNameUserById(fsTodoItem.getAssigneeId());
+            if(StringUtils.isNotBlank(executorName)) {
+                fsTodoItem.setAssigneeName(executorName);
+            }
+        }
+
+        // 分配人
+        if(ObjectUtils.isNotNull(fsTodoItem.getCreatorId())) {
+            String creatorName = sysUserMapper.selectUserNameByUserId(fsTodoItem.getCreatorId());
+            if(StringUtils.isNotBlank(creatorName)) {
+                fsTodoItem.setCreatorName(creatorName);
+            }
+        }
+
+        return fsTodoItem;
     }
 
     /**

+ 4 - 4
fs-service/src/main/resources/application-config-druid-xzt.yml

@@ -10,8 +10,8 @@ logging:
 wx:
   miniapp:
     configs:
-      - appid: wx76cb55db092a41ae   #德瑞康
-        secret: c737a27415946994e977d665d87643b3
+      - appid: wxd56333375d59f1b8  #中康智慧商城APP
+        secret: b39f8b0f078032b285c0dee23fd53278
         token: Ncbnd7lJvkripVOpyTFAna6NAWCxCrvC
         aesKey: HlEiBB55eaWUaeBVAQO3cWKWPYv1vOVQSq7nFNICw4E
         msgDataFormat: JSON
@@ -37,8 +37,8 @@ wx:
       port: 6379
       timeout: 2000
     configs:
-      - appId: wx090c5f399d65456e # 第一个公众号的appid  //公众号名称:德瑞康
-        secret: dc70e963077d80cf61280aea6b7c52b7 # 公众号的appsecret--德瑞康
+      - appId: wxd56333375d59f1b8  #中康智慧商城APP
+        secret: b39f8b0f078032b285c0dee23fd53278
         token: PPKOdAlCoMO # 接口配置里的Token值
         aesKey: Eswa6VjwtVMCcw03qZy6fWllgrv5aytIA1SZPEU0kU2 # 接口配置里的EncodingAESKey值
 aifabu:  #爱链接

+ 7 - 0
fs-user-app/src/main/java/com/fs/app/controller/FsTodoItemsController.java

@@ -12,11 +12,13 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 
+@Slf4j
 @Api("待办")
 @RestController
 @RequestMapping(value="/app/todoItems")
@@ -30,6 +32,7 @@ public class FsTodoItemsController extends BaseController {
     @PostMapping("/listPage")
     public R listPage(@RequestBody QueryTodoItemsParam param)
     {
+        log.info("查看待办列表 参数: {}",param);
         PageHelper.startPage(param.getPageNum(), param.getPageSize());
         List<FsTodoItems> fsTodoItems = fsTodoItemsService.listPage(param);
         PageInfo<FsTodoItems> listPageInfo=new PageInfo<>(fsTodoItems);
@@ -40,6 +43,8 @@ public class FsTodoItemsController extends BaseController {
     @PostMapping("/findById")
     public R findById(@RequestBody QueryTodoItemsParam param)
     {
+        log.info("查看详情 参数: {}",param);
+
         FsTodoItems byId = fsTodoItemsService.getById(param.getId());
         return R.ok().put("data",byId);
     }
@@ -48,6 +53,8 @@ public class FsTodoItemsController extends BaseController {
     @PostMapping("/updateById")
     public R updateById(@RequestBody QueryTodoItemsParam param)
     {
+        log.info("更新详情 参数: {}",param);
+
         fsTodoItemsService.updateStatus(param.getId(),param.getStatus());
         return R.ok();
     }

+ 9 - 0
fs-user-app/src/main/java/com/fs/app/controller/medical/MeasurementUnitController.java

@@ -12,6 +12,7 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -25,6 +26,7 @@ import java.util.List;
  * @author fs
  * @date 2024
  */
+@Slf4j
 @Api("计量单位")
 @RestController
 @RequestMapping("/app/medical/unit")
@@ -40,6 +42,7 @@ public class MeasurementUnitController extends AppBaseController {
     @ApiOperation("查询所有计量单位")
     @GetMapping("/listAll")
     public R listAll() {
+        log.info("查询所有计量单位");
         try {
             List<MeasurementUnit> list = measurementUnitService.listAll();
             return R.ok().put("data",list);
@@ -55,6 +58,7 @@ public class MeasurementUnitController extends AppBaseController {
     @ApiOperation("分页查询计量单位列表")
     @GetMapping("/page")
     public R page(MeasurementUnitQueryDto queryDto) {
+        log.info("分页查询计量单位列表 参数: {}",queryDto);
         try {
             PageHelper.startPage(queryDto.getPageNum(), queryDto.getPageSize());
             List<MeasurementUnit> list = measurementUnitService.selectPageList(queryDto);
@@ -72,6 +76,7 @@ public class MeasurementUnitController extends AppBaseController {
     @ApiOperation("根据单位类型查询计量单位")
     @GetMapping("/listByType")
     public R listByType(@RequestParam String unitType) {
+        log.info("根据单位类型查询计量单位 参数{}",unitType);
         try {
             List<MeasurementUnit> list = measurementUnitService.listByType(unitType);
             return R.ok().put("data",list);
@@ -87,6 +92,7 @@ public class MeasurementUnitController extends AppBaseController {
     @ApiOperation("根据ID查询计量单位详情")
     @GetMapping("/{unitId}")
     public R getById(@PathVariable("unitId") Long unitId) {
+        log.info("根据ID查询计量单位详情 参数: {}",unitId);
         try {
             MeasurementUnit unit = measurementUnitService.getById(unitId);
             return R.ok().put("data",unit);
@@ -104,6 +110,7 @@ public class MeasurementUnitController extends AppBaseController {
     @ApiOperation("新增计量单位")
     @PostMapping("/add")
     public R add(@RequestBody MeasurementUnit unit) {
+        log.info("新增计量单位 参数: {}",unit);
         try {
             boolean result = measurementUnitService.save(unit);
             if (result) {
@@ -125,6 +132,7 @@ public class MeasurementUnitController extends AppBaseController {
     @ApiOperation("更新计量单位")
     @PutMapping("/update")
     public R update(@RequestBody MeasurementUnit unit) {
+        log.info("更新计量单位 参数: {}",unit);
         try {
             boolean result = measurementUnitService.update(unit);
             if (result) {
@@ -145,6 +153,7 @@ public class MeasurementUnitController extends AppBaseController {
     @ApiOperation("删除计量单位")
     @DeleteMapping("/{unitId}")
     public R delete(@PathVariable("unitId") Long unitId) {
+        log.info("删除计量单位 参数:{}",unitId);
         try {
             boolean result = measurementUnitService.deleteById(unitId);
             if (result) {