Browse Source

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

xgb 2 weeks ago
parent
commit
b4a8605a18
36 changed files with 2243 additions and 64 deletions
  1. 1 1
      fs-service/src/main/java/com/fs/his/domain/FsAttachment.java
  2. 5 0
      fs-service/src/main/java/com/fs/his/mapper/FsAttachmentMapper.java
  3. 4 0
      fs-service/src/main/java/com/fs/his/service/IFsAttachmentService.java
  4. 74 49
      fs-service/src/main/java/com/fs/his/service/impl/FsAttachmentServiceImpl.java
  5. 51 0
      fs-service/src/main/java/com/fs/medical/domain/MeasurementUnit.java
  6. 79 0
      fs-service/src/main/java/com/fs/medical/domain/MedicalIndicator.java
  7. 75 0
      fs-service/src/main/java/com/fs/medical/domain/PhysicalExamReport.java
  8. 69 0
      fs-service/src/main/java/com/fs/medical/domain/ReportIndicatorResult.java
  9. 93 0
      fs-service/src/main/java/com/fs/medical/mapper/MeasurementUnitMapper.java
  10. 108 0
      fs-service/src/main/java/com/fs/medical/mapper/MedicalIndicatorMapper.java
  11. 129 0
      fs-service/src/main/java/com/fs/medical/mapper/PhysicalExamReportMapper.java
  12. 104 0
      fs-service/src/main/java/com/fs/medical/mapper/ReportIndicatorResultMapper.java
  13. 40 0
      fs-service/src/main/java/com/fs/medical/param/MeasurementUnitQueryDto.java
  14. 50 0
      fs-service/src/main/java/com/fs/medical/param/MedicalIndicatorQueryDto.java
  15. 75 0
      fs-service/src/main/java/com/fs/medical/param/PhysicalExamReportQueryDto.java
  16. 50 0
      fs-service/src/main/java/com/fs/medical/param/ReportIndicatorResultQueryDto.java
  17. 46 0
      fs-service/src/main/java/com/fs/medical/service/MeasurementUnitService.java
  18. 46 0
      fs-service/src/main/java/com/fs/medical/service/MedicalIndicatorService.java
  19. 47 0
      fs-service/src/main/java/com/fs/medical/service/PhysicalExamReportService.java
  20. 46 0
      fs-service/src/main/java/com/fs/medical/service/ReportIndicatorResultService.java
  21. 55 0
      fs-service/src/main/java/com/fs/medical/service/impl/MeasurementUnitServiceImpl.java
  22. 55 0
      fs-service/src/main/java/com/fs/medical/service/impl/MedicalIndicatorServiceImpl.java
  23. 111 0
      fs-service/src/main/java/com/fs/medical/service/impl/PhysicalExamReportServiceImpl.java
  24. 55 0
      fs-service/src/main/java/com/fs/medical/service/impl/ReportIndicatorResultServiceImpl.java
  25. 3 0
      fs-service/src/main/java/com/fs/saler/domain/FsCompetitorInfo.java
  26. 10 0
      fs-service/src/main/java/com/fs/saler/domain/FsProductInfo.java
  27. 45 7
      fs-service/src/main/java/com/fs/saler/mapper/FsCompetitorInfoMapper.java
  28. 18 7
      fs-service/src/main/java/com/fs/saler/mapper/FsProductInfoMapper.java
  29. 4 0
      fs-service/src/main/java/com/fs/saler/param/FsCompetitorInfoParam.java
  30. 3 0
      fs-service/src/main/java/com/fs/saler/param/ProductInfoListPageParam.java
  31. 6 0
      fs-service/src/main/resources/mapper/his/FsAttachmentMapper.xml
  32. 6 0
      fs-service/src/main/resources/mapper/saler/FsProductInfoMapper.xml
  33. 160 0
      fs-user-app/src/main/java/com/fs/app/controller/medical/MeasurementUnitController.java
  34. 162 0
      fs-user-app/src/main/java/com/fs/app/controller/medical/MedicalIndicatorController.java
  35. 168 0
      fs-user-app/src/main/java/com/fs/app/controller/medical/PhysicalExamReportController.java
  36. 190 0
      fs-user-app/src/main/java/com/fs/app/controller/medical/ReportIndicatorResultController.java

+ 1 - 1
fs-service/src/main/java/com/fs/his/domain/FsAttachment.java

@@ -28,7 +28,7 @@ public class FsAttachment extends BaseEntity{
     private Long userId;
 
     /** 文件类型 0:文件夹 1图片 */
-    @Excel(name = "文件类型 0:文件夹 1图片")
+    @Excel(name = "文件类型 0:文件夹 1图片 2体检报告")
     private Integer type;
 
     /** 文件大小(kb) */

+ 5 - 0
fs-service/src/main/java/com/fs/his/mapper/FsAttachmentMapper.java

@@ -4,6 +4,7 @@ import java.util.List;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.fs.his.domain.FsAttachment;
 import com.fs.his.param.FsAttachmentPageParam;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 附件管理Mapper接口
@@ -61,4 +62,8 @@ public interface FsAttachmentMapper extends BaseMapper<FsAttachment>{
     int deleteFsAttachmentByAttachmentIds(Long[] attachmentIds);
 
     List<FsAttachment> selectFsAttachmentListPage(FsAttachmentPageParam fsAttachment);
+
+    FsAttachment selectFsAttachmentByFolderName(@Param("folderName") String folderName);
+
+    int deleteFsAttachmentByReportId(@Param("reportId")Long reportId);
 }

+ 4 - 0
fs-service/src/main/java/com/fs/his/service/IFsAttachmentService.java

@@ -63,4 +63,8 @@ public interface IFsAttachmentService extends IService<FsAttachment>{
      * @return 结果
      */
     int deleteFsAttachmentByAttachmentId(Long attachmentId);
+
+    FsAttachment selectFsAttachmentByFolderName(String folderName);
+
+    int deleteFsAttachmentByReportId(Long reportId);
 }

+ 74 - 49
fs-service/src/main/java/com/fs/his/service/impl/FsAttachmentServiceImpl.java

@@ -35,8 +35,7 @@ public class FsAttachmentServiceImpl extends ServiceImpl<FsAttachmentMapper, FsA
      * @return 附件管理
      */
     @Override
-    public FsAttachment selectFsAttachmentByAttachmentId(Long attachmentId)
-    {
+    public FsAttachment selectFsAttachmentByAttachmentId(Long attachmentId) {
         return baseMapper.selectFsAttachmentByAttachmentId(attachmentId);
     }
 
@@ -47,8 +46,7 @@ public class FsAttachmentServiceImpl extends ServiceImpl<FsAttachmentMapper, FsA
      * @return 附件管理
      */
     @Override
-    public List<FsAttachment> selectFsAttachmentList(FsAttachment fsAttachment)
-    {
+    public List<FsAttachment> selectFsAttachmentList(FsAttachment fsAttachment) {
         return baseMapper.selectFsAttachmentList(fsAttachment);
     }
 
@@ -64,41 +62,13 @@ public class FsAttachmentServiceImpl extends ServiceImpl<FsAttachmentMapper, FsA
      * @return 结果
      */
     @Override
-    public R insertFsAttachment(FsAttachment fsAttachment)
-    {
-        if (fsAttachment.getUserId() == null){
+    public R insertFsAttachment(FsAttachment fsAttachment) {
+        if (fsAttachment.getUserId() == null) {
             return R.error("未获取到创建人!");
         }
         Integer type = fsAttachment.getType();
-        if (type == null){
-            return R.error("请选择创建文件还是文件夹!");
-        } else if (type == 1){
-            //文件
-            if (StringUtils.isBlank(fsAttachment.getUrl())){
-                return R.error("文件不存在");
-            }
-        }
-        if (fsAttachment.getParentId() == null){
-            fsAttachment.setParentId(0L);
-        } else {
-            //查询父文件是否是文件夹
-            FsAttachment parentItem = selectFsAttachmentByAttachmentId(fsAttachment.getParentId());
-            if (parentItem == null){
-                return R.error("上级文件夹不存在");
-            }else {
-                if (parentItem.getType() != 0){
-                    return R.error("上级文件夹不存在!");
-                }
-            }
-        }
-
-
         //获取文件名
         String fileName = fsAttachment.getFileName();
-        //上传类型为文件时可获取为文件名称
-        if (StringUtils.isBlank(fileName) && type == 1){
-            fileName = FileNameExtractor.getFileNameFromUrl(fsAttachment.getUrl());
-        }
         //查询文件名是否存在
         FsAttachment queryParam = new FsAttachment();
         queryParam.setUserId(fsAttachment.getUserId());
@@ -106,20 +76,68 @@ public class FsAttachmentServiceImpl extends ServiceImpl<FsAttachmentMapper, FsA
         queryParam.setType(fsAttachment.getType());
         queryParam.setFileName(fsAttachment.getFileName());
         List<FsAttachment> list = selectFsAttachmentList(queryParam);
-        if (list != null && !list.isEmpty()){
-            if (fileName.contains(".")){
-                int index = fileName.lastIndexOf(".");
-                String name = fileName.substring(0, index);
-                fileName = name + "(" + (list.size() + 1)+ ")" + fileName.substring(index+1);
+        if (type == null) {
+            return R.error("请选择创建文件还是文件夹!");
+        } else if (type == 1) {
+            //文件
+            if (StringUtils.isBlank(fsAttachment.getUrl())) {
+                return R.error("文件不存在");
+            }
+            //上传类型为文件时可获取为文件名称
+            if (StringUtils.isBlank(fileName)) {
+                fileName = FileNameExtractor.getFileNameFromUrl(fsAttachment.getUrl());
+            }
+            if (list != null && !list.isEmpty()) {
+                if (fileName.contains(".")) {
+                    int index = fileName.lastIndexOf(".");
+                    String name = fileName.substring(0, index);
+                    fileName = name + "(" + (list.size() + 1) + ")" + "." + fileName.substring(index + 1);
+                }
+
             }
+            long size = Objects.requireNonNull(ImageUtils.getImage(fsAttachment.getUrl())).length / 1024; // 单位为 KB
+            fsAttachment.setSize(size);
+        } else if (type == 0) {
+            //文件夹
+            if (StringUtils.isBlank(fsAttachment.getFileName())) {
+                return R.error("文件夹名称不能为空");
+            }
+            if (list != null && !list.isEmpty()) {
+                fileName = fileName + "(" + (list.size() + 1) + ")";
+
+            }
+        } else if (type == 2) {
+            //体检报告
+            if (StringUtils.isBlank(fsAttachment.getUrl())) {
+                return R.error("体检报告不存在");
+            }
+            if (StringUtils.isBlank(fsAttachment.getFileName())) {
+                return R.error("名称不能为空");
+            }
+            if (list != null && !list.isEmpty()) {
+                fileName = fileName + "(" + (list.size() + 1) + ")";
 
+            }
         }
+
+
         fsAttachment.setFileName(fileName);
-        //文件大小
-        long size = Objects.requireNonNull(ImageUtils.getImage(fsAttachment.getUrl())).length / 1024; // 单位为 KB
-        fsAttachment.setSize(size);
+        if (fsAttachment.getParentId() == null) {
+            fsAttachment.setParentId(0L);
+        }
+        if (fsAttachment.getParentId() != 0) {
+            //查询父文件是否是文件夹
+            FsAttachment parentItem = selectFsAttachmentByAttachmentId(fsAttachment.getParentId());
+            if (parentItem == null) {
+                return R.error("上级文件夹不存在");
+            } else {
+                if (parentItem.getType() != 0) {
+                    return R.error("上级文件夹不存在!");
+                }
+            }
+        }
         fsAttachment.setCreateTime(DateUtils.getNowDate());
-        return baseMapper.insertFsAttachment(fsAttachment)>0?R.ok():R.error();
+        return baseMapper.insertFsAttachment(fsAttachment) > 0 ? R.ok() : R.error();
     }
 
     /**
@@ -129,8 +147,7 @@ public class FsAttachmentServiceImpl extends ServiceImpl<FsAttachmentMapper, FsA
      * @return 结果
      */
     @Override
-    public int updateFsAttachment(FsAttachment fsAttachment)
-    {
+    public int updateFsAttachment(FsAttachment fsAttachment) {
         fsAttachment.setUpdateTime(DateUtils.getNowDate());
         return baseMapper.updateFsAttachment(fsAttachment);
     }
@@ -142,8 +159,7 @@ public class FsAttachmentServiceImpl extends ServiceImpl<FsAttachmentMapper, FsA
      * @return 结果
      */
     @Override
-    public int deleteFsAttachmentByAttachmentIds(Long[] attachmentIds)
-    {
+    public int deleteFsAttachmentByAttachmentIds(Long[] attachmentIds) {
         return baseMapper.deleteFsAttachmentByAttachmentIds(attachmentIds);
     }
 
@@ -154,8 +170,17 @@ public class FsAttachmentServiceImpl extends ServiceImpl<FsAttachmentMapper, FsA
      * @return 结果
      */
     @Override
-    public int deleteFsAttachmentByAttachmentId(Long attachmentId)
-    {
+    public int deleteFsAttachmentByAttachmentId(Long attachmentId) {
         return baseMapper.deleteFsAttachmentByAttachmentId(attachmentId);
     }
+
+    @Override
+    public FsAttachment selectFsAttachmentByFolderName(String folderName) {
+        return baseMapper.selectFsAttachmentByFolderName(folderName);
+    }
+
+    @Override
+    public int deleteFsAttachmentByReportId(Long reportId) {
+        return baseMapper.deleteFsAttachmentByReportId(reportId);
+    }
 }

+ 51 - 0
fs-service/src/main/java/com/fs/medical/domain/MeasurementUnit.java

@@ -0,0 +1,51 @@
+package com.fs.medical.domain;
+
+import lombok.Data;
+import java.time.LocalDateTime;
+
+/**
+ * 计量单位表
+ */
+@Data
+public class MeasurementUnit {
+
+    /**
+     * 单位ID
+     */
+    private Long unitId;
+
+    /**
+     * 单位名称
+     */
+    private String unitName;
+
+    /**
+     * 单位符号
+     */
+    private String unitSymbol;
+
+    /**
+     * 单位类型
+     */
+    private String unitType;
+
+    /**
+     * 描述
+     */
+    private String description;
+
+    /**
+     * 状态(1:启用,0:禁用)
+     */
+    private Integer status;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updateTime;
+}

+ 79 - 0
fs-service/src/main/java/com/fs/medical/domain/MedicalIndicator.java

@@ -0,0 +1,79 @@
+package com.fs.medical.domain;
+
+import lombok.Data;
+import lombok.AllArgsConstructor;
+import lombok.NoArgsConstructor;
+import lombok.Builder;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 指标表
+ */
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class MedicalIndicator {
+
+    /**
+     * 指标ID
+     */
+    private Long indicatorId;
+
+    /**
+     * 指标名称
+     */
+    private String indicatorName;
+
+    /**
+     * 指标分类(用户自设,通用指标,查体,肝脏)
+     */
+    private String indicatorCategory;
+
+    /**
+     * 单位ID
+     */
+    private Long unitId;
+
+    /**
+     * 参考范围最小值
+     */
+    private BigDecimal referenceMin;
+
+    /**
+     * 参考范围最大值
+     */
+    private BigDecimal referenceMax;
+
+    /**
+     * 文本形式参考范围
+     */
+    private String referenceText;
+
+    /**
+     * 指标描述
+     */
+    private String description;
+
+    /**
+     * 排序字段
+     */
+    private Integer sortOrder;
+
+    /**
+     * 状态(1:启用,0:禁用)
+     */
+    private Byte status;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+}

+ 75 - 0
fs-service/src/main/java/com/fs/medical/domain/PhysicalExamReport.java

@@ -0,0 +1,75 @@
+package com.fs.medical.domain;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * 体检报告表
+ */
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class PhysicalExamReport {
+
+    /**
+     * 报告ID
+     */
+    private Long reportId;
+
+    /**
+     * 用户ID
+     */
+    private Long userId;
+    private Long companyUserId;
+
+    /**
+     * 体检日期
+     */
+    private LocalDate examDate;
+
+    /**
+     * 身高(cm)
+     */
+    private BigDecimal height;
+
+    /**
+     * 体重(kg)
+     */
+    private BigDecimal weight;
+
+    /**
+     * BMI指数
+     */
+    private BigDecimal bmi;
+
+    /**
+     * 腰围(cm)
+     */
+    private BigDecimal waistCircumference;
+
+    /**
+     * 胸围(cm)
+     */
+    private BigDecimal chestCircumference;
+
+    /**
+     * 报告状态(1:正常,0:删除)
+     */
+    private Integer reportStatus;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updateTime;
+}

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

@@ -0,0 +1,69 @@
+package com.fs.medical.domain;
+
+import lombok.Data;
+import lombok.Builder;
+import lombok.NoArgsConstructor;
+import lombok.AllArgsConstructor;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * 报告指标检查表
+ */
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class ReportIndicatorResult {
+
+    /**
+     * 检查结果ID
+     */
+    private Long resultId;
+
+    /**
+     * 报告ID
+     */
+    private Long reportId;
+
+    /**
+     * 指标ID
+     */
+    private Long indicatorId;
+
+    /**
+     * 检查数值
+     */
+    private BigDecimal testValue;
+
+    /**
+     * 检查结果(文本)
+     */
+    private String testResult;
+
+    /**
+     * 是否异常(0:正常,1:异常)
+     */
+    private Integer isAbnormal;
+
+    /**
+     * 异常类型(偏高,偏低)
+     */
+    private String abnormalType;
+
+    /**
+     * 备注
+     */
+    private String remarks;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updateTime;
+}

+ 93 - 0
fs-service/src/main/java/com/fs/medical/mapper/MeasurementUnitMapper.java

@@ -0,0 +1,93 @@
+package com.fs.medical.mapper;
+
+import com.fs.medical.domain.MeasurementUnit;
+import com.fs.medical.param.MeasurementUnitQueryDto;
+import org.apache.ibatis.annotations.*;
+import java.util.List;
+
+/**
+ * 计量单位表Mapper
+ */
+@Mapper
+public interface MeasurementUnitMapper {
+
+    /**
+     * 根据ID查询计量单位
+     */
+    @Select("SELECT * FROM fs_measurement_unit WHERE unit_id = #{unitId}")
+    MeasurementUnit getById(@Param("unitId") Long unitId);
+
+    /**
+     * 查询所有计量单位
+     */
+    @Select("SELECT * FROM fs_measurement_unit")
+    List<MeasurementUnit> listAll();
+
+    /**
+     * 根据单位类型查询计量单位
+     */
+    @Select("SELECT * FROM fs_measurement_unit WHERE unit_type = #{unitType} AND status = 1")
+    List<MeasurementUnit> listByType(@Param("unitType") String unitType);
+
+    /**
+     * 新增计量单位
+     */
+    @Insert("INSERT INTO fs_measurement_unit(unit_name, unit_symbol, unit_type, description, status) " +
+            "VALUES(#{unitName}, #{unitSymbol}, #{unitType}, #{description}, #{status})")
+    @Options(useGeneratedKeys = true, keyProperty = "unitId")
+    int insert(MeasurementUnit unit);
+
+    /**
+     * 更新计量单位
+     */
+    @Update("<script>" +
+            "UPDATE fs_measurement_unit SET " +
+            "<if test='unitName != null'>unit_name = #{unitName}, </if>" +
+            "<if test='unitSymbol != null'>unit_symbol = #{unitSymbol}, </if>" +
+            "<if test='unitType != null'>unit_type = #{unitType}, </if>" +
+            "<if test='description != null'>description = #{description}, </if>" +
+            "<if test='status != null'>status = #{status}, </if>" +
+            "update_time = NOW() " +
+            "WHERE unit_id = #{unitId}" +
+            "</script>")
+    int update(MeasurementUnit unit);
+
+    /**
+     * 根据ID删除计量单位
+     */
+    @Update("UPDATE fs_measurement_unit SET status = 0 WHERE unit_id = #{unitId}")
+    int deleteById(@Param("unitId") Long unitId);
+
+    /**
+     * 分页查询计量单位列表
+     */
+    @Select("<script>" +
+            "SELECT * FROM fs_measurement_unit " +
+            "WHERE 1=1 " +
+            "<if test='unitName != null and unitName != \"\"'>" +
+            "AND unit_name LIKE CONCAT('%', #{unitName}, '%') " +
+            "</if>" +
+            "<if test='unitSymbol != null and unitSymbol != \"\"'>" +
+            "AND unit_symbol LIKE CONCAT('%', #{unitSymbol}, '%') " +
+            "</if>" +
+            "<if test='unitType != null and unitType != \"\"'>" +
+            "AND unit_type LIKE CONCAT('%', #{unitType}, '%') " +
+            "</if>" +
+            "<if test='description != null and description != \"\"'>" +
+            "AND description LIKE CONCAT('%', #{description}, '%') " +
+            "</if>" +
+            "<if test='status != null'>" +
+            "AND status = #{status} " +
+            "</if>" +
+            "ORDER BY " +
+            "<choose>" +
+            "<when test='orderBy != null and orderBy != \"\"'>" +
+            "${orderBy}" +
+            "</when>" +
+            "<otherwise>" +
+            "create_time DESC" +
+            "</otherwise>" +
+            "</choose>" +
+            "</script>")
+    List<MeasurementUnit> selectPageList(MeasurementUnitQueryDto queryDto);
+}

+ 108 - 0
fs-service/src/main/java/com/fs/medical/mapper/MedicalIndicatorMapper.java

@@ -0,0 +1,108 @@
+package com.fs.medical.mapper;
+
+import com.fs.medical.domain.MedicalIndicator;
+import com.fs.medical.param.MedicalIndicatorQueryDto;
+import org.apache.ibatis.annotations.*;
+import java.util.List;
+
+/**
+ * 指标表Mapper
+ */
+@Mapper
+public interface MedicalIndicatorMapper {
+
+    /**
+     * 根据ID查询指标
+     */
+    @Select("SELECT * FROM fs_medical_indicator WHERE indicator_id = #{indicatorId}")
+    MedicalIndicator getById(@Param("indicatorId") Long indicatorId);
+
+    /**
+     * 查询所有启用的指标
+     */
+    @Select("SELECT * FROM fs_medical_indicator WHERE status = 1 ORDER BY sort_order")
+    List<MedicalIndicator> listAllEnabled();
+
+    /**
+     * 根据分类查询指标
+     */
+    @Select("SELECT * FROM fs_medical_indicator WHERE indicator_category = #{category} AND status = 1 ORDER BY sort_order")
+    List<MedicalIndicator> listByCategory(@Param("category") String category);
+
+    /**
+     * 新增指标
+     */
+    @Insert("INSERT INTO fs_medical_indicator(indicator_name, indicator_category, unit_id, reference_min, " +
+            "reference_max, reference_text, description, sort_order, status) " +
+            "VALUES(#{indicatorName}, #{indicatorCategory}, #{unitId}, #{referenceMin}, " +
+            "#{referenceMax}, #{referenceText}, #{description}, #{sortOrder}, #{status})")
+    @Options(useGeneratedKeys = true, keyProperty = "indicatorId")
+    int insert(MedicalIndicator indicator);
+
+    /**
+     * 更新指标
+     */
+    @Update("<script>" +
+            "UPDATE fs_medical_indicator SET " +
+            "<if test='indicatorName != null'>indicator_name = #{indicatorName}, </if>" +
+            "<if test='indicatorCategory != null'>indicator_category = #{indicatorCategory}, </if>" +
+            "<if test='unitId != null'>unit_id = #{unitId}, </if>" +
+            "<if test='referenceMin != null'>reference_min = #{referenceMin}, </if>" +
+            "<if test='referenceMax != null'>reference_max = #{referenceMax}, </if>" +
+            "<if test='referenceText != null'>reference_text = #{referenceText}, </if>" +
+            "<if test='description != null'>description = #{description}, </if>" +
+            "<if test='sortOrder != null'>sort_order = #{sortOrder}, </if>" +
+            "<if test='status != null'>status = #{status}, </if>" +
+            "update_time = NOW() " +
+            "WHERE indicator_id = #{indicatorId}" +
+            "</script>")
+    int update(MedicalIndicator indicator);
+
+    /**
+     * 根据ID删除指标(逻辑删除)
+     */
+    @Update("UPDATE fs_medical_indicator SET status = 0, update_time = NOW() WHERE indicator_id = #{indicatorId}")
+    int deleteById(@Param("indicatorId") Long indicatorId);
+
+    /**
+     * 分页查询医疗指标列表
+     */
+    @Select("<script>" +
+            "SELECT * FROM fs_medical_indicator " +
+            "WHERE 1=1 " +
+            "<if test='indicatorName != null and indicatorName != &quot;&quot;'>" +
+            "AND indicator_name LIKE CONCAT('%', #{indicatorName}, '%') " +
+            "</if>" +
+            "<if test='indicatorCategory != null and indicatorCategory != &quot;&quot;'>" +
+            "AND indicator_category LIKE CONCAT('%', #{indicatorCategory}, '%') " +
+            "</if>" +
+            "<if test='unitId != null'>" +
+            "AND unit_id = #{unitId} " +
+            "</if>" +
+            "<if test='referenceMin != null'>" +
+            "AND reference_min <![CDATA[>=]]> #{referenceMin} " +
+            "</if>" +
+            "<if test='referenceMax != null'>" +
+            "AND reference_max <![CDATA[<=]]> #{referenceMax} " +
+            "</if>" +
+            "<if test='referenceText != null and referenceText != &quot;&quot;'>" +
+            "AND reference_text LIKE CONCAT('%', #{referenceText}, '%') " +
+            "</if>" +
+            "<if test='description != null and description != &quot;&quot;'>" +
+            "AND description LIKE CONCAT('%', #{description}, '%') " +
+            "</if>" +
+            "<if test='status != null'>" +
+            "AND status = #{status} " +
+            "</if>" +
+            "ORDER BY " +
+            "<choose>" +
+            "<when test='orderBy != null and orderBy != &quot;&quot;'>" +
+            "${orderBy}" +
+            "</when>" +
+            "<otherwise>" +
+            "sort_order ASC, create_time DESC" +
+            "</otherwise>" +
+            "</choose>" +
+            "</script>")
+    List<MedicalIndicator> selectPageList(MedicalIndicatorQueryDto queryDto);
+}

+ 129 - 0
fs-service/src/main/java/com/fs/medical/mapper/PhysicalExamReportMapper.java

@@ -0,0 +1,129 @@
+package com.fs.medical.mapper;
+
+import com.fs.medical.domain.PhysicalExamReport;
+import com.fs.medical.param.PhysicalExamReportQueryDto;
+import org.apache.ibatis.annotations.*;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 体检报告表Mapper
+ */
+@Mapper
+public interface PhysicalExamReportMapper {
+
+    /**
+     * 根据ID查询体检报告
+     */
+    @Select("SELECT * FROM fs_physical_exam_report WHERE report_id = #{reportId} AND report_status = 1")
+    PhysicalExamReport getById(@Param("reportId") Long reportId);
+
+    /**
+     * 根据用户ID查询体检报告列表
+     */
+    @Select("SELECT * FROM fs_physical_exam_report WHERE user_id = #{userId} AND report_status = 1 ORDER BY exam_date DESC")
+    List<PhysicalExamReport> listByUserId(@Param("userId") Long userId);
+
+    /**
+     * 根据用户ID和体检日期查询体检报告
+     */
+    @Select("SELECT * FROM fs_physical_exam_report WHERE user_id = #{userId} AND exam_date = #{examDate} AND report_status = 1")
+    PhysicalExamReport getByUserIdAndDate(@Param("userId") Long userId, @Param("examDate") Date examDate);
+
+    /**
+     * 新增体检报告
+     */
+    @Insert("INSERT INTO fs_physical_exam_report(user_id, company_user_id, exam_date, height, weight, bmi, waist_circumference, " +
+            "chest_circumference, report_status) VALUES(#{userId}, #{companyUserId}, #{examDate}, #{height}, #{weight}, #{bmi}, " +
+            "#{waistCircumference}, #{chestCircumference}, #{reportStatus})")
+    @Options(useGeneratedKeys = true, keyProperty = "reportId")
+    int insert(PhysicalExamReport report);
+
+    /**
+     * 更新体检报告
+     */
+    @Update("<script>" +
+            "UPDATE fs_physical_exam_report SET " +
+            "<if test='userId != null'>user_id = #{userId}, </if>" +
+            "<if test='companyUserId != null'>company_user_id = #{companyUserId}, </if>" +
+            "<if test='examDate != null'>exam_date = #{examDate}, </if>" +
+            "<if test='height != null'>height = #{height}, </if>" +
+            "<if test='weight != null'>weight = #{weight}, </if>" +
+            "<if test='bmi != null'>bmi = #{bmi}, </if>" +
+            "<if test='waistCircumference != null'>waist_circumference = #{waistCircumference}, </if>" +
+            "<if test='chestCircumference != null'>chest_circumference = #{chestCircumference}, </if>" +
+            "<if test='reportStatus != null'>report_status = #{reportStatus}, </if>" +
+            "update_time = NOW() " +
+            "WHERE report_id = #{reportId}" +
+            "</script>")
+    int update(PhysicalExamReport report);
+
+    /**
+     * 根据ID删除体检报告(逻辑删除)
+     */
+    @Update("UPDATE fs_physical_exam_report SET report_status = 0, update_time = NOW() WHERE report_id = #{reportId}")
+    int deleteById(@Param("reportId") Long reportId);
+
+    /**
+     * 分页查询体检报告列表
+     */
+    @Select("<script>" +
+            "SELECT * FROM fs_physical_exam_report " +
+            "WHERE 1=1 " +
+            "<if test='userId != null'>" +
+            "AND user_id = #{userId} " +
+            "</if>" +
+            "<if test='companyUserId != null'>" +
+            "AND company_user_id = #{companyUserId} " +
+            "</if>" +
+            "<if test='examDateStart != null'>" +
+            "AND exam_date <![CDATA[>=]]> #{examDateStart} " +
+            "</if>" +
+            "<if test='examDateEnd != null'>" +
+            "AND exam_date <![CDATA[<=]]> #{examDateEnd} " +
+            "</if>" +
+            "<if test='heightMin != null'>" +
+            "AND height <![CDATA[>=]]> #{heightMin} " +
+            "</if>" +
+            "<if test='heightMax != null'>" +
+            "AND height <![CDATA[<=]]> #{heightMax} " +
+            "</if>" +
+            "<if test='weightMin != null'>" +
+            "AND weight <![CDATA[>=]]> #{weightMin} " +
+            "</if>" +
+            "<if test='weightMax != null'>" +
+            "AND weight <![CDATA[<=]]> #{weightMax} " +
+            "</if>" +
+            "<if test='bmiMin != null'>" +
+            "AND bmi <![CDATA[>=]]> #{bmiMin} " +
+            "</if>" +
+            "<if test='bmiMax != null'>" +
+            "AND bmi <![CDATA[<=]]> #{bmiMax} " +
+            "</if>" +
+            "<if test='waistCircumferenceMin != null'>" +
+            "AND waist_circumference <![CDATA[>=]]> #{waistCircumferenceMin} " +
+            "</if>" +
+            "<if test='waistCircumferenceMax != null'>" +
+            "AND waist_circumference <![CDATA[<=]]> #{waistCircumferenceMax} " +
+            "</if>" +
+            "<if test='chestCircumferenceMin != null'>" +
+            "AND chest_circumference <![CDATA[>=]]> #{chestCircumferenceMin} " +
+            "</if>" +
+            "<if test='chestCircumferenceMax != null'>" +
+            "AND chest_circumference <![CDATA[<=]]> #{chestCircumferenceMax} " +
+            "</if>" +
+            "<if test='reportStatus != null'>" +
+            "AND report_status = #{reportStatus} " +
+            "</if>" +
+            "ORDER BY " +
+            "<choose>" +
+            "<when test='orderBy != null and orderBy != \"\"'>" +
+            "${orderBy}" +
+            "</when>" +
+            "<otherwise>" +
+            "exam_date DESC, create_time DESC" +
+            "</otherwise>" +
+            "</choose>" +
+            "</script>")
+    List<PhysicalExamReport> selectPageList(PhysicalExamReportQueryDto queryDto);
+}

+ 104 - 0
fs-service/src/main/java/com/fs/medical/mapper/ReportIndicatorResultMapper.java

@@ -0,0 +1,104 @@
+package com.fs.medical.mapper;
+
+import com.fs.medical.domain.ReportIndicatorResult;
+import com.fs.medical.param.ReportIndicatorResultQueryDto;
+import org.apache.ibatis.annotations.*;
+import java.util.List;
+
+/**
+ * 报告指标检查表Mapper
+ */
+@Mapper
+public interface ReportIndicatorResultMapper {
+
+    /**
+     * 根据ID查询检查结果
+     */
+    @Select("SELECT * FROM fs_report_indicator_result WHERE result_id = #{resultId}")
+    ReportIndicatorResult getById(@Param("resultId") Long resultId);
+
+    /**
+     * 根据报告ID查询所有指标结果
+     */
+    @Select("SELECT * FROM fs_report_indicator_result WHERE report_id = #{reportId}")
+    List<ReportIndicatorResult> listByReportId(@Param("reportId") Long reportId);
+
+    /**
+     * 根据指标ID查询所有结果
+     */
+    @Select("SELECT * FROM fs_report_indicator_result WHERE indicator_id = #{indicatorId}")
+    List<ReportIndicatorResult> listByIndicatorId(@Param("indicatorId") Long indicatorId);
+
+    /**
+     * 新增检查结果
+     */
+    @Insert("INSERT INTO fs_report_indicator_result(report_id, indicator_id, test_value, test_result, is_abnormal, abnormal_type, remarks) " +
+            "VALUES(#{reportId}, #{indicatorId}, #{testValue}, #{testResult}, #{isAbnormal}, #{abnormalType}, #{remarks})")
+    @Options(useGeneratedKeys = true, keyProperty = "resultId")
+    int insert(ReportIndicatorResult result);
+
+    /**
+     * 更新检查结果
+     */
+    @Update("<script>" +
+            "UPDATE fs_report_indicator_result SET " +
+            "<if test='reportId != null'>report_id = #{reportId}, </if>" +
+            "<if test='indicatorId != null'>indicator_id = #{indicatorId}, </if>" +
+            "<if test='testValue != null'>test_value = #{testValue}, </if>" +
+            "<if test='testResult != null'>test_result = #{testResult}, </if>" +
+            "<if test='isAbnormal != null'>is_abnormal = #{isAbnormal}, </if>" +
+            "<if test='abnormalType != null'>abnormal_type = #{abnormalType}, </if>" +
+            "<if test='remarks != null'>remarks = #{remarks}, </if>" +
+            "update_time = NOW() " +
+            "WHERE result_id = #{resultId}" +
+            "</script>")
+    int update(ReportIndicatorResult result);
+
+    /**
+     * 根据ID删除检查结果
+     */
+    @Delete("DELETE FROM fs_report_indicator_result WHERE result_id = #{resultId}")
+    int deleteById(@Param("resultId") Long resultId);
+
+    /**
+     * 分页查询报告指标检查结果列表
+     */
+    @Select("<script>" +
+            "SELECT * FROM fs_report_indicator_result " +
+            "WHERE 1=1 " +
+            "<if test='reportId != null'>" +
+            "AND report_id = #{reportId} " +
+            "</if>" +
+            "<if test='indicatorId != null'>" +
+            "AND indicator_id = #{indicatorId} " +
+            "</if>" +
+            "<if test='testValueMin != null'>" +
+            "AND test_value <![CDATA[>=]]> #{testValueMin} " +
+            "</if>" +
+            "<if test='testValueMax != null'>" +
+            "AND test_value <![CDATA[<=]]> #{testValueMax} " +
+            "</if>" +
+            "<if test='testResult != null and testResult != \"\"'>" +
+            "AND test_result LIKE CONCAT('%', #{testResult}, '%') " +
+            "</if>" +
+            "<if test='isAbnormal != null'>" +
+            "AND is_abnormal = #{isAbnormal} " +
+            "</if>" +
+            "<if test='abnormalType != null and abnormalType != \"\"'>" +
+            "AND abnormal_type LIKE CONCAT('%', #{abnormalType}, '%') " +
+            "</if>" +
+            "<if test='remarks != null and remarks != \"\"'>" +
+            "AND remarks LIKE CONCAT('%', #{remarks}, '%') " +
+            "</if>" +
+            "ORDER BY " +
+            "<choose>" +
+            "<when test='orderBy != null and orderBy != \"\"'>" +
+            "${orderBy}" +
+            "</when>" +
+            "<otherwise>" +
+            "create_time DESC" +
+            "</otherwise>" +
+            "</choose>" +
+            "</script>")
+    List<ReportIndicatorResult> selectPageList(ReportIndicatorResultQueryDto queryDto);
+}

+ 40 - 0
fs-service/src/main/java/com/fs/medical/param/MeasurementUnitQueryDto.java

@@ -0,0 +1,40 @@
+package com.fs.medical.param;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 计量单位查询参数
+ *
+ * @author fs
+ * @date 2024
+ */
+@Data
+public class MeasurementUnitQueryDto implements Serializable {
+
+    @ApiModelProperty(value = "单位名称")
+    private String unitName;
+
+    @ApiModelProperty(value = "单位符号")
+    private String unitSymbol;
+
+    @ApiModelProperty(value = "单位类型")
+    private String unitType;
+
+    @ApiModelProperty(value = "描述")
+    private String description;
+
+    @ApiModelProperty(value = "状态 1-启用 0-禁用")
+    private Integer status;
+
+    @ApiModelProperty(value = "页码,默认为1")
+    private Integer pageNum = 1;
+
+    @ApiModelProperty(value = "页大小,默认为10")
+    private Integer pageSize = 10;
+
+    @ApiModelProperty(value = "排序字段")
+    private String orderBy;
+}

+ 50 - 0
fs-service/src/main/java/com/fs/medical/param/MedicalIndicatorQueryDto.java

@@ -0,0 +1,50 @@
+package com.fs.medical.param;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * 医疗指标查询参数
+ *
+ * @author fs
+ * @date 2024
+ */
+@Data
+public class MedicalIndicatorQueryDto implements Serializable {
+
+    @ApiModelProperty(value = "指标名称")
+    private String indicatorName;
+
+    @ApiModelProperty(value = "指标分类")
+    private String indicatorCategory;
+
+    @ApiModelProperty(value = "单位ID")
+    private Long unitId;
+
+    @ApiModelProperty(value = "参考值最小值")
+    private BigDecimal referenceMin;
+
+    @ApiModelProperty(value = "参考值最大值")
+    private BigDecimal referenceMax;
+
+    @ApiModelProperty(value = "参考值文本")
+    private String referenceText;
+
+    @ApiModelProperty(value = "描述")
+    private String description;
+
+    @ApiModelProperty(value = "状态 1-启用 0-禁用")
+    private Integer status;
+
+    @ApiModelProperty(value = "页码,默认为1")
+    private Integer pageNum = 1;
+
+    @ApiModelProperty(value = "页大小,默认为10")
+    private Integer pageSize = 10;
+
+    @ApiModelProperty(value = "排序字段")
+    private String orderBy;
+}

+ 75 - 0
fs-service/src/main/java/com/fs/medical/param/PhysicalExamReportQueryDto.java

@@ -0,0 +1,75 @@
+package com.fs.medical.param;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 体检报告查询参数
+ *
+ * @author fs
+ * @date 2024
+ */
+@Data
+public class PhysicalExamReportQueryDto implements Serializable {
+
+    @ApiModelProperty(value = "用户ID")
+    private Long userId;
+
+    private Long companyUserId;
+
+
+    @ApiModelProperty(value = "体检日期开始")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    private Date examDateStart;
+
+    @ApiModelProperty(value = "体检日期结束")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    private Date examDateEnd;
+
+    @ApiModelProperty(value = "身高最小值")
+    private BigDecimal heightMin;
+
+    @ApiModelProperty(value = "身高最大值")
+    private BigDecimal heightMax;
+
+    @ApiModelProperty(value = "体重最小值")
+    private BigDecimal weightMin;
+
+    @ApiModelProperty(value = "体重最大值")
+    private BigDecimal weightMax;
+
+    @ApiModelProperty(value = "BMI最小值")
+    private BigDecimal bmiMin;
+
+    @ApiModelProperty(value = "BMI最大值")
+    private BigDecimal bmiMax;
+
+    @ApiModelProperty(value = "腰围最小值")
+    private BigDecimal waistCircumferenceMin;
+
+    @ApiModelProperty(value = "腰围最大值")
+    private BigDecimal waistCircumferenceMax;
+
+    @ApiModelProperty(value = "胸围最小值")
+    private BigDecimal chestCircumferenceMin;
+
+    @ApiModelProperty(value = "胸围最大值")
+    private BigDecimal chestCircumferenceMax;
+
+    @ApiModelProperty(value = "报告状态 1-正常 0-已删除")
+    private Integer reportStatus;
+
+    @ApiModelProperty(value = "页码,默认为1")
+    private Integer pageNum = 1;
+
+    @ApiModelProperty(value = "页大小,默认为10")
+    private Integer pageSize = 10;
+
+    @ApiModelProperty(value = "排序字段")
+    private String orderBy;
+}

+ 50 - 0
fs-service/src/main/java/com/fs/medical/param/ReportIndicatorResultQueryDto.java

@@ -0,0 +1,50 @@
+package com.fs.medical.param;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * 报告指标检查结果查询参数
+ *
+ * @author fs
+ * @date 2024
+ */
+@Data
+public class ReportIndicatorResultQueryDto implements Serializable {
+
+    @ApiModelProperty(value = "报告ID")
+    private Long reportId;
+
+    @ApiModelProperty(value = "指标ID")
+    private Long indicatorId;
+
+    @ApiModelProperty(value = "检测值最小值")
+    private BigDecimal testValueMin;
+
+    @ApiModelProperty(value = "检测值最大值")
+    private BigDecimal testValueMax;
+
+    @ApiModelProperty(value = "检测结果")
+    private String testResult;
+
+    @ApiModelProperty(value = "是否异常 1-异常 0-正常")
+    private Integer isAbnormal;
+
+    @ApiModelProperty(value = "异常类型")
+    private String abnormalType;
+
+    @ApiModelProperty(value = "备注")
+    private String remarks;
+
+    @ApiModelProperty(value = "页码,默认为1")
+    private Integer pageNum = 1;
+
+    @ApiModelProperty(value = "页大小,默认为10")
+    private Integer pageSize = 10;
+
+    @ApiModelProperty(value = "排序字段")
+    private String orderBy;
+}

+ 46 - 0
fs-service/src/main/java/com/fs/medical/service/MeasurementUnitService.java

@@ -0,0 +1,46 @@
+package com.fs.medical.service;
+
+import com.fs.medical.domain.MeasurementUnit;
+import com.fs.medical.param.MeasurementUnitQueryDto;
+import java.util.List;
+
+/**
+ * 计量单位服务接口
+ */
+public interface MeasurementUnitService {
+
+    /**
+     * 根据ID查询计量单位
+     */
+    MeasurementUnit getById(Long unitId);
+
+    /**
+     * 查询所有计量单位
+     */
+    List<MeasurementUnit> listAll();
+
+    /**
+     * 根据单位类型查询计量单位
+     */
+    List<MeasurementUnit> listByType(String unitType);
+
+    /**
+     * 新增计量单位
+     */
+    boolean save(MeasurementUnit unit);
+
+    /**
+     * 更新计量单位
+     */
+    boolean update(MeasurementUnit unit);
+
+    /**
+     * 根据ID删除计量单位
+     */
+    boolean deleteById(Long unitId);
+
+    /**
+     * 分页查询计量单位列表
+     */
+    List<MeasurementUnit> selectPageList(MeasurementUnitQueryDto queryDto);
+}

+ 46 - 0
fs-service/src/main/java/com/fs/medical/service/MedicalIndicatorService.java

@@ -0,0 +1,46 @@
+package com.fs.medical.service;
+
+import com.fs.medical.domain.MedicalIndicator;
+import com.fs.medical.param.MedicalIndicatorQueryDto;
+import java.util.List;
+
+/**
+ * 医疗指标服务接口
+ */
+public interface MedicalIndicatorService {
+
+    /**
+     * 根据ID查询指标
+     */
+    MedicalIndicator getById(Long indicatorId);
+
+    /**
+     * 查询所有启用的指标
+     */
+    List<MedicalIndicator> listAllEnabled();
+
+    /**
+     * 根据分类查询指标
+     */
+    List<MedicalIndicator> listByCategory(String category);
+
+    /**
+     * 新增指标
+     */
+    boolean save(MedicalIndicator indicator);
+
+    /**
+     * 更新指标
+     */
+    boolean update(MedicalIndicator indicator);
+
+    /**
+     * 根据ID删除指标(逻辑删除)
+     */
+    boolean deleteById(Long indicatorId);
+
+    /**
+     * 分页查询医疗指标列表
+     */
+    List<MedicalIndicator> selectPageList(MedicalIndicatorQueryDto queryDto);
+}

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

@@ -0,0 +1,47 @@
+package com.fs.medical.service;
+
+import com.fs.medical.domain.PhysicalExamReport;
+import com.fs.medical.param.PhysicalExamReportQueryDto;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 体检报告服务接口
+ */
+public interface PhysicalExamReportService {
+
+    /**
+     * 根据ID查询体检报告
+     */
+    PhysicalExamReport getById(Long reportId);
+
+    /**
+     * 根据用户ID查询体检报告列表
+     */
+    List<PhysicalExamReport> listByUserId(Long userId);
+
+    /**
+     * 根据用户ID和体检日期查询体检报告
+     */
+    PhysicalExamReport getByUserIdAndDate(Long userId, Date examDate);
+
+    /**
+     * 新增体检报告
+     */
+    boolean save(PhysicalExamReport report);
+
+    /**
+     * 更新体检报告
+     */
+    boolean update(PhysicalExamReport report);
+
+    /**
+     * 根据ID删除体检报告(逻辑删除)
+     */
+    boolean deleteById(Long reportId);
+
+    /**
+     * 分页查询体检报告列表
+     */
+    List<PhysicalExamReport> selectPageList(PhysicalExamReportQueryDto queryDto);
+}

+ 46 - 0
fs-service/src/main/java/com/fs/medical/service/ReportIndicatorResultService.java

@@ -0,0 +1,46 @@
+package com.fs.medical.service;
+
+import com.fs.medical.domain.ReportIndicatorResult;
+import com.fs.medical.param.ReportIndicatorResultQueryDto;
+import java.util.List;
+
+/**
+ * 报告指标检查服务接口
+ */
+public interface ReportIndicatorResultService {
+
+    /**
+     * 根据ID查询检查结果
+     */
+    ReportIndicatorResult getById(Long resultId);
+
+    /**
+     * 根据报告ID查询所有指标结果
+     */
+    List<ReportIndicatorResult> listByReportId(Long reportId);
+
+    /**
+     * 根据指标ID查询所有结果
+     */
+    List<ReportIndicatorResult> listByIndicatorId(Long indicatorId);
+
+    /**
+     * 新增检查结果
+     */
+    boolean save(ReportIndicatorResult result);
+
+    /**
+     * 更新检查结果
+     */
+    boolean update(ReportIndicatorResult result);
+
+    /**
+     * 根据ID删除检查结果
+     */
+    boolean deleteById(Long resultId);
+
+    /**
+     * 分页查询报告指标检查结果列表
+     */
+    List<ReportIndicatorResult> selectPageList(ReportIndicatorResultQueryDto queryDto);
+}

+ 55 - 0
fs-service/src/main/java/com/fs/medical/service/impl/MeasurementUnitServiceImpl.java

@@ -0,0 +1,55 @@
+package com.fs.medical.service.impl;
+
+import com.fs.medical.domain.MeasurementUnit;
+import com.fs.medical.mapper.MeasurementUnitMapper;
+import com.fs.medical.param.MeasurementUnitQueryDto;
+import com.fs.medical.service.MeasurementUnitService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 计量单位服务实现类
+ */
+@Service
+public class MeasurementUnitServiceImpl implements MeasurementUnitService {
+
+    @Autowired
+    private MeasurementUnitMapper measurementUnitMapper;
+
+    @Override
+    public MeasurementUnit getById(Long unitId) {
+        return measurementUnitMapper.getById(unitId);
+    }
+
+    @Override
+    public List<MeasurementUnit> listAll() {
+        return measurementUnitMapper.listAll();
+    }
+
+    @Override
+    public List<MeasurementUnit> listByType(String unitType) {
+        return measurementUnitMapper.listByType(unitType);
+    }
+
+    @Override
+    public boolean save(MeasurementUnit unit) {
+        return measurementUnitMapper.insert(unit) > 0;
+    }
+
+    @Override
+    public boolean update(MeasurementUnit unit) {
+        return measurementUnitMapper.update(unit) > 0;
+    }
+
+    @Override
+    public boolean deleteById(Long unitId) {
+        return measurementUnitMapper.deleteById(unitId) > 0;
+    }
+
+    @Override
+    public List<MeasurementUnit> selectPageList(MeasurementUnitQueryDto queryDto) {
+        return measurementUnitMapper.selectPageList(queryDto);
+    }
+}

+ 55 - 0
fs-service/src/main/java/com/fs/medical/service/impl/MedicalIndicatorServiceImpl.java

@@ -0,0 +1,55 @@
+package com.fs.medical.service.impl;
+
+import com.fs.medical.domain.MedicalIndicator;
+import com.fs.medical.mapper.MedicalIndicatorMapper;
+import com.fs.medical.param.MedicalIndicatorQueryDto;
+import com.fs.medical.service.MedicalIndicatorService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 医疗指标服务实现类
+ */
+@Service
+public class MedicalIndicatorServiceImpl implements MedicalIndicatorService {
+
+    @Autowired
+    private MedicalIndicatorMapper medicalIndicatorMapper;
+
+    @Override
+    public MedicalIndicator getById(Long indicatorId) {
+        return medicalIndicatorMapper.getById(indicatorId);
+    }
+
+    @Override
+    public List<MedicalIndicator> listAllEnabled() {
+        return medicalIndicatorMapper.listAllEnabled();
+    }
+
+    @Override
+    public List<MedicalIndicator> listByCategory(String category) {
+        return medicalIndicatorMapper.listByCategory(category);
+    }
+
+    @Override
+    public boolean save(MedicalIndicator indicator) {
+        return medicalIndicatorMapper.insert(indicator) > 0;
+    }
+
+    @Override
+    public boolean update(MedicalIndicator indicator) {
+        return medicalIndicatorMapper.update(indicator) > 0;
+    }
+
+    @Override
+    public boolean deleteById(Long indicatorId) {
+        return medicalIndicatorMapper.deleteById(indicatorId) > 0;
+    }
+
+    @Override
+    public List<MedicalIndicator> selectPageList(MedicalIndicatorQueryDto queryDto) {
+        return medicalIndicatorMapper.selectPageList(queryDto);
+    }
+}

+ 111 - 0
fs-service/src/main/java/com/fs/medical/service/impl/PhysicalExamReportServiceImpl.java

@@ -0,0 +1,111 @@
+package com.fs.medical.service.impl;
+
+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.mapper.PhysicalExamReportMapper;
+import com.fs.medical.param.PhysicalExamReportQueryDto;
+import com.fs.medical.service.PhysicalExamReportService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.time.LocalDateTime;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 体检报告服务实现类
+ */
+@Service
+public class PhysicalExamReportServiceImpl implements PhysicalExamReportService {
+
+    @Autowired
+    private PhysicalExamReportMapper physicalExamReportMapper;
+    @Autowired
+    private IFsAttachmentService attachmentService;
+
+    @Override
+    public PhysicalExamReport getById(Long reportId) {
+        return physicalExamReportMapper.getById(reportId);
+    }
+
+    @Override
+    public List<PhysicalExamReport> listByUserId(Long userId) {
+        return physicalExamReportMapper.listByUserId(userId);
+    }
+
+    @Override
+    public PhysicalExamReport getByUserIdAndDate(Long userId, Date examDate) {
+        return physicalExamReportMapper.getByUserIdAndDate(userId, examDate);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean save(PhysicalExamReport report) {
+        if (report.getCreateTime() == null){
+            report.setCreateTime(LocalDateTime.now());
+        }
+        boolean flag = physicalExamReportMapper.insert(report)>0;
+        if (flag) {
+            createFile(report);
+        }
+        return flag;
+    }
+
+    /**
+     * 存储到我的附件
+     * @param report
+     */
+    private void createFile(PhysicalExamReport report) {
+        Long userId = report.getUserId();
+        if (userId == null){
+            return;
+        }
+        //更新文件夹
+        LocalDateTime createTime = report.getCreateTime();
+        String folderName = DateUtil.formatLocalDateTime(createTime, "yyyyMMdd");
+        String fileName = "体检报告";
+        //查看文件夹是否存在
+        FsAttachment folder = attachmentService.selectFsAttachmentByFolderName(folderName);
+        if (folder == null){
+            //新建文件
+            folder = new FsAttachment();
+            folder.setParentId(0L);
+            folder.setType(0);
+            folder.setFileName(folderName);
+            folder.setUserId(userId);
+            attachmentService.insertFsAttachment(folder);
+        }
+        //存报告
+        FsAttachment fsAttachment = new FsAttachment();
+        fsAttachment.setParentId(folder.getAttachmentId());
+        fsAttachment.setFileName(fileName);
+        fsAttachment.setType(2);
+        fsAttachment.setUrl(report.getReportId().toString()); //报告id
+        fsAttachment.setUserId(userId);
+        attachmentService.insertFsAttachment(fsAttachment);
+    }
+
+    @Override
+    public boolean update(PhysicalExamReport report) {
+        return physicalExamReportMapper.update(report) > 0;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean deleteById(Long reportId) {
+        boolean flag = physicalExamReportMapper.deleteById(reportId) > 0;
+        if (flag) {
+            //删除附件体检报告
+            attachmentService.deleteFsAttachmentByReportId(reportId);
+        }
+        return flag;
+    }
+
+    @Override
+    public List<PhysicalExamReport> selectPageList(PhysicalExamReportQueryDto queryDto) {
+        return physicalExamReportMapper.selectPageList(queryDto);
+    }
+}

+ 55 - 0
fs-service/src/main/java/com/fs/medical/service/impl/ReportIndicatorResultServiceImpl.java

@@ -0,0 +1,55 @@
+package com.fs.medical.service.impl;
+
+import com.fs.medical.domain.ReportIndicatorResult;
+import com.fs.medical.mapper.ReportIndicatorResultMapper;
+import com.fs.medical.param.ReportIndicatorResultQueryDto;
+import com.fs.medical.service.ReportIndicatorResultService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 报告指标检查服务实现类
+ */
+@Service
+public class ReportIndicatorResultServiceImpl implements ReportIndicatorResultService {
+
+    @Autowired
+    private ReportIndicatorResultMapper reportIndicatorResultMapper;
+
+    @Override
+    public ReportIndicatorResult getById(Long resultId) {
+        return reportIndicatorResultMapper.getById(resultId);
+    }
+
+    @Override
+    public List<ReportIndicatorResult> listByReportId(Long reportId) {
+        return reportIndicatorResultMapper.listByReportId(reportId);
+    }
+
+    @Override
+    public List<ReportIndicatorResult> listByIndicatorId(Long indicatorId) {
+        return reportIndicatorResultMapper.listByIndicatorId(indicatorId);
+    }
+
+    @Override
+    public boolean save(ReportIndicatorResult result) {
+        return reportIndicatorResultMapper.insert(result) > 0;
+    }
+
+    @Override
+    public boolean update(ReportIndicatorResult result) {
+        return reportIndicatorResultMapper.update(result) > 0;
+    }
+
+    @Override
+    public boolean deleteById(Long resultId) {
+        return reportIndicatorResultMapper.deleteById(resultId) > 0;
+    }
+
+    @Override
+    public List<ReportIndicatorResult> selectPageList(ReportIndicatorResultQueryDto queryDto) {
+        return reportIndicatorResultMapper.selectPageList(queryDto);
+    }
+}

+ 3 - 0
fs-service/src/main/java/com/fs/saler/domain/FsCompetitorInfo.java

@@ -66,4 +66,7 @@ public class FsCompetitorInfo implements Serializable {
      * 更新人
      */
     private String updateBy;
+
+    private Long userId;
+    private Long companyUserId;
 }

+ 10 - 0
fs-service/src/main/java/com/fs/saler/domain/FsProductInfo.java

@@ -74,4 +74,14 @@ public class FsProductInfo {
      * 更新人
      */
     private String updateBy;
+
+    /**
+     * 用户ID
+     */
+    private Long userId;
+
+    /**
+     * 公司用户ID
+     */
+    private Long companyUserId;
 }

+ 45 - 7
fs-service/src/main/java/com/fs/saler/mapper/FsCompetitorInfoMapper.java

@@ -22,7 +22,35 @@ public interface FsCompetitorInfoMapper {
      * 查询所有竞品信息
      * @return 竞品信息列表
      */
-    @Select("SELECT * FROM fs_competitor_info")
+    @Select("<script>" +
+            "SELECT * FROM fs_competitor_info " +
+            "WHERE 1=1 " +
+            "<if test='competitorCompany != null and competitorCompany != \"\"'>" +
+            "AND competitor_company LIKE CONCAT('%', #{competitorCompany}, '%') " +
+            "</if>" +
+            "<if test='product != null and product != \"\"'>" +
+            "AND product LIKE CONCAT('%', #{product}, '%') " +
+            "</if>" +
+            "<if test='price != null'>" +
+            "AND price = #{price} " +
+            "</if>" +
+            "<if test='service != null and service != \"\"'>" +
+            "AND service LIKE CONCAT('%', #{service}, '%') " +
+            "</if>" +
+            "<if test='freeServiceTimes != null'>" +
+            "AND free_service_times = #{freeServiceTimes} " +
+            "</if>" +
+            "<if test='remark != null and remark != \"\"'>" +
+            "AND remark LIKE CONCAT('%', #{remark}, '%') " +
+            "</if>" +
+            "<if test='userId != null'>" +
+            "AND create_by = #{userId} " +
+            "</if>" +
+            "<if test='companyUserId != null'>" +
+            "AND company_user_id = #{companyUserId} " +
+            "</if>" +
+            "ORDER BY create_time DESC" +
+            "</script>")
     List<FsCompetitorInfo> selectAll(FsCompetitorInfoParam param);
 
     /**
@@ -31,9 +59,9 @@ public interface FsCompetitorInfoMapper {
      * @return 影响行数
      */
     @Insert("INSERT INTO fs_competitor_info (competitor_company, product, price, service, " +
-            "free_service_times, remark, create_by, update_by) " +
+            "free_service_times, remark, create_by, update_by, user_id, company_user_id) " +
             "VALUES (#{competitorCompany}, #{product}, #{price}, #{service}, " +
-            "#{freeServiceTimes}, #{remark}, #{createBy}, #{updateBy})")
+            "#{freeServiceTimes}, #{remark}, #{createBy}, #{updateBy}, #{userId}, #{companyUserId})")
     @Options(useGeneratedKeys = true, keyProperty = "id")
     int insert(FsCompetitorInfo FsCompetitorInfo);
 
@@ -42,10 +70,20 @@ public interface FsCompetitorInfoMapper {
      * @param FsCompetitorInfo 竞品信息
      * @return 影响行数
      */
-    @Update("UPDATE fs_competitor_info SET competitor_company = #{competitorCompany}, product = #{product}, " +
-            "price = #{price}, service = #{service}, free_service_times = #{freeServiceTimes}, " +
-            "remark = #{remark}, update_by = #{updateBy} " +
-            "WHERE id = #{id}")
+    @Update("<script>" +
+            "UPDATE fs_competitor_info SET " +
+            "<if test='competitorCompany != null'>competitor_company = #{competitorCompany}, </if>" +
+            "<if test='product != null'>product = #{product}, </if>" +
+            "<if test='price != null'>price = #{price}, </if>" +
+            "<if test='service != null'>service = #{service}, </if>" +
+            "<if test='freeServiceTimes != null'>free_service_times = #{freeServiceTimes}, </if>" +
+            "<if test='remark != null'>remark = #{remark}, </if>" +
+            "<if test='updateBy != null'>update_by = #{updateBy}, </if>" +
+            "<if test='userId != null'>user_id = #{userId}, </if>" +
+            "<if test='companyUserId != null'>company_user_id = #{companyUserId}, </if>" +
+            "update_time = NOW() " +
+            "WHERE id = #{id}" +
+            "</script>")
     int update(FsCompetitorInfo FsCompetitorInfo);
 
     /**

+ 18 - 7
fs-service/src/main/java/com/fs/saler/mapper/FsProductInfoMapper.java

@@ -30,9 +30,9 @@ public interface FsProductInfoMapper {
      * @return 影响行数
      */
     @Insert("INSERT INTO fs_product_info (product_name, purchase_quantity, amount, planned_completion_date, " +
-            "purchase_times, surplus_times, member_status, remark, create_by, update_by) " +
+            "purchase_times, surplus_times, member_status, remark, create_by, update_by, user_id, company_user_id) " +
             "VALUES (#{productName}, #{purchaseQuantity}, #{amount}, #{plannedCompletionDate}, " +
-            "#{purchaseTimes}, #{surplusTimes}, #{memberStatus}, #{remark}, #{createBy}, #{updateBy})")
+            "#{purchaseTimes}, #{surplusTimes}, #{memberStatus}, #{remark}, #{createBy}, #{updateBy}, #{userId}, #{companyUserId})")
     @Options(useGeneratedKeys = true, keyProperty = "id")
     int insert(FsProductInfo FsProductInfo);
 
@@ -41,11 +41,22 @@ public interface FsProductInfoMapper {
      * @param FsProductInfo 商品信息
      * @return 影响行数
      */
-    @Update("UPDATE fs_product_info SET product_name = #{productName}, purchase_quantity = #{purchaseQuantity}, " +
-            "amount = #{amount}, planned_completion_date = #{plannedCompletionDate}, " +
-            "purchase_times = #{purchaseTimes}, surplus_times = #{surplusTimes}, " +
-            "member_status = #{memberStatus}, remark = #{remark}, update_by = #{updateBy} " +
-            "WHERE id = #{id}")
+    @Update("<script>" +
+            "UPDATE fs_product_info SET " +
+            "<if test='productName != null'>product_name = #{productName}, </if>" +
+            "<if test='purchaseQuantity != null'>purchase_quantity = #{purchaseQuantity}, </if>" +
+            "<if test='amount != null'>amount = #{amount}, </if>" +
+            "<if test='plannedCompletionDate != null'>planned_completion_date = #{plannedCompletionDate}, </if>" +
+            "<if test='purchaseTimes != null'>purchase_times = #{purchaseTimes}, </if>" +
+            "<if test='surplusTimes != null'>surplus_times = #{surplusTimes}, </if>" +
+            "<if test='memberStatus != null'>member_status = #{memberStatus}, </if>" +
+            "<if test='remark != null'>remark = #{remark}, </if>" +
+            "<if test='updateBy != null'>update_by = #{updateBy}, </if>" +
+            "<if test='userId != null'>user_id = #{userId}, </if>" +
+            "<if test='companyUserId != null'>company_user_id = #{companyUserId}, </if>" +
+            "update_time = NOW() " +
+            "WHERE id = #{id}" +
+            "</script>")
     int update(FsProductInfo FsProductInfo);
 
     /**

+ 4 - 0
fs-service/src/main/java/com/fs/saler/param/FsCompetitorInfoParam.java

@@ -61,4 +61,8 @@ public class FsCompetitorInfoParam implements Serializable {
      * 更新人
      */
     private String updateBy;
+
+    private Long userId;
+
+    private Long companyUserId;
 }

+ 3 - 0
fs-service/src/main/java/com/fs/saler/param/ProductInfoListPageParam.java

@@ -56,4 +56,7 @@ public class ProductInfoListPageParam {
      * 创建时间
      */
     private LocalDateTime createTime;
+
+    private Long userId;
+    private Long companyUserId;
 }

+ 6 - 0
fs-service/src/main/resources/mapper/his/FsAttachmentMapper.xml

@@ -47,6 +47,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="url != null  and url != ''"> and url like concat('%', #{url}, '%')</if>
         </where>
     </select>
+    <select id="selectFsAttachmentByFolderName" resultType="com.fs.his.domain.FsAttachment">
+        <include refid="selectFsAttachmentVo"/> where type = 0 and file_name like #{folderName}
+    </select>
 
     <insert id="insertFsAttachment" parameterType="FsAttachment" useGeneratedKeys="true" keyProperty="attachmentId">
         insert into fs_attachment
@@ -97,4 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{attachmentId}
         </foreach>
     </delete>
+    <delete id="deleteFsAttachmentByReportId">
+        delete from fs_attachment where url like #{reportId} and type = 2
+    </delete>
 </mapper>

+ 6 - 0
fs-service/src/main/resources/mapper/saler/FsProductInfoMapper.xml

@@ -35,6 +35,12 @@
             <if test="createTime != null">
                 AND create_time = #{createTime}
             </if>
+            <if test="userId != null">
+                AND user_id = #{userId}
+            </if>
+            <if test="companyUserId != null">
+                AND company_user_id = #{companyUserId}
+            </if>
         </where>
         ORDER BY id DESC
     </select>

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

@@ -0,0 +1,160 @@
+package com.fs.app.controller.medical;
+
+import com.fs.app.annotation.Login;
+import com.fs.app.controller.AppBaseController;
+import com.fs.common.annotation.RepeatSubmit;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.domain.R;
+import com.fs.medical.domain.MeasurementUnit;
+import com.fs.medical.param.MeasurementUnitQueryDto;
+import com.fs.medical.service.MeasurementUnitService;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 计量单位Controller
+ *
+ * @author fs
+ * @date 2024
+ */
+@Api("计量单位")
+@RestController
+@RequestMapping("/app/medical/unit")
+public class MeasurementUnitController extends AppBaseController {
+    private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
+    @Autowired
+    private MeasurementUnitService measurementUnitService;
+
+    /**
+     * 查询所有计量单位
+     */
+    @ApiOperation("查询所有计量单位")
+    @GetMapping("/listAll")
+    public R listAll() {
+        try {
+            List<MeasurementUnit> list = measurementUnitService.listAll();
+            return R.ok().put("data",list);
+        } catch (Exception e) {
+            logger.error("查询计量单位失败", e);
+            return R.error("查询失败");
+        }
+    }
+
+    /**
+     * 分页查询计量单位列表(带筛选)
+     */
+    @ApiOperation("分页查询计量单位列表")
+    @GetMapping("/page")
+    public R page(MeasurementUnitQueryDto queryDto) {
+        try {
+            PageHelper.startPage(queryDto.getPageNum(), queryDto.getPageSize());
+            List<MeasurementUnit> list = measurementUnitService.selectPageList(queryDto);
+            PageInfo<MeasurementUnit> pageInfo = new PageInfo<>(list);
+            return R.ok().put("data", pageInfo);
+        } catch (Exception e) {
+            logger.error("分页查询计量单位失败", e);
+            return R.error("查询失败");
+        }
+    }
+
+    /**
+     * 根据单位类型查询计量单位
+     */
+    @ApiOperation("根据单位类型查询计量单位")
+    @GetMapping("/listByType")
+    public R listByType(@RequestParam String unitType) {
+        try {
+            List<MeasurementUnit> list = measurementUnitService.listByType(unitType);
+            return R.ok().put("data",list);
+        } catch (Exception e) {
+            logger.error("根据类型查询计量单位失败", e);
+            return R.error("查询失败");
+        }
+    }
+
+    /**
+     * 根据ID查询计量单位详情
+     */
+    @ApiOperation("根据ID查询计量单位详情")
+    @GetMapping("/{unitId}")
+    public R getById(@PathVariable("unitId") Long unitId) {
+        try {
+            MeasurementUnit unit = measurementUnitService.getById(unitId);
+            return R.ok().put("data",unit);
+        } catch (Exception e) {
+            logger.error("查询计量单位详情失败", e);
+            return R.error("查询失败");
+        }
+    }
+
+    /**
+     * 新增计量单位
+     */
+    @Login
+    @RepeatSubmit
+    @ApiOperation("新增计量单位")
+    @PostMapping("/add")
+    public R add(@RequestBody MeasurementUnit unit) {
+        try {
+            boolean result = measurementUnitService.save(unit);
+            if (result) {
+                return R.ok("新增成功");
+            } else {
+                return R.error("新增失败");
+            }
+        } catch (Exception e) {
+            logger.error("新增计量单位失败", e);
+            return R.error("新增失败");
+        }
+    }
+
+    /**
+     * 更新计量单位
+     */
+    @Login
+    @RepeatSubmit
+    @ApiOperation("更新计量单位")
+    @PutMapping("/update")
+    public R update(@RequestBody MeasurementUnit unit) {
+        try {
+            boolean result = measurementUnitService.update(unit);
+            if (result) {
+                return R.ok("更新成功");
+            } else {
+                return R.error("更新失败");
+            }
+        } catch (Exception e) {
+            logger.error("更新计量单位失败", e);
+            return R.error("更新失败");
+        }
+    }
+
+    /**
+     * 删除计量单位
+     */
+    @Login
+    @ApiOperation("删除计量单位")
+    @DeleteMapping("/{unitId}")
+    public R delete(@PathVariable("unitId") Long unitId) {
+        try {
+            boolean result = measurementUnitService.deleteById(unitId);
+            if (result) {
+                return R.ok("删除成功");
+            } else {
+                return R.error("删除失败");
+            }
+        } catch (Exception e) {
+            logger.error("删除计量单位失败", e);
+            return R.error("删除失败");
+        }
+    }
+}

+ 162 - 0
fs-user-app/src/main/java/com/fs/app/controller/medical/MedicalIndicatorController.java

@@ -0,0 +1,162 @@
+package com.fs.app.controller.medical;
+
+import com.fs.app.annotation.Login;
+import com.fs.app.controller.AppBaseController;
+import com.fs.common.annotation.RepeatSubmit;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.domain.R;
+import com.fs.medical.domain.MedicalIndicator;
+import com.fs.medical.param.MedicalIndicatorQueryDto;
+import com.fs.medical.service.MedicalIndicatorService;
+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;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 医疗指标Controller
+ *
+ * @author fs
+ * @date 2024
+ */
+@Slf4j
+@Api("医疗指标")
+@RestController
+@RequestMapping("/app/medical/indicator")
+public class MedicalIndicatorController extends AppBaseController {
+    private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
+    @Autowired
+    private MedicalIndicatorService medicalIndicatorService;
+
+    /**
+     * 查询所有启用的指标
+     */
+    @ApiOperation("查询所有启用的指标")
+    @GetMapping("/listEnabled")
+    public R listAllEnabled() {
+        try {
+            List<MedicalIndicator> list = medicalIndicatorService.listAllEnabled();
+            return R.ok().put("data",list);
+        } catch (Exception e) {
+            logger.error("查询启用指标失败", e);
+            return R.error("查询失败");
+        }
+    }
+
+    /**
+     * 分页查询医疗指标列表(带筛选)
+     */
+    @ApiOperation("分页查询医疗指标列表")
+    @GetMapping("/page")
+    public R page(MedicalIndicatorQueryDto queryDto) {
+        try {
+            PageHelper.startPage(queryDto.getPageNum(), queryDto.getPageSize());
+            List<MedicalIndicator> list = medicalIndicatorService.selectPageList(queryDto);
+            PageInfo<MedicalIndicator> pageInfo = new PageInfo<>(list);
+            return R.ok().put("data", pageInfo);
+        } catch (Exception e) {
+            logger.error("分页查询医疗指标失败", e);
+            return R.error("查询失败");
+        }
+    }
+
+    /**
+     * 根据分类查询指标
+     */
+    @ApiOperation("根据分类查询指标")
+    @GetMapping("/listByCategory")
+    public R listByCategory(@RequestParam String category) {
+        try {
+            List<MedicalIndicator> list = medicalIndicatorService.listByCategory(category);
+            return R.ok().put("data",list);
+        } catch (Exception e) {
+            logger.error("根据分类查询指标失败", e);
+            return R.error("查询失败");
+        }
+    }
+
+    /**
+     * 根据ID查询指标详情
+     */
+    @ApiOperation("根据ID查询指标详情")
+    @GetMapping("/{indicatorId}")
+    public R getById(@PathVariable("indicatorId") Long indicatorId) {
+        try {
+            MedicalIndicator indicator = medicalIndicatorService.getById(indicatorId);
+            return R.ok().put("data",indicator);
+        } catch (Exception e) {
+            logger.error("查询指标详情失败", e);
+            return R.error("查询失败");
+        }
+    }
+
+    /**
+     * 新增指标
+     */
+    @Login
+    @RepeatSubmit
+    @ApiOperation("新增指标")
+    @PostMapping("/add")
+    public R add(@RequestBody MedicalIndicator indicator) {
+        try {
+            boolean result = medicalIndicatorService.save(indicator);
+            if (result) {
+                return R.ok("新增成功");
+            } else {
+                return R.error("新增失败");
+            }
+        } catch (Exception e) {
+            logger.error("新增指标失败", e);
+            return R.error("新增失败");
+        }
+    }
+
+    /**
+     * 更新指标
+     */
+    @Login
+    @RepeatSubmit
+    @ApiOperation("更新指标")
+    @PutMapping("/update")
+    public R update(@RequestBody MedicalIndicator indicator) {
+        try {
+            boolean result = medicalIndicatorService.update(indicator);
+            if (result) {
+                return R.ok("更新成功");
+            } else {
+                return R.error("更新失败");
+            }
+        } catch (Exception e) {
+            logger.error("更新指标失败", e);
+            return R.error("更新失败");
+        }
+    }
+
+    /**
+     * 删除指标
+     */
+    @Login
+    @ApiOperation("删除指标")
+    @DeleteMapping("/{indicatorId}")
+    public R delete(@PathVariable("indicatorId") Long indicatorId) {
+        try {
+            boolean result = medicalIndicatorService.deleteById(indicatorId);
+            if (result) {
+                return R.ok("删除成功");
+            } else {
+                return R.error("删除失败");
+            }
+        } catch (Exception e) {
+            logger.error("删除指标失败", e);
+            return R.error("删除失败");
+        }
+    }
+}

+ 168 - 0
fs-user-app/src/main/java/com/fs/app/controller/medical/PhysicalExamReportController.java

@@ -0,0 +1,168 @@
+package com.fs.app.controller.medical;
+
+import com.fs.app.annotation.Login;
+import com.fs.app.controller.AppBaseController;
+import com.fs.common.annotation.RepeatSubmit;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.domain.R;
+import com.fs.medical.domain.PhysicalExamReport;
+import com.fs.medical.param.PhysicalExamReportQueryDto;
+import com.fs.medical.service.PhysicalExamReportService;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 体检报告Controller
+ *
+ * @author fs
+ * @date 2024
+ */
+@Api("体检报告")
+@RestController
+@RequestMapping("/app/medical/report")
+public class PhysicalExamReportController extends AppBaseController {
+    private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
+    @Autowired
+    private PhysicalExamReportService physicalExamReportService;
+
+    /**
+     * 根据用户ID查询体检报告列表
+     */
+    @Login
+    @ApiOperation("查询用户体检报告列表")
+    @GetMapping("/listByUser/{userId}")
+    public R listByUserId(@PathVariable("userId") Long userId) {
+        try {
+            List<PhysicalExamReport> list = physicalExamReportService.listByUserId(userId);
+            return R.ok().put("data",list);
+        } catch (Exception e) {
+            logger.error("查询用户体检报告失败", e);
+            return R.error("查询失败");
+        }
+    }
+
+    /**
+     * 分页查询体检报告列表(带筛选)
+     */
+    @Login
+    @ApiOperation("分页查询体检报告列表")
+    @GetMapping("/page")
+    public R page(PhysicalExamReportQueryDto queryDto) {
+        try {
+            PageHelper.startPage(queryDto.getPageNum(), queryDto.getPageSize());
+            List<PhysicalExamReport> list = physicalExamReportService.selectPageList(queryDto);
+            PageInfo<PhysicalExamReport> pageInfo = new PageInfo<>(list);
+            return R.ok().put("data", pageInfo);
+        } catch (Exception e) {
+            logger.error("分页查询体检报告失败", e);
+            return R.error("查询失败");
+        }
+    }
+
+    /**
+     * 根据用户ID和体检日期查询体检报告
+     */
+    @Login
+    @ApiOperation("根据用户ID和体检日期查询体检报告")
+    @GetMapping("/getByUserAndDate")
+    public R getByUserIdAndDate(
+            @RequestParam Long userId,
+            @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date examDate) {
+        try {
+            PhysicalExamReport report = physicalExamReportService.getByUserIdAndDate(userId, examDate);
+            return R.ok().put("data",report);
+        } catch (Exception e) {
+            logger.error("根据用户ID和日期查询体检报告失败", e);
+            return R.error("查询失败");
+        }
+    }
+
+    /**
+     * 根据ID查询体检报告详情
+     */
+    @Login
+    @ApiOperation("查询体检报告详情")
+    @GetMapping("/{reportId}")
+    public R getById(@PathVariable("reportId") Long reportId) {
+        try {
+            PhysicalExamReport report = physicalExamReportService.getById(reportId);
+            return R.ok().put("data",report);
+        } catch (Exception e) {
+            logger.error("查询体检报告详情失败", e);
+            return R.error("查询失败");
+        }
+    }
+
+    /**
+     * 新增体检报告
+     */
+    @Login
+    @RepeatSubmit
+    @ApiOperation("新增体检报告")
+    @PostMapping("/add")
+    public R add(@RequestBody PhysicalExamReport report) {
+        try {
+            boolean result = physicalExamReportService.save(report);
+            if (result) {
+                return R.ok("新增成功");
+            } else {
+                return R.error("新增失败");
+            }
+        } catch (Exception e) {
+            logger.error("新增体检报告失败", e);
+            return R.error("新增失败");
+        }
+    }
+
+    /**
+     * 更新体检报告
+     */
+    @Login
+    @RepeatSubmit
+    @ApiOperation("更新体检报告")
+    @PutMapping("/update")
+    public R update(@RequestBody PhysicalExamReport report) {
+        try {
+            boolean result = physicalExamReportService.update(report);
+            if (result) {
+                return R.ok("更新成功");
+            } else {
+                return R.error("更新失败");
+            }
+        } catch (Exception e) {
+            logger.error("更新体检报告失败", e);
+            return R.error("更新失败");
+        }
+    }
+
+    /**
+     * 删除体检报告
+     */
+    @Login
+    @ApiOperation("删除体检报告")
+    @DeleteMapping("/{reportId}")
+    public R delete(@PathVariable("reportId") Long reportId) {
+        try {
+            boolean result = physicalExamReportService.deleteById(reportId);
+            if (result) {
+                return R.ok("删除成功");
+            } else {
+                return R.error("删除失败");
+            }
+        } catch (Exception e) {
+            logger.error("删除体检报告失败", e);
+            return R.error("删除失败");
+        }
+    }
+}

+ 190 - 0
fs-user-app/src/main/java/com/fs/app/controller/medical/ReportIndicatorResultController.java

@@ -0,0 +1,190 @@
+package com.fs.app.controller.medical;
+
+import com.fs.app.annotation.Login;
+import com.fs.app.controller.AppBaseController;
+import com.fs.common.annotation.RepeatSubmit;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.domain.R;
+import com.fs.medical.domain.ReportIndicatorResult;
+import com.fs.medical.param.ReportIndicatorResultQueryDto;
+import com.fs.medical.service.ReportIndicatorResultService;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 报告指标检查Controller
+ *
+ * @author fs
+ * @date 2024
+ */
+@Api("报告指标检查")
+@RestController
+@RequestMapping("/app/medical/result")
+public class ReportIndicatorResultController extends AppBaseController {
+    private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
+    @Autowired
+    private ReportIndicatorResultService reportIndicatorResultService;
+
+    /**
+     * 根据报告ID查询所有指标结果
+     */
+    @Login
+    @ApiOperation("根据报告ID查询所有指标结果")
+    @GetMapping("/listByReport/{reportId}")
+    public R listByReportId(@PathVariable("reportId") Long reportId) {
+        try {
+            List<ReportIndicatorResult> list = reportIndicatorResultService.listByReportId(reportId);
+            return R.ok().put("data",list);
+        } catch (Exception e) {
+            logger.error("根据报告ID查询指标结果失败", e);
+            return R.error("查询失败");
+        }
+    }
+
+    /**
+     * 分页查询报告指标检查结果列表(带筛选)
+     */
+    @Login
+    @ApiOperation("分页查询报告指标检查结果列表")
+    @GetMapping("/page")
+    public R page(ReportIndicatorResultQueryDto queryDto) {
+        try {
+            PageHelper.startPage(queryDto.getPageNum(), queryDto.getPageSize());
+            List<ReportIndicatorResult> list = reportIndicatorResultService.selectPageList(queryDto);
+            PageInfo<ReportIndicatorResult> pageInfo = new PageInfo<>(list);
+            return R.ok().put("data", pageInfo);
+        } catch (Exception e) {
+            logger.error("分页查询报告指标检查结果失败", e);
+            return R.error("查询失败");
+        }
+    }
+
+    /**
+     * 根据指标ID查询所有结果
+     */
+    @Login
+    @ApiOperation("根据指标ID查询所有结果")
+    @GetMapping("/listByIndicator/{indicatorId}")
+    public R listByIndicatorId(@PathVariable("indicatorId") Long indicatorId) {
+        try {
+            List<ReportIndicatorResult> list = reportIndicatorResultService.listByIndicatorId(indicatorId);
+            return R.ok().put("data",list);
+        } catch (Exception e) {
+            logger.error("根据指标ID查询结果失败", e);
+            return R.error("查询失败");
+        }
+    }
+
+    /**
+     * 根据ID查询检查结果详情
+     */
+    @Login
+    @ApiOperation("查询检查结果详情")
+    @GetMapping("/{resultId}")
+    public R getById(@PathVariable("resultId") Long resultId) {
+        try {
+            ReportIndicatorResult result = reportIndicatorResultService.getById(resultId);
+            return R.ok().put("data",result);
+        } catch (Exception e) {
+            logger.error("查询检查结果详情失败", e);
+            return R.error("查询失败");
+        }
+    }
+
+    /**
+     * 新增检查结果
+     */
+    @Login
+    @RepeatSubmit
+    @ApiOperation("新增检查结果")
+    @PostMapping("/add")
+    public R add(@RequestBody ReportIndicatorResult result) {
+        try {
+            boolean success = reportIndicatorResultService.save(result);
+            if (success) {
+                return R.ok("新增成功");
+            } else {
+                return R.error("新增失败");
+            }
+        } catch (Exception e) {
+            logger.error("新增检查结果失败", e);
+            return R.error("新增失败");
+        }
+    }
+
+    /**
+     * 批量新增检查结果
+     */
+    @Login
+    @RepeatSubmit
+    @ApiOperation("批量新增检查结果")
+    @PostMapping("/batchAdd")
+    public R batchAdd(@RequestBody List<ReportIndicatorResult> results) {
+        try {
+            int successCount = 0;
+            for (ReportIndicatorResult result : results) {
+                if (reportIndicatorResultService.save(result)) {
+                    successCount++;
+                }
+            }
+            if (successCount == results.size()) {
+                return R.ok("批量新增成功");
+            } else {
+                return R.ok("部分新增成功,成功" + successCount + "条");
+            }
+        } catch (Exception e) {
+            logger.error("批量新增检查结果失败", e);
+            return R.error("批量新增失败");
+        }
+    }
+
+    /**
+     * 更新检查结果
+     */
+    @Login
+    @RepeatSubmit
+    @ApiOperation("更新检查结果")
+    @PutMapping("/update")
+    public R update(@RequestBody ReportIndicatorResult result) {
+        try {
+            boolean success = reportIndicatorResultService.update(result);
+            if (success) {
+                return R.ok("更新成功");
+            } else {
+                return R.error("更新失败");
+            }
+        } catch (Exception e) {
+            logger.error("更新检查结果失败", e);
+            return R.error("更新失败");
+        }
+    }
+
+    /**
+     * 删除检查结果
+     */
+    @Login
+    @ApiOperation("删除检查结果")
+    @DeleteMapping("/{resultId}")
+    public R delete(@PathVariable("resultId") Long resultId) {
+        try {
+            boolean success = reportIndicatorResultService.deleteById(resultId);
+            if (success) {
+                return R.ok("删除成功");
+            } else {
+                return R.error("删除失败");
+            }
+        } catch (Exception e) {
+            logger.error("删除检查结果失败", e);
+            return R.error("删除失败");
+        }
+    }
+}