46 Commits d39239e41a ... 015f358681

Author SHA1 Message Date
  matianxiang 015f358681 feat(口腔医院): 修改短信提示语 2 months ago
  matianxiang 71e8e79854 feat(口腔医院): 修改短信提示语 2 months ago
  matianxiang a7e6de9dcb feat(口腔医院): 修改参数格式 2 months ago
  matianxiang 0bb4000311 feat(口腔医院): 加密 2 months ago
  matianxiang a5d142048b feat(口腔医院): 修改返回值&添加注解 2 months ago
  matianxiang f4fe5d6674 feat(口腔医院): 排班缺少一天bug 2 months ago
  matianxiang a819f1a136 feat(口腔医院): 修改上传最大内存 2 months ago
  matianxiang c347c960b1 feat(慧视健康): 修改上传最大内存 2 months ago
  matianxiang 5a66956aaf feat(慧视健康): 慧视健康上传照片视频接口 2 months ago
  matianxiang 81ec836c08 患者中心刷新后患者详情都是空 2 months ago
  matianxiang c9ac5a2ba1 登录添加头像 2 months ago
  matianxiang 052df2bcd8 惠州石化岗检信息平台可任意篡改用户的登录IP 2 months ago
  matianxiang e00d9165be 运营分析诊断统计undefined 2 months ago
  matianxiang e39ad32ac5 惠州实化系统岗检实施处越权问题 2 months ago
  matianxiang 0d9c696479 惠州实化系统查询角色时泄露数据库的SQL信息 2 months ago
  matianxiang a4daf6d00a feat(电子病例): 密码加密 2 months ago
  matianxiang d9c31dd4f8 feat(电子病例): 去掉初始密码接口 2 months ago
  matianxiang d84d51e01d feat(电子病例): 登录密码加密 2 months ago
  matianxiang 1cf5877afd feat(电子病例): 慧视口腔-诊所列表 2 months ago
  zjs 0097fdfea1 Merge remote-tracking branch 'origin/eitc-erm' into eitc-erm 2 months ago
  zjs 27e2c09782 验证码 2 months ago
  matianxiang 8d9950a9f3 feat(电子病例): 诊断分页 2 months ago
  matianxiang 1e1d15e9a7 feat(电子病例): 短信验证码校验不加token 2 months ago
  matianxiang 595698a144 feat(电子病例): 优化 2 months ago
  matianxiang c881a87cf9 feat(电子病例): 病例bug 2 months ago
  matianxiang c1ff506efd feat(电子病例): 病例bug 2 months ago
  matianxiang 2e3e76b666 feat(电子病例): 编辑病例收费重复问题 2 months ago
  matianxiang 3a0817bc16 feat(电子病例): 登录优化 2 months ago
  matianxiang a74ef6987a feat(电子病例): 加密报错 2 months ago
  matianxiang cf8bd70b12 feat(电子病例): 添加年龄回显 2 months ago
  matianxiang 7da6711c0e feat(电子病例): 发短信 2 months ago
  matianxiang ddbf1e6bd4 feat(电子病例): 发短信 2 months ago
  matianxiang f0325bcee5 feat(电子病例): 收费 2 months ago
  matianxiang 01afd9d151 Merge branch 'eitc-erm' into emr 2 months ago
  matianxiang 857f6c5c6b feat(电子病例): 配置文件 2 months ago
  matianxiang 14dd0e0e99 feat(电子病例): 病例 2 months ago
  matianxiang 952eb7bad0 Merge branch 'eitc-erm' into emr 3 months ago
  zjs 15c59173f0 Merge branch 'master' into eitc-erm 3 months ago
  zjs ed1f841f27 配置文件加密 3 months ago
  matianxiang 933c1b77eb feat(电子病例): 诊断模板 3 months ago
  matianxiang dff3bd022d feat(电子病例): 诊断管理新增首拼字段 3 months ago
  matianxiang 2240964d00 feat(电子病例): 诊断管理新增首拼字段 3 months ago
  zhangjiansheng a52eadcef9 接口加密 3 months ago
  matianxiang 51f5e2a433 feat(电子病例): 诊断分类添加祖籍字段 3 months ago
  matianxiang e96278db8f feat(电子病例): 诊断管理分页 3 months ago
  matianxiang 7a732da081 feat(电子病例): 诊断管理 3 months ago
91 changed files with 2972 additions and 1463 deletions
  1. 32 3
      eitc-admin/src/main/java/com/eitc/web/controller/common/CaptchaController.java
  2. 113 0
      eitc-admin/src/main/java/com/eitc/web/controller/saomiaoyi/SaoMiaoYiController.java
  3. 1 1
      eitc-admin/src/main/java/com/eitc/web/controller/system/SysConfigController.java
  4. 5 1
      eitc-admin/src/main/java/com/eitc/web/controller/system/SysLoginController.java
  5. 7 3
      eitc-admin/src/main/java/com/eitc/web/controller/system/SysRoleController.java
  6. 4 0
      eitc-admin/src/main/java/com/eitc/web/controller/system/SysUserController.java
  7. 15 7
      eitc-admin/src/main/resources/application-dev.yml
  8. 11 2
      eitc-admin/src/main/resources/application-druid.yml
  9. 9 0
      eitc-admin/src/main/resources/application-prod.yml
  10. 2 0
      eitc-admin/src/main/resources/application.yml
  11. 39 18
      eitc-admin/src/main/resources/templates/medical-record.html
  12. 22 0
      eitc-common/pom.xml
  13. 21 0
      eitc-common/src/main/java/com/eitc/common/annotation/IgnoreReturnResultEncryption.java
  14. 118 0
      eitc-common/src/main/java/com/eitc/common/config/ParameterRequestWrapper.java
  15. 23 0
      eitc-common/src/main/java/com/eitc/common/constant/HttpConst.java
  16. 4 1
      eitc-common/src/main/java/com/eitc/common/core/domain/AjaxResult.java
  17. 54 0
      eitc-common/src/main/java/com/eitc/common/filter/CustomResponseBodyAdviceAdapter.java
  18. 96 21
      eitc-common/src/main/java/com/eitc/common/filter/RepeatableFilter.java
  19. 113 0
      eitc-common/src/main/java/com/eitc/common/utils/CryptoUtil.java
  20. 33 0
      eitc-common/src/main/java/com/eitc/common/utils/JasyptUtils.java
  21. 50 0
      eitc-common/src/main/java/com/eitc/common/utils/ObjectUtils.java
  22. 25 2
      eitc-common/src/main/java/com/eitc/common/utils/PatientBaseUtil.java
  23. 1 1
      eitc-common/src/main/java/com/eitc/common/utils/file/FileUploadUtils.java
  24. 1 1
      eitc-common/src/main/java/com/eitc/common/utils/file/MimeTypeUtils.java
  25. 7 3
      eitc-manage/src/main/java/com/eitc/manage/controller/helper/SysClinicInfoHelper.java
  26. 11 4
      eitc-patient-app/src/main/java/com/eitc/patient/controller/ApiAppController.java
  27. 2 9
      eitc-patient-app/src/main/java/com/eitc/patient/controller/AppLoginController.java
  28. 1 1
      eitc-patient-base/src/main/java/com/eitc/patient/domain/AppUser.java
  29. 46 0
      eitc-patient-base/src/main/java/com/eitc/patient/domain/DiagnosisManage.java
  30. 12 0
      eitc-patient-base/src/main/java/com/eitc/patient/domain/DiagnosisType.java
  31. 79 20
      eitc-patient-base/src/main/java/com/eitc/patient/domain/DiagnosisTypeTemplate.java
  32. 35 0
      eitc-patient-base/src/main/java/com/eitc/patient/domain/ImageRecord.java
  33. 32 0
      eitc-patient-base/src/main/java/com/eitc/patient/domain/MedicalRecord.java
  34. 6 38
      eitc-patient-base/src/main/java/com/eitc/patient/domain/MedicalRecordDetails.java
  35. 65 12
      eitc-patient-base/src/main/java/com/eitc/patient/dto/DiagnosisTypeTemplateDto.java
  36. 30 0
      eitc-patient-base/src/main/java/com/eitc/patient/excel/DiagnosisManageTemplateExcel.java
  37. 64 4
      eitc-patient-base/src/main/java/com/eitc/patient/excel/DiagnosisTypeTemplateExcel.java
  38. 16 0
      eitc-patient-base/src/main/java/com/eitc/patient/mapper/DiagnosisManageMapper.java
  39. 15 0
      eitc-patient-base/src/main/java/com/eitc/patient/mapper/ImageRecordMapper.java
  40. 0 16
      eitc-patient-base/src/main/java/com/eitc/patient/mapper/MedicalRecordDetailsMapper.java
  41. 20 0
      eitc-patient-base/src/main/java/com/eitc/patient/mapper/MedicalRecordMapper.java
  42. 3 5
      eitc-patient-base/src/main/java/com/eitc/patient/dto/MedicalRecordDto.java
  43. 25 0
      eitc-patient-base/src/main/java/com/eitc/patient/param/MedicalRecordParam.java
  44. 76 0
      eitc-patient-base/src/main/java/com/eitc/patient/param/MedicalRecordSaveParam.java
  45. 26 0
      eitc-patient-base/src/main/java/com/eitc/patient/service/IDiagnosisManageService.java
  46. 17 2
      eitc-patient-base/src/main/java/com/eitc/patient/service/IDiagnosisTypeService.java
  47. 15 19
      eitc-patient-base/src/main/java/com/eitc/patient/service/IDiagnosisTypeTemplateService.java
  48. 16 0
      eitc-patient-base/src/main/java/com/eitc/patient/service/IImageRecordService.java
  49. 10 10
      eitc-patient-base/src/main/java/com/eitc/patient/service/IMedicalHistoryService.java
  50. 0 29
      eitc-patient-base/src/main/java/com/eitc/patient/service/IMedicalRecordDetailsService.java
  51. 22 11
      eitc-patient-base/src/main/java/com/eitc/patient/service/IMedicalRecordService.java
  52. 29 44
      eitc-patient-base/src/main/java/com/eitc/patient/service/impl/AppUserServiceImpl.java
  53. 15 12
      eitc-patient-base/src/main/java/com/eitc/patient/service/impl/CollectCostPatientsServiceImpl.java
  54. 98 0
      eitc-patient-base/src/main/java/com/eitc/patient/service/impl/DiagnosisManageServiceImpl.java
  55. 1 2
      eitc-patient-base/src/main/java/com/eitc/patient/service/impl/DiagnosisTypeCostProjectServiceImpl.java
  56. 65 58
      eitc-patient-base/src/main/java/com/eitc/patient/service/impl/DiagnosisTypeServiceImpl.java
  57. 409 114
      eitc-patient-base/src/main/java/com/eitc/patient/service/impl/DiagnosisTypeTemplateServiceImpl.java
  58. 17 0
      eitc-patient-base/src/main/java/com/eitc/patient/service/impl/ImageRecordServiceImpl.java
  59. 41 31
      eitc-patient-base/src/main/java/com/eitc/patient/service/impl/MedicalHistoryServiceImpl.java
  60. 0 110
      eitc-patient-base/src/main/java/com/eitc/patient/service/impl/MedicalRecordDetailsServiceImpl.java
  61. 55 306
      eitc-patient-base/src/main/java/com/eitc/patient/service/impl/MedicalRecordServiceImpl.java
  62. 14 0
      eitc-patient-base/src/main/java/com/eitc/patient/tree/DiagnosisTypeTree.java
  63. 0 103
      eitc-patient-base/src/main/java/com/eitc/patient/utils/PatientUtil.java
  64. 49 2
      eitc-patient-base/src/main/java/com/eitc/patient/vo/DiagnosisTypeTemplateSaveVO.java
  65. 7 9
      eitc-patient-base/src/main/java/com/eitc/patient/vo/DiagnosisTypeTemplateVO.java
  66. 0 31
      eitc-patient-base/src/main/java/com/eitc/patient/vo/FormattedPartsVO.java
  67. 0 64
      eitc-patient-base/src/main/java/com/eitc/patient/vo/MedicalRecordDetailsVO.java
  68. 44 0
      eitc-patient-base/src/main/java/com/eitc/patient/vo/MedicalRecordListVO.java
  69. 33 0
      eitc-patient-base/src/main/java/com/eitc/patient/vo/MedicalRecordNoteVO.java
  70. 0 53
      eitc-patient-base/src/main/java/com/eitc/patient/vo/MedicalRecordParamVO.java
  71. 36 10
      eitc-patient-base/src/main/java/com/eitc/patient/vo/MedicalRecordTemplateVO.java
  72. 7 6
      eitc-patient-base/src/main/java/com/eitc/patient/vo/MedicalRecordVO.java
  73. 2 0
      eitc-patient-base/src/main/java/com/eitc/patient/vo/PatientVO.java
  74. 1 1
      eitc-patient-base/src/main/resources/mapper/patient/BusinessDictDataMapper.xml
  75. 0 38
      eitc-patient-base/src/main/resources/mapper/patient/MedicalRecordDetailsMapper.xml
  76. 66 19
      eitc-patient-base/src/main/resources/mapper/patient/MedicalRecordMapper.xml
  77. 1 4
      eitc-patient-base/src/main/resources/mapper/patient/PatientFollowUpMapper.xml
  78. 3 11
      eitc-patient-chat/src/main/java/com/eitc/patient/netty/server/ChatServer.java
  79. 1 1
      eitc-patient-pc/src/main/java/com/eitc/patient/controller/AppointmentProjectController.java
  80. 199 0
      eitc-patient-pc/src/main/java/com/eitc/patient/controller/DiagnosisManageController.java
  81. 17 0
      eitc-patient-pc/src/main/java/com/eitc/patient/controller/DiagnosisTypeController.java
  82. 3 2
      eitc-patient-pc/src/main/java/com/eitc/patient/controller/DiagnosisTypeOrderDoctorController.java
  83. 67 78
      eitc-patient-pc/src/main/java/com/eitc/patient/controller/DiagnosisTypeTemplateController.java
  84. 180 88
      eitc-patient-pc/src/main/java/com/eitc/patient/controller/MedicalRecordController.java
  85. 3 2
      eitc-patient-pc/src/main/java/com/eitc/patient/controller/NoticeManageController.java
  86. 1 1
      eitc-patient-pc/src/main/java/com/eitc/patient/controller/OperationsAnalysisController.java
  87. 18 5
      eitc-patient-pc/src/main/java/com/eitc/patient/controller/PatientController.java
  88. 1 1
      eitc-patient-pc/src/main/java/com/eitc/patient/controller/SchedulingDetailsController.java
  89. 1 1
      eitc-quartz/src/main/java/com/eitc/quartz/task/SchedulingConfigurationTask.java
  90. 21 12
      eitc-system/src/main/java/com/eitc/system/utils/SendSmsUtil.java
  91. 17 0
      pom.xml

+ 32 - 3
eitc-admin/src/main/java/com/eitc/web/controller/common/CaptchaController.java

@@ -1,5 +1,6 @@
1 1
 package com.eitc.web.controller.common;
2 2
 
3
+import java.awt.*;
3 4
 import java.awt.image.BufferedImage;
4 5
 import java.io.IOException;
5 6
 import java.util.concurrent.TimeUnit;
@@ -52,7 +53,8 @@ public class CaptchaController
52 53
         {
53 54
             return ajax;
54 55
         }
55
-
56
+        int width = 200;
57
+        int height = 50;
56 58
         // 保存验证码信息
57 59
         String uuid = IdUtils.simpleUUID();
58 60
         String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid;
@@ -67,12 +69,39 @@ public class CaptchaController
67 69
             String capText = captchaProducerMath.createText();
68 70
             capStr = capText.substring(0, capText.lastIndexOf("@"));
69 71
             code = capText.substring(capText.lastIndexOf("@") + 1);
70
-            image = captchaProducerMath.createImage(capStr);
72
+//            image = captchaProducerMath.createImage(capStr);
73
+            image = new BufferedImage(150, 50, BufferedImage.TYPE_INT_RGB);
74
+            Graphics2D g2d = image.createGraphics();
75
+            // 设置背景颜色
76
+            g2d.setColor(Color.WHITE);
77
+            g2d.fillRect(0, 0, width, height);
78
+
79
+            // 设置字体和颜色
80
+            Font font = new Font("Arial", Font.BOLD, 20);
81
+            g2d.setFont(font);
82
+            g2d.setColor(Color.BLACK);
83
+            g2d.drawString(capStr, 10, 30);
84
+
85
+            // 释放图形上下文使用的系统资源
86
+            g2d.dispose();
71 87
         }
72 88
         else if ("char".equals(captchaType))
73 89
         {
74 90
             capStr = code = captchaProducer.createText();
75
-            image = captchaProducer.createImage(capStr);
91
+            image = new BufferedImage(150, 50, BufferedImage.TYPE_INT_RGB);
92
+            Graphics2D g2d = image.createGraphics();
93
+            // 设置背景颜色
94
+            g2d.setColor(Color.WHITE);
95
+            g2d.fillRect(0, 0, width, height);
96
+
97
+            // 设置字体和颜色
98
+            Font font = new Font("Arial", Font.BOLD, 20);
99
+            g2d.setFont(font);
100
+            g2d.setColor(Color.BLACK);
101
+            g2d.drawString(capStr, 10, 30);
102
+
103
+            // 释放图形上下文使用的系统资源
104
+            g2d.dispose();
76 105
         }
77 106
 
78 107
         redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);

+ 113 - 0
eitc-admin/src/main/java/com/eitc/web/controller/saomiaoyi/SaoMiaoYiController.java

@@ -0,0 +1,113 @@
1
+package com.eitc.web.controller.saomiaoyi;
2
+
3
+import com.alibaba.fastjson2.JSONObject;
4
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
5
+import com.eitc.common.annotation.IgnoreReturnResultEncryption;
6
+import com.eitc.common.config.EitcConfig;
7
+import com.eitc.common.core.domain.AjaxResult;
8
+import com.eitc.common.utils.InterfaceVerificationUtil;
9
+import com.eitc.common.utils.file.FileUploadUtils;
10
+import com.eitc.framework.config.ServerConfig;
11
+import com.eitc.patient.domain.ImageRecord;
12
+import com.eitc.patient.service.IImageRecordService;
13
+import io.swagger.annotations.ApiOperation;
14
+import org.apache.commons.lang3.StringUtils;
15
+import org.springframework.beans.factory.annotation.Value;
16
+import org.springframework.web.bind.annotation.DeleteMapping;
17
+import org.springframework.web.bind.annotation.GetMapping;
18
+import org.springframework.web.bind.annotation.PostMapping;
19
+import org.springframework.web.bind.annotation.RequestMapping;
20
+import org.springframework.web.bind.annotation.RestController;
21
+import org.springframework.web.client.RestTemplate;
22
+import org.springframework.web.multipart.MultipartFile;
23
+
24
+import javax.annotation.Resource;
25
+import java.util.ArrayList;
26
+import java.util.Arrays;
27
+import java.util.HashMap;
28
+import java.util.List;
29
+
30
+/**
31
+ * SaoMiaoYiController
32
+ *
33
+ * @author mtx
34
+ * @date: 2024/09/11 14:37
35
+ */
36
+@RestController
37
+@RequestMapping("/pc/api/scanner")
38
+public class SaoMiaoYiController {
39
+
40
+    @Resource
41
+    private RestTemplate restTemplate;
42
+    @Value("${Total.ip}")
43
+    private String fileUrl;
44
+    @Resource
45
+    private IImageRecordService imageRecordService;
46
+    @Resource
47
+    private ServerConfig serverConfig;
48
+
49
+    /**
50
+     * 慧视口腔-诊所列表
51
+     */
52
+    @GetMapping(value = "/clinicList")
53
+    @ApiOperation("慧视健康-诊所列表")
54
+    @IgnoreReturnResultEncryption
55
+    public AjaxResult clinicList() {
56
+        // 这个是为了防止恶意请求来做的参数增加
57
+        String saSignStr = InterfaceVerificationUtil.getSaSignStr(new HashMap<>());
58
+        String url = fileUrl + "api/sys/clinict/appGetClinictList?" + saSignStr;
59
+        String object = restTemplate.getForObject(url, String.class);
60
+        return JSONObject.parseObject(object, AjaxResult.class);
61
+    }
62
+
63
+
64
+    @PostMapping("/uploads")
65
+    @ApiOperation("上传影像")
66
+    @IgnoreReturnResultEncryption
67
+    public AjaxResult uploadFiles(String identificationCard, List<MultipartFile> files) {
68
+        if (StringUtils.isBlank(identificationCard)) {
69
+            return AjaxResult.warn("请输入身份证号");
70
+        }
71
+        try {
72
+            List<ImageRecord> list = new ArrayList<>();
73
+            // 上传文件路径
74
+            String filePath = EitcConfig.getUploadPath();
75
+            // 上传并返回新文件名称
76
+            for (MultipartFile file : files) {
77
+                // 上传并返回新文件名称
78
+                String fileName = FileUploadUtils.upload(filePath, file);
79
+                ImageRecord imageRecord = new ImageRecord();
80
+                imageRecord.setImageUrl(fileName);
81
+                String url = serverConfig.getUrl() + fileName;
82
+                imageRecord.setFullImageUrl(url);
83
+                imageRecord.setIdentificationCard(identificationCard);
84
+                list.add(imageRecord);
85
+            }
86
+            return toAjax(imageRecordService.saveBatch(list));
87
+        } catch (Exception e) {
88
+            return AjaxResult.error(e.getMessage());
89
+        }
90
+    }
91
+
92
+    @GetMapping("/list")
93
+    @ApiOperation("查询影像")
94
+    @IgnoreReturnResultEncryption
95
+    public AjaxResult list(ImageRecord imageRecord) {
96
+        List<ImageRecord> list = imageRecordService.list(Wrappers.<ImageRecord>lambdaQuery()
97
+                .eq(StringUtils.isNotBlank(imageRecord.getIdentificationCard()), ImageRecord::getIdentificationCard, imageRecord.getIdentificationCard()));
98
+        return AjaxResult.success(list);
99
+    }
100
+
101
+    @DeleteMapping("/remove")
102
+    @ApiOperation("删除影像")
103
+    @IgnoreReturnResultEncryption
104
+    public AjaxResult remove(String ids) {
105
+        List<String> idList = Arrays.asList(ids.split(","));
106
+        return toAjax(imageRecordService.removeBatchByIds(idList));
107
+    }
108
+
109
+    private AjaxResult toAjax(boolean result) {
110
+        return result ? AjaxResult.success() : AjaxResult.error();
111
+    }
112
+
113
+}

+ 1 - 1
eitc-admin/src/main/java/com/eitc/web/controller/system/SysConfigController.java

@@ -69,7 +69,7 @@ public class SysConfigController extends BaseController
69 69
     /**
70 70
      * 根据参数键名查询参数值
71 71
      */
72
-    @GetMapping(value = "/configKey/{configKey}")
72
+//    @GetMapping(value = "/configKey/{configKey}")
73 73
     public AjaxResult getConfigKey(@PathVariable String configKey)
74 74
     {
75 75
         return success(configService.selectConfigByKey(configKey));

+ 5 - 1
eitc-admin/src/main/java/com/eitc/web/controller/system/SysLoginController.java

@@ -2,6 +2,8 @@ package com.eitc.web.controller.system;
2 2
 
3 3
 import java.util.List;
4 4
 import java.util.Set;
5
+
6
+import com.eitc.common.utils.CryptoUtil;
5 7
 import org.springframework.beans.factory.annotation.Autowired;
6 8
 import org.springframework.web.bind.annotation.GetMapping;
7 9
 import org.springframework.web.bind.annotation.PostMapping;
@@ -44,8 +46,10 @@ public class SysLoginController
44 46
     public AjaxResult login(@RequestBody LoginBody loginBody)
45 47
     {
46 48
         AjaxResult ajax = AjaxResult.success();
49
+        String encryptPassword = loginBody.getPassword();
50
+        String password = CryptoUtil.decrypt(encryptPassword);
47 51
         // 生成令牌
48
-        String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
52
+        String token = loginService.login(loginBody.getUsername(), password, loginBody.getCode(),
49 53
                 loginBody.getUuid());
50 54
         ajax.put(Constants.TOKEN, token);
51 55
         return ajax;

+ 7 - 3
eitc-admin/src/main/java/com/eitc/web/controller/system/SysRoleController.java

@@ -59,9 +59,13 @@ public class SysRoleController extends BaseController
59 59
     @GetMapping("/list")
60 60
     public TableDataInfo list(SysRole role)
61 61
     {
62
-        startPage();
63
-        List<SysRole> list = roleService.selectRoleList(role);
64
-        return getDataTable(list);
62
+        try {
63
+            startPage();
64
+            List<SysRole> list = roleService.selectRoleList(role);
65
+            return getDataTable(list);
66
+        } catch (Exception e) {
67
+            throw new RuntimeException("查询失败");
68
+        }
65 69
     }
66 70
 
67 71
     @Log(title = "角色管理", businessType = BusinessType.EXPORT)

+ 4 - 0
eitc-admin/src/main/java/com/eitc/web/controller/system/SysUserController.java

@@ -146,6 +146,8 @@ public class SysUserController extends BaseController
146 146
         }
147 147
         user.setCreateBy(getUsername());
148 148
         user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
149
+        user.setLoginIp(null);
150
+        user.setLoginDate(null);
149 151
         return toAjax(userService.insertUser(user));
150 152
     }
151 153
 
@@ -172,6 +174,8 @@ public class SysUserController extends BaseController
172 174
             return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
173 175
         }
174 176
         user.setUpdateBy(getUsername());
177
+        user.setLoginIp(null);
178
+        user.setLoginDate(null);
175 179
         return toAjax(userService.updateUser(user));
176 180
     }
177 181
 

+ 15 - 7
eitc-admin/src/main/resources/application-dev.yml

@@ -1,7 +1,7 @@
1 1
 # 开发环境配置
2 2
 server:
3 3
     # 服务器的HTTP端口,默认为8080
4
-    port: 8080
4
+    port: 8081
5 5
     servlet:
6 6
         # 应用的访问路径
7 7
         context-path: /api
@@ -41,8 +41,9 @@ spring:
41 41
             # 主库数据源
42 42
             master:
43 43
                 url: jdbc:mysql://39.105.121.97:13306/eitc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true
44
-                username: root
45
-                password: Eitc@gnhz702
44
+                username: ENC(Y+enSi2hyVCiZUI6FwKzyptOL3Ekds9Q)
45
+#                Eitc@gnhz702
46
+                password: ENC(uPV/9/Fy5TFFE0m0GGchwPjT0/iulahbf/0Y46/whfE=)
46 47
             # 从库数据源
47 48
             slave:
48 49
                 # 从数据源开关/默认关闭
@@ -116,14 +117,21 @@ spring:
116 117
                 max-active: 8
117 118
                 # #连接池最大阻塞等待时间(使用负值表示没有限制)
118 119
                 max-wait: -1ms
119
-
120
+jasypt:
121
+    encryptor:
122
+        # 密码盐值(自定义)
123
+        password: guoneng
124
+        # 加密算法设置
125
+        algorithm: PBEWithMD5AndDES
126
+        iv-generator-classname: org.jasypt.iv.RandomIvGenerator
127
+        salt-generator-classname: org.jasypt.salt.RandomSaltGenerator
120 128
 Total:
121
-    ip: http://localhost:8080/ # 主服务器的ip
122
-    ipport: http://127.0.0.1  # 本机ip
129
+    ip: http://39.105.121.97:8080/ # 主服务器的ip
130
+    ipport: http://39.105.121.97  # 本机ip 必须是映射ip 要不访问不到宿主机的脚本服务
123 131
 # Minio配置
124 132
 minio:
125 133
     #  url: http://39.105.121.97:19000
126 134
     accessKey: minioadmin
127 135
     secretKey: minioadmin
128 136
     bucketName: eitc
129
-    endpoint: http://192.168.3.17:19000
137
+    endpoint: http://39.105.121.97:19000

+ 11 - 2
eitc-admin/src/main/resources/application-druid.yml

@@ -40,8 +40,8 @@ spring:
40 40
             # 主库数据源
41 41
             master:
42 42
                 url: jdbc:mysql://mysql:3306/eitc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true
43
-                username: root
44
-                password: Eitc@gnhz702
43
+                username: ENC(Y+enSi2hyVCiZUI6FwKzyptOL3Ekds9Q)
44
+                password: ENC(uPV/9/Fy5TFFE0m0GGchwPjT0/iulahbf/0Y46/whfE=)
45 45
             # 从库数据源
46 46
             slave:
47 47
                 # 从数据源开关/默认关闭
@@ -116,6 +116,15 @@ spring:
116 116
                 # #连接池最大阻塞等待时间(使用负值表示没有限制)
117 117
                 max-wait: -1ms
118 118
 
119
+jasypt:
120
+    encryptor:
121
+        # 密码盐值(自定义)
122
+        password: guoneng
123
+        # 加密算法设置
124
+        algorithm: PBEWithMD5AndDES
125
+        iv-generator-classname: org.jasypt.iv.RandomIvGenerator
126
+        salt-generator-classname: org.jasypt.salt.RandomSaltGenerator
127
+
119 128
 Total:
120 129
     ip: http://39.105.121.97:8080/ # 主服务器的ip
121 130
     ipport: http://39.105.121.97  # 本机ip 必须是映射ip 要不访问不到宿主机的脚本服务

+ 9 - 0
eitc-admin/src/main/resources/application-prod.yml

@@ -116,6 +116,15 @@ spring:
116 116
                 # #连接池最大阻塞等待时间(使用负值表示没有限制)
117 117
                 max-wait: -1ms
118 118
 
119
+jasypt:
120
+    encryptor:
121
+        # 密码盐值(自定义)
122
+        password: guoneng
123
+        # 加密算法设置
124
+        algorithm: PBEWithMD5AndDES
125
+        iv-generator-classname: org.jasypt.iv.RandomIvGenerator
126
+        salt-generator-classname: org.jasypt.salt.RandomSaltGenerator
127
+
119 128
 Total:
120 129
     ip: http://39.105.121.97:8080/ # 主服务器的ip
121 130
     ipport: http://106.74.15.131  # 本机ip 必须是映射ip 要不访问不到宿主机的脚本服务

+ 2 - 0
eitc-admin/src/main/resources/application.yml

@@ -82,3 +82,5 @@ sa-token:
82 82
     # API 接口签名秘钥 (随便乱摁几个字母即可)
83 83
     secret-key: kQwIOrYvnXmSDkwEiFngrKidMcdrgKor
84 84
 
85
+websocket:
86
+  port: 8002

+ 39 - 18
eitc-admin/src/main/resources/templates/medical-record.html

@@ -135,25 +135,46 @@ lang=EN-US style='font-size:18.0pt;line-height:150%'>${companyName}</span></b></
135 135
 </table>
136 136
 <hr/>
137 137
 <table class=MsoTableGrid border=0 cellspacing=0 cellpadding=0 width=713 style='width:534.65pt;border-collapse:collapse;border:none'>
138
- <#if patient.listMap?? && (patient.listMap?size>0)>
139
- <#list patient.listMap?keys as key>
140
- <tr>
141
-  <td width=111 valign=top style='width:83.3pt;padding:0cm 5.4pt 0cm 5.4pt'>
142
-  <p class=MsoNormal style='text-align:justify;text-justify:distribute-all-lines'><span style='font-family:宋体'>${key}:</span></p>
143
-  </td>
144
-  <td width=602 valign=top style='width:451.35pt;padding:0cm 5.4pt 0cm 5.4pt'>
145
-  <p class=MsoNormal><span lang=EN-US>
146
-  <#assign list = patient.listMap[key]!>
147
-  <#if list?? && (list?size>0)>
148
-      <#list list as li>
149
-          <p><span>${li.toothPosition!} ${li.contentInfo!}</span></p>
150
-      </#list>
151
-  </#if>
152
-  </span></p>
153
-  </td>
138
+ <tr>
139
+  <td width=111 valign=top style='width:83.3pt;padding:0cm 5.4pt 0cm 5.4pt'><p class=MsoNormal style='text-align:justify;text-justify:distribute-all-lines'><span style='font-family:宋体'>主诉:</span></p></td>
140
+  <td width=602 valign=top style='width:451.35pt;padding:0cm 5.4pt 0cm 5.4pt'><p class=MsoNormal><span lang=EN-US>${patient.chiefComplaintContent!}</span></p></td>
141
+ </tr>
142
+ <tr>
143
+  <td width=111 valign=top style='width:83.3pt;padding:0cm 5.4pt 0cm 5.4pt'><p class=MsoNormal style='text-align:justify;text-justify:distribute-all-lines'><span style='font-family:宋体'>现病史:</span></p></td>
144
+  <td width=602 valign=top style='width:451.35pt;padding:0cm 5.4pt 0cm 5.4pt'><p class=MsoNormal><span lang=EN-US>${patient.presentIllnessContent!}</span></p></td>
145
+ </tr>
146
+ <tr>
147
+  <td width=111 valign=top style='width:83.3pt;padding:0cm 5.4pt 0cm 5.4pt'><p class=MsoNormal style='text-align:justify;text-justify:distribute-all-lines'><span style='font-family:宋体'>既往史:</span></p></td>
148
+  <td width=602 valign=top style='width:451.35pt;padding:0cm 5.4pt 0cm 5.4pt'><p class=MsoNormal><span lang=EN-US>${patient.pastHistory!}</span></p></td>
149
+ </tr>
150
+ <tr>
151
+  <td width=111 valign=top style='width:83.3pt;padding:0cm 5.4pt 0cm 5.4pt'><p class=MsoNormal style='text-align:justify;text-justify:distribute-all-lines'><span style='font-family:宋体'>家族史:</span></p></td>
152
+  <td width=602 valign=top style='width:451.35pt;padding:0cm 5.4pt 0cm 5.4pt'><p class=MsoNormal><span lang=EN-US>${patient.familyHistory!}</span></p></td>
153
+ </tr>
154
+ <tr>
155
+  <td width=111 valign=top style='width:83.3pt;padding:0cm 5.4pt 0cm 5.4pt'><p class=MsoNormal style='text-align:justify;text-justify:distribute-all-lines'><span style='font-family:宋体'>过敏史:</span></p></td>
156
+  <td width=602 valign=top style='width:451.35pt;padding:0cm 5.4pt 0cm 5.4pt'><p class=MsoNormal><span lang=EN-US>${patient.allergyHistory!}</span></p></td>
157
+ </tr>
158
+ <tr>
159
+  <td width=111 valign=top style='width:83.3pt;padding:0cm 5.4pt 0cm 5.4pt'><p class=MsoNormal style='text-align:justify;text-justify:distribute-all-lines'><span style='font-family:宋体'>检查:</span></p></td>
160
+  <td width=602 valign=top style='width:451.35pt;padding:0cm 5.4pt 0cm 5.4pt'><p class=MsoNormal><span lang=EN-US>${patient.inspectContent!}</span></p></td>
161
+ </tr>
162
+ <tr>
163
+  <td width=111 valign=top style='width:83.3pt;padding:0cm 5.4pt 0cm 5.4pt'><p class=MsoNormal style='text-align:justify;text-justify:distribute-all-lines'><span style='font-family:宋体'>诊断:</span></p></td>
164
+  <td width=602 valign=top style='width:451.35pt;padding:0cm 5.4pt 0cm 5.4pt'><p class=MsoNormal><span lang=EN-US>${patient.diagnosisContent!}</span></p></td>
165
+ </tr>
166
+ <tr>
167
+  <td width=111 valign=top style='width:83.3pt;padding:0cm 5.4pt 0cm 5.4pt'><p class=MsoNormal style='text-align:justify;text-justify:distribute-all-lines'><span style='font-family:宋体'>治疗计划:</span></p></td>
168
+  <td width=602 valign=top style='width:451.35pt;padding:0cm 5.4pt 0cm 5.4pt'><p class=MsoNormal><span lang=EN-US>${patient.treatmentPlanningContent!}</span></p></td>
169
+ </tr>
170
+ <tr>
171
+  <td width=111 valign=top style='width:83.3pt;padding:0cm 5.4pt 0cm 5.4pt'><p class=MsoNormal style='text-align:justify;text-justify:distribute-all-lines'><span style='font-family:宋体'>处置:</span></p></td>
172
+  <td width=602 valign=top style='width:451.35pt;padding:0cm 5.4pt 0cm 5.4pt'><p class=MsoNormal><span lang=EN-US>${patient.disposeContent!}</span></p></td>
173
+ </tr>
174
+ <tr>
175
+  <td width=111 valign=top style='width:83.3pt;padding:0cm 5.4pt 0cm 5.4pt'><p class=MsoNormal style='text-align:justify;text-justify:distribute-all-lines'><span style='font-family:宋体'>便签:</span></p></td>
176
+  <td width=602 valign=top style='width:451.35pt;padding:0cm 5.4pt 0cm 5.4pt'><p class=MsoNormal><span lang=EN-US>${patient.noteContent!}</span></p></td>
154 177
  </tr>
155
-</#list>
156
-</#if>
157 178
 </table>
158 179
 <div style="page-break-after: always;"></div>
159 180
 <p class=MsoNormal><span style='font-family:宋体'>医生声明:</span></p>

+ 22 - 0
eitc-common/pom.xml

@@ -181,7 +181,29 @@
181 181
             <groupId>cn.hutool</groupId>
182 182
             <artifactId>hutool-all</artifactId>
183 183
         </dependency>
184
+        <dependency>
185
+            <groupId>org.springframework</groupId>
186
+            <artifactId>spring-webmvc</artifactId>
187
+        </dependency>
184 188
 
189
+        <!-- 第三方拼音依赖包,配合 hutool-all 包中的 PinyinUtil 拼音工具使用 start -->
190
+        <dependency>
191
+            <groupId>com.belerweb</groupId>
192
+            <artifactId>pinyin4j</artifactId>
193
+        </dependency>
194
+        <dependency>
195
+            <groupId>io.github.biezhi</groupId>
196
+            <artifactId>TinyPinyin</artifactId>
197
+        </dependency>
198
+        <dependency>
199
+            <groupId>com.github.stuxuhai</groupId>
200
+            <artifactId>jpinyin</artifactId>
201
+        </dependency>
202
+        <dependency>
203
+            <groupId>com.github.ulisesbocchio</groupId>
204
+            <artifactId>jasypt-spring-boot-starter</artifactId>
205
+            <version>3.0.3</version>
206
+        </dependency>
185 207
     </dependencies>
186 208
 
187 209
 </project>

+ 21 - 0
eitc-common/src/main/java/com/eitc/common/annotation/IgnoreReturnResultEncryption.java

@@ -0,0 +1,21 @@
1
+package com.eitc.common.annotation;
2
+
3
+import org.springframework.stereotype.Component;
4
+
5
+import java.lang.annotation.Documented;
6
+import java.lang.annotation.ElementType;
7
+import java.lang.annotation.Retention;
8
+import java.lang.annotation.RetentionPolicy;
9
+import java.lang.annotation.Target;
10
+
11
+/**
12
+ * 忽略返回结果加密
13
+ *
14
+ * @author eitc
15
+ */
16
+@Target({ ElementType.METHOD, ElementType.TYPE })
17
+@Retention(RetentionPolicy.RUNTIME)
18
+@Documented
19
+@Component
20
+public @interface IgnoreReturnResultEncryption {
21
+}

+ 118 - 0
eitc-common/src/main/java/com/eitc/common/config/ParameterRequestWrapper.java

@@ -0,0 +1,118 @@
1
+package com.eitc.common.config;
2
+
3
+import org.springframework.util.StreamUtils;
4
+
5
+import javax.servlet.ReadListener;
6
+import javax.servlet.ServletInputStream;
7
+import javax.servlet.http.HttpServletRequest;
8
+import javax.servlet.http.HttpServletRequestWrapper;
9
+import java.io.BufferedReader;
10
+import java.io.ByteArrayInputStream;
11
+import java.io.IOException;
12
+import java.io.InputStream;
13
+import java.io.InputStreamReader;
14
+import java.util.HashMap;
15
+import java.util.Map;
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+public class ParameterRequestWrapper  extends HttpServletRequestWrapper {
27
+    private Map<String , String[]> params = new HashMap<String, String[]>();
28
+    /**
29
+     * 缓存下来的HTTP body
30
+     */
31
+    private byte[] body;
32
+
33
+
34
+    @SuppressWarnings("unchecked")
35
+    public ParameterRequestWrapper(HttpServletRequest request) throws IOException {
36
+        // 将request交给父类,以便于调用对应方法的时候,将其输出,其实父亲类的实现方式和第一种new的方式类似
37
+        super(request);
38
+        //将参数表,赋予给当前的Map以便于持有request中的参数
39
+        this.params.putAll(request.getParameterMap());
40
+        //将参数表,赋予给当前的Map以便于持有request中的参数
41
+        this.body = StreamUtils.copyToByteArray(request.getInputStream());
42
+    }
43
+    //重载一个构造方法
44
+    public ParameterRequestWrapper(HttpServletRequest request , Map<String , Object> extendParams) throws IOException {
45
+        this(request);
46
+        addAllParameters(extendParams);//这里将扩展参数写入参数表
47
+    }
48
+
49
+
50
+    public void addAllParameters(Map<String , Object>otherParams) {//增加多个参数
51
+        for(Map.Entry<String , Object>entry : otherParams.entrySet()) {
52
+            addParameter(entry.getKey() , entry.getValue());
53
+        }
54
+    }
55
+
56
+
57
+    public void addParameter(String name , Object value) {//增加参数
58
+        if(value != null) {
59
+            if(value instanceof String[]) {
60
+                this.params.put(name , (String[])value);
61
+            }else if(value instanceof String) {
62
+                this.params.put(name , new String[] {(String)value});
63
+            }else {
64
+                this.params.put(name , new String[] {String.valueOf(value)});
65
+            }
66
+        }
67
+    }
68
+
69
+
70
+
71
+
72
+    /**
73
+     * 重新包装输入流
74
+     * @return
75
+     * @throws IOException
76
+     */
77
+    @Override
78
+    public ServletInputStream getInputStream() throws IOException {
79
+        InputStream bodyStream = new ByteArrayInputStream(body);
80
+        return new ServletInputStream() {
81
+
82
+            @Override
83
+            public int read() throws IOException {
84
+                return bodyStream.read();
85
+            }
86
+
87
+            /**
88
+             * 下面的方法一般情况下不会被使用,如果你引入了一些需要使用ServletInputStream的外部组件,可以重点关注一下。
89
+             * @return
90
+             */
91
+            @Override
92
+            public boolean isFinished() {
93
+                return false;
94
+            }
95
+
96
+            @Override
97
+            public boolean isReady() {
98
+                return true;
99
+            }
100
+
101
+            @Override
102
+            public void setReadListener(ReadListener readListener) {
103
+
104
+            }
105
+        };
106
+    }
107
+
108
+    @Override
109
+    public BufferedReader getReader() throws IOException {
110
+        return new BufferedReader(new InputStreamReader(getInputStream()));
111
+    }
112
+
113
+    public void setInputStream( byte[] in) {
114
+        this.body = in;
115
+    }
116
+
117
+
118
+}

+ 23 - 0
eitc-common/src/main/java/com/eitc/common/constant/HttpConst.java

@@ -0,0 +1,23 @@
1
+package com.eitc.common.constant;
2
+
3
+public class HttpConst {
4
+    /**
5
+     * 几种常见的Content-Type
6
+     */
7
+    public static final String FORM_URLENCODED_CONTENT_TYPE ="application/x-www-form-urlencoded";
8
+
9
+    public static final String JSON_CONTENT_TYPE = "application/json";
10
+
11
+    public static final String MULTIPART_CONTENT_TYPE = "multipart/form-data";
12
+    /**
13
+     * 常见的post/get请求方式
14
+     */
15
+    public static final String POST_METHOD = "post";
16
+
17
+    public static final String GET_METHOD = "GET";
18
+
19
+    public static final String PUT_METHOD = "put";
20
+
21
+    public static final String OPTIONS_METHOD = "options";
22
+
23
+}

+ 4 - 1
eitc-common/src/main/java/com/eitc/common/core/domain/AjaxResult.java

@@ -2,7 +2,10 @@ package com.eitc.common.core.domain;
2 2
 
3 3
 import java.util.HashMap;
4 4
 import java.util.Objects;
5
+
6
+import com.alibaba.fastjson2.JSON;
5 7
 import com.eitc.common.constant.HttpStatus;
8
+import com.eitc.common.utils.CryptoUtil;
6 9
 import com.eitc.common.utils.StringUtils;
7 10
 
8 11
 /**
@@ -55,7 +58,7 @@ public class AjaxResult extends HashMap<String, Object>
55 58
         super.put(MSG_TAG, msg);
56 59
         if (StringUtils.isNotNull(data))
57 60
         {
58
-            super.put(DATA_TAG, data);
61
+            super.put(DATA_TAG,  data);
59 62
         }
60 63
     }
61 64
 

+ 54 - 0
eitc-common/src/main/java/com/eitc/common/filter/CustomResponseBodyAdviceAdapter.java

@@ -0,0 +1,54 @@
1
+package com.eitc.common.filter;
2
+
3
+import com.alibaba.fastjson2.JSON;
4
+import com.eitc.common.annotation.IgnoreReturnResultEncryption;
5
+import com.eitc.common.core.domain.AjaxResult;
6
+import com.eitc.common.core.page.TableDataInfo;
7
+import com.eitc.common.utils.CryptoUtil;
8
+import lombok.extern.slf4j.Slf4j;
9
+import org.springframework.core.MethodParameter;
10
+import org.springframework.http.MediaType;
11
+import org.springframework.http.server.ServerHttpRequest;
12
+import org.springframework.http.server.ServerHttpResponse;
13
+import org.springframework.web.bind.annotation.ControllerAdvice;
14
+import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
15
+
16
+import java.lang.reflect.Method;
17
+import java.util.Objects;
18
+
19
+
20
+@ControllerAdvice
21
+@Slf4j
22
+public class CustomResponseBodyAdviceAdapter implements ResponseBodyAdvice<Object> {
23
+
24
+    @Override
25
+    public boolean supports(MethodParameter returnType, Class converterType) {
26
+        Method method = returnType.getMethod();
27
+        assert method != null;
28
+        IgnoreReturnResultEncryption ra = method.getAnnotation(IgnoreReturnResultEncryption.class);
29
+        return Objects.isNull(ra);
30
+    }
31
+
32
+    @Override
33
+    public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType,
34
+                                  Class selectedConverterType, ServerHttpRequest request, ServerHttpResponse response) {
35
+        if (body instanceof AjaxResult) {
36
+            AjaxResult ajaxResult = (AjaxResult) body;
37
+            try {
38
+                return CryptoUtil.encrypt(JSON.toJSONString(ajaxResult));
39
+            } catch (Exception e) {
40
+                log.error("AjaxResult加密失败:" + body, e);
41
+                return ajaxResult;
42
+            }
43
+        } else if (body instanceof TableDataInfo) {
44
+            TableDataInfo tableDataInfo = (TableDataInfo) body;
45
+            try {
46
+                return CryptoUtil.encrypt(JSON.toJSONString(tableDataInfo));
47
+            } catch (Exception e) {
48
+                log.error("TableDataInfo加密失败:" + body, e);
49
+                return tableDataInfo;
50
+            }
51
+        }
52
+        return body;
53
+    }
54
+}

+ 96 - 21
eitc-common/src/main/java/com/eitc/common/filter/RepeatableFilter.java

@@ -1,6 +1,14 @@
1 1
 package com.eitc.common.filter;
2 2
 
3
-import java.io.IOException;
3
+import com.alibaba.fastjson2.JSONArray;
4
+import com.alibaba.fastjson2.JSONObject;
5
+import com.eitc.common.config.ParameterRequestWrapper;
6
+import com.eitc.common.constant.HttpConst;
7
+import com.eitc.common.utils.CryptoUtil;
8
+import com.eitc.common.utils.StringUtils;
9
+import lombok.extern.slf4j.Slf4j;
10
+import org.springframework.http.MediaType;
11
+
4 12
 import javax.servlet.Filter;
5 13
 import javax.servlet.FilterChain;
6 14
 import javax.servlet.FilterConfig;
@@ -8,45 +16,112 @@ import javax.servlet.ServletException;
8 16
 import javax.servlet.ServletRequest;
9 17
 import javax.servlet.ServletResponse;
10 18
 import javax.servlet.http.HttpServletRequest;
11
-import org.springframework.http.MediaType;
12
-import com.eitc.common.utils.StringUtils;
19
+import javax.servlet.http.HttpServletResponse;
20
+import java.io.ByteArrayOutputStream;
21
+import java.io.IOException;
22
+import java.nio.charset.StandardCharsets;
23
+import java.util.stream.Collectors;
24
+
13 25
 
14 26
 /**
15 27
  * Repeatable 过滤器
16 28
  *
17 29
  * @author eitc
18 30
  */
19
-public class RepeatableFilter implements Filter
20
-{
31
+@Slf4j
32
+public class RepeatableFilter implements Filter {
33
+
34
+    private static final String DECRYPT_PARAM_NAME = "decrypt";//请求参数包含的是否加密的字段
35
+
36
+    private static final String DEFAULT_DECRYPT_TYPE = "AES";//默认加密的类型
37
+
21 38
     @Override
22
-    public void init(FilterConfig filterConfig) throws ServletException
23
-    {
39
+    public void init(FilterConfig filterConfig) throws ServletException {
24 40
 
25 41
     }
26 42
 
27 43
     @Override
28 44
     public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
29
-            throws IOException, ServletException
30
-    {
31
-        ServletRequest requestWrapper = null;
32
-        if (request instanceof HttpServletRequest
33
-                && StringUtils.startsWithIgnoreCase(request.getContentType(), MediaType.APPLICATION_JSON_VALUE))
45
+            throws IOException, ServletException {
46
+        HttpServletRequest req = (HttpServletRequest) request;
47
+        HttpServletResponse res = (HttpServletResponse) response;
34 48
         {
35
-            requestWrapper = new RepeatedlyRequestWrapper((HttpServletRequest) request, response);
49
+            String contentType = req.getContentType();//获取contentType请求头
50
+            if (StringUtils.isNotBlank(contentType)) {
51
+                String method = req.getMethod();//获取请求方法  post/get
52
+                //2 处理post请求  只处理application/x-www-form-urlencoded  application/json,对于multipart/form-data,直接放行
53
+                if (method.trim().equalsIgnoreCase(HttpConst.POST_METHOD) || method.trim().equalsIgnoreCase(HttpConst.PUT_METHOD)) {
54
+                    if (contentType.trim().toLowerCase().contains(HttpConst.MULTIPART_CONTENT_TYPE)) {
55
+                        chain.doFilter(req, response);
56
+                        return;
57
+                    }
58
+                    //处理application/x-www-form-urlencoded
59
+                    if (contentType.trim().toLowerCase().contains(HttpConst.FORM_URLENCODED_CONTENT_TYPE)) {
60
+                        String decrypt = request.getParameter(DECRYPT_PARAM_NAME);
61
+                        if (decrypt == null || decrypt.trim().isEmpty()) {
62
+                            chain.doFilter(request, response);
63
+                            return;
64
+                        }
65
+                        chain.doFilter(req, response);
66
+                        return;
67
+                    }
68
+                    //处理application/json
69
+                    if (contentType.trim().toLowerCase().contains(HttpConst.JSON_CONTENT_TYPE)) {
70
+                        ParameterRequestWrapper requestWrapper = new ParameterRequestWrapper(req);
71
+                        try {
72
+                            String collect = requestWrapper.getReader().lines().collect(Collectors.joining(System.lineSeparator()));
73
+                            // 解密
74
+                            String decrypt = CryptoUtil.decrypt(collect);
75
+                            String jsonString = null;
76
+                            try {
77
+                                JSONObject parseObject = JSONObject.parseObject(decrypt);
78
+                                jsonString = parseObject.toJSONString();
79
+                            } catch (Exception e) {
80
+                                JSONArray jsonArray = JSONArray.parseArray(decrypt);
81
+                                jsonString = jsonArray.toJSONString();
82
+                            }
83
+                            byte[] bytes = jsonString.getBytes(StandardCharsets.UTF_8);
84
+                            ByteArrayOutputStream binaryStream = new ByteArrayOutputStream();
85
+                            try {
86
+                                binaryStream.write(bytes);
87
+                                byte[] byteArray = binaryStream.toByteArray();
88
+                                requestWrapper.setInputStream(byteArray);
89
+                            } catch (IOException e) {
90
+                                e.printStackTrace();
91
+                            } finally {
92
+                                try {
93
+                                    binaryStream.close();
94
+                                } catch (IOException e) {
95
+                                    e.printStackTrace();
96
+                                }
97
+                            }
98
+                        } catch (Exception e) {
99
+                            log.error("解密失败:" + req.getContextPath(), e);
100
+                        }
101
+                        chain.doFilter(requestWrapper, response);
102
+                        return;
103
+                    }
104
+                }
105
+            }
36 106
         }
37
-        if (null == requestWrapper)
38
-        {
39
-            chain.doFilter(request, response);
107
+
108
+
109
+        HttpServletRequest requestWrapper = null;
110
+        if (req instanceof HttpServletRequest
111
+                && StringUtils.startsWithIgnoreCase(req.getContentType(), MediaType.APPLICATION_JSON_VALUE)) {
112
+            requestWrapper = new RepeatedlyRequestWrapper((HttpServletRequest) request, response);
40 113
         }
41
-        else
42
-        {
43
-            chain.doFilter(requestWrapper, response);
114
+        if (null == requestWrapper) {
115
+            chain.doFilter(req, res);
116
+        } else {
117
+            chain.doFilter(requestWrapper, res);
44 118
         }
45 119
     }
46 120
 
47 121
     @Override
48
-    public void destroy()
49
-    {
122
+    public void destroy() {
50 123
 
51 124
     }
125
+
126
+
52 127
 }

+ 113 - 0
eitc-common/src/main/java/com/eitc/common/utils/CryptoUtil.java

@@ -0,0 +1,113 @@
1
+package com.eitc.common.utils;
2
+
3
+import org.apache.commons.codec.binary.Base64;
4
+
5
+import javax.crypto.Cipher;
6
+import javax.crypto.spec.IvParameterSpec;
7
+import javax.crypto.spec.SecretKeySpec;
8
+import java.nio.charset.StandardCharsets;
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+public class CryptoUtil {
20
+
21
+    private final static String IV = "1234567890123456";//需要前端与后端配置一致
22
+    private final static String KEY = "1234567890123456";
23
+
24
+    /***
25
+     * 加密
26
+     * @param  data 要加密的数据
27
+     * @return encrypt
28
+     */
29
+    public static String encrypt(String data){
30
+        return encrypt(data, KEY, IV);
31
+    }
32
+
33
+    public static Object decryptObject(Object obj) throws Exception{
34
+        return ObjectUtils.decryptObjectValues(obj);
35
+    }
36
+
37
+    /***
38
+     * param data 需要解密的数据
39
+     * 调用desEncrypt()方法
40
+     */
41
+    public static String decrypt(String data){
42
+        return decrypt(data, KEY, IV);
43
+    }
44
+
45
+    /**
46
+     * 加密方法
47
+     * @param data  要加密的数据
48
+     * @param key 加密key
49
+     * @param iv 加密iv
50
+     * @return 加密的结果
51
+     */
52
+    private static String encrypt(String data, String key, String iv){
53
+        try {
54
+            //"算法/模式/补码方式"NoPadding PkcsPadding
55
+            Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
56
+            int blockSize = cipher.getBlockSize();
57
+
58
+            byte[] dataBytes = data.getBytes();
59
+            int plaintextLength = dataBytes.length;
60
+            if (plaintextLength % blockSize != 0) {
61
+                plaintextLength = plaintextLength + (blockSize - (plaintextLength % blockSize));
62
+            }
63
+
64
+            byte[] plaintext = new byte[plaintextLength];
65
+            System.arraycopy(dataBytes, 0, plaintext, 0, dataBytes.length);
66
+
67
+            SecretKeySpec keyspec = new SecretKeySpec(key.getBytes(), "AES");
68
+            IvParameterSpec ivspec = new IvParameterSpec(iv.getBytes());
69
+
70
+            cipher.init(Cipher.ENCRYPT_MODE, keyspec, ivspec);
71
+            byte[] encrypted = cipher.doFinal(plaintext);
72
+
73
+            return Base64.encodeBase64String(encrypted);
74
+
75
+        } catch (Exception e) {
76
+            e.printStackTrace();
77
+            return null;
78
+        }
79
+    }
80
+
81
+    /**
82
+     * 解密方法
83
+     * @param data 要解密的数据
84
+     * @param key  解密key
85
+     * @param iv 解密iv
86
+     * @return 解密的结果
87
+     */
88
+    private static String decrypt(String data, String key, String iv){
89
+        try {
90
+            if(StringUtils.isEmpty(data)) {
91
+                return "";
92
+            }
93
+            byte[] encrypted1 = new Base64().decode(data);
94
+            Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
95
+            SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(), "AES");
96
+            IvParameterSpec ivSpec = new IvParameterSpec(iv.getBytes());
97
+            cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec);
98
+            byte[] original = cipher.doFinal(encrypted1);
99
+            return new String(original, StandardCharsets.UTF_8).trim();
100
+
101
+        } catch (Exception e) {
102
+            e.printStackTrace();
103
+            return "解析错误";
104
+        }
105
+    }
106
+
107
+    public static void main(String[] args) {
108
+        String a = encrypt("123456");
109
+        System.out.println(a);
110
+        String b = decrypt(a);
111
+        System.out.println(b);
112
+    }
113
+}

+ 33 - 0
eitc-common/src/main/java/com/eitc/common/utils/JasyptUtils.java

@@ -0,0 +1,33 @@
1
+package com.eitc.common.utils;
2
+
3
+import org.jasypt.encryption.pbe.PooledPBEStringEncryptor;
4
+import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig;
5
+
6
+public class JasyptUtils {
7
+    public static void main(String[] args) {
8
+        PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
9
+        // set config
10
+        SimpleStringPBEConfig config = new SimpleStringPBEConfig();
11
+        //设置盐值
12
+        config.setPassword("guoneng");
13
+        //设置算法配置信息
14
+        config.setAlgorithm("PBEWithMD5AndDES");
15
+        config.setKeyObtentionIterations("1000");
16
+        config.setProviderName("SunJCE");
17
+        config.setIvGeneratorClassName("org.jasypt.iv.RandomIvGenerator");
18
+        config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator");
19
+        config.setStringOutputType("base64");
20
+        config.setPoolSize("1");
21
+        //注入配置
22
+        encryptor.setConfig(config);
23
+        //加密
24
+        System.out.println("-----------加密串");
25
+        String encryptUserName = encryptor.encrypt("Eitc@gnhz702");
26
+        System.out.println(encryptUserName);
27
+        //解密
28
+        System.out.println("-----------解密串");
29
+        String decrypted = encryptor.decrypt(encryptUserName);
30
+        System.out.println(decrypted);
31
+
32
+    }
33
+}

+ 50 - 0
eitc-common/src/main/java/com/eitc/common/utils/ObjectUtils.java

@@ -0,0 +1,50 @@
1
+package com.eitc.common.utils;
2
+
3
+import com.eitc.common.utils.bean.BeanUtils;
4
+import lombok.extern.log4j.Log4j2;
5
+
6
+import java.beans.PropertyDescriptor;
7
+import java.lang.reflect.InvocationTargetException;
8
+import java.lang.reflect.Method;
9
+
10
+//import static sun.invoke.util.Wrapper.isPrimitiveType;
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+@Log4j2
21
+public class ObjectUtils {
22
+    public static Object decryptObjectValues(Object obj) throws Exception{
23
+        if (obj == null) {
24
+            return null;
25
+        }
26
+        Class<?> objClass = obj.getClass();
27
+        PropertyDescriptor[] propertyDescriptors = BeanUtils.getPropertyDescriptors(objClass);
28
+        for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
29
+            Method readMethod = propertyDescriptor.getReadMethod();
30
+            Method writeMethod = propertyDescriptor.getWriteMethod();
31
+            if (readMethod != null && writeMethod!=null) {
32
+                try {
33
+                    Object value = readMethod.invoke(obj);
34
+                    if(value==null) {
35
+                        continue;
36
+                    }
37
+//                    if(isPrimitiveType(value.getClass()) && value instanceof String) {
38
+//                        String changeValue = CryptoUtil.decrypt((String)value);
39
+//                        writeMethod.invoke(obj, changeValue);
40
+//                    }
41
+                } catch (IllegalAccessException | InvocationTargetException e) {
42
+                    e.printStackTrace();
43
+                    log.error("反射获取类【" + objClass.getName() + "】方法异常,", e);
44
+                }
45
+            }
46
+        }
47
+        return obj;
48
+
49
+    }
50
+}

+ 25 - 2
eitc-common/src/main/java/com/eitc/common/utils/PatientBaseUtil.java

@@ -1,11 +1,10 @@
1 1
 package com.eitc.common.utils;
2 2
 
3
+import cn.hutool.extra.pinyin.PinyinUtil;
3 4
 import com.eitc.common.core.redis.RedisCache;
4 5
 import com.eitc.common.utils.spring.SpringUtils;
5
-import org.springframework.beans.factory.annotation.Value;
6 6
 import org.springframework.stereotype.Component;
7 7
 
8
-import javax.annotation.PostConstruct;
9 8
 import java.text.ParseException;
10 9
 import java.text.SimpleDateFormat;
11 10
 import java.util.Calendar;
@@ -25,6 +24,7 @@ public class PatientBaseUtil {
25 24
 
26 25
     /**
27 26
      * 生成多少位位随机数
27
+     *
28 28
      * @param length 需要生成的位数
29 29
      * @return 返回结果
30 30
      * @author mtx
@@ -156,4 +156,27 @@ public class PatientBaseUtil {
156 156
         return start1.compareTo(end2) <= 0 && end1.compareTo(start2) >= 0;
157 157
     }
158 158
 
159
+    /**
160
+     * 获取字符串中每个汉字的拼音首字母
161
+     *
162
+     * @param content 输入的字符串,用于提取拼音首字母
163
+     * @return 返回提取后的拼音首字母字符串
164
+     */
165
+    public static String getPinYinFirstLetter(String content) {
166
+        // 调用PinyinUtil工具类的getFirstLetter方法,传入content和空字符串作为参数
167
+        // 空字符串表示如果content为空,则返回空字符串
168
+        return PinyinUtil.getFirstLetter(content, "");
169
+    }
170
+
171
+    /**
172
+     * 将汉字转换为拼音
173
+     *
174
+     * @param content 需要转换的汉字内容
175
+     * @return 转换后的拼音字符串
176
+     */
177
+    public static String getPinyin(String content) {
178
+        // 调用PinyinUtil工具类的getPinyin方法进行汉字到拼音的转换,若content中包含非汉字字符,则不处理,返回空字符串
179
+        return PinyinUtil.getPinyin(content, "");
180
+    }
181
+
159 182
 }

+ 1 - 1
eitc-common/src/main/java/com/eitc/common/utils/file/FileUploadUtils.java

@@ -25,7 +25,7 @@ public class FileUploadUtils
25 25
     /**
26 26
      * 默认大小 50M
27 27
      */
28
-    public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024;
28
+    public static final long DEFAULT_MAX_SIZE = 150 * 1024 * 1024;
29 29
 
30 30
     /**
31 31
      * 默认的文件名最大长度 100

+ 1 - 1
eitc-common/src/main/java/com/eitc/common/utils/file/MimeTypeUtils.java

@@ -34,7 +34,7 @@ public class MimeTypeUtils
34 34
             // 压缩文件
35 35
             "rar", "zip", "gz", "bz2",
36 36
             // 视频格式
37
-            "mp4", "avi", "rmvb",
37
+            "mp4", "avi", "rmvb", "mov",
38 38
             // pdf
39 39
             "pdf" };
40 40
 

+ 7 - 3
eitc-manage/src/main/java/com/eitc/manage/controller/helper/SysClinicInfoHelper.java

@@ -123,9 +123,13 @@ public class SysClinicInfoHelper {
123 123
     }
124 124
 
125 125
     public String getSysClinicInfoCode() {
126
-        List<SysClinicInfo> list = sysClinicInfoService.list(Wrappers.<SysClinicInfo>lambdaQuery().select(SysClinicInfo::getClinicCode));
127
-        List<String> collect = list.stream().map(SysClinicInfo::getClinicCode).collect(Collectors.toList());
128
-        String max = Collections.max(collect);
126
+        String max = "0";
127
+        try {
128
+            List<SysClinicInfo> list = sysClinicInfoService.list(Wrappers.<SysClinicInfo>lambdaQuery().select(SysClinicInfo::getClinicCode));
129
+            List<String> collect = list.stream().map(SysClinicInfo::getClinicCode).collect(Collectors.toList());
130
+            max = Collections.max(collect);
131
+        } catch (Exception e) {
132
+        }
129 133
         return String.format("%04d",Integer.parseInt(max)+1);
130 134
     }
131 135
 

+ 11 - 4
eitc-patient-app/src/main/java/com/eitc/patient/controller/ApiAppController.java

@@ -7,6 +7,7 @@ import com.eitc.common.annotation.Log;
7 7
 import com.eitc.common.core.controller.BaseController;
8 8
 import com.eitc.common.core.domain.AjaxResult;
9 9
 import com.eitc.common.enums.BusinessType;
10
+import com.eitc.common.utils.CryptoUtil;
10 11
 import com.eitc.common.utils.InterfaceVerificationUtil;
11 12
 import com.eitc.patient.domain.AppUser;
12 13
 import com.eitc.patient.domain.ProtocolTemplate;
@@ -30,6 +31,7 @@ import javax.annotation.Resource;
30 31
 import javax.validation.Valid;
31 32
 import java.util.HashMap;
32 33
 import java.util.List;
34
+import java.util.Map;
33 35
 
34 36
 /**
35 37
  * ApiController
@@ -72,17 +74,15 @@ public class ApiAppController extends BaseController {
72 74
 
73 75
     /**
74 76
      * 诊所列表
75
-     *
76
-     * @return
77 77
      */
78 78
     @GetMapping(value = "/clinicList")
79 79
     @ApiOperation("诊所列表")
80
-    public JSONObject clinicList() {
80
+    public AjaxResult clinicList() {
81 81
         // 这个是为了防止恶意请求来做的参数增加
82 82
         String saSignStr = InterfaceVerificationUtil.getSaSignStr(new HashMap<>());
83 83
         String url = fileUrl + "api/sys/clinict/appGetClinictList?" + saSignStr;
84 84
         String object = restTemplate.getForObject(url, String.class);
85
-        return JSONObject.parseObject(object);
85
+        return JSONObject.parseObject(CryptoUtil.decrypt(object), AjaxResult.class);
86 86
     }
87 87
 
88 88
     /**
@@ -111,4 +111,11 @@ public class ApiAppController extends BaseController {
111 111
         }
112 112
         return success(userNoticeContent);
113 113
     }
114
+
115
+    @PostMapping("/checkCaptchaCode")
116
+    @ApiOperation("验证短信验证码")
117
+    public AjaxResult checkCaptchaCode(@RequestBody Map<String, String> map) {
118
+        appUserService.checkCaptchaCode(map.get("phoneNumber"), map.get("captchaCode"));
119
+        return success();
120
+    }
114 121
 }

+ 2 - 9
eitc-patient-app/src/main/java/com/eitc/patient/controller/AppLoginController.java

@@ -90,15 +90,8 @@ public class AppLoginController extends BaseController {
90 90
      */
91 91
     @PostMapping("/sendCaptchaCode")
92 92
     @ApiOperation("获取短信验证码")
93
-    public AjaxResult sendCaptchaCode(String phoneNumber) throws ClientException {
94
-        return appUserService.sendCaptchaCode(phoneNumber);
95
-    }
96
-
97
-    @PostMapping("/checkCaptchaCode")
98
-    @ApiOperation("验证短信验证码")
99
-    public AjaxResult checkCaptchaCode(String phoneNumber, String captchaCode) {
100
-        appUserService.checkCaptchaCode(phoneNumber, captchaCode);
101
-        return success();
93
+    public AjaxResult sendCaptchaCode(@RequestBody Map<String, String> map) throws ClientException {
94
+        return appUserService.sendCaptchaCode(map.get("phoneNumber"));
102 95
     }
103 96
 
104 97
     /**

+ 1 - 1
eitc-patient-base/src/main/java/com/eitc/patient/domain/AppUser.java

@@ -29,7 +29,7 @@ public class AppUser extends EitcBaseEntity {
29 29
     private String password;
30 30
 
31 31
     @TableField(value = "identification_card")
32
-    @ApiModelProperty(value = "手机号码", name = "identificationCard")
32
+    @ApiModelProperty(value = "身份证号", name = "identificationCard")
33 33
     private String identificationCard;
34 34
 
35 35
     @TableField(value = "avatar")

+ 46 - 0
eitc-patient-base/src/main/java/com/eitc/patient/domain/DiagnosisManage.java

@@ -0,0 +1,46 @@
1
+package com.eitc.patient.domain;
2
+
3
+import com.baomidou.mybatisplus.annotation.TableField;
4
+import com.baomidou.mybatisplus.annotation.TableName;
5
+import com.eitc.common.core.domain.EitcBaseEntity;
6
+import io.swagger.annotations.ApiModel;
7
+import io.swagger.annotations.ApiModelProperty;
8
+import lombok.Data;
9
+import lombok.EqualsAndHashCode;
10
+
11
+import javax.validation.constraints.NotBlank;
12
+import javax.validation.constraints.Size;
13
+
14
+/**
15
+ * DiagnosisManage
16
+ *
17
+ * @author mtx
18
+ * @date: 2024/05/17 14:41
19
+ */
20
+@EqualsAndHashCode(callSuper = true)
21
+@Data
22
+@ApiModel("诊断管理表")
23
+@TableName("erm_diagnosis_manage")
24
+public class DiagnosisManage extends EitcBaseEntity {
25
+
26
+    @TableField(value = "diagnosis_code")
27
+    @ApiModelProperty(value = "诊断编码", name = "diagnosisCode")
28
+    @NotBlank(message = "诊断编码不能为空")
29
+    @Size(max = 50, message = "诊断编码长度不能超过50个字符")
30
+    private String diagnosisCode;
31
+
32
+    @TableField(value = "diagnosis_name")
33
+    @ApiModelProperty(value = "诊断名称", name = "diagnosisName")
34
+    @NotBlank(message = "诊断名称不能为空")
35
+    @Size(max = 50, message = "诊断名称长度不能超过50个字符")
36
+    private String diagnosisName;
37
+
38
+    @TableField(value = "diagnosis_name_pinyin_first_letter")
39
+    @ApiModelProperty(value = "诊断名称首拼", name = "diagnosisNamePinyinFirstLetter")
40
+    private String diagnosisNamePinyinFirstLetter;
41
+
42
+    @TableField(value = "diagnosis_name_pinyin")
43
+    @ApiModelProperty(value = "诊断名称拼音", name = "diagnosisNamePinyin")
44
+    private String diagnosisNamePinyin;
45
+
46
+}

+ 12 - 0
eitc-patient-base/src/main/java/com/eitc/patient/domain/DiagnosisType.java

@@ -27,10 +27,22 @@ public class DiagnosisType extends EitcBaseEntity {
27 27
     @ApiModelProperty(value = "父级id", name = "parentId")
28 28
     private String parentId;
29 29
 
30
+    @TableField(value = "ancestors")
31
+    @ApiModelProperty(value = "祖籍", name = "ancestors")
32
+    private String ancestors;
33
+
30 34
     @TableField(value = "diagnosis_name")
31 35
     @ApiModelProperty(value = "诊断名称", name = "diagnosisName")
32 36
     @NotBlank(message = "诊断名称不能为空")
33 37
     @Size(max = 50, message = "诊断名称长度不能超过50个字符")
34 38
     private String diagnosisName;
35 39
 
40
+    @TableField(value = "diagnosis_name_pinyin_first_letter")
41
+    @ApiModelProperty(value = "诊断名称首拼", name = "diagnosisNamePinyinFirstLetter")
42
+    private String diagnosisNamePinyinFirstLetter;
43
+
44
+    @TableField(value = "diagnosis_name_pinyin")
45
+    @ApiModelProperty(value = "诊断名称拼音", name = "diagnosisNamePinyin")
46
+    private String diagnosisNamePinyin;
47
+
36 48
 }

+ 79 - 20
eitc-patient-base/src/main/java/com/eitc/patient/domain/DiagnosisTypeTemplate.java

@@ -32,25 +32,84 @@ public class DiagnosisTypeTemplate extends EitcBaseEntity {
32 32
     @NotBlank(message = "模板名称不能为空")
33 33
     private String templateName;
34 34
 
35
-    @TableField(value = "template_example")
36
-    @ApiModelProperty(value = "模板示例", name = "templateExample")
37
-    @NotBlank(message = "模板示例不能为空")
38
-    private String templateExample;
39
-
40
-    @TableField(value = "template_info")
41
-    @ApiModelProperty(value = "模板信息", name = "templateInfo")
42
-    private String templateInfo;
43
-
44
-    @TableField(value = "template_option")
45
-    @ApiModelProperty(value = "模板选项", name = "templateOption")
46
-    private String templateOption;
47
-
48
-    @TableField(value = "review_status")
49
-    @ApiModelProperty(value = "审核状态(1待审核,2已审核)", name = "reviewStatus")
50
-    private Integer reviewStatus;
51
-
52
-    @TableField(value = "order_num")
53
-    @ApiModelProperty(value = "排序", name = "orderNum")
54
-    private Integer orderNum;
35
+    @TableField(value = "name_pinyin_first_letter")
36
+    @ApiModelProperty(value = "诊断名称首拼", name = "namePinyinFirstLetter")
37
+    private String namePinyinFirstLetter;
38
+
39
+    @TableField(value = "name_pinyin")
40
+    @ApiModelProperty(value = "诊断名称拼音", name = "namePinyin")
41
+    private String namePinyin;
42
+
43
+    @TableField(value = "template_desc")
44
+    @ApiModelProperty(value = "模板描述", name = "templateDesc")
45
+    private String templateDesc;
46
+
47
+    @TableField(value = "diagnosis_manage_id")
48
+    @ApiModelProperty(value = "诊断管理id", name = "diagnosisManageId")
49
+    private String diagnosisManageId;
50
+
51
+    @TableField(value = "diagnosis_manage_name")
52
+    @ApiModelProperty(value = "诊断管理名称", name = "diagnosisManageName")
53
+    private String diagnosisManageName;
54
+
55
+    @TableField(value = "apply_dept")
56
+    @ApiModelProperty(value = "适用科室", name = "applyDept")
57
+    private String applyDept;
58
+
59
+    @TableField(value = "visit_type")
60
+    @ApiModelProperty(value = "就诊类型(1初诊,2复诊)", name = "visitType")
61
+    private Integer visitType;
62
+
63
+    @TableField(value = "enable_status")
64
+    @ApiModelProperty(value = "启用状态(1启用,0未启用)", name = "enableStatus")
65
+    private Integer enableStatus;
66
+
67
+    @TableField(value = "chief_complaint_content")
68
+    @ApiModelProperty(value = "主诉内容", name = "chiefComplaintContent")
69
+    private String chiefComplaintContent;
70
+
71
+    @TableField(value = "chief_complaint_option")
72
+    @ApiModelProperty(value = "主诉选项", name = "chiefComplaintOption")
73
+    private String chiefComplaintOption;
74
+
75
+    @TableField(value = "present_illness_content")
76
+    @ApiModelProperty(value = "现病史内容", name = "presentIllnessContent")
77
+    private String presentIllnessContent;
78
+
79
+    @TableField(value = "present_illness_option")
80
+    @ApiModelProperty(value = "现病史选项", name = "presentIllnessOption")
81
+    private String presentIllnessOption;
82
+
83
+    @TableField(value = "inspect_content")
84
+    @ApiModelProperty(value = "检查内容", name = "inspectContent")
85
+    private String inspectContent;
86
+
87
+    @TableField(value = "inspect_option")
88
+    @ApiModelProperty(value = "检查选项", name = "inspectOption")
89
+    private String inspectOption;
90
+
91
+    @TableField(value = "treatment_planning_content")
92
+    @ApiModelProperty(value = "治疗计划内容", name = "treatmentPlanningContent")
93
+    private String treatmentPlanningContent;
94
+
95
+    @TableField(value = "treatment_planning_option")
96
+    @ApiModelProperty(value = "治疗计划选项", name = "treatmentPlanningOption")
97
+    private String treatmentPlanningOption;
98
+
99
+    @TableField(value = "dispose_content")
100
+    @ApiModelProperty(value = "处置内容", name = "disposeContent")
101
+    private String disposeContent;
102
+
103
+    @TableField(value = "dispose_option")
104
+    @ApiModelProperty(value = "处置选项", name = "disposeOption")
105
+    private String disposeOption;
106
+
107
+    @TableField(value = "note_content")
108
+    @ApiModelProperty(value = "便签", name = "note_content")
109
+    private String noteContent;
110
+
111
+    @TableField(value = "note_option")
112
+    @ApiModelProperty(value = "便签", name = "noteOption")
113
+    private String noteOption;
55 114
 
56 115
 }

+ 35 - 0
eitc-patient-base/src/main/java/com/eitc/patient/domain/ImageRecord.java

@@ -0,0 +1,35 @@
1
+package com.eitc.patient.domain;
2
+
3
+import com.baomidou.mybatisplus.annotation.TableField;
4
+import com.baomidou.mybatisplus.annotation.TableName;
5
+import com.eitc.common.core.domain.EitcBaseEntity;
6
+import io.swagger.annotations.ApiModel;
7
+import io.swagger.annotations.ApiModelProperty;
8
+import lombok.Data;
9
+import lombok.EqualsAndHashCode;
10
+
11
+/**
12
+ * ImageRecord
13
+ *
14
+ * @author mtx
15
+ * @date: 2024-09-12 13:59:30
16
+ */
17
+@EqualsAndHashCode(callSuper = true)
18
+@Data
19
+@ApiModel("影像记录")
20
+@TableName("erm_image_record")
21
+public class ImageRecord extends EitcBaseEntity {
22
+
23
+    @TableField(value = "identification_card")
24
+    @ApiModelProperty(value = "身份证号", name = "identificationCard")
25
+    private String identificationCard;
26
+
27
+    @TableField(value = "image_url")
28
+    @ApiModelProperty(value = "影像路径", name = "imageUrl")
29
+    private String imageUrl;
30
+
31
+    @TableField(value = "full_image_url")
32
+    @ApiModelProperty(value = "影像全路径", name = "fullImageUrl")
33
+    private String fullImageUrl;
34
+
35
+}

+ 32 - 0
eitc-patient-base/src/main/java/com/eitc/patient/domain/MedicalRecord.java

@@ -54,4 +54,36 @@ public class MedicalRecord extends EitcBaseEntity {
54 54
     @ApiModelProperty(value = "费用", name = "cost")
55 55
     private BigDecimal cost;
56 56
 
57
+    @TableField(value = "chief_complaint_content")
58
+    @ApiModelProperty(value = "主诉内容", name = "chiefComplaintContent")
59
+    private String chiefComplaintContent;
60
+
61
+    @TableField(value = "present_illness_content")
62
+    @ApiModelProperty(value = "现病史内容", name = "presentIllnessContent")
63
+    private String presentIllnessContent;
64
+
65
+    @TableField(value = "inspect_content")
66
+    @ApiModelProperty(value = "检查内容", name = "inspectContent")
67
+    private String inspectContent;
68
+
69
+    @TableField(value = "treatment_planning_content")
70
+    @ApiModelProperty(value = "治疗计划内容", name = "treatmentPlanningContent")
71
+    private String treatmentPlanningContent;
72
+
73
+    @TableField(value = "dispose_content")
74
+    @ApiModelProperty(value = "处置内容", name = "disposeContent")
75
+    private String disposeContent;
76
+
77
+    @TableField(value = "note_content")
78
+    @ApiModelProperty(value = "便签", name = "noteContent")
79
+    private String noteContent;
80
+
81
+    @TableField(value = "diagnosis_content")
82
+    @ApiModelProperty(value = "诊断", name = "diagnosisContent")
83
+    private String diagnosisContent;
84
+
85
+    @TableField(value = "save_status")
86
+    @ApiModelProperty(value = "保存状态(1保存,2提交))", name = "saveStatus")
87
+    private Integer saveStatus;
88
+
57 89
 }

+ 6 - 38
eitc-patient-base/src/main/java/com/eitc/patient/domain/MedicalRecordDetails.java

@@ -24,18 +24,6 @@ public class MedicalRecordDetails extends EitcBaseEntity {
24 24
     @ApiModelProperty(value = "病历id", name = "medicalRecordId")
25 25
     private String medicalRecordId;
26 26
 
27
-    @TableField(value = "diagnosis_type_template_id")
28
-    @ApiModelProperty(value = "诊断分类模板id", name = "diagnosisTypeTemplateId")
29
-    private String diagnosisTypeTemplateId;
30
-
31
-    @TableField(value = "diagnosis_type_id")
32
-    @ApiModelProperty(value = "诊断分类id", name = "diagnosisTypeId")
33
-    private String diagnosisTypeId;
34
-
35
-    @TableField(value = "diagnosis_type_name")
36
-    @ApiModelProperty(value = "诊断分类名称", name = "diagnosisTypeName")
37
-    private String diagnosisTypeName;
38
-
39 27
     @TableField(value = "tooth_position")
40 28
     @ApiModelProperty(value = "牙位", name = "toothPosition")
41 29
     private String toothPosition;
@@ -44,32 +32,12 @@ public class MedicalRecordDetails extends EitcBaseEntity {
44 32
     @ApiModelProperty(value = "牙位状态(1未完成,2已完成治疗)", name = "toothStatus")
45 33
     private Integer toothStatus;
46 34
 
47
-    @TableField(value = "template_name")
48
-    @ApiModelProperty(value = "模板名称", name = "templateName")
49
-    private String templateName;
50
-
51
-    @TableField(value = "template_example")
52
-    @ApiModelProperty(value = "模板示例", name = "templateExample")
53
-    private String templateExample;
35
+    @TableField(value = "diagnosis_manage_id")
36
+    @ApiModelProperty(value = "诊断管理id", name = "diagnosisManageId")
37
+    private String diagnosisManageId;
54 38
 
55
-    @TableField(value = "template_info")
56
-    @ApiModelProperty(value = "模板信息", name = "templateInfo")
57
-    private String templateInfo;
58
-
59
-    @TableField(value = "content_info")
60
-    @ApiModelProperty(value = "内容信息", name = "contentInfo")
61
-    private String contentInfo;
62
-
63
-    @TableField(value = "template_option")
64
-    @ApiModelProperty(value = "模板选项", name = "templateOption")
65
-    private String templateOption;
66
-
67
-    @TableField(value = "template_view")
68
-    @ApiModelProperty(value = "模板选项", name = "template_view")
69
-    private String templateView;
70
-
71
-    @TableField(value = "order_num")
72
-    @ApiModelProperty(value = "排序", name = "orderNum")
73
-    private Integer orderNum;
39
+    @TableField(value = "diagnosis_type_template_id")
40
+    @ApiModelProperty(value = "病例模板id", name = "diagnosisTypeTemplateId")
41
+    private String diagnosisTypeTemplateId;
74 42
 
75 43
 }

+ 65 - 12
eitc-patient-base/src/main/java/com/eitc/patient/dto/DiagnosisTypeTemplateDto.java

@@ -1,10 +1,9 @@
1 1
 package com.eitc.patient.dto;
2 2
 
3
-import com.eitc.patient.domain.DiagnosisTypeTemplate;
3
+import com.alibaba.fastjson2.JSONObject;
4 4
 import io.swagger.annotations.ApiModel;
5 5
 import io.swagger.annotations.ApiModelProperty;
6 6
 import lombok.Data;
7
-import lombok.EqualsAndHashCode;
8 7
 
9 8
 import java.util.List;
10 9
 
@@ -14,22 +13,76 @@ import java.util.List;
14 13
  * @author mtx
15 14
  * @date: 2024/05/30 11:06
16 15
  */
17
-@EqualsAndHashCode(callSuper = true)
18 16
 @Data
19 17
 @ApiModel("诊断分类模板表")
20
-public class DiagnosisTypeTemplateDto extends DiagnosisTypeTemplate {
18
+public class DiagnosisTypeTemplateDto {
21 19
 
22
-    @ApiModelProperty(value = "患者病史", name = "patientMedicalRecord")
23
-    private String patientMedicalRecord;
20
+    @ApiModelProperty(value = "患者id", name = "patientId")
21
+    private String patientId;
24 22
 
25
-    @ApiModelProperty(value = "医生录入病史", name = "doctorMedicalRecord")
26
-    private String doctorMedicalRecord;
23
+    @ApiModelProperty(value = "患者过敏史", name = "patientAllergyHistory")
24
+    private List<String> patientAllergyHistory;
27 25
 
28
-    @ApiModelProperty(value = "模板示例", name = "templateExample2")
29
-    private String templateExample2;
26
+    @ApiModelProperty(value = "医生过敏史", name = "doctorAllergyHistory")
27
+    private List<String> doctorAllergyHistory;
30 28
 
31
-    private List<String> formattedPartsList;
29
+    @ApiModelProperty(value = "患者既往史", name = "patientPastHistory")
30
+    private List<String> patientPastHistory;
32 31
 
33
-    private boolean flag = false;
32
+    @ApiModelProperty(value = "医生既往史", name = "doctorPastHistory")
33
+    private List<String> doctorPastHistory;
34
+
35
+    @ApiModelProperty(value = "患者家族史", name = "patientFamilyHistory")
36
+    private List<String> patientFamilyHistory;
37
+
38
+    @ApiModelProperty(value = "医生家族史", name = "doctorFamilyHistory")
39
+    private List<String> doctorFamilyHistory;
40
+
41
+    @ApiModelProperty(value = "诊断-主诊断", name = "mainDiagnosis")
42
+    private String mainDiagnosis;
43
+
44
+    @ApiModelProperty(value = "诊断-主诊断id", name = "mainDiagnosisId")
45
+    private String mainDiagnosisId;
46
+
47
+    @ApiModelProperty(value = "诊断-其他诊断诊断", name = "otherDiagnosis")
48
+    private List<String> otherDiagnosis;
49
+
50
+    @ApiModelProperty(value = "主诉内容", name = "chiefComplaintContent")
51
+    private String chiefComplaintContent;
52
+
53
+    @ApiModelProperty(value = "主诉选项", name = "chiefComplaintOption")
54
+    private JSONObject chiefComplaintOption;
55
+
56
+    @ApiModelProperty(value = "现病史内容", name = "presentIllnessContent")
57
+    private String presentIllnessContent;
58
+
59
+    @ApiModelProperty(value = "现病史选项", name = "presentIllnessOption")
60
+    private JSONObject presentIllnessOption;
61
+
62
+    @ApiModelProperty(value = "检查内容", name = "inspectContent")
63
+    private String inspectContent;
64
+
65
+    @ApiModelProperty(value = "检查选项", name = "inspectOption")
66
+    private JSONObject inspectOption;
67
+
68
+    @ApiModelProperty(value = "治疗计划内容", name = "treatmentPlanningContent")
69
+    private String treatmentPlanningContent;
70
+
71
+    @ApiModelProperty(value = "治疗计划选项", name = "treatmentPlanningOption")
72
+    private JSONObject treatmentPlanningOption;
73
+
74
+    @ApiModelProperty(value = "处置内容", name = "disposeContent")
75
+    private String disposeContent;
76
+
77
+    @ApiModelProperty(value = "处置选项", name = "disposeOption")
78
+    private JSONObject disposeOption;
79
+
80
+    @ApiModelProperty(value = "便签", name = "noteContent")
81
+    private String noteContent;
82
+
83
+    @ApiModelProperty(value = "便签", name = "noteOption")
84
+    private JSONObject noteOption;
85
+
86
+    private String id;
34 87
 
35 88
 }

+ 30 - 0
eitc-patient-base/src/main/java/com/eitc/patient/excel/DiagnosisManageTemplateExcel.java

@@ -0,0 +1,30 @@
1
+package com.eitc.patient.excel;
2
+
3
+import com.eitc.common.annotation.Excel;
4
+import io.swagger.annotations.ApiModel;
5
+import io.swagger.annotations.ApiModelProperty;
6
+import lombok.Data;
7
+
8
+/**
9
+ * DiagnosisManageTemplateExcel
10
+ *
11
+ * @author mtx
12
+ * @date: 2024/05/20 15:34
13
+ */
14
+@Data
15
+@ApiModel("诊断管理模板导入")
16
+public class DiagnosisManageTemplateExcel {
17
+
18
+    @Excel(name = "诊断编码", type = Excel.Type.ALL)
19
+    @ApiModelProperty(value = "诊断编码", name = "diagnosisCode")
20
+    private String diagnosisCode;
21
+
22
+    @Excel(name = "诊断名称", type = Excel.Type.ALL)
23
+    @ApiModelProperty(value = "诊断名称", name = "diagnosisName")
24
+    private String diagnosisName;
25
+
26
+    @Excel(name = "返回信息", type = Excel.Type.EXPORT)
27
+    @ApiModelProperty(value = "返回信息", name = "msg")
28
+    private String msg;
29
+
30
+}

+ 64 - 4
eitc-patient-base/src/main/java/com/eitc/patient/excel/DiagnosisTypeTemplateExcel.java

@@ -15,13 +15,73 @@ import lombok.Data;
15 15
 @ApiModel("诊断分类模板导入")
16 16
 public class DiagnosisTypeTemplateExcel {
17 17
 
18
-    @Excel(name = "项目", type = Excel.Type.ALL)
18
+    @Excel(name = "一级分类", type = Excel.Type.ALL)
19
+    @ApiModelProperty(value = "一级分类", name = "classifyOne")
20
+    private String classifyOne;
21
+
22
+    @Excel(name = "二级分类", type = Excel.Type.ALL)
23
+    @ApiModelProperty(value = "二级分类", name = "classifyTwo")
24
+    private String classifyTwo;
25
+
26
+    @Excel(name = "三级分类", type = Excel.Type.ALL)
27
+    @ApiModelProperty(value = "三级分类", name = "classifyThree")
28
+    private String classifyThree;
29
+
30
+    @Excel(name = "四级分类", type = Excel.Type.ALL)
31
+    @ApiModelProperty(value = "四级分类", name = "classifyFour")
32
+    private String classifyFour;
33
+
34
+    @Excel(name = "五级分类", type = Excel.Type.ALL)
35
+    @ApiModelProperty(value = "五级分类", name = "classifyFive")
36
+    private String classifyFive;
37
+
38
+    @Excel(name = "六级分类", type = Excel.Type.ALL)
39
+    @ApiModelProperty(value = "六级分类", name = "classifySix")
40
+    private String classifySix;
41
+
42
+    @Excel(name = "模板名称", type = Excel.Type.ALL)
19 43
     @ApiModelProperty(value = "模板名称", name = "templateName")
20 44
     private String templateName;
21 45
 
22
-    @Excel(name = "模版示例(该文档内容为示例,请根据实际诊断病历填写内容)", type = Excel.Type.ALL)
23
-    @ApiModelProperty(value = "模版示例", name = "templateExample")
24
-    private String templateExample;
46
+    @Excel(name = "诊断名称", type = Excel.Type.ALL)
47
+    @ApiModelProperty(value = "诊断管理名称", name = "diagnosisManageName")
48
+    private String diagnosisManageName;
49
+
50
+    @Excel(name = "模板描述", type = Excel.Type.ALL)
51
+    @ApiModelProperty(value = "模板描述", name = "templateDesc")
52
+    private String templateDesc;
53
+
54
+    @Excel(name = "适用科室", type = Excel.Type.ALL)
55
+    @ApiModelProperty(value = "适用科室", name = "applyDept")
56
+    private String applyDept;
57
+
58
+    @Excel(name = "就诊类型", type = Excel.Type.ALL)
59
+    @ApiModelProperty(value = "就诊类型(1初诊,2复诊)", name = "visitType")
60
+    private String visitType;
61
+
62
+    @Excel(name = "主诉", type = Excel.Type.ALL)
63
+    @ApiModelProperty(value = "主诉内容", name = "chiefComplaintContent")
64
+    private String chiefComplaintContent;
65
+
66
+    @Excel(name = "现病史", type = Excel.Type.ALL)
67
+    @ApiModelProperty(value = "现病史内容", name = "presentIllnessContent")
68
+    private String presentIllnessContent;
69
+
70
+    @Excel(name = "检查", type = Excel.Type.ALL)
71
+    @ApiModelProperty(value = "检查内容", name = "inspectContent")
72
+    private String inspectContent;
73
+
74
+    @Excel(name = "治疗计划", type = Excel.Type.ALL)
75
+    @ApiModelProperty(value = "治疗计划内容", name = "treatmentPlanningContent")
76
+    private String treatmentPlanningContent;
77
+
78
+    @Excel(name = "处置", type = Excel.Type.ALL)
79
+    @ApiModelProperty(value = "处置内容", name = "disposeContent")
80
+    private String disposeContent;
81
+
82
+    @Excel(name = "便签", type = Excel.Type.ALL)
83
+    @ApiModelProperty(value = "便签", name = "noteContent")
84
+    private String noteContent;
25 85
 
26 86
     @Excel(name = "返回信息", type = Excel.Type.EXPORT)
27 87
     @ApiModelProperty(value = "返回信息", name = "msg")

+ 16 - 0
eitc-patient-base/src/main/java/com/eitc/patient/mapper/DiagnosisManageMapper.java

@@ -0,0 +1,16 @@
1
+package com.eitc.patient.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.eitc.patient.domain.DiagnosisManage;
5
+import com.eitc.patient.domain.DiagnosisType;
6
+import org.apache.ibatis.annotations.Mapper;
7
+
8
+/**
9
+ * DiagnosisManageMapper
10
+ *
11
+ * @author mtx
12
+ * @date: 2024/05/17 15:31
13
+ */
14
+@Mapper
15
+public interface DiagnosisManageMapper extends BaseMapper<DiagnosisManage> {
16
+}

+ 15 - 0
eitc-patient-base/src/main/java/com/eitc/patient/mapper/ImageRecordMapper.java

@@ -0,0 +1,15 @@
1
+package com.eitc.patient.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.eitc.patient.domain.ImageRecord;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * ImageRecordMapper
9
+ *
10
+ * @author mtx
11
+ * @date: 2024/06/11 17:39
12
+ */
13
+@Mapper
14
+public interface ImageRecordMapper extends BaseMapper<ImageRecord> {
15
+}

+ 0 - 16
eitc-patient-base/src/main/java/com/eitc/patient/mapper/MedicalRecordDetailsMapper.java

@@ -17,20 +17,4 @@ import java.util.Map;
17 17
  */
18 18
 @Mapper
19 19
 public interface MedicalRecordDetailsMapper extends BaseMapper<MedicalRecordDetails> {
20
-
21
-    /**
22
-     * 统计诊断分类
23
-     *
24
-     * @return 统计结果
25
-     * @author mtx
26
-     * @date: 2024/6/5 9:10
27
-     */
28
-    List<Map<String, String>> countByDiagnosisTypeName();
29
-
30
-    /**
31
-     * 根据牙齿位置检查访问类型
32
-     *
33
-     * @return 返回访问类型,具体类型根据业务逻辑确定
34
-     */
35
-    List<MedicalRecord> findListByToothPosition(MedicalRecordHistoryDto dto);
36 20
 }

+ 20 - 0
eitc-patient-base/src/main/java/com/eitc/patient/mapper/MedicalRecordMapper.java

@@ -2,10 +2,12 @@ package com.eitc.patient.mapper;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.eitc.patient.domain.MedicalRecord;
5
+import com.eitc.patient.dto.MedicalRecordHistoryDto;
5 6
 import com.eitc.patient.dto.MedicalRecordListDto;
6 7
 import org.apache.ibatis.annotations.Mapper;
7 8
 
8 9
 import java.util.List;
10
+import java.util.Map;
9 11
 
10 12
 /**
11 13
  * MedicalRecordMapper
@@ -25,4 +27,22 @@ public interface MedicalRecordMapper extends BaseMapper<MedicalRecord> {
25 27
      * @date: 2024/5/23 9:17
26 28
      */
27 29
     List<MedicalRecordListDto> medicalRecordList(String searchParam);
30
+
31
+
32
+    /**
33
+     * 统计诊断分类
34
+     *
35
+     * @return 统计结果
36
+     * @author mtx
37
+     * @date: 2024/6/5 9:10
38
+     */
39
+    List<Map<String, String>> countByDiagnosisTypeName();
40
+
41
+    /**
42
+     * 根据牙齿位置检查访问类型
43
+     *
44
+     * @return 返回访问类型,具体类型根据业务逻辑确定
45
+     */
46
+    List<MedicalRecord> findListByToothPosition(MedicalRecordHistoryDto dto);
47
+
28 48
 }

+ 3 - 5
eitc-patient-base/src/main/java/com/eitc/patient/dto/MedicalRecordDto.java

@@ -1,4 +1,4 @@
1
-package com.eitc.patient.dto;
1
+package com.eitc.patient.param;
2 2
 
3 3
 import com.eitc.patient.domain.MedicalRecord;
4 4
 import io.swagger.annotations.ApiModel;
@@ -6,10 +6,8 @@ import io.swagger.annotations.ApiModelProperty;
6 6
 import lombok.Data;
7 7
 import lombok.EqualsAndHashCode;
8 8
 
9
-import java.util.List;
10
-
11 9
 /**
12
- * MedicalRecordVO
10
+ * MedicalRecordListParam
13 11
  *
14 12
  * @author mtx
15 13
  * @date: 2024/05/17 14:42
@@ -17,7 +15,7 @@ import java.util.List;
17 15
 @EqualsAndHashCode(callSuper = true)
18 16
 @Data
19 17
 @ApiModel("病例表")
20
-public class MedicalRecordDto extends MedicalRecord {
18
+public class MedicalRecordListParam extends MedicalRecord {
21 19
 
22 20
     @ApiModelProperty(value = "查询范围", name = "queryScope")
23 21
     private Long queryScope;

+ 25 - 0
eitc-patient-base/src/main/java/com/eitc/patient/param/MedicalRecordParam.java

@@ -0,0 +1,25 @@
1
+package com.eitc.patient.param;
2
+
3
+import io.swagger.annotations.ApiModelProperty;
4
+import lombok.Data;
5
+
6
+import java.util.List;
7
+
8
+/**
9
+ * MedicalRecordParam
10
+ *
11
+ * @author mtx
12
+ * @date: 2024/08/21 13:49
13
+ */
14
+@Data
15
+public class MedicalRecordParam {
16
+
17
+    @ApiModelProperty(value = "患者id", name = "patientId")
18
+    private String patientId;
19
+
20
+    @ApiModelProperty(value = "主诊断", name = "diagnosisTypeTemplateId")
21
+    private String diagnosisTypeTemplateId;
22
+
23
+    @ApiModelProperty(value = "其他诊断", name = "otherDiagnosisTypeTemplateIdList")
24
+    private List<String> otherDiagnosisTypeTemplateIdList;
25
+}

+ 76 - 0
eitc-patient-base/src/main/java/com/eitc/patient/param/MedicalRecordSaveParam.java

@@ -0,0 +1,76 @@
1
+package com.eitc.patient.param;
2
+
3
+import com.eitc.patient.vo.MedicalRecordToothVO;
4
+import io.swagger.annotations.ApiModel;
5
+import io.swagger.annotations.ApiModelProperty;
6
+import lombok.Data;
7
+
8
+import java.util.List;
9
+
10
+/**
11
+ * MedicalRecordSaveParam
12
+ *
13
+ * @author mtx
14
+ * @date: 2024/08/22 16:34
15
+ */
16
+@Data
17
+@ApiModel("病例保存表")
18
+public class MedicalRecordSaveParam {
19
+
20
+    private String id;
21
+
22
+    @ApiModelProperty(value = "医生过敏史", name = "doctorAllergyHistory")
23
+    private List<String> doctorAllergyHistory;
24
+
25
+    @ApiModelProperty(value = "医生既往史", name = "doctorPastHistory")
26
+    private List<String> doctorPastHistory;
27
+
28
+    @ApiModelProperty(value = "医生家族史", name = "doctorFamilyHistory")
29
+    private List<String> doctorFamilyHistory;
30
+
31
+    @ApiModelProperty(value = "患者id", name = "patientId")
32
+    private String patientId;
33
+
34
+    @ApiModelProperty(value = "预约id", name = "appointmentId")
35
+    private String appointmentId;
36
+
37
+    @ApiModelProperty(value = "就诊类型(1初诊,2复诊)", name = "visitType")
38
+    private Integer visitType;
39
+
40
+    @ApiModelProperty(value = "主治医生", name = "attendingDoctorId")
41
+    private Long attendingDoctorId;
42
+
43
+    @ApiModelProperty(value = "预约门诊", name = "outpatientService")
44
+    private String outpatientService;
45
+
46
+    @ApiModelProperty(value = "预约科室", name = "department")
47
+    private String department;
48
+
49
+    @ApiModelProperty(value = "主诉内容", name = "chiefComplaintContent")
50
+    private String chiefComplaintContent;
51
+
52
+    @ApiModelProperty(value = "现病史内容", name = "presentIllnessContent")
53
+    private String presentIllnessContent;
54
+
55
+    @ApiModelProperty(value = "检查内容", name = "inspectContent")
56
+    private String inspectContent;
57
+
58
+    @ApiModelProperty(value = "治疗计划内容", name = "treatmentPlanningContent")
59
+    private String treatmentPlanningContent;
60
+
61
+    @ApiModelProperty(value = "处置内容", name = "disposeContent")
62
+    private String disposeContent;
63
+
64
+    @ApiModelProperty(value = "便签", name = "noteContent")
65
+    private String noteContent;
66
+
67
+    @ApiModelProperty(value = "诊断", name = "diagnosisContent")
68
+    private String diagnosisContent;
69
+
70
+    @ApiModelProperty(value = "保存状态(1保存,2提交)", name = "saveStatus")
71
+    private Integer saveStatus;
72
+
73
+
74
+    List<MedicalRecordToothVO> toothList;
75
+
76
+}

+ 26 - 0
eitc-patient-base/src/main/java/com/eitc/patient/service/IDiagnosisManageService.java

@@ -0,0 +1,26 @@
1
+package com.eitc.patient.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.eitc.patient.domain.DiagnosisManage;
5
+import com.eitc.patient.excel.DiagnosisManageTemplateExcel;
6
+import org.springframework.stereotype.Service;
7
+
8
+import java.util.List;
9
+
10
+/**
11
+ * IDiagnosisManageService
12
+ *
13
+ * @author mtx
14
+ * @date: 2024/05/17 15:36
15
+ */
16
+@Service
17
+public interface IDiagnosisManageService extends IService<DiagnosisManage> {
18
+
19
+    /**
20
+     * 导入模板数据
21
+     *
22
+     * @param list 待导入的诊断管理模板Excel列表
23
+     * @return 导入失败的诊断管理模板Excel列表,包含错误信息
24
+     */
25
+    List<DiagnosisManageTemplateExcel> importTemplate(List<DiagnosisManageTemplateExcel> list);
26
+}

+ 17 - 2
eitc-patient-base/src/main/java/com/eitc/patient/service/IDiagnosisTypeService.java

@@ -47,7 +47,22 @@ public interface IDiagnosisTypeService extends IService<DiagnosisType> {
47 47
     /**
48 48
      * 获取树形结构
49 49
      *
50
-     * @return 树形结构
50
+     * @param searchParam 搜索信息
51
+     * @param visitType   状态
52
+     * @return 返回结果
53
+     * @author mtx
54
+     * @date: 2024/8/21 9:36
55
+     */
56
+    List<DiagnosisTypeTree> findTreeList(String searchParam, String visitType);
57
+
58
+    /**
59
+     * 检查是否可以添加诊断类型
60
+     * 此方法主要进行两个重要检查:
61
+     * 1. 确保传入的诊断类型ID不为空,因为这是添加新诊断类型的必要条件
62
+     * 2. 检查传入的诊断类型ID是否已经有子类型存在,如果存在子类型,则不允许添加新的诊断类型
63
+     *
64
+     * @param diagnosisTypeId 诊断类型ID,用于检查和添加新的诊断类型
65
+     * @throws IllegalArgumentException 如果诊断类型ID为空或存在子类型,则抛出此异常
51 66
      */
52
-    List<DiagnosisTypeTree> findTreeList();
67
+    void checkAddDiagnosisType(String diagnosisTypeId);
53 68
 }

+ 15 - 19
eitc-patient-base/src/main/java/com/eitc/patient/service/IDiagnosisTypeTemplateService.java

@@ -5,9 +5,7 @@ import com.eitc.patient.domain.DiagnosisTypeTemplate;
5 5
 import com.eitc.patient.excel.DiagnosisTypeTemplateExcel;
6 6
 import com.eitc.patient.vo.DiagnosisTypeTemplateSaveVO;
7 7
 import org.springframework.stereotype.Service;
8
-import org.springframework.web.multipart.MultipartFile;
9 8
 
10
-import java.io.IOException;
11 9
 import java.util.List;
12 10
 
13 11
 /**
@@ -19,43 +17,41 @@ import java.util.List;
19 17
 @Service
20 18
 public interface IDiagnosisTypeTemplateService extends IService<DiagnosisTypeTemplate> {
21 19
 
22
-    /**
23
-     * 获取模板选项的json串
24
-     *
25
-     * @param templateExample 要获取json串的示例
26
-     * @return json串
27
-     * @author mtx
28
-     * @date: 2024/5/20 14:50
29
-     */
30
-    String findTemplateOptionJson(String templateExample);
31 20
 
32 21
     /**
33
-     * 获取模板数据的json串
22
+     * 根据提供的模板示例字符串,查找并生成模板选项的JSON表示
34 23
      *
35
-     * @param templateExample 要获取json串的示例
24
+     * @param jsonContent 要获取json串的示例
36 25
      * @return json串
37 26
      * @author mtx
38 27
      * @date: 2024/5/20 14:50
39 28
      */
40
-    String findTemplateInfo(String templateExample);
29
+    String findTemplateInfo(String jsonContent);
41 30
 
42 31
     /**
43 32
      * 导入诊断分类模板
44 33
      *
45
-     * @param file            文件
34
+     * @param list            数据
46 35
      * @param diagnosisTypeId 诊断分类id
47 36
      * @return 错误信息
48 37
      * @author mtx
49 38
      * @date: 2024/5/20 15:27
50 39
      */
51
-    List<DiagnosisTypeTemplateExcel> importTemplate(MultipartFile file, String diagnosisTypeId) throws IOException;
40
+    List<DiagnosisTypeTemplateExcel> importTemplate(List<DiagnosisTypeTemplateExcel> list, String diagnosisTypeId);
41
+
42
+    /**
43
+     * 新增诊断模板
44
+     * @param entry 参数
45
+     * @author mtx
46
+     * @date: 2024/6/7 14:06
47
+     */
48
+    void add(DiagnosisTypeTemplateSaveVO entry);
52 49
 
53 50
     /**
54
-     * 新增或修改诊断模板
51
+     * 修改诊断模板
55 52
      * @param entry 参数
56
-     * @return 返回值
57 53
      * @author mtx
58 54
      * @date: 2024/6/7 14:06
59 55
      */
60
-    boolean add(DiagnosisTypeTemplateSaveVO entry);
56
+    void edit(DiagnosisTypeTemplateSaveVO entry);
61 57
 }

+ 16 - 0
eitc-patient-base/src/main/java/com/eitc/patient/service/IImageRecordService.java

@@ -0,0 +1,16 @@
1
+package com.eitc.patient.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.eitc.patient.domain.ImageRecord;
5
+import org.springframework.stereotype.Service;
6
+
7
+/**
8
+ * IImageRecordService
9
+ *
10
+ * @author mtx
11
+ * @date: 2024/06/11 17:37
12
+ */
13
+@Service
14
+public interface IImageRecordService extends IService<ImageRecord> {
15
+
16
+}

+ 10 - 10
eitc-patient-base/src/main/java/com/eitc/patient/service/IMedicalHistoryService.java

@@ -2,7 +2,7 @@ package com.eitc.patient.service;
2 2
 
3 3
 import com.baomidou.mybatisplus.extension.service.IService;
4 4
 import com.eitc.patient.domain.MedicalHistory;
5
-import com.eitc.patient.dto.DiagnosisTypeTemplateDto;
5
+import com.eitc.patient.param.MedicalRecordSaveParam;
6 6
 import org.springframework.stereotype.Service;
7 7
 
8 8
 import java.util.List;
@@ -56,21 +56,21 @@ public interface IMedicalHistoryService extends IService<MedicalHistory> {
56 56
     /**
57 57
      * 查询患者的病史保存到历史记录中
58 58
      *
59
-     * @param patientId       患者id
60
-     * @param medicalRecordId 病id
59
+     * @param param           参数
60
+     * @param medicalRecordId 病id
61 61
      * @author mtx
62 62
      * @date: 2024/5/22 13:57
63 63
      */
64
-    void saveMedicalHistoryToMedicalRecordIdByPatientId(String patientId, String medicalRecordId);
64
+    void saveMedicalHistoryByHistoryType(MedicalRecordSaveParam param, String medicalRecordId);
65 65
 
66 66
     /**
67
-     * 查询患者的病史
67
+     * 根据患者ID、疾病类型和诊断类型模板详情,查询患者的病史信息。
68
+     * 此方法主要用于检索与特定疾病类型和患者相关的病史记录,并根据病史来源筛选出患者自述的病史内容。
68 69
      *
69
-     * @param patientId   患者id
70
-     * @param diseaseType 类型
71
-     * @param detailsVO   模板信息
70
+     * @param patientId   患者的唯一标识ID,用于查询特定患者的病史记录。
71
+     * @param diseaseType 疾病类型的标识,用于筛选特定类型的病史记录。
72 72
      * @author mtx
73
-     * @date: 2024/06/07 14:01
73
+     * @date 2024/06/07 14:01
74 74
      */
75
-    void findMedicalHistory(String patientId, Integer diseaseType, DiagnosisTypeTemplateDto detailsVO);
75
+    List<String> findMedicalHistory(String patientId, Integer diseaseType);
76 76
 }

+ 0 - 29
eitc-patient-base/src/main/java/com/eitc/patient/service/IMedicalRecordDetailsService.java

@@ -1,15 +1,9 @@
1 1
 package com.eitc.patient.service;
2 2
 
3 3
 import com.baomidou.mybatisplus.extension.service.IService;
4
-import com.eitc.patient.domain.MedicalRecord;
5 4
 import com.eitc.patient.domain.MedicalRecordDetails;
6
-import com.eitc.patient.dto.MedicalRecordHistoryDto;
7
-import com.eitc.patient.vo.MedicalRecordDetailsVO;
8 5
 import org.springframework.stereotype.Service;
9 6
 
10
-import java.util.List;
11
-import java.util.Map;
12
-
13 7
 /**
14 8
  * MedicalRecordDetailsService
15 9
  *
@@ -19,27 +13,4 @@ import java.util.Map;
19 13
 @Service
20 14
 public interface IMedicalRecordDetailsService extends IService<MedicalRecordDetails> {
21 15
 
22
-    /**
23
-     * 通过病历id获取病历详情vo
24
-     * @param medicalRecordId 病历id
25
-     * @return 病历详情vo
26
-     * @author mtx
27
-     * @date: 2024/6/5 9:10
28
-     */
29
-    List<MedicalRecordDetailsVO> findMedicalRecordDetailsVOByMedicalRecordId(String medicalRecordId);
30
-
31
-    /**
32
-     * 统计诊断分类
33
-     * @return 统计结果
34
-     * @author mtx
35
-     * @date: 2024/6/5 9:10
36
-     */
37
-    List<Map<String, String>> countByDiagnosisTypeName();
38
-
39
-    /**
40
-     * 根据牙齿位置检查访问类型
41
-     *
42
-     * @return 返回访问类型,具体类型根据业务逻辑确定
43
-     */
44
-    List<MedicalRecord> findListByToothPosition(MedicalRecordHistoryDto dto);
45 16
 }

+ 22 - 11
eitc-patient-base/src/main/java/com/eitc/patient/service/IMedicalRecordService.java

@@ -2,11 +2,13 @@ package com.eitc.patient.service;
2 2
 
3 3
 import com.baomidou.mybatisplus.extension.service.IService;
4 4
 import com.eitc.patient.domain.MedicalRecord;
5
+import com.eitc.patient.dto.MedicalRecordHistoryDto;
5 6
 import com.eitc.patient.dto.MedicalRecordListDto;
6
-import com.eitc.patient.vo.MedicalRecordParamVO;
7
+import com.eitc.patient.param.MedicalRecordSaveParam;
7 8
 import org.springframework.stereotype.Service;
8 9
 
9 10
 import java.util.List;
11
+import java.util.Map;
10 12
 
11 13
 /**
12 14
  * MedicalRecordService
@@ -19,28 +21,37 @@ public interface IMedicalRecordService extends IService<MedicalRecord> {
19 21
 
20 22
     /**
21 23
      * 保存病历
24
+     *
22 25
      * @param vo 参数
23 26
      * @author mtx
24 27
      * @date: 2024/5/22 10:00
25 28
      */
26
-    void addOrEdit(MedicalRecordParamVO vo);
29
+    void addOrEdit(MedicalRecordSaveParam vo);
27 30
 
28 31
     /**
29
-     * 封装病历信息
32
+     * 病历列表
30 33
      *
31
-     * @param medicalRecord 病历信息
32
-     * @return 病历信息
34
+     * @param searchParam 病历信息
35
+     * @return 病历列表
33 36
      * @author mtx
34 37
      * @date: 2024/5/23 9:17
35 38
      */
36
-    MedicalRecordParamVO getMedicalRecordVO(MedicalRecord medicalRecord);
39
+    List<MedicalRecordListDto> medicalRecordList(String searchParam);
37 40
 
38 41
     /**
39
-     * 病历列表
40
-     * @param searchParam 病历信息
41
-     * @return 病历列表
42
+     * 统计诊断分类
43
+     *
44
+     * @return 统计结果
42 45
      * @author mtx
43
-     * @date: 2024/5/23 9:17
46
+     * @date: 2024/6/5 9:10
44 47
      */
45
-    List<MedicalRecordListDto> medicalRecordList(String searchParam);
48
+    List<Map<String, String>> countByDiagnosisTypeName();
49
+
50
+    /**
51
+     * 根据牙齿位置检查访问类型
52
+     *
53
+     * @return 返回访问类型,具体类型根据业务逻辑确定
54
+     */
55
+    List<MedicalRecord> findListByToothPosition(MedicalRecordHistoryDto dto);
56
+
46 57
 }

+ 29 - 44
eitc-patient-base/src/main/java/com/eitc/patient/service/impl/AppUserServiceImpl.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7 7
 import com.eitc.common.core.domain.AjaxResult;
8 8
 import com.eitc.common.core.domain.entity.SysUser;
9 9
 import com.eitc.common.core.redis.RedisCache;
10
+import com.eitc.common.utils.CryptoUtil;
10 11
 import com.eitc.common.utils.JWTUtil;
11 12
 import com.eitc.common.utils.PatientBaseUtil;
12 13
 import com.eitc.common.utils.SecurityUtils;
@@ -23,6 +24,7 @@ import com.eitc.patient.service.IPatientService;
23 24
 import com.eitc.patient.vo.AppUserPatientVO;
24 25
 import com.eitc.patient.vo.PatientVO;
25 26
 import com.eitc.system.service.ISysUserService;
27
+import com.eitc.system.utils.SendSmsUtil;
26 28
 import org.apache.commons.lang3.StringUtils;
27 29
 import org.springframework.beans.factory.annotation.Value;
28 30
 import org.springframework.stereotype.Service;
@@ -77,24 +79,24 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
77 79
         // 校验验证码发送是否超过限制
78 80
         String key = PatientConstant.ERM_APP_CAPTCHA_CODE + phoneNumber;
79 81
         String repeat = key + ":repeat";
80
-        int repeatNum = 1;
82
+        int repeatNum = 1, timeout = 30;
81 83
         if (redisCache.hasKey(repeat)) {
82 84
             repeatNum = redisCache.getCacheObject(repeat);
83 85
             int num = maxRetryCount;
84 86
             if (repeatNum >= num) {
85
-                return AjaxResult.error("验证码发送次数超过" + num + "次,请后再试");
87
+                return AjaxResult.error("验证码发送次数超过" + num + "次,请" + timeout + "分钟后再试");
86 88
             }
87 89
             repeatNum++;
88 90
         }
89
-        redisCache.setCacheObject(repeat, repeatNum, 30, TimeUnit.MINUTES);
91
+        redisCache.setCacheObject(repeat, repeatNum, timeout, TimeUnit.MINUTES);
90 92
 
91 93
         // 生成验证码
92 94
         int captchaCode = PatientBaseUtil.getCaptchaCode();
93
-        // 发送短信 todo
94
-//        SendSmsUtil.sendSmsToLogin(phoneNumber, String.valueOf(captchaCode));
95
+        // 发送短信
96
+        SendSmsUtil.sendSmsToLogin(phoneNumber, String.valueOf(captchaCode));
95 97
         // 缓存验证码
96 98
         redisCache.setCacheObject(key, captchaCode, 5, TimeUnit.MINUTES);
97
-        return AjaxResult.success(captchaCode);
99
+        return AjaxResult.success();
98 100
     }
99 101
 
100 102
     /**
@@ -139,34 +141,25 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
139 141
      */
140 142
     private Map<String, String> generateTokenToApp(Map<String, String> map, String loginType) {
141 143
         String phoneNumber = map.get("phoneNumber");
142
-        AppUser appUser;
144
+        AppUser user = getAppUserByPhoneNumber(phoneNumber);
145
+        if (Objects.isNull(user)) {
146
+            throw new RuntimeException(phoneNumber + "用户不存在");
147
+        }
143 148
         // 登录
144 149
         if (String.valueOf(AppUserLoginTypeEnum.ACCOUNT.getCode()).equals(loginType)) {
145 150
             // 账号密码登录
146
-            String password = map.get("password");
147
-            if (StringUtils.isBlank(password)) {
151
+            String encryptPassword = map.get("password");
152
+            if (StringUtils.isBlank(encryptPassword)) {
148 153
                 throw new RuntimeException("密码不能为空");
149 154
             }
150
-            AppUser user = getAppUserByPhoneNumber(phoneNumber);
151
-            if (Objects.isNull(user)) {
152
-                throw new RuntimeException(phoneNumber + "用户不存在或密码错误");
153
-            }
154
-            appUser = user;
155
-            boolean flag = SecurityUtils.matchesPassword(password, appUser.getPassword());
155
+            String decryptPassword = CryptoUtil.decrypt(encryptPassword);
156
+            boolean flag = SecurityUtils.matchesPassword(decryptPassword, user.getPassword());
156 157
             if (!flag) {
157 158
                 throw new RuntimeException("用户不存在或密码错误");
158 159
             }
159
-        } else if (String.valueOf(AppUserLoginTypeEnum.CAPTCHA.getCode()).equals(loginType)) {
160
-            AppUser user = getAppUserByPhoneNumber(phoneNumber);
161
-            if (Objects.isNull(user)) {
162
-                throw new RuntimeException(phoneNumber + "用户不存在");
163
-            }
164
-            appUser = user;
165
-        } else {
166
-            throw new RuntimeException("登录方式错误");
167 160
         }
168 161
         // 生成token
169
-        return getTokenByAppUserInfo(appUser);
162
+        return getTokenByAppUserInfo(user);
170 163
     }
171 164
 
172 165
     /**
@@ -180,34 +173,25 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
180 173
      */
181 174
     private Map<String, String> generateTokenToPC(Map<String, String> map, String loginType) {
182 175
         String phoneNumber = map.get("phoneNumber");
183
-        SysUser user;
176
+        SysUser sysUser = getPCUserByPhoneNumber(phoneNumber);
177
+        if (Objects.isNull(sysUser)) {
178
+            throw new RuntimeException(phoneNumber + "用户不存在");
179
+        }
184 180
         // 登录
185 181
         if (String.valueOf(AppUserLoginTypeEnum.ACCOUNT.getCode()).equals(loginType)) {
186 182
             // 账号密码登录
187
-            String password = map.get("password");
188
-            if (StringUtils.isBlank(password)) {
183
+            String encryptPassword = map.get("password");
184
+            if (StringUtils.isBlank(encryptPassword)) {
189 185
                 throw new RuntimeException("密码不能为空");
190 186
             }
191
-            SysUser sysUser = getPCUserByPhoneNumber(phoneNumber);
192
-            if (Objects.isNull(sysUser)) {
193
-                throw new RuntimeException("用户不存在或密码错误");
194
-            }
195
-            user = sysUser;
196
-            boolean flag = SecurityUtils.matchesPassword(password, sysUser.getPassword());
187
+            String decryptPassword = CryptoUtil.decrypt(encryptPassword);
188
+            boolean flag = SecurityUtils.matchesPassword(decryptPassword, sysUser.getPassword());
197 189
             if (!flag) {
198 190
                 throw new RuntimeException(phoneNumber + "用户不存在或密码错误");
199 191
             }
200
-        } else if (String.valueOf(AppUserLoginTypeEnum.CAPTCHA.getCode()).equals(loginType)) {
201
-            SysUser sysUser = getPCUserByPhoneNumber(phoneNumber);
202
-            if (Objects.isNull(sysUser)) {
203
-                throw new RuntimeException(phoneNumber + "用户不存在");
204
-            }
205
-            user = sysUser;
206
-        } else {
207
-            throw new RuntimeException("登录方式错误");
208 192
         }
209 193
         // 生成token
210
-        return getTokenByPCUserInfo(user);
194
+        return getTokenByPCUserInfo(sysUser);
211 195
     }
212 196
 
213 197
     /**
@@ -221,7 +205,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
221 205
         payload.put("id", appUser.getId());
222 206
         payload.put("phoneNumber", appUser.getPhoneNumber());
223 207
         payload.put("identificationCard", appUser.getIdentificationCard());
224
-
208
+        payload.put("avatar", appUser.getAvatar());
225 209
         String secretKey = PatientBaseUtil.getSecretKey(appUser.getId());
226 210
         //生成JWt的令牌
227 211
         String token = JWTUtil.getToken(payload, secretKey);
@@ -240,6 +224,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
240 224
         Map<String, String> payload = new HashMap<>();
241 225
         payload.put("id", userId);
242 226
         payload.put("phoneNumber", user.getPhonenumber());
227
+        payload.put("avatar", user.getAvatar());
243 228
         String secretKey = PatientBaseUtil.getSecretKey(userId);
244 229
         //生成JWt的令牌
245 230
         String token = JWTUtil.getToken(payload, secretKey);
@@ -269,7 +254,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
269 254
             repeatNum = redisCache.getCacheObject(repeat);
270 255
             // 如果当前重复次数超过最大允许次数,则抛出异常。
271 256
             if (repeatNum >= maxRetryCount) {
272
-                throw new RuntimeException("登录失败次数超过" + maxRetryCount + "次,请后再试");
257
+                throw new RuntimeException("登录失败次数超过" + maxRetryCount + "次,请" + lockTime + "分钟后再试");
273 258
             }
274 259
             // 本次登录尝试后,累计重复次数加1。
275 260
             repeatNum++;

+ 15 - 12
eitc-patient-base/src/main/java/com/eitc/patient/service/impl/CollectCostPatientsServiceImpl.java

@@ -23,7 +23,6 @@ import javax.annotation.Resource;
23 23
 import java.math.BigDecimal;
24 24
 import java.util.ArrayList;
25 25
 import java.util.List;
26
-import java.util.Map;
27 26
 import java.util.Objects;
28 27
 import java.util.stream.Collectors;
29 28
 
@@ -55,15 +54,21 @@ public class CollectCostPatientsServiceImpl extends ServiceImpl<CollectCostPatie
55 54
     @Override
56 55
     @Transactional(rollbackFor = {Exception.class})
57 56
     public BigDecimal saveCollectCostPatientsToMedicalRecord(List<MedicalRecordDetails> recordDetailsList, String patientId) {
58
-        // 给病例详情分组,每颗牙是一个集合
59
-        Map<String, List<MedicalRecordDetails>> collect =
60
-                recordDetailsList.stream().collect(Collectors.groupingBy(MedicalRecordDetails::getToothPosition));
57
+        String medicalRecordId = recordDetailsList.get(0).getMedicalRecordId();
58
+        // 删除之前的收费,一个病例一个收费
59
+        List<CollectCostPatients> list = this.list(Wrappers.<CollectCostPatients>lambdaQuery().eq(CollectCostPatients::getMedicalRecordId, medicalRecordId));
60
+        if (CollectionUtils.isNotEmpty(list)) {
61
+            List<String> collect = list.stream().map(CollectCostPatients::getId).collect(Collectors.toList());
62
+            // 删除已存在的与给定患者ID相关的费用采集详情
63
+            collectCostPatientsDetailsService.remove(Wrappers.<CollectCostPatientsDetails>lambdaQuery().in(CollectCostPatientsDetails::getCollectCostPatientsId, collect));
64
+            this.removeByIds(collect);
65
+        }
61 66
 
62 67
         // 先保存收费初始信息
63
-        CollectCostPatients collectCostPatients = saveCostInfo(recordDetailsList.get(0).getMedicalRecordId(), patientId);
68
+        CollectCostPatients collectCostPatients = saveCostInfo(medicalRecordId, patientId);
64 69
 
65 70
         // 保存患者收费详情
66
-        BigDecimal receivableCost = saveCollectCostPatientsDetails(collect, collectCostPatients.getId());
71
+        BigDecimal receivableCost = saveCollectCostPatientsDetails(recordDetailsList, collectCostPatients.getId());
67 72
 
68 73
         // 更新应收费用
69 74
         CollectCostPatients costPatients = new CollectCostPatients();
@@ -101,18 +106,16 @@ public class CollectCostPatientsServiceImpl extends ServiceImpl<CollectCostPatie
101 106
     /**
102 107
      * 保存患者收费详情
103 108
      *
104
-     * @param collect               病例详情分组
109
+     * @param recordDetailsList     病例详情分组
105 110
      * @param collectCostPatientsId 收费信息ID
106 111
      * @return BigDecimal
107 112
      */
108
-    private BigDecimal saveCollectCostPatientsDetails(Map<String, List<MedicalRecordDetails>> collect, String collectCostPatientsId) {
113
+    private BigDecimal saveCollectCostPatientsDetails(List<MedicalRecordDetails> recordDetailsList, String collectCostPatientsId) {
109 114
         BigDecimal receivableCost = new BigDecimal(0);
110 115
         List<CollectCostPatientsDetails> collectCostPatientsDetailsList = new ArrayList<>();
111
-        for (String toothPosition : collect.keySet()) {
112
-            MedicalRecordDetails medicalRecordDetails = collect.get(toothPosition).get(0);
113
-
116
+        for (MedicalRecordDetails medicalRecordDetails : recordDetailsList) {
114 117
             DiagnosisTypeCostProjectInfoVO entry = new DiagnosisTypeCostProjectInfoVO();
115
-            entry.setDiagnosisTypeId(medicalRecordDetails.getDiagnosisTypeId());
118
+            entry.setDiagnosisTypeId(medicalRecordDetails.getDiagnosisTypeTemplateId());
116 119
             List<DiagnosisTypeCostProjectInfoVO> list = diagnosisTypeCostProjectService.findList(entry);
117 120
             if (CollectionUtils.isEmpty(list)) {
118 121
                 continue;

+ 98 - 0
eitc-patient-base/src/main/java/com/eitc/patient/service/impl/DiagnosisManageServiceImpl.java

@@ -0,0 +1,98 @@
1
+package com.eitc.patient.service.impl;
2
+
3
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
4
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5
+import com.eitc.common.utils.PatientBaseUtil;
6
+import com.eitc.common.utils.bean.BeanUtils;
7
+import com.eitc.patient.domain.DiagnosisManage;
8
+import com.eitc.patient.excel.DiagnosisManageTemplateExcel;
9
+import com.eitc.patient.mapper.DiagnosisManageMapper;
10
+import com.eitc.patient.service.IDiagnosisManageService;
11
+import org.apache.commons.lang3.StringUtils;
12
+import org.springframework.stereotype.Service;
13
+import org.springframework.transaction.annotation.Transactional;
14
+
15
+import javax.annotation.Resource;
16
+import java.util.ArrayList;
17
+import java.util.List;
18
+import java.util.stream.Collectors;
19
+
20
+/**
21
+ * DiagnosisManageServiceImpl
22
+ *
23
+ * @author mtx
24
+ * @date: 2024/05/17 15:39
25
+ */
26
+@Service
27
+public class DiagnosisManageServiceImpl extends ServiceImpl<DiagnosisManageMapper, DiagnosisManage> implements IDiagnosisManageService {
28
+
29
+    @Resource
30
+    private IDiagnosisManageService diagnosisManageService;
31
+
32
+    /**
33
+     * 导入模板数据
34
+     *
35
+     * @param list 待导入的诊断管理模板Excel列表
36
+     * @return 导入失败的诊断管理模板Excel列表,包含错误信息
37
+     */
38
+    @Override
39
+    @Transactional(rollbackFor = {Exception.class})
40
+    public List<DiagnosisManageTemplateExcel> importTemplate(List<DiagnosisManageTemplateExcel> list) {
41
+        // 用于存储导入成功的诊断管理对象
42
+        List<DiagnosisManage> successList = new ArrayList<>();
43
+        // 用于存储导入失败的诊断管理模板Excel对象,保留错误信息
44
+        List<DiagnosisManageTemplateExcel> errorList = new ArrayList<>();
45
+
46
+        // 封装已存在的诊断管理
47
+        List<DiagnosisManage> manageList = diagnosisManageService.list();
48
+        List<String> diagnosisCodeList = new ArrayList<>();
49
+        List<String> diagnosisNameList = new ArrayList<>();
50
+        if (CollectionUtils.isNotEmpty(manageList)) {
51
+            diagnosisCodeList.addAll(manageList.stream().map(DiagnosisManage::getDiagnosisCode).collect(Collectors.toList()));
52
+            diagnosisNameList.addAll(manageList.stream().map(DiagnosisManage::getDiagnosisName).collect(Collectors.toList()));
53
+        }
54
+
55
+        // 校验数据是否正确
56
+        for (DiagnosisManageTemplateExcel excel : list) {
57
+            DiagnosisManage diagnosisManage = new DiagnosisManage();
58
+            // 检查诊断编码是否为空
59
+            if (StringUtils.isEmpty(excel.getDiagnosisCode())) {
60
+                excel.setMsg("诊断编码不能为空");
61
+                errorList.add(excel);
62
+                continue;
63
+            }
64
+            // 检查诊断编码是否存在
65
+            if (diagnosisCodeList.contains(excel.getDiagnosisCode())) {
66
+                excel.setMsg("诊断编码已存在");
67
+                errorList.add(excel);
68
+                continue;
69
+            }
70
+            // 检查诊断名称是否为空
71
+            if (StringUtils.isEmpty(excel.getDiagnosisName())) {
72
+                excel.setMsg("诊断名称不能为空");
73
+                errorList.add(excel);
74
+                continue;
75
+            }
76
+            // 检查诊断名称是否存在
77
+            if (diagnosisNameList.contains(excel.getDiagnosisName())) {
78
+                excel.setMsg("诊断名称已存在");
79
+                errorList.add(excel);
80
+                continue;
81
+            }
82
+            // 将Excel对象的属性复制到诊断管理对象
83
+            BeanUtils.copyProperties(excel, diagnosisManage);
84
+            // 首拼
85
+            diagnosisManage.setDiagnosisNamePinyinFirstLetter(PatientBaseUtil.getPinYinFirstLetter(diagnosisManage.getDiagnosisName()));
86
+            diagnosisManage.setDiagnosisNamePinyin(PatientBaseUtil.getPinyin(diagnosisManage.getDiagnosisName()));
87
+            // 将校验成功的诊断管理对象添加到成功列表
88
+            successList.add(diagnosisManage);
89
+        }
90
+        // 如果有成功导入的数据,则批量保存
91
+        if (CollectionUtils.isNotEmpty(successList)) {
92
+            this.saveBatch(successList);
93
+        }
94
+        // 返回导入失败的列表,外部可用于显示错误信息
95
+        return errorList;
96
+    }
97
+
98
+}

+ 1 - 2
eitc-patient-base/src/main/java/com/eitc/patient/service/impl/DiagnosisTypeCostProjectServiceImpl.java

@@ -70,7 +70,6 @@ public class DiagnosisTypeCostProjectServiceImpl extends ServiceImpl<DiagnosisTy
70 70
             if (StringUtils.isBlank(id)) {
71 71
                 throw new RuntimeException("收费分类详情ID不能为空");
72 72
             }
73
-
74 73
             // 创建诊断类型收费项目对象
75 74
             DiagnosisTypeCostProject diagnosisTypeCostProject = new DiagnosisTypeCostProject();
76 75
             // 设置诊断类型ID
@@ -84,7 +83,7 @@ public class DiagnosisTypeCostProjectServiceImpl extends ServiceImpl<DiagnosisTy
84 83
         }
85 84
 
86 85
         // 删除原有的同诊断类型ID的诊断类型收费项目
87
-        this.remove(Wrappers.<DiagnosisTypeCostProject>lambdaQuery().eq(DiagnosisTypeCostProject::getDiagnosisTypeId, diagnosisTypeId));
86
+//        this.remove(Wrappers.<DiagnosisTypeCostProject>lambdaQuery().eq(DiagnosisTypeCostProject::getDiagnosisTypeId, diagnosisTypeId));
88 87
         // 批量保存新的诊断类型收费项目
89 88
         this.saveBatch(list);
90 89
     }

+ 65 - 58
eitc-patient-base/src/main/java/com/eitc/patient/service/impl/DiagnosisTypeServiceImpl.java

@@ -4,22 +4,19 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 4
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
5 5
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
6 6
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
-import com.eitc.common.utils.SecurityUtils;
8 7
 import com.eitc.common.utils.bean.BeanUtils;
9 8
 import com.eitc.patient.domain.DiagnosisType;
10
-import com.eitc.patient.dto.DiagnosisTypeOrderDoctorDto;
9
+import com.eitc.patient.domain.DiagnosisTypeTemplate;
11 10
 import com.eitc.patient.mapper.DiagnosisTypeMapper;
12
-import com.eitc.patient.service.IDiagnosisTypeOrderDoctorService;
13 11
 import com.eitc.patient.service.IDiagnosisTypeService;
12
+import com.eitc.patient.service.IDiagnosisTypeTemplateService;
14 13
 import com.eitc.patient.tree.DiagnosisTypeTree;
15 14
 import org.apache.commons.lang3.StringUtils;
16 15
 import org.springframework.stereotype.Service;
17 16
 
18 17
 import javax.annotation.Resource;
19 18
 import java.util.ArrayList;
20
-import java.util.HashMap;
21 19
 import java.util.List;
22
-import java.util.Map;
23 20
 import java.util.Objects;
24 21
 import java.util.stream.Collectors;
25 22
 
@@ -33,7 +30,7 @@ import java.util.stream.Collectors;
33 30
 public class DiagnosisTypeServiceImpl extends ServiceImpl<DiagnosisTypeMapper, DiagnosisType> implements IDiagnosisTypeService {
34 31
 
35 32
     @Resource
36
-    private IDiagnosisTypeOrderDoctorService diagnosisTypeOrderDoctorService;
33
+    private IDiagnosisTypeTemplateService diagnosisTypeTemplateService;
37 34
 
38 35
     /**
39 36
      * 获取面包屑
@@ -69,8 +66,12 @@ public class DiagnosisTypeServiceImpl extends ServiceImpl<DiagnosisTypeMapper, D
69 66
     @Override
70 67
     public List<DiagnosisType> getDiagnosisTypes(DiagnosisType diagnosisType) {
71 68
         LambdaQueryWrapper<DiagnosisType> eq = Wrappers.<DiagnosisType>lambdaQuery()
72
-                .eq(StringUtils.isNotBlank(diagnosisType.getDiagnosisName()), DiagnosisType::getDiagnosisName, diagnosisType.getDiagnosisName())
73
-                .orderByDesc(DiagnosisType::getDiagnosisName);
69
+                .like(StringUtils.isNotBlank(diagnosisType.getDiagnosisName()), DiagnosisType::getDiagnosisName, diagnosisType.getDiagnosisName()).or()
70
+                .like(StringUtils.isNotBlank(diagnosisType.getDiagnosisNamePinyinFirstLetter()),
71
+                        DiagnosisType::getDiagnosisNamePinyinFirstLetter, diagnosisType.getDiagnosisNamePinyinFirstLetter()).or()
72
+                .like(StringUtils.isNotBlank(diagnosisType.getDiagnosisNamePinyin()),
73
+                        DiagnosisType::getDiagnosisNamePinyin, diagnosisType.getDiagnosisNamePinyin())
74
+                .orderByDesc(DiagnosisType::getCreateDate);
74 75
 
75 76
         return this.list(eq);
76 77
     }
@@ -90,75 +91,81 @@ public class DiagnosisTypeServiceImpl extends ServiceImpl<DiagnosisTypeMapper, D
90 91
     }
91 92
 
92 93
     /**
93
-     * 根据医生ID查找诊断类型树形列表。
94
-     * 该方法主要用于获取与医生相关的诊断类型树,用于前端展示或筛选。
95
-     * 如果医生没有关联的诊断类型,则返回所有的诊断类型树。
94
+     * 获取树形结构
96 95
      *
97
-     * @return 树形结构列表,包含诊断类型信息。
96
+     * @param searchParam 搜索信息
97
+     * @param visitType   状态
98
+     * @return 返回结果
99
+     * @author mtx
100
+     * @date: 2024/8/21 9:36
98 101
      */
99 102
     @Override
100
-    public List<DiagnosisTypeTree> findTreeList() {
101
-        // 根据当前登录用户的ID查找与其关联的诊断类型订单
102
-        List<DiagnosisTypeOrderDoctorDto> dtoList = diagnosisTypeOrderDoctorService.findListByDoctorId(String.valueOf(SecurityUtils.getUserId()));
103
-        // 用于存储诊断类型ID和对应的诊断类型ID的映射
104
-        Map<String, String> map = new HashMap<>();
105
-        // 初始化诊断类型列表
106
-        List<DiagnosisType> list = new ArrayList<>();
107
-
108
-        // 如果关联的诊断类型订单列表为空,则直接获取所有的诊断类型
109
-        if (CollectionUtils.isEmpty(dtoList)) {
110
-            list = this.getDiagnosisTypes(new DiagnosisType());
111
-        } else {
112
-            // 遍历关联的诊断类型订单,转换为诊断类型对象,并存储映射关系
113
-            for (DiagnosisTypeOrderDoctorDto dto : dtoList) {
114
-                DiagnosisType dt = new DiagnosisType();
115
-                BeanUtils.copyProperties(dto, dt);
116
-                map.put(dto.getId(), dto.getDiagnosisTypeId());
117
-                list.add(dt);
103
+    public List<DiagnosisTypeTree> findTreeList(String searchParam, String visitType) {
104
+        // 获取分类列表
105
+        List<DiagnosisType> list = this.getDiagnosisTypes(new DiagnosisType());
106
+        // 封装树形结构
107
+        List<DiagnosisTypeTree> treeBeans = new ArrayList<>();
108
+        // 获取数据列表
109
+        LambdaQueryWrapper<DiagnosisTypeTemplate> wrapper = Wrappers.lambdaQuery();
110
+        if (StringUtils.isNotBlank(searchParam)) {
111
+            wrapper.and(w -> w.like(DiagnosisTypeTemplate::getTemplateName, searchParam).or()
112
+                    .like(DiagnosisTypeTemplate::getNamePinyinFirstLetter, searchParam).or()
113
+                    .like(DiagnosisTypeTemplate::getNamePinyin, searchParam));
114
+        }
115
+        if (StringUtils.isNotBlank(visitType)) {
116
+            wrapper.eq(DiagnosisTypeTemplate::getVisitType, visitType);
117
+        }
118
+        wrapper.eq(DiagnosisTypeTemplate::getEnableStatus, 1);
119
+        List<DiagnosisTypeTemplate> templates = diagnosisTypeTemplateService.list(wrapper);
120
+        if (CollectionUtils.isNotEmpty(templates)) {
121
+            for (DiagnosisTypeTemplate template : templates) {
122
+                DiagnosisTypeTree diagnosisTypeTree = new DiagnosisTypeTree();
123
+                diagnosisTypeTree.setDiagnosisName(template.getTemplateName());
124
+                diagnosisTypeTree.setTemplateDesc(template.getTemplateDesc());
125
+                diagnosisTypeTree.setDiagnosisNamePinyin(template.getNamePinyin());
126
+                diagnosisTypeTree.setDiagnosisNamePinyinFirstLetter(template.getNamePinyinFirstLetter());
127
+                diagnosisTypeTree.setVisitType(template.getVisitType());
128
+                diagnosisTypeTree.setParentId(template.getDiagnosisTypeId());
129
+                diagnosisTypeTree.setId(template.getId());
130
+                diagnosisTypeTree.setDiagnosisManageId(template.getDiagnosisManageId());
131
+
132
+                treeBeans.add(diagnosisTypeTree);
118 133
             }
119 134
         }
120 135
 
121
-        // 将诊断类型列表转换为树形结构列表
122
-        List<DiagnosisTypeTree> treeBeans = new ArrayList<>();
123 136
         list.forEach(t -> {
124 137
             DiagnosisTypeTree diagnosisTypeTree = new DiagnosisTypeTree();
125 138
             BeanUtils.copyProperties(t, diagnosisTypeTree);
126 139
             treeBeans.add(diagnosisTypeTree);
127 140
         });
128 141
 
129
-        // 获取树形结构中的根节点
130
-        List<DiagnosisTypeTree> children = this.getChildren("0", treeBeans);
131
-        // 将映射关系中的诊断类型ID设置到树形结构中,用于后续的关联操作
132
-        setTreeIdToDiagnosisTypeId(children, map);
133
-
134
-        return children;
142
+        //获取父节点
143
+        return this.getChildren("0", treeBeans);
135 144
     }
136 145
 
137
-
138 146
     /**
139
-     * 将诊断类型树的ID设置为诊断类型ID的映射值。
140
-     * 此方法递归处理一个诊断类型树列表,将每个节点的ID替换为映射表中对应的值。
141
-     * 这样做的目的是为了更新树结构中节点的ID,确保ID的唯一性和一致性。
147
+     * 检查是否可以添加诊断类型
148
+     * 此方法主要进行两个重要检查:
149
+     * 1. 确保传入的诊断类型ID不为空,因为这是添加新诊断类型的必要条件
150
+     * 2. 检查传入的诊断类型ID是否已经有子类型存在,如果存在子类型,则不允许添加新的诊断类型
142 151
      *
143
-     * @param list 诊断类型树列表,包含待处理的树结构。
144
-     * @param map  用于映射旧ID到新ID的映射表,提供ID的替换规则。
152
+     * @param diagnosisTypeId 诊断类型ID,用于检查和添加新的诊断类型
153
+     * @throws IllegalArgumentException 如果诊断类型ID为空或存在子类型,则抛出此异常
145 154
      */
146
-    public void setTreeIdToDiagnosisTypeId(List<DiagnosisTypeTree> list, Map<String, String> map) {
147
-        // 检查列表是否为空,如果为空则直接返回,无需处理。
148
-        if (CollectionUtils.isEmpty(list)) {
149
-            return;
155
+    @Override
156
+    public void checkAddDiagnosisType(String diagnosisTypeId) {
157
+        // 检查诊断类型ID是否为空
158
+        if (StringUtils.isBlank(diagnosisTypeId)) {
159
+            throw new IllegalArgumentException("必填项不能为空");
150 160
         }
151
-        // 遍历列表中的每个诊断类型树节点。
152
-        for (DiagnosisTypeTree diagnosisTypeTree : list) {
153
-            // 递归处理当前节点的子节点列表,确保树结构的所有节点都被处理。
154
-            List<DiagnosisTypeTree> childrenList = diagnosisTypeTree.getChildrenList();
155
-            setTreeIdToDiagnosisTypeId(childrenList, map);
156
-            // 使用映射表中旧ID对应的 新ID 更新当前节点的ID。
157
-            if (StringUtils.isNotBlank(map.get(diagnosisTypeTree.getId()))) {
158
-                diagnosisTypeTree.setId(map.get(diagnosisTypeTree.getId()));
159
-            }
161
+
162
+        // 查询是否有子类型存在
163
+        long typeCount = this.count(Wrappers.<DiagnosisType>lambdaQuery().eq(DiagnosisType::getParentId, diagnosisTypeId));
164
+
165
+        // 如果存在子类型,则不允许添加模板
166
+        if (typeCount > 0) {
167
+            throw new IllegalArgumentException("存在子类型,不允许添加模板");
160 168
         }
161 169
     }
162 170
 
163
-
164 171
 }

+ 409 - 114
eitc-patient-base/src/main/java/com/eitc/patient/service/impl/DiagnosisTypeTemplateServiceImpl.java

@@ -1,32 +1,35 @@
1 1
 package com.eitc.patient.service.impl;
2 2
 
3
+import cn.hutool.core.lang.UUID;
4
+import com.alibaba.fastjson2.JSONArray;
3 5
 import com.alibaba.fastjson2.JSONObject;
4 6
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
5 7
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
6 8
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
-import com.eitc.common.utils.poi.ExcelUtil;
9
+import com.eitc.common.core.domain.entity.SysDept;
10
+import com.eitc.common.utils.PatientBaseUtil;
11
+import com.eitc.common.utils.bean.BeanUtils;
8 12
 import com.eitc.patient.constant.PatientConstant;
13
+import com.eitc.patient.domain.DiagnosisManage;
14
+import com.eitc.patient.domain.DiagnosisType;
9 15
 import com.eitc.patient.domain.DiagnosisTypeTemplate;
10
-import com.eitc.patient.enums.DiagnosisTypeTemplateReviewStatusEnum;
11 16
 import com.eitc.patient.excel.DiagnosisTypeTemplateExcel;
12 17
 import com.eitc.patient.mapper.DiagnosisTypeTemplateMapper;
18
+import com.eitc.patient.service.IDiagnosisManageService;
19
+import com.eitc.patient.service.IDiagnosisTypeService;
13 20
 import com.eitc.patient.service.IDiagnosisTypeTemplateService;
14
-import com.eitc.patient.utils.PatientUtil;
15 21
 import com.eitc.patient.vo.DiagnosisTypeTemplateSaveVO;
16
-import com.eitc.patient.vo.DiagnosisTypeTemplateVO;
17
-import com.eitc.system.service.ISysDictDataService;
22
+import com.eitc.system.service.ISysDeptService;
18 23
 import org.apache.commons.lang3.StringUtils;
19 24
 import org.springframework.stereotype.Service;
20 25
 import org.springframework.transaction.annotation.Transactional;
21
-import org.springframework.web.multipart.MultipartFile;
22 26
 
23 27
 import javax.annotation.Resource;
24
-import java.io.IOException;
25 28
 import java.util.ArrayList;
26
-import java.util.Collections;
29
+import java.util.HashMap;
27 30
 import java.util.List;
28
-import java.util.Optional;
29
-import java.util.concurrent.atomic.AtomicInteger;
31
+import java.util.Map;
32
+import java.util.Objects;
30 33
 import java.util.regex.Matcher;
31 34
 import java.util.regex.Pattern;
32 35
 import java.util.stream.Collectors;
@@ -41,66 +44,126 @@ import java.util.stream.Collectors;
41 44
 public class DiagnosisTypeTemplateServiceImpl extends ServiceImpl<DiagnosisTypeTemplateMapper, DiagnosisTypeTemplate> implements IDiagnosisTypeTemplateService {
42 45
 
43 46
     @Resource
44
-    private ISysDictDataService sysDictDataService;
47
+    private ISysDeptService sysDeptService;
48
+    @Resource
49
+    private IDiagnosisTypeService diagnosisTypeService;
50
+    @Resource
51
+    private IDiagnosisManageService diagnosisManageService;
45 52
 
46 53
 
47 54
     /**
48
-     * 获取模板选项的json串
55
+     * 根据提供的模板示例字符串,查找并生成模板选项的JSON表示
49 56
      *
50
-     * @param templateExample 要获取json串的示例
57
+     * @param jsonContent 要获取json串的示例
51 58
      * @return json串
52 59
      * @author mtx
53 60
      * @date: 2024/5/20 14:50
54 61
      */
55 62
     @Override
56
-    public String findTemplateOptionJson(String templateExample) {
57
-        JSONObject templateOption = new JSONObject();
58
-        if (StringUtils.isNotBlank(templateExample)) {
59
-            Matcher matcher = PatientConstant.COMPILE.matcher(templateExample);
60
-            int num = 1;
61
-            // 牙{发黑、有洞、龋洞} {1、2、3、6} 个月  将{}里的内容存到json串里
62
-            // 将《牙{发黑、有洞、龋洞} {1、2、3、6} 个月》转换成 {"patient_diagnosisTypeTemplate_1":["发黑","有洞","龋洞"],"patient_diagnosisTypeTemplate_2":["1","2","3","6"]}
63
+    public String findTemplateInfo(String jsonContent) {
64
+        JSONObject json = new JSONObject();
65
+        JSONObject dicData = new JSONObject();
66
+        List<String> keyList = new ArrayList<>();
67
+        StringBuilder sb = new StringBuilder();
68
+        // 拆分传过来的字符串,将字符串里的选项存到json里,并且根据第一个选项生成字符串
69
+        if (StringUtils.isNotBlank(jsonContent)) {
70
+            Matcher matcher = PatientConstant.COMPILE.matcher(jsonContent);
63 71
             while (matcher.find()) {
64
-                String group = matcher.group(1);
65
-                String[] split = group.split("、");
66
-                templateOption.put(PatientConstant.DIAGNOSIS_TYPE_TEMPLATE_KEY_PREFIX + num, split);
67
-                num++;
72
+                String replacement = "_" + UUID.randomUUID().toString().replaceAll("-", "");
73
+                keyList.add(replacement);
74
+                // 获取内容
75
+                String content = matcher.group(0);
76
+                jsonContent = Pattern.compile(content, Pattern.LITERAL).matcher(jsonContent).replaceFirst(Matcher.quoteReplacement(replacement));
77
+
78
+                // 获取选项
79
+                String option = matcher.group(1);
80
+                dicData.put(replacement, option.split("、"));
68 81
             }
69 82
         }
70
-        return templateOption.toJSONString();
83
+        // 将传过来的走传进行拆分
84
+        JSONArray str = getJsonContent(jsonContent, dicData, sb, keyList);
85
+        json.put("dic_data", dicData);
86
+        json.put("text", sb.toString());
87
+        json.put("str", str);
88
+        return json.toJSONString();
71 89
     }
72 90
 
73 91
     /**
74
-     * 获取模板数据中{}中的数据
92
+     * 将给定的字符串根据关键字列表拆分成JSON数组
93
+     * 如果字符串为空,则返回包含空值的单个JSON对象的数组
94
+     * 如果没有关键字,则直接返回包含原始字符串的单个JSON对象的数组
95
+     * 否则,根据关键字将字符串拆分,并将拆分部分及其在字典数据中的对应选项(如果存在)转换为JSON对象,然后添加到数组中
75 96
      *
76
-     * @param templateExample 要获取json串的示例
77
-     * @return json串
78
-     * @author mtx
79
-     * @date: 2024/5/20 14:50
97
+     * @param content 待处理的字符串
98
+     * @param dicData 字典数据,包含关键字及其选项
99
+     * @param sb 用于累加处理过程中的字符串
100
+     * @param keyList 关键字列表,用于拆分字符串
101
+     * @return 包含拆分字符串部分及其选项(如果存在)的JSON对象的数组
80 102
      */
81
-    @Override
82
-    public String findTemplateInfo(String templateExample) {
83
-        if (StringUtils.isEmpty(templateExample)) {
84
-            return "";
103
+    public JSONArray getJsonContent(String content, JSONObject dicData, StringBuilder sb, List<String> keyList) {
104
+        JSONArray array = new JSONArray();
105
+        JSONObject json;
106
+        // 如果字符串为空,则直接返回空
107
+        if (StringUtils.isBlank(content)){
108
+            json = new JSONObject();
109
+            json.put("type", "string");
110
+            json.put("value", "");
111
+            array.add(json);
112
+            return array;
113
+        }
114
+        // 如果是字符串,没有选项,则直接返回字符串
115
+        if (CollectionUtils.isEmpty(keyList)){
116
+            sb.append(content);
117
+            json = new JSONObject();
118
+            json.put("type", "string");
119
+            json.put("value", content);
120
+            array.add(json);
121
+            return array;
85 122
         }
86
-        // 将《牙{发黑、有洞、龋洞} {1、2、3、6} 个月》转换成 牙patient_diagnosisTypeTemplate_1 patient_diagnosisTypeTemplate_2 个月
87
-        Matcher matcher = PatientConstant.COMPILE.matcher(templateExample);
88
-        int num = 1;
89
-        while (matcher.find()) {
90
-            String oldStr = templateExample;
91
-            String target = matcher.group(0);
92
-            String replacement = PatientConstant.DIAGNOSIS_TYPE_TEMPLATE_KEY_PREFIX + num;
93
-
94
-            templateExample = Pattern.compile(target, Pattern.LITERAL).matcher(oldStr).replaceFirst(Matcher.quoteReplacement(replacement));
95
-            num++;
123
+        // 其他的拆分成json
124
+        String jsonContent = content;
125
+        for (int i = 0; i < keyList.size(); i++) {
126
+            String key = keyList.get(i);
127
+            String[] split = jsonContent.split(key);
128
+            String str0 = split[0];
129
+            if (StringUtils.isNotBlank(str0)) {
130
+                sb.append(str0);
131
+                json = new JSONObject();
132
+                json.put("type", "string");
133
+                json.put("value", str0);
134
+                array.add(json);
135
+            }
136
+
137
+            JSONArray jsonArray = dicData.getJSONArray(key);
138
+            if (Objects.nonNull(jsonArray)) {
139
+                sb.append(jsonArray.get(0));
140
+                json = new JSONObject();
141
+                json.put("type", "select");
142
+                json.put("val", jsonArray.get(0));
143
+                json.put("value", key);
144
+                array.add(json);
145
+            }
146
+            if(split.length<2){
147
+                continue;
148
+            }
149
+
150
+            String str1 = split[1];
151
+            if (StringUtils.isNotBlank(str1) && i == keyList.size() - 1) {
152
+                sb.append(str1);
153
+                json = new JSONObject();
154
+                json.put("type", "string");
155
+                json.put("value", str1);
156
+                array.add(json);
157
+            }
158
+            jsonContent = str1;
96 159
         }
97
-        return templateExample;
160
+        return array;
98 161
     }
99 162
 
100 163
     /**
101 164
      * 导入诊断分类模板
102 165
      *
103
-     * @param file            文件
166
+     * @param list            列表
104 167
      * @param diagnosisTypeId 诊断分类id
105 168
      * @return AjaxResult
106 169
      * @author mtx
@@ -108,103 +171,335 @@ public class DiagnosisTypeTemplateServiceImpl extends ServiceImpl<DiagnosisTypeT
108 171
      */
109 172
     @Override
110 173
     @Transactional(rollbackFor = {Exception.class})
111
-    public List<DiagnosisTypeTemplateExcel> importTemplate(MultipartFile file, String diagnosisTypeId) throws IOException {
112
-        boolean b = true;
113
-        List<DiagnosisTypeTemplate> diagnosisTypeTemplateList = new ArrayList<>();
114
-        List<DiagnosisTypeTemplateExcel> list;
115
-
116
-        // 1.解析excel
117
-        ExcelUtil<DiagnosisTypeTemplateExcel> util = new ExcelUtil<>(DiagnosisTypeTemplateExcel.class);
118
-        list = util.importExcel(file.getInputStream());
119
-        // 2.如果解析数据为空则返回错误信息
120
-        if (CollectionUtils.isEmpty(list)) {
121
-            throw new RuntimeException("上传数据为空,请填写");
174
+    public List<DiagnosisTypeTemplateExcel> importTemplate(List<DiagnosisTypeTemplateExcel> list, String diagnosisTypeId) {
175
+        // 用于存储导入成功的诊断管理对象
176
+        List<DiagnosisTypeTemplate> successList = new ArrayList<>();
177
+        // 用于存储导入失败的诊断管理模板Excel对象,保留错误信息
178
+        List<DiagnosisTypeTemplateExcel> errorList = new ArrayList<>();
179
+
180
+        // 封装已存在的诊断管理
181
+        List<DiagnosisManage> manageList = diagnosisManageService.list();
182
+        Map<String, String> diagnosisCodeMap = new HashMap<>();
183
+        if (CollectionUtils.isNotEmpty(manageList)) {
184
+            diagnosisCodeMap = manageList.stream().collect(Collectors.toMap(DiagnosisManage::getId, DiagnosisManage::getDiagnosisName));
122 185
         }
123
-        AtomicInteger num = new AtomicInteger(1);
186
+
124 187
         // 3.校验数据是否正确
125 188
         for (DiagnosisTypeTemplateExcel excel : list) {
189
+            DiagnosisTypeTemplate template = new DiagnosisTypeTemplate();
190
+
191
+            // 诊断分类
192
+            try {
193
+                checkClassify(excel, template);
194
+            } catch (IllegalArgumentException e) {
195
+                excel.setMsg(e.getMessage());
196
+                errorList.add(excel);
197
+                continue;
198
+            }
199
+
200
+            // 模板名称
126 201
             if (StringUtils.isEmpty(excel.getTemplateName())) {
127 202
                 excel.setMsg("模板名称不能为空");
128
-                b = false;
203
+                errorList.add(excel);
129 204
                 continue;
130 205
             }
206
+            template.setTemplateName(excel.getTemplateName());
131 207
 
132
-            String typeTemplateName = sysDictDataService.selectDictLabel(PatientConstant.DICT_KEY_DIAGNOSIS_TYPE_TEMPLATE_NAME, excel.getTemplateName());
133
-            if (StringUtils.isEmpty(typeTemplateName)) {
134
-                excel.setMsg("模板名称错误");
135
-                b = false;
208
+            // 诊断名称
209
+            if (StringUtils.isEmpty(excel.getDiagnosisManageName())) {
210
+                excel.setMsg("诊断名称不能为空");
211
+                errorList.add(excel);
136 212
                 continue;
137 213
             }
214
+            if (!diagnosisCodeMap.containsValue(excel.getDiagnosisManageName())) {
215
+                excel.setMsg("诊断名称不存在");
216
+                errorList.add(excel);
217
+                continue;
218
+            }
219
+            for (String id : diagnosisCodeMap.keySet()) {
220
+                if (!diagnosisCodeMap.get(id).equals(excel.getDiagnosisManageName())) {
221
+                    continue;
222
+                }
223
+                template.setDiagnosisManageId(id);
224
+                template.setDiagnosisManageName(excel.getDiagnosisManageName());
225
+            }
138 226
 
139
-            if (StringUtils.isEmpty(excel.getTemplateExample())) {
140
-                excel.setMsg("模板示例不能为空");
141
-                b = false;
227
+            // 模板描述
228
+            if (StringUtils.isEmpty(excel.getTemplateDesc())) {
229
+                excel.setMsg("模板描述不能为空");
230
+                errorList.add(excel);
231
+                continue;
142 232
             }
143
-        }
144
-        for (String s : PatientUtil.diagnosisTypeTemplateKeyList()) {
145
-            Optional<DiagnosisTypeTemplateExcel> first = list.stream().filter(li -> s.equals(li.getTemplateName())).findFirst();
146
-            if (first.isPresent()) {
147
-                DiagnosisTypeTemplateExcel excel = first.get();
148
-                DiagnosisTypeTemplate diagnosisTypeTemplate = new DiagnosisTypeTemplate();
149
-                // 牙{发黑、有洞、龋洞} {1、2、3、6} 个月
150
-                diagnosisTypeTemplate.setTemplateName(excel.getTemplateName());
151
-                String templateExample = excel.getTemplateExample();
152
-                if (StringUtils.isNotEmpty(templateExample)) {
153
-                    diagnosisTypeTemplate.setTemplateExample(templateExample);
154
-                    diagnosisTypeTemplate.setTemplateOption(this.findTemplateOptionJson(templateExample));
155
-                    diagnosisTypeTemplate.setTemplateInfo(this.findTemplateInfo(templateExample));
233
+            template.setTemplateDesc(excel.getTemplateDesc());
234
+
235
+            // 适用科室
236
+            String applyDept = excel.getApplyDept();
237
+            if (StringUtils.isEmpty(applyDept)) {
238
+                excel.setMsg("适用科室不能为空");
239
+                errorList.add(excel);
240
+                continue;
241
+            }
242
+            List<Long> deptList = new ArrayList<>();
243
+            try {
244
+                String[] split = applyDept.split(",");
245
+                for (String deptName : split) {
246
+                    SysDept sd = new SysDept();
247
+                    sd.setDeptName(deptName);
248
+                    List<SysDept> sysDepts = sysDeptService.selectDeptList(sd);
249
+                    if (CollectionUtils.isNotEmpty(sysDepts)) {
250
+                        deptList.add(sysDepts.get(0).getDeptId());
251
+                    } else {
252
+                        throw new IllegalArgumentException("适用科室不存在");
253
+                    }
156 254
                 }
157
-                diagnosisTypeTemplate.setReviewStatus(DiagnosisTypeTemplateReviewStatusEnum.ALREADY_AUDITING.getCode());
158
-                diagnosisTypeTemplate.setDiagnosisTypeId(diagnosisTypeId);
159
-                diagnosisTypeTemplate.setOrderNum(num.getAndIncrement());
160
-                diagnosisTypeTemplateList.add(diagnosisTypeTemplate);
255
+            } catch (IllegalArgumentException e) {
256
+                excel.setMsg(e.getMessage());
257
+                errorList.add(excel);
258
+                continue;
259
+            }
260
+            template.setApplyDept(StringUtils.join(deptList, ","));
261
+
262
+            // 就诊类型
263
+            if (StringUtils.isEmpty(excel.getVisitType())) {
264
+                excel.setMsg("就诊类型不能为空");
265
+                errorList.add(excel);
266
+                continue;
267
+            }
268
+            if ("初诊".equals(excel.getVisitType()) || "复诊".equals(excel.getVisitType())) {
269
+                template.setVisitType("初诊".equals(excel.getVisitType()) ? 1 : 2);
161 270
             } else {
162
-                throw new RuntimeException("模板错误");
271
+                excel.setMsg("就诊类型错误");
272
+                errorList.add(excel);
273
+                continue;
163 274
             }
164
-        }
165 275
 
166
-        if (b && CollectionUtils.isNotEmpty(diagnosisTypeTemplateList)) {
167
-            // 4.删除历史数据
168
-            this.remove(Wrappers.<DiagnosisTypeTemplate>lambdaQuery().eq(DiagnosisTypeTemplate::getDiagnosisTypeId, diagnosisTypeId));
169
-            // 5.保存数据并返回
170
-            this.saveBatch(diagnosisTypeTemplateList);
276
+            // 主诉
277
+            if (StringUtils.isEmpty(excel.getChiefComplaintContent())) {
278
+                excel.setMsg("主诉不能为空");
279
+                errorList.add(excel);
280
+                continue;
281
+            }
282
+            template.setChiefComplaintContent(excel.getChiefComplaintContent());
283
+
284
+            // 现病史
285
+            if (template.getVisitType() == 1 && StringUtils.isBlank(excel.getPresentIllnessContent())) {
286
+                throw new IllegalArgumentException("初诊必须填写现病史");
287
+            }
288
+            template.setPresentIllnessContent(excel.getPresentIllnessContent());
289
+
290
+            // 检查
291
+            if (StringUtils.isEmpty(excel.getInspectContent())) {
292
+                excel.setMsg("检查不能为空");
293
+                errorList.add(excel);
294
+                continue;
295
+            }
296
+            template.setInspectContent(excel.getInspectContent());
297
+
298
+            // 治疗计划
299
+            if (StringUtils.isEmpty(excel.getTreatmentPlanningContent())) {
300
+                excel.setMsg("治疗计划不能为空");
301
+                errorList.add(excel);
302
+                continue;
303
+            }
304
+            template.setTreatmentPlanningContent(excel.getTreatmentPlanningContent());
305
+
306
+            // 处置
307
+            if (StringUtils.isEmpty(excel.getDisposeContent())) {
308
+                excel.setMsg("处置不能为空");
309
+                errorList.add(excel);
310
+                continue;
311
+            }
312
+            template.setDisposeContent(excel.getDisposeContent());
313
+
314
+            // 便签
315
+            if (StringUtils.isNotBlank(excel.getNoteContent())) {
316
+                template.setNoteContent(excel.getNoteContent());
317
+            }
318
+
319
+            // 设置主诉选项
320
+            saveDiagnosisOption(template);
321
+            // 默认未启用
322
+            template.setEnableStatus(0);
323
+
324
+            successList.add(template);
171 325
         }
326
+        // 保存数据并返回
327
+        if (CollectionUtils.isNotEmpty(successList)) {
328
+            this.saveBatch(successList);
329
+        }
330
+        // 返回导入失败的列表,外部可用于显示错误信息
331
+        return errorList;
332
+    }
172 333
 
173
-        return b ? Collections.emptyList() : list;
334
+    private void checkClassify(DiagnosisTypeTemplateExcel excel, DiagnosisTypeTemplate template) {
335
+        if (StringUtils.isNotBlank(excel.getClassifyOne())) {
336
+            List<DiagnosisType> list1 = diagnosisTypeService.list(Wrappers.<DiagnosisType>lambdaQuery()
337
+                    .eq(DiagnosisType::getParentId, "0")
338
+                    .eq(DiagnosisType::getDiagnosisName, excel.getClassifyOne()));
339
+            if (CollectionUtils.isNotEmpty(list1)) {
340
+                if (StringUtils.isNotBlank(excel.getClassifyTwo())) {
341
+                    List<DiagnosisType> list2 = diagnosisTypeService.list(Wrappers.<DiagnosisType>lambdaQuery()
342
+                            .eq(DiagnosisType::getParentId, list1.get(0).getId())
343
+                            .eq(DiagnosisType::getDiagnosisName, excel.getClassifyTwo()));
344
+                    if (CollectionUtils.isNotEmpty(list2)) {
345
+                        if (StringUtils.isNotBlank(excel.getClassifyThree())) {
346
+                            List<DiagnosisType> list3 = diagnosisTypeService.list(Wrappers.<DiagnosisType>lambdaQuery()
347
+                                    .eq(DiagnosisType::getParentId, list2.get(0).getId())
348
+                                    .eq(DiagnosisType::getDiagnosisName, excel.getClassifyThree()));
349
+                            if (CollectionUtils.isNotEmpty(list3)) {
350
+                                if (StringUtils.isNotBlank(excel.getClassifyFour())) {
351
+                                    List<DiagnosisType> list4 = diagnosisTypeService.list(Wrappers.<DiagnosisType>lambdaQuery()
352
+                                            .eq(DiagnosisType::getParentId, list3.get(0).getId())
353
+                                            .eq(DiagnosisType::getDiagnosisName, excel.getClassifyFour()));
354
+                                    if (CollectionUtils.isNotEmpty(list4)) {
355
+                                        if (StringUtils.isNotBlank(excel.getClassifyFive())) {
356
+                                            List<DiagnosisType> list5 = diagnosisTypeService.list(Wrappers.<DiagnosisType>lambdaQuery()
357
+                                                    .eq(DiagnosisType::getParentId, list4.get(0).getId())
358
+                                                    .eq(DiagnosisType::getDiagnosisName, excel.getClassifyFive()));
359
+                                            if (CollectionUtils.isNotEmpty(list5)) {
360
+                                                if (StringUtils.isNotBlank(excel.getClassifySix())) {
361
+                                                    List<DiagnosisType> list6 = diagnosisTypeService.list(Wrappers.<DiagnosisType>lambdaQuery()
362
+                                                            .eq(DiagnosisType::getParentId, list5.get(0).getId())
363
+                                                            .eq(DiagnosisType::getDiagnosisName, excel.getClassifySix()));
364
+                                                    if (CollectionUtils.isNotEmpty(list6)) {
365
+                                                        // 校验是否可以添加模板
366
+                                                        diagnosisTypeService.checkAddDiagnosisType(list6.get(0).getId());
367
+                                                        template.setDiagnosisTypeId(list6.get(0).getId());
368
+                                                    } else {
369
+                                                        throw new IllegalArgumentException("六级分类不存在");
370
+                                                    }
371
+                                                } else {
372
+                                                    // 校验是否可以添加模板
373
+                                                    diagnosisTypeService.checkAddDiagnosisType(list5.get(0).getId());
374
+                                                    template.setDiagnosisTypeId(list5.get(0).getId());
375
+                                                }
376
+                                            } else {
377
+                                                throw new IllegalArgumentException("五级分类不存在");
378
+                                            }
379
+                                        } else {
380
+                                            // 校验是否可以添加模板
381
+                                            diagnosisTypeService.checkAddDiagnosisType(list4.get(0).getId());
382
+                                            template.setDiagnosisTypeId(list4.get(0).getId());
383
+                                        }
384
+                                    } else {
385
+                                        throw new IllegalArgumentException("四级分类不存在");
386
+                                    }
387
+                                } else {
388
+                                    // 校验是否可以添加模板
389
+                                    diagnosisTypeService.checkAddDiagnosisType(list3.get(0).getId());
390
+                                    template.setDiagnosisTypeId(list3.get(0).getId());
391
+                                }
392
+                            } else {
393
+                                throw new IllegalArgumentException("三级分类不存在");
394
+                            }
395
+                        } else {
396
+                            // 校验是否可以添加模板
397
+                            diagnosisTypeService.checkAddDiagnosisType(list2.get(0).getId());
398
+                            template.setDiagnosisTypeId(list2.get(0).getId());
399
+                        }
400
+                    } else {
401
+                        throw new IllegalArgumentException("二级分类不存在");
402
+                    }
403
+                } else {
404
+                    // 校验是否可以添加模板
405
+                    diagnosisTypeService.checkAddDiagnosisType(list1.get(0).getId());
406
+                    template.setDiagnosisTypeId(list1.get(0).getId());
407
+                }
408
+            } else {
409
+                throw new IllegalArgumentException("一级分类不存在");
410
+            }
411
+        } else {
412
+            throw new IllegalArgumentException("一级分类不能为空");
413
+        }
174 414
     }
175 415
 
176 416
     /**
177 417
      * 新增或修改诊断模板
178 418
      *
179 419
      * @param entry 参数
180
-     * @return 返回值
181 420
      * @author mtx
182 421
      * @date: 2024/6/7 14:06
183 422
      */
184 423
     @Override
185 424
     @Transactional(rollbackFor = {Exception.class})
186
-    public boolean add(DiagnosisTypeTemplateSaveVO entry) {
187
-        String diagnosisTypeId = entry.getDiagnosisTypeId();
188
-        List<DiagnosisTypeTemplateVO> diagnosisTypeTemplateList = entry.getDiagnosisTypeTemplateList();
189
-        AtomicInteger num = new AtomicInteger(1);
190
-        // 封装诊断模板数据
191
-        List<DiagnosisTypeTemplate> collect = diagnosisTypeTemplateList.stream().map(typeTemplateVO -> {
192
-            // 封装模板数据
193
-            DiagnosisTypeTemplate diagnosisTypeTemplate = new DiagnosisTypeTemplate();
194
-            String templateExample = typeTemplateVO.getTemplateExample();
195
-            if (StringUtils.isNotBlank(templateExample)) {
196
-                diagnosisTypeTemplate.setTemplateOption(this.findTemplateOptionJson(templateExample));
197
-                diagnosisTypeTemplate.setTemplateInfo(this.findTemplateInfo(templateExample));
198
-                diagnosisTypeTemplate.setTemplateExample(templateExample);
199
-            }
200
-            diagnosisTypeTemplate.setReviewStatus(DiagnosisTypeTemplateReviewStatusEnum.ALREADY_AUDITING.getCode());
201
-            diagnosisTypeTemplate.setTemplateName(typeTemplateVO.getTemplateName());
202
-            diagnosisTypeTemplate.setDiagnosisTypeId(diagnosisTypeId);
203
-            diagnosisTypeTemplate.setOrderNum(num.getAndIncrement());
204
-            return diagnosisTypeTemplate;
205
-        }).collect(Collectors.toList());
206
-
207
-        return this.saveBatch(collect);
425
+    public void add(DiagnosisTypeTemplateSaveVO entry) {
426
+        // 校验是否可以添加模板
427
+        diagnosisTypeService.checkAddDiagnosisType(entry.getDiagnosisTypeId());
428
+        this.save(getDiagnosisTypeTemplate(entry));
429
+    }
430
+
431
+    /**
432
+     * 修改诊断模板
433
+     *
434
+     * @param entry 参数
435
+     * @author mtx
436
+     * @date: 2024/6/7 14:06
437
+     */
438
+    @Override
439
+    public void edit(DiagnosisTypeTemplateSaveVO entry) {
440
+        if (StringUtils.isEmpty(entry.getId())) {
441
+            throw new IllegalArgumentException("id不能为空");
442
+        }
443
+        this.updateById(getDiagnosisTypeTemplate(entry));
444
+    }
445
+
446
+    /**
447
+     * 根据提供的诊断类型模板保存视图对象,构建并返回一个新的 DiagnosisTypeTemplate 实例
448
+     * 该方法主要用于处理诊断类型模板的保存逻辑,其中包括复制视图对象属性、验证诊断管理ID、
449
+     * 设置诊断管理名称以及处理适用部门列表
450
+     *
451
+     * @param entry 诊断类型模板保存视图对象,用于接收前端传入的诊断类型模板信息
452
+     * @return 返回构建好的 DiagnosisTypeTemplate 实例
453
+     */
454
+    private DiagnosisTypeTemplate getDiagnosisTypeTemplate(DiagnosisTypeTemplateSaveVO entry) {
455
+        if (entry.getVisitType() == 1 && StringUtils.isBlank(entry.getPresentIllnessContent())) {
456
+            throw new IllegalArgumentException("初诊必须填写现病史");
457
+        }
458
+
459
+        // 初始化 DiagnosisTypeTemplate 实例
460
+        DiagnosisTypeTemplate diagnosisTypeTemplate = new DiagnosisTypeTemplate();
461
+        // 将视图对象的属性复制到 DiagnosisTypeTemplate 实例中
462
+        BeanUtils.copyProperties(entry, diagnosisTypeTemplate);
463
+        // 根据提供的ID获取诊断管理实体
464
+        DiagnosisManage manage = diagnosisManageService.getById(entry.getDiagnosisManageId());
465
+        // 若诊断管理ID不存在,则抛出参数异常
466
+        if (Objects.isNull(manage)) {
467
+            throw new IllegalArgumentException("诊断管理id不存在");
468
+        }
469
+        // 设置 DiagnosisTypeTemplate 的诊断管理名称
470
+        diagnosisTypeTemplate.setDiagnosisManageName(manage.getDiagnosisName());
471
+        // 获取适用部门列表
472
+        List<Long> applyDeptList = entry.getApplyDeptList();
473
+        // 若适用部门列表不为空,则将其转换为以逗号分隔的字符串,并设置到 DiagnosisTypeTemplate 中
474
+        if (CollectionUtils.isEmpty(applyDeptList)) {
475
+            throw new IllegalArgumentException("适用科室不能为空");
476
+        }
477
+        diagnosisTypeTemplate.setApplyDept(StringUtils.join(applyDeptList, ","));
478
+        // 设置主诉选项
479
+        saveDiagnosisOption(diagnosisTypeTemplate);
480
+
481
+        // 返回构建好的 DiagnosisTypeTemplate 实例
482
+        return diagnosisTypeTemplate;
483
+    }
484
+
485
+    /**
486
+     * 保存诊断选项
487
+     * 此方法用于将诊断类型模板中的诊断内容设置到相应的选项中
488
+     * 它通过将各个诊断部分的内容赋值给模板的相应选项,来简化诊断信息的管理和使用
489
+     *
490
+     * @param diagnosisTypeTemplate 诊断类型模板,包含各种诊断内容和对应的选项
491
+     */
492
+    private void saveDiagnosisOption(DiagnosisTypeTemplate diagnosisTypeTemplate) {
493
+        // 首拼
494
+        diagnosisTypeTemplate.setNamePinyinFirstLetter(PatientBaseUtil.getPinYinFirstLetter(diagnosisTypeTemplate.getTemplateName()));
495
+        diagnosisTypeTemplate.setNamePinyin(PatientBaseUtil.getPinyin(diagnosisTypeTemplate.getTemplateName()));
496
+
497
+        diagnosisTypeTemplate.setChiefComplaintOption(this.findTemplateInfo(diagnosisTypeTemplate.getChiefComplaintContent()));
498
+        diagnosisTypeTemplate.setPresentIllnessOption(this.findTemplateInfo(diagnosisTypeTemplate.getPresentIllnessContent()));
499
+        diagnosisTypeTemplate.setInspectOption(this.findTemplateInfo(diagnosisTypeTemplate.getInspectContent()));
500
+        diagnosisTypeTemplate.setTreatmentPlanningOption(this.findTemplateInfo(diagnosisTypeTemplate.getTreatmentPlanningContent()));
501
+        diagnosisTypeTemplate.setDisposeOption(this.findTemplateInfo(diagnosisTypeTemplate.getDisposeContent()));
502
+        diagnosisTypeTemplate.setNoteOption(this.findTemplateInfo(diagnosisTypeTemplate.getNoteContent()));
208 503
     }
209 504
 
210 505
 }

+ 17 - 0
eitc-patient-base/src/main/java/com/eitc/patient/service/impl/ImageRecordServiceImpl.java

@@ -0,0 +1,17 @@
1
+package com.eitc.patient.service.impl;
2
+
3
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4
+import com.eitc.patient.domain.ImageRecord;
5
+import com.eitc.patient.mapper.ImageRecordMapper;
6
+import com.eitc.patient.service.IImageRecordService;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * ImageRecordServiceImpl
11
+ *
12
+ * @author mtx
13
+ * @date: 2024/06/11 17:37
14
+ */
15
+@Service
16
+public class ImageRecordServiceImpl extends ServiceImpl<ImageRecordMapper, ImageRecord> implements IImageRecordService {
17
+}

+ 41 - 31
eitc-patient-base/src/main/java/com/eitc/patient/service/impl/MedicalHistoryServiceImpl.java

@@ -4,10 +4,10 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
4 4
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
5 5
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
6 6
 import com.eitc.patient.domain.MedicalHistory;
7
-import com.eitc.patient.dto.DiagnosisTypeTemplateDto;
8 7
 import com.eitc.patient.enums.MedicalHistoryDiseaseSourceEnum;
9 8
 import com.eitc.patient.enums.MedicalHistoryDiseaseTypeEnum;
10 9
 import com.eitc.patient.mapper.MedicalHistoryMapper;
10
+import com.eitc.patient.param.MedicalRecordSaveParam;
11 11
 import com.eitc.patient.service.IMedicalHistoryService;
12 12
 import org.apache.commons.lang3.StringUtils;
13 13
 import org.springframework.stereotype.Service;
@@ -134,62 +134,72 @@ public class MedicalHistoryServiceImpl extends ServiceImpl<MedicalHistoryMapper,
134 134
     /**
135 135
      * 查询患者的病史保存到历史记录中
136 136
      *
137
-     * @param patientId       患者id
138
-     * @param medicalRecordId 病id
137
+     * @param param           参数
138
+     * @param medicalRecordId 病id
139 139
      * @author mtx
140 140
      * @date: 2024/5/22 13:57
141 141
      */
142 142
     @Override
143 143
     @Transactional(rollbackFor = {Exception.class})
144
-    public void saveMedicalHistoryToMedicalRecordIdByPatientId(String patientId, String medicalRecordId) {
145
-        // 查询患者保存的病史
146
-        List<MedicalHistory> list = this.list(Wrappers.<MedicalHistory>lambdaQuery().eq(MedicalHistory::getPatientId, patientId));
147
-        if (CollectionUtils.isEmpty(list)) {
148
-            return;
149
-        }
144
+    public void saveMedicalHistoryByHistoryType(MedicalRecordSaveParam param, String medicalRecordId) {
145
+        List<MedicalHistory> list = new ArrayList<>();
150 146
         // 封装并保存记录
151
-        List<MedicalHistory> lists = list.stream().map(item -> {
152
-            MedicalHistory medicalHistory = new MedicalHistory();
153
-            medicalHistory.setMedicalRecordId(medicalRecordId);
154
-            medicalHistory.setDiseaseType(item.getDiseaseType());
155
-            medicalHistory.setDiseaseContent(item.getDiseaseContent());
156
-            medicalHistory.setDiseaseSource(MedicalHistoryDiseaseSourceEnum.PATIENT.getCode());
157
-            return medicalHistory;
158
-        }).collect(Collectors.toList());
147
+        if (CollectionUtils.isNotEmpty(param.getDoctorAllergyHistory())) {
148
+            list.addAll(param.getDoctorAllergyHistory().stream().map(item -> {
149
+                MedicalHistory medicalHistory = new MedicalHistory();
150
+                medicalHistory.setMedicalRecordId(medicalRecordId);
151
+                medicalHistory.setDiseaseType(MedicalHistoryDiseaseTypeEnum.ALLERGY_HISTORY.getCode());
152
+                medicalHistory.setDiseaseContent(item);
153
+                medicalHistory.setDiseaseSource(MedicalHistoryDiseaseSourceEnum.DOCTOR.getCode());
154
+                return medicalHistory;
155
+            }).collect(Collectors.toList()));
156
+        }
157
+        if (CollectionUtils.isNotEmpty(param.getDoctorPastHistory())) {
158
+            list.addAll(param.getDoctorPastHistory().stream().map(item -> {
159
+                MedicalHistory medicalHistory = new MedicalHistory();
160
+                medicalHistory.setMedicalRecordId(medicalRecordId);
161
+                medicalHistory.setDiseaseType(MedicalHistoryDiseaseTypeEnum.PAST_HISTORY.getCode());
162
+                medicalHistory.setDiseaseContent(item);
163
+                medicalHistory.setDiseaseSource(MedicalHistoryDiseaseSourceEnum.DOCTOR.getCode());
164
+                return medicalHistory;
165
+            }).collect(Collectors.toList()));
166
+        }
167
+        if (CollectionUtils.isNotEmpty(param.getDoctorFamilyHistory())) {
168
+            list.addAll(param.getDoctorFamilyHistory().stream().map(item -> {
169
+                MedicalHistory medicalHistory = new MedicalHistory();
170
+                medicalHistory.setMedicalRecordId(medicalRecordId);
171
+                medicalHistory.setDiseaseType(MedicalHistoryDiseaseTypeEnum.FAMILY_HISTORY.getCode());
172
+                medicalHistory.setDiseaseContent(item);
173
+                medicalHistory.setDiseaseSource(MedicalHistoryDiseaseSourceEnum.DOCTOR.getCode());
174
+                return medicalHistory;
175
+            }).collect(Collectors.toList()));
176
+        }
159 177
 
160 178
         this.remove(Wrappers.<MedicalHistory>lambdaQuery()
161 179
                 .eq(MedicalHistory::getMedicalRecordId, medicalRecordId)
162
-                .eq(MedicalHistory::getDiseaseSource, MedicalHistoryDiseaseSourceEnum.PATIENT.getCode()));
163
-        this.saveBatch(lists);
180
+                .eq(MedicalHistory::getDiseaseSource, MedicalHistoryDiseaseSourceEnum.DOCTOR.getCode()));
181
+        this.saveBatch(list);
164 182
     }
165 183
 
166 184
     /**
167 185
      * 根据患者ID、疾病类型和诊断类型模板详情,查询患者的病史信息。
168 186
      * 此方法主要用于检索与特定疾病类型和患者相关的病史记录,并根据病史来源筛选出患者自述的病史内容。
169 187
      *
170
-     * @param patientId 患者的唯一标识ID,用于查询特定患者的病史记录。
188
+     * @param patientId   患者的唯一标识ID,用于查询特定患者的病史记录。
171 189
      * @param diseaseType 疾病类型的标识,用于筛选特定类型的病史记录。
172
-     * @param detailsVO 诊断类型模板详情的DTO(数据传输对象),用于接收和存储查询结果。
173
-     *                  此对象将包含患者自述的病史内容列表和这些内容的格式化列表。
174 190
      * @author mtx
175 191
      * @date 2024/06/07 14:01
176 192
      */
177 193
     @Override
178
-    public void findMedicalHistory(String patientId, Integer diseaseType, DiagnosisTypeTemplateDto detailsVO) {
194
+    public List<String> findMedicalHistory(String patientId, Integer diseaseType) {
179 195
         // 根据疾病类型和患者ID查询所有的病史记录
180 196
         List<MedicalHistory> histories = this.list(Wrappers.<MedicalHistory>lambdaQuery()
181 197
                 .eq(MedicalHistory::getDiseaseType, diseaseType)
198
+                .eq(MedicalHistory::getDiseaseSource, MedicalHistoryDiseaseSourceEnum.PATIENT.getCode())
182 199
                 .eq(MedicalHistory::getPatientId, patientId));
183 200
 
184 201
         // 筛选病史来源为患者自述的病史记录,将病史内容拼接为字符串,用逗号分隔,存储到detailsVO中
185
-        detailsVO.setPatientMedicalRecord(histories.stream()
186
-                .filter(li -> MedicalHistoryDiseaseSourceEnum.PATIENT.getCode().equals(li.getDiseaseSource()))
187
-                .map(MedicalHistory::getDiseaseContent).collect(Collectors.joining(",")));
188
-
189
-        // 筛选病史来源为患者自述的病史记录,将病史内容收集到列表中,存储到detailsVO中
190
-        detailsVO.setFormattedPartsList(histories.stream()
191
-                .filter(li -> MedicalHistoryDiseaseSourceEnum.PATIENT.getCode().equals(li.getDiseaseSource()))
192
-                .map(MedicalHistory::getDiseaseContent).collect(Collectors.toList()));
202
+        return histories.stream().map(MedicalHistory::getDiseaseContent).collect(Collectors.toList());
193 203
     }
194 204
 
195 205
 

+ 0 - 110
eitc-patient-base/src/main/java/com/eitc/patient/service/impl/MedicalRecordDetailsServiceImpl.java

@@ -1,28 +1,11 @@
1 1
 package com.eitc.patient.service.impl;
2 2
 
3
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
4
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
5 3
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
6
-import com.eitc.common.utils.bean.BeanUtils;
7
-import com.eitc.patient.domain.MedicalHistory;
8
-import com.eitc.patient.domain.MedicalRecord;
9 4
 import com.eitc.patient.domain.MedicalRecordDetails;
10
-import com.eitc.patient.dto.MedicalRecordHistoryDto;
11
-import com.eitc.patient.enums.MedicalHistoryDiseaseSourceEnum;
12
-import com.eitc.patient.enums.MedicalHistoryDiseaseTypeEnum;
13 5
 import com.eitc.patient.mapper.MedicalRecordDetailsMapper;
14
-import com.eitc.patient.service.IMedicalHistoryService;
15 6
 import com.eitc.patient.service.IMedicalRecordDetailsService;
16
-import com.eitc.patient.vo.MedicalRecordDetailsVO;
17
-import org.apache.commons.lang3.StringUtils;
18 7
 import org.springframework.stereotype.Service;
19 8
 
20
-import javax.annotation.Resource;
21
-import java.util.Collections;
22
-import java.util.List;
23
-import java.util.Map;
24
-import java.util.stream.Collectors;
25
-
26 9
 /**
27 10
  * MedicalRecordDetailsServiceImpl
28 11
  *
@@ -32,97 +15,4 @@ import java.util.stream.Collectors;
32 15
 @Service
33 16
 public class MedicalRecordDetailsServiceImpl extends ServiceImpl<MedicalRecordDetailsMapper, MedicalRecordDetails> implements IMedicalRecordDetailsService {
34 17
 
35
-    @Resource
36
-    private IMedicalHistoryService medicalHistoryService;
37
-
38
-    /**
39
-     * 通过病历id获取病历详情vo
40
-     * @param medicalRecordId 病历id
41
-     * @return 病历详情vo
42
-     * @author mtx
43
-     * @date: 2024/6/5 9:10
44
-     */
45
-    @Override
46
-    public List<MedicalRecordDetailsVO> findMedicalRecordDetailsVOByMedicalRecordId(String medicalRecordId) {
47
-        List<MedicalRecordDetails> list = this.list(Wrappers.<MedicalRecordDetails>lambdaQuery()
48
-                .eq(MedicalRecordDetails::getMedicalRecordId, medicalRecordId)
49
-                .orderByAsc(MedicalRecordDetails::getOrderNum));
50
-        if (CollectionUtils.isNotEmpty(list)) {
51
-            // 封装病例详情数据
52
-            return list.stream().map(item -> {
53
-                MedicalRecordDetailsVO detailsVO = new MedicalRecordDetailsVO();
54
-                BeanUtils.copyProperties(item, detailsVO);
55
-                // 根据病历ID和疾病类型,查询病史信息,并将查询结果封装到MedicalRecordDetailsVO对象中。
56
-                if (MedicalHistoryDiseaseTypeEnum.ALLERGY_HISTORY.getInfo().equals(detailsVO.getTemplateName())) {
57
-                    findMedicalHistory(medicalRecordId, MedicalHistoryDiseaseTypeEnum.ALLERGY_HISTORY.getCode(), detailsVO);
58
-                }
59
-                if (MedicalHistoryDiseaseTypeEnum.PAST_HISTORY.getInfo().equals(detailsVO.getTemplateName())) {
60
-                    findMedicalHistory(medicalRecordId, MedicalHistoryDiseaseTypeEnum.PAST_HISTORY.getCode(), detailsVO);
61
-                }
62
-                if (MedicalHistoryDiseaseTypeEnum.FAMILY_HISTORY.getInfo().equals(detailsVO.getTemplateName())) {
63
-                    findMedicalHistory(medicalRecordId, MedicalHistoryDiseaseTypeEnum.FAMILY_HISTORY.getCode(), detailsVO);
64
-                }
65
-                return detailsVO;
66
-            }).collect(Collectors.toList());
67
-        } else {
68
-            return Collections.emptyList();
69
-        }
70
-    }
71
-
72
-    /**
73
-     * 统计诊断分类
74
-     *
75
-     * @return 统计结果
76
-     * @author mtx
77
-     * @date: 2024/6/5 9:10
78
-     */
79
-    @Override
80
-    public List<Map<String, String>> countByDiagnosisTypeName() {
81
-        return this.baseMapper.countByDiagnosisTypeName();
82
-    }
83
-
84
-    /**
85
-     * 根据牙齿位置检查访问类型
86
-     *
87
-     * @return 返回访问类型,具体类型根据业务逻辑确定
88
-     */
89
-    @Override
90
-    public List<MedicalRecord> findListByToothPosition(MedicalRecordHistoryDto dto) {
91
-        return this.baseMapper.findListByToothPosition(dto);
92
-    }
93
-
94
-    /**
95
-     * 根据病历ID和疾病类型,查询病史信息,并将查询结果封装到MedicalRecordDetailsVO对象中。
96
-     *
97
-     * @param medicalRecordId 病历ID,用于查询特定病历的病史。
98
-     * @param diseaseType 疾病类型,用于筛选特定类型的病史记录。
99
-     * @param detailsVO 一个MedicalRecordDetailsVO对象,用于存储查询结果。
100
-     *                  该对象将包含患者自述病史和医生记录的病史。
101
-     */
102
-    private void findMedicalHistory(String medicalRecordId, Integer diseaseType, MedicalRecordDetailsVO detailsVO) {
103
-        // 根据病历ID和疾病类型查询所有的病史记录
104
-        List<MedicalHistory> histories = medicalHistoryService.list(Wrappers.<MedicalHistory>lambdaQuery()
105
-                .eq(MedicalHistory::getDiseaseType, diseaseType)
106
-                .eq(MedicalHistory::getMedicalRecordId, medicalRecordId));
107
-
108
-        // 分别筛选出患者自述和医生记录的病史内容,并将它们加入到detailsVO对象中
109
-        detailsVO.setPatientMedicalRecord(histories.stream()
110
-                .filter(li -> MedicalHistoryDiseaseSourceEnum.PATIENT.getCode().equals(li.getDiseaseSource()))
111
-                .map(MedicalHistory::getDiseaseContent).collect(Collectors.joining(",")));
112
-        detailsVO.setDoctorMedicalRecord(histories.stream()
113
-                .filter(li -> MedicalHistoryDiseaseSourceEnum.DOCTOR.getCode().equals(li.getDiseaseSource()))
114
-                .map(MedicalHistory::getDiseaseContent).collect(Collectors.joining(",")));
115
-
116
-        // 根据患者自述和医生记录的病史内容,设置最终的内容信息
117
-        String patientMedicalRecord = detailsVO.getPatientMedicalRecord();
118
-        String doctorMedicalRecord = detailsVO.getDoctorMedicalRecord();
119
-        if (StringUtils.isNotBlank(patientMedicalRecord) && StringUtils.isNotBlank(doctorMedicalRecord)) {
120
-            detailsVO.setContentInfo(patientMedicalRecord + "," + doctorMedicalRecord);
121
-        } else if (StringUtils.isNotBlank(patientMedicalRecord)) {
122
-            detailsVO.setContentInfo(patientMedicalRecord);
123
-        } else if (StringUtils.isNotBlank(doctorMedicalRecord)) {
124
-            detailsVO.setContentInfo(doctorMedicalRecord);
125
-        }
126
-    }
127
-
128 18
 }

+ 55 - 306
eitc-patient-base/src/main/java/com/eitc/patient/service/impl/MedicalRecordServiceImpl.java

@@ -1,33 +1,24 @@
1 1
 package com.eitc.patient.service.impl;
2 2
 
3
-import com.alibaba.fastjson2.JSONArray;
4 3
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
5 4
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
6 5
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
-import com.eitc.patient.constant.PatientConstant;
8
-import com.eitc.patient.domain.DiagnosisType;
9
-import com.eitc.patient.domain.DiagnosisTypeTemplate;
10
-import com.eitc.patient.domain.MedicalHistory;
6
+import com.eitc.common.utils.bean.BeanUtils;
11 7
 import com.eitc.patient.domain.MedicalRecord;
12 8
 import com.eitc.patient.domain.MedicalRecordDetails;
13 9
 import com.eitc.patient.domain.PatientAppointment;
10
+import com.eitc.patient.dto.MedicalRecordHistoryDto;
14 11
 import com.eitc.patient.dto.MedicalRecordListDto;
15
-import com.eitc.patient.enums.MedicalHistoryDiseaseSourceEnum;
16
-import com.eitc.patient.enums.MedicalHistoryDiseaseTypeEnum;
17 12
 import com.eitc.patient.enums.MedicalRecordStatusEnum;
18 13
 import com.eitc.patient.enums.PatientAppointmentStatusEnum;
19 14
 import com.eitc.patient.mapper.MedicalRecordMapper;
15
+import com.eitc.patient.param.MedicalRecordSaveParam;
20 16
 import com.eitc.patient.service.ICollectCostPatientsService;
21
-import com.eitc.patient.service.IDiagnosisTypeService;
22
-import com.eitc.patient.service.IDiagnosisTypeTemplateService;
23 17
 import com.eitc.patient.service.IMedicalHistoryService;
24 18
 import com.eitc.patient.service.IMedicalRecordDetailsService;
25 19
 import com.eitc.patient.service.IMedicalRecordService;
26 20
 import com.eitc.patient.service.IPatientAppointmentService;
27
-import com.eitc.patient.vo.FormattedPartsVO;
28
-import com.eitc.patient.vo.MedicalRecordDetailsVO;
29
-import com.eitc.patient.vo.MedicalRecordParamVO;
30
-import com.eitc.patient.vo.MedicalRecordVO;
21
+import com.eitc.patient.vo.MedicalRecordToothVO;
31 22
 import com.eitc.system.utils.UserCacheUtil;
32 23
 import org.apache.commons.lang3.StringUtils;
33 24
 import org.springframework.stereotype.Service;
@@ -36,14 +27,10 @@ import org.springframework.transaction.annotation.Transactional;
36 27
 import javax.annotation.Resource;
37 28
 import java.math.BigDecimal;
38 29
 import java.util.ArrayList;
39
-import java.util.Arrays;
40
-import java.util.Comparator;
41 30
 import java.util.List;
42 31
 import java.util.Map;
43 32
 import java.util.Objects;
44 33
 import java.util.concurrent.atomic.AtomicBoolean;
45
-import java.util.concurrent.atomic.AtomicInteger;
46
-import java.util.stream.Collectors;
47 34
 
48 35
 /**
49 36
  * MedicalRecordServiceImpl
@@ -59,10 +46,6 @@ public class MedicalRecordServiceImpl extends ServiceImpl<MedicalRecordMapper, M
59 46
     @Resource
60 47
     private IMedicalRecordDetailsService medicalRecordDetailsService;
61 48
     @Resource
62
-    private IDiagnosisTypeTemplateService diagnosisTypeTemplateService;
63
-    @Resource
64
-    private IDiagnosisTypeService diagnosisTypeService;
65
-    @Resource
66 49
     private IPatientAppointmentService patientAppointmentService;
67 50
     @Resource
68 51
     private ICollectCostPatientsService collectCostPatientsService;
@@ -70,45 +53,38 @@ public class MedicalRecordServiceImpl extends ServiceImpl<MedicalRecordMapper, M
70 53
     /**
71 54
      * 保存或编辑病历信息。
72 55
      *
73
-     * @param vo 包含病历及相关信息的参数对象。
56
+     * @param param 包含病历及相关信息的参数对象。
74 57
      * @author mtx
75 58
      * @date 2024/5/22 10:00
76 59
      */
77 60
     @Override
78 61
     @Transactional(rollbackFor = {Exception.class})
79
-    public void addOrEdit(MedicalRecordParamVO vo) {
80
-        // 检查病历详情列表是否为空
81
-        List<MedicalRecordVO> dataList = vo.getDataList();
82
-        if (CollectionUtils.isEmpty(dataList)) {
83
-            throw new RuntimeException("病历详情不能为空");
84
-        }
85
-
62
+    public void addOrEdit(MedicalRecordSaveParam param) {
86 63
         // 初始化病历对象并设置基本信息,保存病历信息
87
-        MedicalRecord medicalRecord = saveMedicalRecordInfo(vo);
64
+        MedicalRecord medicalRecord = saveMedicalRecordInfo(param);
88 65
 
89 66
         // 保存个人录入的病史信息到病历记录中
90
-        medicalHistoryService.saveMedicalHistoryToMedicalRecordIdByPatientId(medicalRecord.getPatientId(), medicalRecord.getId());
67
+        medicalHistoryService.saveMedicalHistoryByHistoryType(param, medicalRecord.getId());
91 68
 
92 69
         // 初始化标志位和计数器,用于后续处理
93 70
         AtomicBoolean flag = new AtomicBoolean(true);
94
-        AtomicInteger num = new AtomicInteger(1);
95 71
         List<MedicalRecordDetails> recordDetailsList = new ArrayList<>();
96 72
 
97
-        // 遍历病历详情列表,处理每条详情信息
98
-        dataList.forEach(medicalRecordVO -> {
99
-            List<MedicalRecordDetailsVO> data = medicalRecordVO.getData();
100
-
101
-            data.forEach(medicalRecordDetailsVO -> {
102
-                MedicalRecordDetails recordDetails = saveMedicalRecordDetails(medicalRecord.getId(), flag, num,
103
-                        medicalRecordVO.getToothStatus(), medicalRecordVO.getToothPosition(), medicalRecordDetailsVO);
73
+        List<MedicalRecordToothVO> dataList = param.getToothList();
74
+        if (CollectionUtils.isNotEmpty(dataList)) {
75
+            // 遍历病历详情列表,处理每条详情信息
76
+            dataList.forEach(medicalRecordToothVO -> {
77
+                MedicalRecordDetails recordDetails = new MedicalRecordDetails();
78
+                BeanUtils.copyProperties(medicalRecordToothVO, recordDetails);
79
+                recordDetails.setMedicalRecordId(medicalRecord.getId());
104 80
                 recordDetailsList.add(recordDetails);
105 81
             });
106
-        });
82
+        }
107 83
 
108 84
         // 修改预约状态
109
-        if (StringUtils.isNotBlank(vo.getAppointmentId())) {
85
+        if (StringUtils.isNotBlank(param.getAppointmentId())) {
110 86
             PatientAppointment appointment = new PatientAppointment();
111
-            appointment.setId(vo.getAppointmentId());
87
+            appointment.setId(param.getAppointmentId());
112 88
             appointment.setMedicalRecordId(medicalRecord.getId());
113 89
             appointment.setAppointmentStatus(flag.get() ? PatientAppointmentStatusEnum.TREATMENT_COMPLETED.getCode() : PatientAppointmentStatusEnum.IN_TREATMENT.getCode());
114 90
             patientAppointmentService.updateById(appointment);
@@ -128,214 +104,39 @@ public class MedicalRecordServiceImpl extends ServiceImpl<MedicalRecordMapper, M
128 104
         this.updateById(mr);
129 105
     }
130 106
 
131
-    /**
132
-     * 封装病历详情信息。
133
-     *
134
-     * @param medicalRecordId        病历
135
-     * @param flag                   标志位
136
-     * @param num                    排序
137
-     * @param toothStatus            牙位状态
138
-     * @param toothPosition          牙位
139
-     * @param medicalRecordDetailsVO 病历详情VO
140
-     * @return 返回结果
141
-     * @author mtx
142
-     * @date: 2024/7/18 15:01
143
-     */
144
-    private MedicalRecordDetails saveMedicalRecordDetails(String medicalRecordId, AtomicBoolean flag, AtomicInteger num, Integer toothStatus, String toothPosition, MedicalRecordDetailsVO medicalRecordDetailsVO) {
145
-        // 根据诊断类型模板ID获取模板信息
146
-        String templateId = medicalRecordDetailsVO.getDiagnosisTypeTemplateId();
147
-        DiagnosisTypeTemplate diagnosisTypeTemplate = diagnosisTypeTemplateService.getById(templateId);
148
-        if (Objects.isNull(diagnosisTypeTemplate)) {
149
-            throw new RuntimeException("诊断分类模板表获取失败");
150
-        }
151
-
152
-        // 处理选择项信息,如选项拼接
153
-        String option = "";
154
-        if (Objects.nonNull(medicalRecordDetailsVO.getFormattedParts())) {
155
-            option = medicalRecordDetailsVO.getFormattedParts().stream()
156
-                    .filter(li -> "select".equals(li.getType()))
157
-                    .map(FormattedPartsVO::getValue)
158
-                    .collect(Collectors.joining(","));
159
-        }
160
-
161
-        // 初始化并设置病历详情对象属性
162
-        MedicalRecordDetails recordDetails = new MedicalRecordDetails();
163
-        recordDetails.setMedicalRecordId(medicalRecordId);
164
-        recordDetails.setDiagnosisTypeTemplateId(templateId);
165
-        recordDetails.setDiagnosisTypeId(diagnosisTypeTemplate.getDiagnosisTypeId());
166
-        DiagnosisType diagnosisType = diagnosisTypeService.getById(diagnosisTypeTemplate.getDiagnosisTypeId());
167
-        if (Objects.nonNull(diagnosisType)) {
168
-            recordDetails.setDiagnosisTypeName(diagnosisType.getDiagnosisName());
169
-        }
170
-        recordDetails.setToothPosition(toothPosition);
171
-        if (Objects.isNull(toothStatus) || !MedicalRecordStatusEnum.ALREADY_COMPLETE.getCode().equals(toothStatus)) {
172
-            flag.set(false);
173
-        }
174
-        recordDetails.setToothStatus(toothStatus);
175
-        recordDetails.setTemplateName(medicalRecordDetailsVO.getTemplateName());
176
-        recordDetails.setTemplateExample(medicalRecordDetailsVO.getTemplateExample());
177
-        recordDetails.setTemplateInfo(medicalRecordDetailsVO.getTemplateInfo());
178
-        recordDetails.setTemplateOption(option);
179
-        recordDetails.setOrderNum(num.getAndIncrement());
180
-
181
-        String templateExample = recordDetails.getTemplateExample();
182
-        String templateInfo = diagnosisTypeTemplateService.findTemplateInfo(templateExample);
183
-
184
-        recordDetails.setContentInfo(
185
-                encapsulationTemplateInfo(templateInfo, recordDetails.getTemplateOption()));
186
-
187
-        List<String> list = new ArrayList<>();
188
-        String patientMedicalRecord = medicalRecordDetailsVO.getPatientMedicalRecord();
189
-        if (StringUtils.isNotBlank(patientMedicalRecord)) {
190
-            list.addAll(Arrays.asList(patientMedicalRecord.split(",")));
191
-        }
192
-        if ("过敏史".equals(medicalRecordDetailsVO.getTemplateName())) {
193
-            String collect = medicalRecordDetailsVO.getFormattedPartsList().stream()
194
-                    .filter(li -> !list.contains(li)).collect(Collectors.joining(","));
195
-
196
-            // 保存医生填写的病史
197
-            medicalHistoryService.saveMedicalHistoryList(
198
-                    collect, null, null,
199
-                    medicalRecordId, null, MedicalHistoryDiseaseSourceEnum.DOCTOR.getCode());
200
-        }
201
-        if ("既往史".equals(medicalRecordDetailsVO.getTemplateName())) {
202
-            String collect = medicalRecordDetailsVO.getFormattedPartsList().stream()
203
-                    .filter(li -> !list.contains(li)).collect(Collectors.joining(","));
204
-            // 保存医生填写的病史
205
-            medicalHistoryService.saveMedicalHistoryList(
206
-                    null, collect, null,
207
-                    medicalRecordId, null, MedicalHistoryDiseaseSourceEnum.DOCTOR.getCode());
208
-        }
209
-        if ("家族史".equals(medicalRecordDetailsVO.getTemplateName())) {
210
-            String collect = medicalRecordDetailsVO.getFormattedPartsList().stream()
211
-                    .filter(li -> !list.contains(li)).collect(Collectors.joining(","));
212
-            // 保存医生填写的病史
213
-            medicalHistoryService.saveMedicalHistoryList(
214
-                    null, null, collect,
215
-                    medicalRecordId, null, MedicalHistoryDiseaseSourceEnum.DOCTOR.getCode());
216
-        }
217
-
218
-        String jsonString = JSONArray.toJSONString(medicalRecordDetailsVO.getFormattedParts());
219
-        recordDetails.setTemplateView(jsonString);
220
-        return recordDetails;
221
-    }
222 107
 
223 108
     /**
224 109
      * 初始化病历对象并设置基本信息,保存病历信息
225 110
      *
226
-     * @param vo 参数
111
+     * @param param 参数
227 112
      * @return 返回
228 113
      */
229 114
     @Transactional(rollbackFor = {Exception.class})
230
-    public MedicalRecord saveMedicalRecordInfo(MedicalRecordParamVO vo) {
115
+    public MedicalRecord saveMedicalRecordInfo(MedicalRecordSaveParam param) {
231 116
         MedicalRecord medicalRecord = new MedicalRecord();
232
-        medicalRecord.setAttendingDoctorId(vo.getAttendingDoctorId());
233
-        medicalRecord.setAttendingDoctorName(UserCacheUtil.getSysUserById(vo.getAttendingDoctorId()).getNickName());
234
-        medicalRecord.setPatientId(vo.getPatientId());
235
-        medicalRecord.setStatus(vo.getStatus());
117
+        medicalRecord.setPatientId(param.getPatientId());
118
+        medicalRecord.setVisitType(param.getVisitType());
119
+        medicalRecord.setAttendingDoctorId(param.getAttendingDoctorId());
120
+        medicalRecord.setAttendingDoctorName(UserCacheUtil.getSysUserById(param.getAttendingDoctorId()).getNickName());
236 121
         medicalRecord.setOutpatientService(UserCacheUtil.getClinicName());
237
-        medicalRecord.setDepartment(UserCacheUtil.getSysDeptByUserId(vo.getAttendingDoctorId()).getDeptName());
122
+        medicalRecord.setDepartment(UserCacheUtil.getSysDeptByUserId(param.getAttendingDoctorId()).getDeptName());
238 123
         medicalRecord.setCost(BigDecimal.ZERO);
239 124
 
240
-        if (Objects.nonNull(vo.getId())) {
241
-            medicalRecord.setId(vo.getId());
242
-        }
243
-        medicalRecord.setVisitType(vo.getVisitType());
244
-        this.saveOrUpdate(medicalRecord);
245
-        return medicalRecord;
246
-    }
125
+        medicalRecord.setChiefComplaintContent(param.getChiefComplaintContent());
126
+        medicalRecord.setPresentIllnessContent(param.getPresentIllnessContent());
127
+        medicalRecord.setInspectContent(param.getInspectContent());
128
+        medicalRecord.setTreatmentPlanningContent(param.getTreatmentPlanningContent());
129
+        medicalRecord.setDisposeContent(param.getDisposeContent());
130
+        medicalRecord.setNoteContent(param.getNoteContent());
131
+        medicalRecord.setDiagnosisContent(param.getDiagnosisContent());
247 132
 
248
-    /**
249
-     * 封装病历信息
250
-     *
251
-     * @param medicalRecord 病历信息
252
-     * @return 病历信息
253
-     * @author mtx
254
-     * @date: 2024/5/23 9:17
255
-     */
256
-    @Override
257
-    public MedicalRecordParamVO getMedicalRecordVO(MedicalRecord medicalRecord) {
258
-        // 创建一个新的VO对象,用于存储处理后的病历信息
259
-        MedicalRecordParamVO vo = new MedicalRecordParamVO();
260
-        // 将病历实体的基本信息赋值给VO对象
261
-        vo.setId(medicalRecord.getId());
262
-        vo.setVisitType(medicalRecord.getVisitType());
263
-        vo.setStatus(medicalRecord.getStatus());
264
-        vo.setPatientId(medicalRecord.getPatientId());
265
-        vo.setAttendingDoctorId(medicalRecord.getAttendingDoctorId());
266
-        vo.setAttendingDoctorName(medicalRecord.getAttendingDoctorName());
267
-
268
-        vo.setDepartment(medicalRecord.getDepartment());
269
-        vo.setCost(medicalRecord.getCost());
270
-        vo.setClinicName(medicalRecord.getOutpatientService());
271
-        vo.setCreateDate(medicalRecord.getCreateDate());
272
-
273
-        // 初始化存储详细数据的列表
274
-        List<MedicalRecordVO> dataList = new ArrayList<>();
275
-        // 根据病历ID查询详细的医疗记录
276
-        List<MedicalRecordDetails> list = medicalRecordDetailsService.list(Wrappers.<MedicalRecordDetails>lambdaQuery()
277
-                .eq(MedicalRecordDetails::getMedicalRecordId, medicalRecord.getId())
278
-                .orderByAsc(MedicalRecordDetails::getOrderNum));
279
-        // 将详细信息按牙齿位置分组
280
-        Map<String, List<MedicalRecordDetails>> collect = list.stream().collect(Collectors.groupingBy(MedicalRecordDetails::getToothPosition));
281
-        // 遍历分组后的数据
282
-        for (String key : collect.keySet()) {
283
-            MedicalRecordVO medicalRecordVO = new MedicalRecordVO();
284
-            medicalRecordVO.setToothPosition(key);
133
+        medicalRecord.setSaveStatus(param.getSaveStatus());
285 134
 
286
-            List<MedicalRecordDetails> detailsList = collect.get(key);
287
-            // 如果详细数据为空,则在VO中设置为空列表
288
-            if (CollectionUtils.isEmpty(detailsList)) {
289
-                medicalRecordVO.setData(new ArrayList<>());
290
-            } else {
291
-                // 处理每个牙齿的详细信息,并将其添加到VO中
292
-                List<MedicalRecordDetailsVO> details = new ArrayList<>();
293
-                detailsList.stream().sorted(Comparator.comparing(MedicalRecordDetails::getOrderNum)).forEach(li -> {
294
-                    MedicalRecordDetailsVO medicalRecordDetailsVO = new MedicalRecordDetailsVO();
295
-
296
-                    // 根据模板名称,填充VO中的对应信息
297
-                    if ("诊断".equals(li.getTemplateName()) && StringUtils.isBlank(vo.getDiagnosisTypeCn())) {
298
-                        vo.setDiagnosisTypeCn(li.getDiagnosisTypeName());
299
-                    }
300
-                    if ("治疗计划".equals(li.getTemplateName()) && StringUtils.isBlank(vo.getTreatment())) {
301
-                        vo.setTreatment(li.getContentInfo());
302
-                    }
303
-                    medicalRecordVO.setToothStatus(li.getToothStatus());
304
-
305
-                    // 将详细信息的各个字段从实体对象复制到VO对象
306
-                    medicalRecordDetailsVO.setMedicalRecordDetailsId(li.getId());
307
-                    medicalRecordDetailsVO.setDiagnosisTypeTemplateId(li.getDiagnosisTypeTemplateId());
308
-                    medicalRecordDetailsVO.setDiagnosisTypeId(li.getDiagnosisTypeId());
309
-                    medicalRecordDetailsVO.setDiagnosisTypeCn(li.getDiagnosisTypeName());
310
-                    medicalRecordDetailsVO.setTemplateName(li.getTemplateName());
311
-                    medicalRecordDetailsVO.setTemplateExample(li.getTemplateExample());
312
-                    medicalRecordDetailsVO.setTemplateExample2(li.getTemplateExample());
313
-                    medicalRecordDetailsVO.setContentInfo(li.getContentInfo());
314
-                    medicalRecordDetailsVO.setTemplateInfo(li.getTemplateInfo());
315
-                    medicalRecordDetailsVO.setTemplateOption(li.getTemplateOption());
316
-
317
-                    // 根据病历ID查询相关的病史信息,并根据类型进行处理
318
-                    List<MedicalHistory> histories = medicalHistoryService.list(Wrappers.<MedicalHistory>lambdaQuery().eq(MedicalHistory::getMedicalRecordId, li.getMedicalRecordId()));
319
-                    if (MedicalHistoryDiseaseTypeEnum.ALLERGY_HISTORY.getInfo().equals(li.getTemplateName())) {
320
-                        findMedicalHistory(medicalRecordDetailsVO, histories, MedicalHistoryDiseaseTypeEnum.ALLERGY_HISTORY.getCode());
321
-                    } else if (MedicalHistoryDiseaseTypeEnum.PAST_HISTORY.getInfo().equals(li.getTemplateName())) {
322
-                        findMedicalHistory(medicalRecordDetailsVO, histories, MedicalHistoryDiseaseTypeEnum.PAST_HISTORY.getCode());
323
-                    } else if (MedicalHistoryDiseaseTypeEnum.FAMILY_HISTORY.getInfo().equals(li.getTemplateName())) {
324
-                        findMedicalHistory(medicalRecordDetailsVO, histories, MedicalHistoryDiseaseTypeEnum.FAMILY_HISTORY.getCode());
325
-                    }
326
-
327
-                    // 处理模板视图信息,并将其转换为VO对象
328
-                    medicalRecordDetailsVO.setFormattedParts(JSONArray.parseArray(li.getTemplateView(), FormattedPartsVO.class));
329
-                    details.add(medicalRecordDetailsVO);
330
-                });
331
-                // 将处理后的详细数据添加到VO中
332
-                medicalRecordVO.setData(details);
333
-            }
334
-            dataList.add(medicalRecordVO);
135
+        if (Objects.nonNull(param.getId())) {
136
+            medicalRecord.setId(param.getId());
335 137
         }
336
-
337
-        vo.setDataList(dataList);
338
-        return vo;
138
+        this.saveOrUpdate(medicalRecord);
139
+        return medicalRecord;
339 140
     }
340 141
 
341 142
     /**
@@ -348,87 +149,35 @@ public class MedicalRecordServiceImpl extends ServiceImpl<MedicalRecordMapper, M
348 149
      */
349 150
     @Override
350 151
     public List<MedicalRecordListDto> medicalRecordList(String searchParam) {
351
-        List<MedicalRecordListDto> dtos = this.getBaseMapper().medicalRecordList(null);
352
-        if (CollectionUtils.isEmpty(dtos)) {
353
-            return dtos;
354
-        }
355
-        for (MedicalRecordListDto dto : dtos) {
356
-            String id = dto.getId();
357
-            List<MedicalRecordDetails> list = medicalRecordDetailsService.list(Wrappers.<MedicalRecordDetails>lambdaQuery()
358
-                    .eq(MedicalRecordDetails::getMedicalRecordId, id));
359
-            if (CollectionUtils.isEmpty(list)) {
360
-                continue;
361
-            }
362
-            String collect = list.stream().map(MedicalRecordDetails::getContentInfo)
363
-                    .filter(StringUtils::isNotBlank).collect(Collectors.joining(","));
364
-            dto.setContentInfo(collect);
365
-        }
366
-        if (StringUtils.isNotBlank(searchParam)) {
367
-            dtos = dtos.stream().filter(dto -> dto.getContentInfo().contains(searchParam)
368
-                    || dto.getAttendingDoctorName().contains(searchParam)
369
-                    || dto.getPatientName().contains(searchParam)).collect(Collectors.toList());
370
-        }
371
-        return dtos;
152
+        return this.getBaseMapper().medicalRecordList(searchParam);
372 153
     }
373 154
 
374 155
     /**
375
-     * 根据用户编号和疾病类型,查找并设置病人的医疗记录详情。
376
-     * 此方法会分别筛选出患者自述和医生诊断的疾病内容,并将其分别设置到医疗记录详情对象中。
377
-     * 同时,还会设置一份格式化的疾病内容列表。
156
+     * 统计诊断分类
378 157
      *
379
-     * @param medicalRecordDetailsVO 医疗记录详情对象,用于存储查询结果。
380
-     * @param histories              病历库中的所有病历记录列表。
381
-     * @param diseaseType            疾病类型,用于筛选特定类型的病历。
158
+     * @return 统计结果
159
+     * @author mtx
160
+     * @date: 2024/6/5 9:10
382 161
      */
383
-    private void findMedicalHistory(MedicalRecordDetailsVO medicalRecordDetailsVO, List<MedicalHistory> histories, Integer diseaseType) {
384
-        // 根据疾病类型筛选出相应的病历记录
385
-        List<MedicalHistory> collect = histories.stream().filter(l -> diseaseType.equals(l.getDiseaseType())).collect(Collectors.toList());
386
-
387
-        // 设置患者自述的疾病内容,以逗号分隔
388
-        medicalRecordDetailsVO.setPatientMedicalRecord(collect.stream()
389
-                .filter(l -> MedicalHistoryDiseaseSourceEnum.PATIENT.getCode().equals(l.getDiseaseSource()))
390
-                .map(MedicalHistory::getDiseaseContent).collect(Collectors.joining(",")));
391
-
392
-        // 设置医生诊断的疾病内容,以逗号分隔
393
-        medicalRecordDetailsVO.setDoctorMedicalRecord(collect.stream()
394
-                .filter(l -> MedicalHistoryDiseaseSourceEnum.DOCTOR.getCode().equals(l.getDiseaseSource()))
395
-                .map(MedicalHistory::getDiseaseContent).collect(Collectors.joining(",")));
396
-
397
-        // 设置格式化的疾病内容列表,包含所有病历的疾病内容
398
-        medicalRecordDetailsVO.setFormattedPartsList(collect.stream().map(MedicalHistory::getDiseaseContent).collect(Collectors.toList()));
162
+    @Override
163
+    public List<Map<String, String>> countByDiagnosisTypeName() {
164
+        return this.baseMapper.countByDiagnosisTypeName();
399 165
     }
400 166
 
401 167
     /**
402
-     * 根据模板选项,将模板选项替换成模板示例
168
+     * 根据牙齿位置检查访问类型
403 169
      *
404
-     * @param templateInfo   模板信息
405
-     * @param templateOption 模板选项
406
-     * @return 替换后的数据
407
-     * @author mtx
408
-     * @date: 2024/5/23 9:15
170
+     * @return 返回访问类型,具体类型根据业务逻辑确定
409 171
      */
410
-    public String encapsulationTemplateInfo(String templateInfo, String templateOption) {
411
-        if (StringUtils.isEmpty(templateInfo)) {
412
-            return null;
413
-        }
414
-
415
-        String[] split = templateOption.split(",");
416
-        String keyPrefix = PatientConstant.DIAGNOSIS_TYPE_TEMPLATE_KEY_PREFIX;
417
-        int count = 0, i = 0;
418
-        while (templateInfo.indexOf(keyPrefix, i) >= 0) {
419
-            count++;
420
-            i = templateInfo.indexOf(keyPrefix, i) + keyPrefix.length();
172
+    @Override
173
+    public List<MedicalRecord> findListByToothPosition(MedicalRecordHistoryDto dto) {
174
+        if (CollectionUtils.isEmpty(dto.getToothPositionList())) {
175
+            return new ArrayList<>();
421 176
         }
422
-
423
-        for (int j = 0; j < count; j++) {
424
-            int i1 = j + 1;
425
-            String s = "";
426
-            try {
427
-                s = split[j];
428
-            } catch (Exception ignored) {
429
-            }
430
-            templateInfo = templateInfo.replace(keyPrefix + i1, s);
177
+        if (StringUtils.isBlank(dto.getPatientId())) {
178
+            throw new IllegalArgumentException("患者ID不能为空");
431 179
         }
432
-        return templateInfo;
180
+        return this.baseMapper.findListByToothPosition(dto);
433 181
     }
182
+
434 183
 }

+ 14 - 0
eitc-patient-base/src/main/java/com/eitc/patient/tree/DiagnosisTypeTree.java

@@ -19,6 +19,20 @@ import java.util.List;
19 19
 @ApiModel("诊断分类表")
20 20
 public class DiagnosisTypeTree extends DiagnosisType {
21 21
 
22
+    private String diagnosisManageId;
23
+
24
+    @ApiModelProperty(value = "模板描述", name = "templateDesc")
25
+    private String templateDesc;
26
+
27
+    @ApiModelProperty(value = "诊断名称首拼", name = "diagnosisNamePinyinFirstLetter")
28
+    private String diagnosisNamePinyinFirstLetter;
29
+
30
+    @ApiModelProperty(value = "诊断名称拼音", name = "diagnosisNamePinyin")
31
+    private String diagnosisNamePinyin;
32
+
33
+    @ApiModelProperty(value = "就诊类型(1初诊,2复诊)", name = "visitType")
34
+    private Integer visitType;
35
+
22 36
     @ApiModelProperty(value = "子集", name = "childrenList")
23 37
     private List<DiagnosisTypeTree> childrenList;
24 38
 

+ 0 - 103
eitc-patient-base/src/main/java/com/eitc/patient/utils/PatientUtil.java

@@ -2,7 +2,6 @@ package com.eitc.patient.utils;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
4 4
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
5
-import com.eitc.common.core.domain.entity.SysDictData;
6 5
 import com.eitc.common.core.domain.entity.SysRole;
7 6
 import com.eitc.common.core.domain.entity.SysUser;
8 7
 import com.eitc.common.core.domain.model.LoginUser;
@@ -11,14 +10,12 @@ import com.eitc.common.utils.PatientBaseUtil;
11 10
 import com.eitc.common.utils.SecurityUtils;
12 11
 import com.eitc.common.utils.spring.SpringUtils;
13 12
 import com.eitc.framework.security.context.PermissionContextHolder;
14
-import com.eitc.patient.constant.PatientConstant;
15 13
 import com.eitc.patient.domain.ClinicInfo;
16 14
 import com.eitc.patient.domain.SchedulingDetails;
17 15
 import com.eitc.patient.domain.SchedulingStatus;
18 16
 import com.eitc.patient.service.IClinicInfoService;
19 17
 import com.eitc.patient.service.ISchedulingDetailsService;
20 18
 import com.eitc.patient.service.ISchedulingStatusService;
21
-import com.eitc.system.service.ISysDictDataService;
22 19
 import com.eitc.system.service.ISysUserService;
23 20
 import org.apache.commons.lang3.StringUtils;
24 21
 import org.springframework.stereotype.Component;
@@ -38,33 +35,11 @@ import java.util.stream.Collectors;
38 35
  */
39 36
 @Component
40 37
 public class PatientUtil {
41
-    private final static ISysDictDataService sysDictDataService = SpringUtils.getBean(ISysDictDataService.class);
42 38
     private final static ISchedulingDetailsService schedulingDetailsService = SpringUtils.getBean(ISchedulingDetailsService.class);
43 39
     private final static ISchedulingStatusService schedulingStatusService = SpringUtils.getBean(ISchedulingStatusService.class);
44 40
     private final static IClinicInfoService clinicInfoService = SpringUtils.getBean(IClinicInfoService.class);
45 41
 
46 42
     /**
47
-     * 获取诊断类型模板的键列表。
48
-     * 该方法通过查询系统字典数据,获取特定类型(诊断类型模板名称)的所有字典项,
49
-     * 并将这些字典项的标签(dictLabel)收集到一个列表中返回。
50
-     * 如果查询结果为空,则返回一个空列表。
51
-     *
52
-     * @return List<String> 包含所有诊断类型模板键的列表。
53
-     */
54
-    public static List<String> diagnosisTypeTemplateKeyList() {
55
-        // 根据诊断类型模板名称查询系统字典数据
56
-        List<SysDictData> sysDictData = sysDictDataService.selectDictDataByType(PatientConstant.DICT_KEY_DIAGNOSIS_TYPE_TEMPLATE_NAME);
57
-
58
-        // 如果查询结果为空,则返回一个空列表
59
-        if (CollectionUtils.isEmpty(sysDictData)) {
60
-            return new ArrayList<>();
61
-        }
62
-
63
-        // 将查询到的字典数据的标签映射为列表,并返回该列表
64
-        return sysDictData.stream().map(SysDictData::getDictLabel).collect(Collectors.toList());
65
-    }
66
-
67
-    /**
68 43
      * 根据给定的星期几的数字返回对应的中文星期名称。
69 44
      * 使用Calendar类中的常量来表示星期几,提高代码的可读性和维护性。
70 45
      *
@@ -204,84 +179,6 @@ public class PatientUtil {
204 179
         return new ArrayList<>();
205 180
     }
206 181
 
207
-
208
-    /**
209
-     * 根据牙齿位置代码初始化牙齿位置描述
210
-     *
211
-     * @param toothPosition 牙齿位置代码,例如"upLeft1"
212
-     * @return 牙齿位置描述,如果代码无效,则返回"-"
213
-     */
214
-    public static String initToothPosition(String toothPosition) {
215
-        switch (toothPosition) {
216
-            case "upLeft1":
217
-                return "上左牙位1";
218
-            case "upLeft2":
219
-                return "上左牙位2";
220
-            case "upLeft3":
221
-                return "上左牙位3";
222
-            case "upLeft4":
223
-                return "上左牙位4";
224
-            case "upLeft5":
225
-                return "上左牙位5";
226
-            case "upLeft6":
227
-                return "上左牙位6";
228
-            case "upLeft7":
229
-                return "上左牙位7";
230
-            case "upLeft8":
231
-                return "上左牙位8";
232
-            case "upRight1":
233
-                return "上右牙位1";
234
-            case "upRight2":
235
-                return "上右牙位2";
236
-            case "upRight3":
237
-                return "上右牙位3";
238
-            case "upRight4":
239
-                return "上右牙位4";
240
-            case "upRight5":
241
-                return "上右牙位5";
242
-            case "upRight6":
243
-                return "上右牙位6";
244
-            case "upRight7":
245
-                return "上右牙位7";
246
-            case "upRight8":
247
-                return "上右牙位8";
248
-            case "downLeft1":
249
-                return "下左牙位1";
250
-            case "downLeft2":
251
-                return "下左牙位2";
252
-            case "downLeft3":
253
-                return "下左牙位3";
254
-            case "downLeft4":
255
-                return "下左牙位4";
256
-            case "downLeft5":
257
-                return "下左牙位5";
258
-            case "downLeft6":
259
-                return "下左牙位6";
260
-            case "downLeft7":
261
-                return "下左牙位7";
262
-            case "downLeft8":
263
-                return "下左牙位8";
264
-            case "downRight1":
265
-                return "下左牙位1";
266
-            case "downRight2":
267
-                return "下左牙位2";
268
-            case "downRight3":
269
-                return "下左牙位3";
270
-            case "downRight4":
271
-                return "下左牙位4";
272
-            case "downRight5":
273
-                return "下左牙位5";
274
-            case "downRight6":
275
-                return "下左牙位6";
276
-            case "downRight7":
277
-                return "下左牙位7";
278
-            case "downRight8":
279
-                return "下左牙位8";
280
-            default:
281
-                return "-";
282
-        }
283
-    }
284
-
285 182
     /**
286 183
      * 全部数据权限
287 184
      */

+ 49 - 2
eitc-patient-base/src/main/java/com/eitc/patient/vo/DiagnosisTypeTemplateSaveVO.java

@@ -1,10 +1,12 @@
1 1
 package com.eitc.patient.vo;
2 2
 
3
+import com.baomidou.mybatisplus.annotation.TableField;
3 4
 import io.swagger.annotations.ApiModel;
4 5
 import io.swagger.annotations.ApiModelProperty;
5 6
 import lombok.Data;
6 7
 
7 8
 import javax.validation.constraints.NotBlank;
9
+import javax.validation.constraints.NotNull;
8 10
 import java.util.List;
9 11
 
10 12
 /**
@@ -17,11 +19,56 @@ import java.util.List;
17 19
 @ApiModel("诊断分类模板保存参数")
18 20
 public class DiagnosisTypeTemplateSaveVO {
19 21
 
22
+    private String id;
23
+
20 24
     @NotBlank(message = "诊断分类id不能为空")
21 25
     @ApiModelProperty(value = "诊断分类id", name = "diagnosisTypeId")
22 26
     private String diagnosisTypeId;
23 27
 
24
-    @ApiModelProperty(value = "模板列表", required = true, name = "diagnosisTypeTemplateList")
25
-    private List<DiagnosisTypeTemplateVO> diagnosisTypeTemplateList;
28
+    @ApiModelProperty(value = "模板名称", name = "templateName")
29
+    @NotBlank(message = "模板名称不能为空")
30
+    private String templateName;
31
+
32
+    @ApiModelProperty(value = "模板描述", name = "templateDesc")
33
+    @NotBlank(message = "模板描述不能为空")
34
+    private String templateDesc;
35
+
36
+    @ApiModelProperty(value = "诊断管理id", name = "diagnosisManageId")
37
+    @NotBlank(message = "诊断管理id不能为空")
38
+    private String diagnosisManageId;
39
+
40
+    @ApiModelProperty(value = "适用科室", name = "applyDept")
41
+    @NotNull(message = "适用科室不能为空")
42
+    private List<Long> applyDeptList;
43
+
44
+    @ApiModelProperty(value = "就诊类型(1初诊,2复诊)", name = "visitType")
45
+    @NotNull(message = "就诊类型不能为空")
46
+    private Integer visitType;
47
+
48
+    @ApiModelProperty(value = "启用状态(1启用,0未启用)", name = "enableStatus")
49
+    @NotNull(message = "启用状态不能为空")
50
+    private Integer enableStatus;
51
+
52
+    @ApiModelProperty(value = "主诉内容", name = "chiefComplaintContent")
53
+    @NotBlank(message = "主诉内容不能为空")
54
+    private String chiefComplaintContent;
55
+
56
+    @ApiModelProperty(value = "现病史内容", name = "presentIllnessContent")
57
+    private String presentIllnessContent;
58
+
59
+    @ApiModelProperty(value = "检查内容", name = "inspectContent")
60
+    @NotBlank(message = "检查内容不能为空")
61
+    private String inspectContent;
62
+
63
+    @ApiModelProperty(value = "治疗计划内容", name = "treatmentPlanningContent")
64
+    @NotBlank(message = "治疗计划内容不能为空")
65
+    private String treatmentPlanningContent;
66
+
67
+    @ApiModelProperty(value = "处置内容", name = "disposeContent")
68
+    @NotBlank(message = "处置内容不能为空")
69
+    private String disposeContent;
70
+
71
+    @ApiModelProperty(value = "便签", name = "noteContent")
72
+    private String noteContent;
26 73
 
27 74
 }

+ 7 - 9
eitc-patient-base/src/main/java/com/eitc/patient/vo/DiagnosisTypeTemplateVO.java

@@ -1,10 +1,12 @@
1 1
 package com.eitc.patient.vo;
2 2
 
3
+import com.eitc.patient.domain.DiagnosisTypeTemplate;
3 4
 import io.swagger.annotations.ApiModel;
4 5
 import io.swagger.annotations.ApiModelProperty;
5 6
 import lombok.Data;
7
+import lombok.EqualsAndHashCode;
6 8
 
7
-import javax.validation.constraints.NotBlank;
9
+import java.util.List;
8 10
 
9 11
 /**
10 12
  * DiagnosisTypeTemplateVO
@@ -12,16 +14,12 @@ import javax.validation.constraints.NotBlank;
12 14
  * @author mtx
13 15
  * @date: 2024/05/30 11:06
14 16
  */
17
+@EqualsAndHashCode(callSuper = true)
15 18
 @Data
16 19
 @ApiModel("诊断分类模板表")
17
-public class DiagnosisTypeTemplateVO {
20
+public class DiagnosisTypeTemplateVO extends DiagnosisTypeTemplate {
18 21
 
19
-    @ApiModelProperty(value = "模板名称", name = "templateName")
20
-    @NotBlank(message = "模板名称不能为空")
21
-    private String templateName;
22
-
23
-    @ApiModelProperty(value = "模板示例", name = "templateExample")
24
-    @NotBlank(message = "模板示例不能为空")
25
-    private String templateExample;
22
+    @ApiModelProperty(value = "科室列表", name = "deptIdList")
23
+    private List<Long> applyDeptList;
26 24
 
27 25
 }

+ 0 - 31
eitc-patient-base/src/main/java/com/eitc/patient/vo/FormattedPartsVO.java

@@ -1,31 +0,0 @@
1
-package com.eitc.patient.vo;
2
-
3
-import io.swagger.annotations.ApiModel;
4
-import io.swagger.annotations.ApiModelProperty;
5
-import lombok.Data;
6
-
7
-import java.util.List;
8
-import java.util.Map;
9
-
10
-/**
11
- * FormattedPartsVO
12
- *
13
- * @author mtx
14
- * @date: 2024/06/07 8:57
15
- */
16
-@Data
17
-@ApiModel("病例详情表")
18
-public class FormattedPartsVO {
19
-
20
-    @ApiModelProperty(value = "类型", name = "type")
21
-    private String type;
22
-    @ApiModelProperty(value = "文本", name = "text")
23
-    private String text;
24
-    @ApiModelProperty(value = "值", name = "value")
25
-    private String value;
26
-    @ApiModelProperty(value = "选项", name = "options")
27
-    private List<Map<String, String>> options;
28
-    @ApiModelProperty(value = "索引", name = "index")
29
-    private int index;
30
-
31
-}

+ 0 - 64
eitc-patient-base/src/main/java/com/eitc/patient/vo/MedicalRecordDetailsVO.java

@@ -1,64 +0,0 @@
1
-package com.eitc.patient.vo;
2
-
3
-import io.swagger.annotations.ApiModel;
4
-import io.swagger.annotations.ApiModelProperty;
5
-import lombok.Data;
6
-
7
-import java.util.List;
8
-
9
-/**
10
- * MedicalRecordDetails
11
- *
12
- * @author mtx
13
- * @date: 2024/05/17 14:44
14
- */
15
-@Data
16
-@ApiModel("病例详情表")
17
-public class MedicalRecordDetailsVO {
18
-
19
-    private String medicalRecordDetailsId;
20
-    @ApiModelProperty(value = "诊断分类模板id", name = "diagnosisTypeTemplateId")
21
-    private String diagnosisTypeTemplateId;
22
-
23
-    @ApiModelProperty(value = "诊断分类id", name = "diagnosisTypeId")
24
-    private String diagnosisTypeId;
25
-
26
-    @ApiModelProperty(value = "诊断分类Cn", name = "diagnosisTypeCn")
27
-    private String diagnosisTypeCn;
28
-
29
-    @ApiModelProperty(value = "牙位", name = "toothPosition")
30
-    private String toothPosition;
31
-
32
-    @ApiModelProperty(value = "模板名称", name = "templateName")
33
-    private String templateName;
34
-
35
-    @ApiModelProperty(value = "模板示例", name = "templateExample")
36
-    private String templateExample;
37
-
38
-    @ApiModelProperty(value = "模板示例", name = "templateExample2")
39
-    private String templateExample2;
40
-
41
-    @ApiModelProperty(value = "内容信息", name = "contentInfo")
42
-    private String contentInfo;
43
-
44
-    @ApiModelProperty(value = "模板信息", name = "templateInfo")
45
-    private String templateInfo;
46
-
47
-    @ApiModelProperty(value = "模板选项", name = "templateOption")
48
-    private String templateOption;
49
-
50
-    @ApiModelProperty(value = "患者病史", name = "patientMedicalRecord")
51
-    private String patientMedicalRecord;
52
-
53
-    @ApiModelProperty(value = "医生录入病史", name = "doctorMedicalRecord")
54
-    private String doctorMedicalRecord;
55
-
56
-    private List<String> formattedPartsList;
57
-
58
-    @ApiModelProperty(value = "选项", name = "formattedParts")
59
-    private List<FormattedPartsVO> formattedParts;
60
-
61
-    private boolean flag = false;
62
-    private boolean flagCheck;
63
-
64
-}

+ 44 - 0
eitc-patient-base/src/main/java/com/eitc/patient/vo/MedicalRecordListVO.java

@@ -0,0 +1,44 @@
1
+package com.eitc.patient.vo;
2
+
3
+import com.eitc.patient.domain.MedicalRecord;
4
+import com.eitc.patient.domain.MedicalRecordDetails;
5
+import io.swagger.annotations.ApiModel;
6
+import io.swagger.annotations.ApiModelProperty;
7
+import lombok.Data;
8
+import lombok.EqualsAndHashCode;
9
+
10
+import java.util.List;
11
+
12
+/**
13
+ * MedicalRecordListDto
14
+ *
15
+ * @author mtx
16
+ * @date: 2024/07/17 17:04
17
+ */
18
+@EqualsAndHashCode(callSuper = true)
19
+@Data
20
+@ApiModel("病例表")
21
+public class MedicalRecordListVO extends MedicalRecord {
22
+
23
+    @ApiModelProperty(value = "患者过敏史", name = "patientAllergyHistory")
24
+    private List<String> patientAllergyHistory;
25
+
26
+    @ApiModelProperty(value = "医生过敏史", name = "doctorAllergyHistory")
27
+    private List<String> doctorAllergyHistory;
28
+
29
+    @ApiModelProperty(value = "患者既往史", name = "patientPastHistory")
30
+    private List<String> patientPastHistory;
31
+
32
+    @ApiModelProperty(value = "医生既往史", name = "doctorPastHistory")
33
+    private List<String> doctorPastHistory;
34
+
35
+    @ApiModelProperty(value = "患者家族史", name = "patientFamilyHistory")
36
+    private List<String> patientFamilyHistory;
37
+
38
+    @ApiModelProperty(value = "医生家族史", name = "doctorFamilyHistory")
39
+    private List<String> doctorFamilyHistory;
40
+
41
+
42
+    @ApiModelProperty(value = "病例牙位列表", name = "recordDetailsList")
43
+    private List<MedicalRecordDetails> recordDetailsList;
44
+}

+ 33 - 0
eitc-patient-base/src/main/java/com/eitc/patient/vo/MedicalRecordNoteVO.java

@@ -0,0 +1,33 @@
1
+package com.eitc.patient.vo;
2
+
3
+import com.fasterxml.jackson.annotation.JsonFormat;
4
+import io.swagger.annotations.ApiModel;
5
+import io.swagger.annotations.ApiModelProperty;
6
+import lombok.Data;
7
+
8
+import java.util.Date;
9
+import java.util.List;
10
+
11
+/**
12
+ * MedicalRecordNoteVO
13
+ *
14
+ * @author mtx
15
+ * @date: 2024/05/17 14:42
16
+ */
17
+@Data
18
+@ApiModel("便签")
19
+public class MedicalRecordNoteVO {
20
+
21
+    @ApiModelProperty(value = "便签", name = "noteContent")
22
+    private String noteContent;
23
+
24
+    @ApiModelProperty(value = "诊断", name = "diagnosisContent")
25
+    private String diagnosisContent;
26
+
27
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
28
+    @ApiModelProperty(value = "创建时间", hidden = true)
29
+    private Date createDate;
30
+
31
+    List<MedicalRecordToothVO> toothList;
32
+
33
+}

+ 0 - 53
eitc-patient-base/src/main/java/com/eitc/patient/vo/MedicalRecordParamVO.java

@@ -1,53 +0,0 @@
1
-package com.eitc.patient.vo;
2
-
3
-import com.fasterxml.jackson.annotation.JsonFormat;
4
-import io.swagger.annotations.ApiModelProperty;
5
-import lombok.Data;
6
-
7
-import java.math.BigDecimal;
8
-import java.util.Date;
9
-import java.util.List;
10
-
11
-/**
12
- * MedicalRecordParamVO
13
- *
14
- * @author mtx
15
- * @date: 2024/06/07 9:38
16
- */
17
-@Data
18
-public class MedicalRecordParamVO {
19
-
20
-    private String id;
21
-    @ApiModelProperty(value = "预约id", name = "appointmentId")
22
-    private String appointmentId;
23
-    @ApiModelProperty(value = "患者id", name = "patientId")
24
-    private String patientId;
25
-    @ApiModelProperty(value = "状态(1未完成,2已完成治疗)", name = "status")
26
-    private Integer status;
27
-    @ApiModelProperty(value = "就诊类型(1初诊,2复诊)", name = "visitType")
28
-    private Integer visitType;
29
-    @ApiModelProperty(value = "主治医生", name = "attendingDoctorId")
30
-    private Long attendingDoctorId;
31
-
32
-    @ApiModelProperty(value = "科室", name = "department")
33
-    private String department;
34
-    @ApiModelProperty(value = "主治医生", name = "attendingDoctorName")
35
-    private String attendingDoctorName;
36
-    @ApiModelProperty(value = "费用", name = "cost")
37
-    private BigDecimal cost;
38
-    @ApiModelProperty(value = "诊所名称", name = "clinicName")
39
-    private String clinicName;
40
-
41
-    @ApiModelProperty(value = "诊断分类名称", name = "diagnosisTypeCn")
42
-    private String diagnosisTypeCn;
43
-    @ApiModelProperty(value = "治疗", name = "treatment")
44
-    private String treatment;
45
-
46
-    @ApiModelProperty(value = "创建时间", name = "createDate")
47
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
48
-    private Date createDate;
49
-
50
-    @ApiModelProperty(value = "病历详情", name = "dataList")
51
-    private List<MedicalRecordVO> dataList;
52
-
53
-}

+ 36 - 10
eitc-patient-base/src/main/java/com/eitc/patient/vo/MedicalRecordTemplateVO.java

@@ -6,20 +6,16 @@ import io.swagger.annotations.ApiModelProperty;
6 6
 import lombok.Data;
7 7
 
8 8
 import java.util.Date;
9
-import java.util.List;
10
-import java.util.Map;
11 9
 
12 10
 /**
13
- * MedicalRecordTemplate
11
+ * MedicalRecordVO
14 12
  *
15 13
  * @author mtx
16
- * @date: 2024/06/05 8:34
14
+ * @date: 2024/05/17 14:42
17 15
  */
18 16
 @Data
19
-@ApiModel("病例详情表")
20
-public class MedicalRecordTemplateVO {
21
-
22
-//    private String medicalRecordId;
17
+@ApiModel("打印病例")
18
+public class MedicalRecordToPdf {
23 19
 
24 20
     @ApiModelProperty(value = "患者姓名", name = "patientName")
25 21
     private String patientName;
@@ -61,8 +57,38 @@ public class MedicalRecordTemplateVO {
61 57
     @ApiModelProperty(value = "公司名称", name = "companyName")
62 58
     private String companyName;
63 59
 
64
-    private Map<String, List<MedicalRecordDetailsVO>> listMap;
65
-
66 60
     private String content;
67 61
 
62
+
63
+    @ApiModelProperty(value = "主诉内容", name = "chiefComplaintContent")
64
+    private String chiefComplaintContent;
65
+
66
+    @ApiModelProperty(value = "现病史内容", name = "presentIllnessContent")
67
+    private String presentIllnessContent;
68
+
69
+    @ApiModelProperty(value = "检查内容", name = "inspectContent")
70
+    private String inspectContent;
71
+
72
+    @ApiModelProperty(value = "治疗计划内容", name = "treatmentPlanningContent")
73
+    private String treatmentPlanningContent;
74
+
75
+    @ApiModelProperty(value = "处置内容", name = "disposeContent")
76
+    private String disposeContent;
77
+
78
+    @ApiModelProperty(value = "便签", name = "noteContent")
79
+    private String noteContent;
80
+
81
+    @ApiModelProperty(value = "诊断", name = "diagnosisContent")
82
+    private String diagnosisContent;
83
+
84
+
85
+    @ApiModelProperty(value = "过敏史", name = "allergyHistory")
86
+    private String allergyHistory;
87
+
88
+    @ApiModelProperty(value = "既往史", name = "pastHistory")
89
+    private String pastHistory;
90
+
91
+    @ApiModelProperty(value = "家族史", name = "familyHistory")
92
+    private String familyHistory;
93
+
68 94
 }

+ 7 - 6
eitc-patient-base/src/main/java/com/eitc/patient/vo/MedicalRecordVO.java

@@ -4,8 +4,6 @@ import io.swagger.annotations.ApiModel;
4 4
 import io.swagger.annotations.ApiModelProperty;
5 5
 import lombok.Data;
6 6
 
7
-import java.util.List;
8
-
9 7
 /**
10 8
  * MedicalRecordVO
11 9
  *
@@ -13,8 +11,8 @@ import java.util.List;
13 11
  * @date: 2024/05/17 14:42
14 12
  */
15 13
 @Data
16
-@ApiModel("病例")
17
-public class MedicalRecordVO {
14
+@ApiModel("病例牙齿")
15
+public class MedicalRecordToothVO {
18 16
 
19 17
     @ApiModelProperty(value = "牙位", name = "toothPosition")
20 18
     private String toothPosition;
@@ -22,7 +20,10 @@ public class MedicalRecordVO {
22 20
     @ApiModelProperty(value = "牙位状态(1未完成,2已完成治疗)", name = "toothStatus")
23 21
     private Integer toothStatus;
24 22
 
25
-    @ApiModelProperty(value = "病历详情", name = "data")
26
-    private List<MedicalRecordDetailsVO> data;
23
+    @ApiModelProperty(value = "诊断管理id", name = "diagnosisManageId")
24
+    private String diagnosisManageId;
25
+
26
+    @ApiModelProperty(value = "病例模板id", name = "diagnosisTypeTemplateId")
27
+    private String diagnosisTypeTemplateId;
27 28
 
28 29
 }

+ 2 - 0
eitc-patient-base/src/main/java/com/eitc/patient/vo/PatientVO.java

@@ -41,4 +41,6 @@ public class PatientVO extends Patient {
41 41
 
42 42
     private String visitingPhysicianSet;
43 43
 
44
+    private Integer age;
45
+
44 46
 }

+ 1 - 1
eitc-patient-base/src/main/resources/mapper/patient/BusinessDictDataMapper.xml

@@ -2,5 +2,5 @@
2 2
 <!DOCTYPE mapper
3 3
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 4
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5
-<mapper namespace="com.eitc.patient.mapper.DiagnosisTypeMapper">
5
+<mapper namespace="com.eitc.patient.mapper.BusinessDictDataMapper">
6 6
 </mapper>

+ 0 - 38
eitc-patient-base/src/main/resources/mapper/patient/MedicalRecordDetailsMapper.xml

@@ -3,42 +3,4 @@
3 3
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 4
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 5
 <mapper namespace="com.eitc.patient.mapper.MedicalRecordDetailsMapper">
6
-
7
-    <resultMap type="com.eitc.patient.domain.MedicalRecord" id="medicalRecordResult">
8
-        <id property="id" column="id"/>
9
-        <result property="patientId" column="patient_id"/>
10
-        <result property="status" column="status"/>
11
-        <result property="visitType" column="visit_type"/>
12
-        <result property="attendingDoctorId" column="attending_doctor_id"/>
13
-        <result property="attendingDoctorName" column="attending_doctor_name"/>
14
-        <result property="outpatientService" column="outpatient_service"/>
15
-        <result property="department" column="department"/>
16
-        <result property="cost" column="cost"/>
17
-        <result property="createDate" column="create_date"/>
18
-        <result property="createUser" column="create_user"/>
19
-        <result property="updateDate" column="update_date"/>
20
-        <result property="updateUser" column="update_user"/>
21
-    </resultMap>
22
-
23
-    <select id="countByDiagnosisTypeName" resultType="java.util.Map">
24
-        select *
25
-        from (select diagnosis_type_name diagnosisTypeName, count(*) count
26
-              from erm_medical_record_details
27
-              where is_del = 0
28
-              group by diagnosis_type_name) a
29
-        order by a.count desc
30
-        limit 10
31
-    </select>
32
-    <select id="findListByToothPosition" resultMap="medicalRecordResult">
33
-        select emr.*
34
-        from (select *
35
-              from erm_medical_record_details emrd
36
-              where emrd.is_del = 0 and emrd.tooth_position in
37
-                 <foreach collection="toothPositionList" item="toothPosition" open="(" separator="," close=")">
38
-                     #{toothPosition}
39
-                 </foreach>
40
-              group by emrd.medical_record_id) a
41
-                 inner join erm_medical_record emr on emr.id = a.medical_record_id and emr.is_del = 0
42
-        where emr.patient_id = #{patientId} order by emr.create_date desc
43
-    </select>
44 6
 </mapper>

+ 66 - 19
eitc-patient-base/src/main/resources/mapper/patient/MedicalRecordMapper.xml

@@ -4,26 +4,73 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 4
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 5
 <mapper namespace="com.eitc.patient.mapper.MedicalRecordMapper">
6 6
     <select id="medicalRecordList" resultType="com.eitc.patient.dto.MedicalRecordListDto">
7
-        select * from (
8
-            select emr.id,
9
-                ep.patient_name as patientName,
10
-                emr.create_date as createDate,
11
-                emr.visit_type as visitType,
12
-                emr.department as department,
13
-                emr.attending_doctor_name as attendingDoctorName,
14
-                (SELECT GROUP_CONCAT(DISTINCT emrd.tooth_position ORDER BY emrd.tooth_position SEPARATOR ',') AS toothPosition
15
-                FROM erm_medical_record_details emrd
16
-                where emrd.is_del = 0 and emrd.medical_record_id = emr.id) toothPosition
17
-            from erm_medical_record emr
18
-            left join erm_patient ep on emr.patient_id = ep.id
19
-            where emr.is_del = 0 order by emr.create_date desc
20
-        ) a
21
-        <where>
7
+        select emr.id,
8
+            ep.patient_name           as            patientName,
9
+            emr.create_date           as            createDate,
10
+            emr.visit_type            as            visitType,
11
+            emr.department            as            department,
12
+            emr.attending_doctor_name as            attendingDoctorName,
13
+            (SELECT GROUP_CONCAT(DISTINCT emrd.tooth_position ORDER BY emrd.tooth_position SEPARATOR ',') AS toothPosition
14
+            FROM erm_medical_record_details emrd where emrd.is_del = 0 and emrd.medical_record_id = emr.id) toothPosition
15
+        from erm_medical_record emr
16
+        left join erm_patient ep on emr.patient_id = ep.id
17
+        where emr.is_del = 0
22 18
             <if test="searchParam != null and searchParam != ''">
23
-                a.contentInfo like concat('%', #{searchParam}, '%')
24
-                or a.patientName like concat('%', #{searchParam}, '%')
25
-                or a.attendingDoctorName like concat('%', #{searchParam}, '%')
19
+                and (
20
+                    emr.chief_complaint_content like concat('%', #{searchParam}, '%')
21
+                    or emr.dispose_content like concat('%', #{searchParam}, '%')
22
+                    or emr.inspect_content like concat('%', #{searchParam}, '%')
23
+                    or emr.present_illness_content like concat('%', #{searchParam}, '%')
24
+                    or emr.treatment_planning_content like concat('%', #{searchParam}, '%')
25
+                    or emr.note_content like concat('%', #{searchParam}, '%')
26
+                    or ep.patient_name like concat('%', #{searchParam}, '%')
27
+                    or emr.attending_doctor_name like concat('%', #{searchParam}, '%')
28
+                )
26 29
             </if>
27
-        </where>
30
+        order by emr.create_date desc
31
+    </select>
32
+
33
+    <resultMap type="com.eitc.patient.domain.MedicalRecord" id="medicalRecordResult">
34
+        <id property="id" column="id"/>
35
+        <result property="patientId" column="patient_id"/>
36
+        <result property="status" column="status"/>
37
+        <result property="visitType" column="visit_type"/>
38
+        <result property="attendingDoctorId" column="attending_doctor_id"/>
39
+        <result property="attendingDoctorName" column="attending_doctor_name"/>
40
+        <result property="outpatientService" column="outpatient_service"/>
41
+        <result property="department" column="department"/>
42
+        <result property="cost" column="cost"/>
43
+        <result property="createDate" column="create_date"/>
44
+        <result property="createUser" column="create_user"/>
45
+        <result property="updateDate" column="update_date"/>
46
+        <result property="updateUser" column="update_user"/>
47
+    </resultMap>
48
+
49
+    <select id="countByDiagnosisTypeName" resultType="java.util.Map">
50
+        select * from (
51
+            select (select diagnosis_name from erm_diagnosis_manage where id = diagnosis_manage_id) diagnosisTypeName, count(*) count
52
+            from erm_medical_record_details
53
+            where is_del = 0
54
+            group by diagnosis_manage_id order by count desc
55
+        ) a where a.diagnosisTypeName is not null
56
+        limit 10
57
+    </select>
58
+
59
+    <select id="findListByToothPosition" resultMap="medicalRecordResult">
60
+        SELECT *
61
+        FROM erm_medical_record emr
62
+        where emr.is_del = 0
63
+        and emr.id in (select distinct emrd.medical_record_id from erm_medical_record_details emrd
64
+        where emrd.is_del = 0
65
+        <if test="toothPositionList != null">
66
+            and tooth_position in
67
+            <foreach collection="toothPositionList" item="item" open="(" separator="," close=")">
68
+                #{item}
69
+            </foreach>
70
+        </if>
71
+        )
72
+        and emr.patient_id = #{patientId}
73
+        order by emr.create_date desc
28 74
     </select>
75
+
29 76
 </mapper>

+ 1 - 4
eitc-patient-base/src/main/resources/mapper/patient/PatientFollowUpMapper.xml

@@ -130,19 +130,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
130 130
         from (select * from erm_patient_follow_up where is_del = 0 group by patient_appointment_id) epfu
131 131
         left join erm_patient_appointment epa on epfu.patient_appointment_id = epa.id
132 132
         left join erm_patient ep on epa.appointment_person_id = ep.id
133
-        <where>
134
-            and epa.is_del = 0 and ep.is_del = 0
133
+        where epa.is_del = 0 and ep.is_del = 0
135 134
             <if test="patientName != null and patientName != ''"> and ep.patient_name like concat('%', #{patientName}, '%')</if>
136 135
             <if test="followUpStatus != null and followUpStatus != ''"> and epfu.follow_up_status = #{followUpStatus}</if>
137 136
             <if test="followUpUser != null and followUpUser != ''"> and epfu.follow_up_user like concat('%', #{followUpUser}, '%')</if>
138
-
139 137
             <if test="followUpStartTime != null and followUpStartTime != ''"><!-- 开始时间检索 -->
140 138
                 and date_format(epfu.follow_up_time,'%Y-%m-%d %H:%i:%S') &gt;= date_format(#{followUpStartTime},'%Y-%m-%d %H:%i:%S')
141 139
             </if>
142 140
             <if test="followUpEndTime != null and followUpEndTime != ''"><!-- 结束时间检索 -->
143 141
                 and date_format(epfu.follow_up_time,'%Y-%m-%d %H:%i:%S') &lt;= date_format(#{followUpEndTime},'%Y-%m-%d %H:%i:%S')
144 142
             </if>
145
-        </where>
146 143
         ORDER BY epa.appointment_start_time DESC
147 144
     </select>
148 145
 </mapper>

+ 3 - 11
eitc-patient-chat/src/main/java/com/eitc/patient/netty/server/ChatServer.java

@@ -15,7 +15,9 @@ import io.netty.handler.codec.http.HttpServerCodec;
15 15
 import io.netty.handler.stream.ChunkedWriteHandler;
16 16
 
17 17
 public class ChatServer {
18
-    private int port =8002;
18
+
19
+//    @Value("${websocket.port}")
20
+    private int port = 8002;
19 21
     public void start() throws Exception {
20 22
         //boss线程
21 23
         EventLoopGroup bossGroup = new NioEventLoopGroup();
@@ -66,14 +68,4 @@ public class ChatServer {
66 68
 
67 69
     }
68 70
 
69
-
70
-
71
-    public static void main(String[] args){
72
-        try {
73
-            new ChatServer().start();
74
-        } catch (Exception e) {
75
-            e.printStackTrace();
76
-        }
77
-    }
78
-
79 71
 }

+ 1 - 1
eitc-patient-pc/src/main/java/com/eitc/patient/controller/AppointmentProjectController.java

@@ -85,7 +85,7 @@ public class AppointmentProjectController extends BaseController {
85 85
                 .eq(StringUtils.isNotBlank(appointmentProject.getParentId()), AppointmentProject::getParentId, appointmentProject.getParentId())
86 86
                 .eq(StringUtils.isNotBlank(appointmentProject.getAppointmentName()), AppointmentProject::getAppointmentName, appointmentProject.getAppointmentName())
87 87
                 .orderByDesc(AppointmentProject::getUpdateDate);
88
-
88
+        eq.orderByDesc(AppointmentProject::getCreateDate);
89 89
         return appointmentProjectService.list(eq);
90 90
     }
91 91
 

+ 199 - 0
eitc-patient-pc/src/main/java/com/eitc/patient/controller/DiagnosisManageController.java

@@ -0,0 +1,199 @@
1
+package com.eitc.patient.controller;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
5
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
6
+import com.eitc.common.annotation.Log;
7
+import com.eitc.common.constant.HttpStatus;
8
+import com.eitc.common.core.controller.BaseController;
9
+import com.eitc.common.core.domain.AjaxResult;
10
+import com.eitc.common.core.page.TableDataInfo;
11
+import com.eitc.common.enums.BusinessType;
12
+import com.eitc.common.utils.PatientBaseUtil;
13
+import com.eitc.common.utils.poi.ExcelUtil;
14
+import com.eitc.patient.domain.DiagnosisManage;
15
+import com.eitc.patient.domain.DiagnosisTypeTemplate;
16
+import com.eitc.patient.excel.DiagnosisManageTemplateExcel;
17
+import com.eitc.patient.service.IDiagnosisManageService;
18
+import com.eitc.patient.service.IDiagnosisTypeTemplateService;
19
+import com.github.pagehelper.PageInfo;
20
+import io.swagger.annotations.Api;
21
+import io.swagger.annotations.ApiOperation;
22
+import io.swagger.annotations.ApiParam;
23
+import org.apache.commons.lang3.StringUtils;
24
+import org.springframework.web.bind.annotation.DeleteMapping;
25
+import org.springframework.web.bind.annotation.GetMapping;
26
+import org.springframework.web.bind.annotation.PostMapping;
27
+import org.springframework.web.bind.annotation.PutMapping;
28
+import org.springframework.web.bind.annotation.RequestBody;
29
+import org.springframework.web.bind.annotation.RequestMapping;
30
+import org.springframework.web.bind.annotation.RequestParam;
31
+import org.springframework.web.bind.annotation.RestController;
32
+import org.springframework.web.multipart.MultipartFile;
33
+
34
+import javax.annotation.Resource;
35
+import javax.servlet.http.HttpServletResponse;
36
+import javax.validation.Valid;
37
+import java.io.IOException;
38
+import java.util.List;
39
+
40
+/**
41
+ * DiagnosisManageController
42
+ *
43
+ * @author mtx
44
+ * @date: 2024/05/17 15:51
45
+ */
46
+@Api(tags = "诊断管理")
47
+@RestController
48
+@RequestMapping("/diagnosis-manage")
49
+public class DiagnosisManageController extends BaseController {
50
+
51
+    @Resource
52
+    private IDiagnosisManageService diagnosisManageService;
53
+    @Resource
54
+    private IDiagnosisTypeTemplateService diagnosisTypeTemplateService;
55
+
56
+    /**
57
+     * 查询诊断管理
58
+     */
59
+    @GetMapping("/page")
60
+    @ApiOperation("查询诊断管理")
61
+    public TableDataInfo page(@ApiParam(name = "diagnosisParam", value = "搜索条件")
62
+                              @RequestParam(name = "diagnosisParam", required = false) String diagnosisParam) {
63
+        startPage();
64
+        LambdaQueryWrapper<DiagnosisManage> wrapper = Wrappers.lambdaQuery();
65
+        if (StringUtils.isNotBlank(diagnosisParam)) {
66
+            wrapper.like(DiagnosisManage::getDiagnosisName, diagnosisParam).or()
67
+                    .like(DiagnosisManage::getDiagnosisCode, diagnosisParam).or()
68
+                    .like(DiagnosisManage::getDiagnosisNamePinyin, diagnosisParam).or()
69
+                    .like(DiagnosisManage::getDiagnosisNamePinyinFirstLetter, diagnosisParam);
70
+        }
71
+        wrapper.orderByDesc(DiagnosisManage::getCreateDate);
72
+        List<DiagnosisManage> manageList = diagnosisManageService.list(wrapper);
73
+
74
+        TableDataInfo rspData = new TableDataInfo();
75
+        rspData.setCode(HttpStatus.SUCCESS);
76
+        rspData.setMsg("10087");
77
+        rspData.setRows(manageList);
78
+        rspData.setTotal(new PageInfo(manageList).getTotal());
79
+        return rspData;
80
+    }
81
+
82
+    /**
83
+     * 获取诊断管理详细信息
84
+     */
85
+    @GetMapping(value = "/detail")
86
+    @ApiOperation("获取诊断管理详细信息")
87
+    public AjaxResult detail(String id) {
88
+        return success(diagnosisManageService.getById(id));
89
+    }
90
+
91
+    /**
92
+     * 新增诊断管理
93
+     */
94
+    @Log(title = "新增诊断管理", businessType = BusinessType.INSERT)
95
+    @PostMapping
96
+    @ApiOperation("新增诊断管理")
97
+    public AjaxResult add(@Valid @RequestBody DiagnosisManage diagnosisManage) {
98
+        checkSaveDiagnosisManage(diagnosisManage);
99
+        // 首拼
100
+        diagnosisManage.setDiagnosisNamePinyinFirstLetter(PatientBaseUtil.getPinYinFirstLetter(diagnosisManage.getDiagnosisName()));
101
+        diagnosisManage.setDiagnosisNamePinyin(PatientBaseUtil.getPinyin(diagnosisManage.getDiagnosisName()));
102
+        return toAjax(diagnosisManageService.save(diagnosisManage));
103
+    }
104
+
105
+    /**
106
+     * 修改诊断管理
107
+     */
108
+    @Log(title = "修改诊断管理", businessType = BusinessType.UPDATE)
109
+    @PutMapping
110
+    @ApiOperation("修改诊断管理")
111
+    public AjaxResult edit(@Valid @RequestBody DiagnosisManage diagnosisManage) {
112
+        checkSaveDiagnosisManage(diagnosisManage);
113
+        // 首拼
114
+        diagnosisManage.setDiagnosisNamePinyinFirstLetter(PatientBaseUtil.getPinYinFirstLetter(diagnosisManage.getDiagnosisName()));
115
+        diagnosisManage.setDiagnosisNamePinyin(PatientBaseUtil.getPinyin(diagnosisManage.getDiagnosisName()));
116
+        return toAjax(diagnosisManageService.updateById(diagnosisManage));
117
+    }
118
+
119
+    /**
120
+     * 导入诊断分类模板
121
+     *
122
+     * @param file 文件
123
+     */
124
+    @Log(title = "导入诊断分类模板", businessType = BusinessType.INSERT)
125
+    @PostMapping("/importTemplate")
126
+    @ApiOperation("导入诊断分类模板")
127
+    public void importTemplate(@RequestParam("file") @ApiParam(name = "file", value = "上传文件") MultipartFile file, HttpServletResponse response) throws IOException {
128
+        // 1.解析excel
129
+        ExcelUtil<DiagnosisManageTemplateExcel> util = new ExcelUtil<>(DiagnosisManageTemplateExcel.class);
130
+        List<DiagnosisManageTemplateExcel> list = util.importExcel(file.getInputStream());
131
+        // 2.如果解析数据为空则返回错误信息
132
+        if (CollectionUtils.isEmpty(list)) {
133
+            throw new RuntimeException("上传数据为空,请填写");
134
+        }
135
+        // 解析模板
136
+        List<DiagnosisManageTemplateExcel> diagnosisManageTemplateExcels = diagnosisManageService.importTemplate(list);
137
+        // 导出错误模板
138
+        if (CollectionUtils.isNotEmpty(diagnosisManageTemplateExcels)) {
139
+            util.exportExcel(response, diagnosisManageTemplateExcels, "模板错误");
140
+        }
141
+    }
142
+
143
+    /**
144
+     * 删除诊断管理
145
+     */
146
+    @Log(title = "删除诊断管理", businessType = BusinessType.DELETE)
147
+    @DeleteMapping("/remove")
148
+    @ApiOperation("删除诊断管理")
149
+    public AjaxResult remove(String id) {
150
+        checkDelDiagnosisManage(id);
151
+        return toAjax(diagnosisManageService.removeById(id));
152
+    }
153
+
154
+    /**
155
+     * 检查诊断管理对象的诊断编码和诊断名称是否重复
156
+     * 此方法通过查询数据库中是否存在相同的诊断编码或诊断名称来确保数据的唯一性
157
+     * 如果发现重复,将抛出IllegalArgumentException异常
158
+     *
159
+     * @param diagnosisManage 待检查的诊断管理对象
160
+     * @throws IllegalArgumentException 如果诊断编码或诊断名称重复,则抛出此异常
161
+     */
162
+    private void checkSaveDiagnosisManage(DiagnosisManage diagnosisManage) {
163
+        // 查询数据库中是否有与提供的诊断编码相同的记录
164
+        long diagnosisCodeCount = diagnosisManageService.count(Wrappers.<DiagnosisManage>lambdaQuery()
165
+                .ne(StringUtils.isNotBlank(diagnosisManage.getId()), DiagnosisManage::getId, diagnosisManage.getId())
166
+                .eq(DiagnosisManage::getDiagnosisCode, diagnosisManage.getDiagnosisCode()));
167
+        // 如果诊断编码重复,则抛出异常
168
+        if (diagnosisCodeCount > 0) {
169
+            throw new IllegalArgumentException("诊断编码重复");
170
+        }
171
+        // 查询数据库中是否有与提供的诊断名称相同的记录
172
+        long diagnosisNameCount = diagnosisManageService.count(Wrappers.<DiagnosisManage>lambdaQuery()
173
+                .ne(StringUtils.isNotBlank(diagnosisManage.getId()), DiagnosisManage::getId, diagnosisManage.getId())
174
+                .eq(DiagnosisManage::getDiagnosisName, diagnosisManage.getDiagnosisName()));
175
+        // 如果诊断名称重复,则抛出异常
176
+        if (diagnosisNameCount > 0) {
177
+            throw new IllegalArgumentException("诊断名称重复");
178
+        }
179
+    }
180
+
181
+    /**
182
+     * 检查并处理删除诊断管理信息前的准备工作
183
+     *
184
+     * @param id 待删除的诊断管理信息的ID
185
+     * @throws IllegalArgumentException 如果id为空,则抛出此异常
186
+     */
187
+    private void checkDelDiagnosisManage(String id) {
188
+        // 检查ID是否为空,如果为空则抛出异常,提示id不能为空
189
+        if (StringUtils.isEmpty(id)) {
190
+            throw new IllegalArgumentException("id不能为空");
191
+        }
192
+        long count = diagnosisTypeTemplateService.count(Wrappers.<DiagnosisTypeTemplate>lambdaQuery()
193
+                .eq(DiagnosisTypeTemplate::getDiagnosisManageId, id));
194
+        if (count > 0) {
195
+            throw new IllegalArgumentException("该诊断管理已被使用,无法删除");
196
+        }
197
+    }
198
+
199
+}

+ 17 - 0
eitc-patient-pc/src/main/java/com/eitc/patient/controller/DiagnosisTypeController.java

@@ -5,6 +5,7 @@ import com.eitc.common.annotation.Log;
5 5
 import com.eitc.common.core.controller.BaseController;
6 6
 import com.eitc.common.core.domain.AjaxResult;
7 7
 import com.eitc.common.enums.BusinessType;
8
+import com.eitc.common.utils.PatientBaseUtil;
8 9
 import com.eitc.common.utils.bean.BeanUtils;
9 10
 import com.eitc.patient.domain.DiagnosisType;
10 11
 import com.eitc.patient.domain.DiagnosisTypeTemplate;
@@ -29,6 +30,7 @@ import javax.validation.Valid;
29 30
 import java.util.ArrayList;
30 31
 import java.util.Arrays;
31 32
 import java.util.List;
33
+import java.util.Objects;
32 34
 
33 35
 /**
34 36
  * DiagnosisTypeController
@@ -109,6 +111,18 @@ public class DiagnosisTypeController extends BaseController {
109 111
         if (count > 0) {
110 112
             return error("不允许添加子集");
111 113
         }
114
+        DiagnosisType type = diagnosisTypeService.getById(diagnosisType.getParentId());
115
+        if (Objects.nonNull(type)) {
116
+            if(StringUtils.isNotBlank(type.getAncestors()) && type.getAncestors().split(",").length > 4){
117
+                return error("不允许继续添加子集");
118
+            }
119
+            diagnosisType.setAncestors(type.getAncestors() + "," + diagnosisType.getParentId());
120
+        } else {
121
+            diagnosisType.setAncestors(diagnosisType.getParentId());
122
+        }
123
+        // 首拼
124
+        diagnosisType.setDiagnosisNamePinyinFirstLetter(PatientBaseUtil.getPinYinFirstLetter(diagnosisType.getDiagnosisName()));
125
+        diagnosisType.setDiagnosisNamePinyin(PatientBaseUtil.getPinyin(diagnosisType.getDiagnosisName()));
112 126
         return toAjax(diagnosisTypeService.save(diagnosisType));
113 127
     }
114 128
 
@@ -119,6 +133,9 @@ public class DiagnosisTypeController extends BaseController {
119 133
     @PutMapping
120 134
     @ApiOperation("修改诊断分类")
121 135
     public AjaxResult edit(@ApiParam(name = "diagnosisType") @Valid @RequestBody DiagnosisType diagnosisType) {
136
+        // 首拼
137
+        diagnosisType.setDiagnosisNamePinyinFirstLetter(PatientBaseUtil.getPinYinFirstLetter(diagnosisType.getDiagnosisName()));
138
+        diagnosisType.setDiagnosisNamePinyin(PatientBaseUtil.getPinyin(diagnosisType.getDiagnosisName()));
122 139
         return toAjax(diagnosisTypeService.updateById(diagnosisType));
123 140
     }
124 141
 

+ 3 - 2
eitc-patient-pc/src/main/java/com/eitc/patient/controller/DiagnosisTypeOrderDoctorController.java

@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.GetMapping;
14 14
 import org.springframework.web.bind.annotation.PostMapping;
15 15
 import org.springframework.web.bind.annotation.RequestBody;
16 16
 import org.springframework.web.bind.annotation.RequestMapping;
17
+import org.springframework.web.bind.annotation.RequestParam;
17 18
 import org.springframework.web.bind.annotation.RestController;
18 19
 
19 20
 import javax.annotation.Resource;
@@ -48,8 +49,8 @@ public class DiagnosisTypeOrderDoctorController extends BaseController {
48 49
 
49 50
     @GetMapping("/tree")
50 51
     @ApiOperation("查询诊断分类")
51
-    public AjaxResult tree() {
52
-        return success(diagnosisTypeService.findTreeList());
52
+    public AjaxResult tree(@RequestParam(name = "searchParam", required = false) String searchParam, @RequestParam(name = "visitType", required = false) String visitType) {
53
+        return success(diagnosisTypeService.findTreeList(searchParam, visitType));
53 54
     }
54 55
 
55 56
 }

+ 67 - 78
eitc-patient-pc/src/main/java/com/eitc/patient/controller/DiagnosisTypeTemplateController.java

@@ -6,23 +6,18 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
6 6
 import com.eitc.common.annotation.Log;
7 7
 import com.eitc.common.core.controller.BaseController;
8 8
 import com.eitc.common.core.domain.AjaxResult;
9
+import com.eitc.common.core.page.TableDataInfo;
9 10
 import com.eitc.common.enums.BusinessType;
10 11
 import com.eitc.common.utils.bean.BeanUtils;
11 12
 import com.eitc.common.utils.poi.ExcelUtil;
12
-import com.eitc.patient.domain.DiagnosisType;
13 13
 import com.eitc.patient.domain.DiagnosisTypeTemplate;
14
-import com.eitc.patient.dto.DiagnosisTypeTemplateDto;
15
-import com.eitc.patient.enums.DiagnosisTypeTemplateReviewStatusEnum;
16
-import com.eitc.patient.enums.MedicalHistoryDiseaseTypeEnum;
17 14
 import com.eitc.patient.excel.DiagnosisTypeTemplateExcel;
18
-import com.eitc.patient.service.IDiagnosisTypeService;
19 15
 import com.eitc.patient.service.IDiagnosisTypeTemplateService;
20
-import com.eitc.patient.service.IMedicalHistoryService;
21 16
 import com.eitc.patient.vo.DiagnosisTypeTemplateSaveVO;
22 17
 import com.eitc.patient.vo.DiagnosisTypeTemplateVO;
18
+import com.eitc.system.utils.UserCacheUtil;
23 19
 import io.swagger.annotations.Api;
24 20
 import io.swagger.annotations.ApiOperation;
25
-import io.swagger.annotations.ApiParam;
26 21
 import org.apache.commons.lang3.StringUtils;
27 22
 import org.springframework.web.bind.annotation.DeleteMapping;
28 23
 import org.springframework.web.bind.annotation.GetMapping;
@@ -38,6 +33,7 @@ import javax.annotation.Resource;
38 33
 import javax.servlet.http.HttpServletResponse;
39 34
 import javax.validation.Valid;
40 35
 import java.io.IOException;
36
+import java.util.ArrayList;
41 37
 import java.util.Arrays;
42 38
 import java.util.List;
43 39
 import java.util.Objects;
@@ -56,64 +52,75 @@ public class DiagnosisTypeTemplateController extends BaseController {
56 52
 
57 53
     @Resource
58 54
     private IDiagnosisTypeTemplateService diagnosisTypeTemplateService;
59
-    @Resource
60
-    private IDiagnosisTypeService diagnosisTypeService;
61
-    @Resource
62
-    private IMedicalHistoryService medicalHistoryService;
55
+
63 56
 
64 57
     /**
65 58
      * 查询诊断分类模板
66 59
      */
67
-    @GetMapping("/list")
60
+    @GetMapping("/page")
68 61
     @ApiOperation("查询诊断分类模板")
69
-    public AjaxResult list(DiagnosisTypeTemplate diagnosisTypeTemplate) {
62
+    public TableDataInfo page(DiagnosisTypeTemplate diagnosisTypeTemplate) {
63
+        startPage();
70 64
         LambdaQueryWrapper<DiagnosisTypeTemplate> eq = Wrappers.<DiagnosisTypeTemplate>lambdaQuery()
71
-                .like(Objects.nonNull(diagnosisTypeTemplate.getDiagnosisTypeId()), DiagnosisTypeTemplate::getDiagnosisTypeId, diagnosisTypeTemplate.getDiagnosisTypeId())
72
-                .like(StringUtils.isNotBlank(diagnosisTypeTemplate.getTemplateName()), DiagnosisTypeTemplate::getTemplateName, diagnosisTypeTemplate.getTemplateName())
73
-                .like(StringUtils.isNotBlank(diagnosisTypeTemplate.getTemplateExample()), DiagnosisTypeTemplate::getTemplateExample, diagnosisTypeTemplate.getTemplateExample())
74
-                .orderByAsc(DiagnosisTypeTemplate::getOrderNum);
65
+                .like(Objects.nonNull(diagnosisTypeTemplate.getDiagnosisTypeId()),
66
+                        DiagnosisTypeTemplate::getDiagnosisTypeId, diagnosisTypeTemplate.getDiagnosisTypeId())
67
+                .orderByDesc(DiagnosisTypeTemplate::getCreateDate);
68
+        List<DiagnosisTypeTemplate> list = diagnosisTypeTemplateService.list(eq);
69
+        List<DiagnosisTypeTemplateVO> voList = new ArrayList<>();
70
+        if (CollectionUtils.isNotEmpty(list)) {
71
+            for (DiagnosisTypeTemplate template : list) {
72
+                voList.add(getDiagnosisTypeTemplateVO(template));
73
+            }
74
+        }
75 75
 
76
-        return success(diagnosisTypeTemplateService.list(eq));
76
+        return getDataTable(voList);
77 77
     }
78 78
 
79
-
80
-    @GetMapping("/listToPatientId")
81
-    @ApiOperation("查询诊断分类模板")
82
-    public AjaxResult listToPatientId(String patientId, String diagnosisTypeId) {
83
-        LambdaQueryWrapper<DiagnosisTypeTemplate> eq = Wrappers.<DiagnosisTypeTemplate>lambdaQuery()
84
-                .eq(DiagnosisTypeTemplate::getDiagnosisTypeId, diagnosisTypeId)
85
-                .orderByAsc(DiagnosisTypeTemplate::getOrderNum);
86
-
87
-        List<DiagnosisTypeTemplate> list = diagnosisTypeTemplateService.list(eq);
88
-        if (CollectionUtils.isEmpty(list)) {
89
-            return error("请先配置诊断分类模板");
90
-        }
91
-        // 封装模板信息
92
-        List<DiagnosisTypeTemplateDto> collect = list.stream().map(li -> {
93
-            DiagnosisTypeTemplateDto dto = new DiagnosisTypeTemplateDto();
94
-            BeanUtils.copyProperties(li, dto);
95
-            dto.setTemplateExample2(dto.getTemplateExample());
96
-            if (MedicalHistoryDiseaseTypeEnum.ALLERGY_HISTORY.getInfo().equals(li.getTemplateName())) {
97
-                medicalHistoryService.findMedicalHistory(patientId, MedicalHistoryDiseaseTypeEnum.ALLERGY_HISTORY.getCode(), dto);
98
-            }
99
-            if (MedicalHistoryDiseaseTypeEnum.PAST_HISTORY.getInfo().equals(li.getTemplateName())) {
100
-                medicalHistoryService.findMedicalHistory(patientId, MedicalHistoryDiseaseTypeEnum.PAST_HISTORY.getCode(), dto);
79
+    /**
80
+     * 根据诊断类型模板对象创建诊断类型模板VO对象
81
+     * 主要用于展示诊断类型的详细信息,包括适用的部门名称
82
+     *
83
+     * @param template 诊断类型模板对象
84
+     * @return 创建的诊断类型模板VO对象
85
+     */
86
+    private static DiagnosisTypeTemplateVO getDiagnosisTypeTemplateVO(DiagnosisTypeTemplate template) {
87
+        // 初始化诊断类型模板VO对象
88
+        DiagnosisTypeTemplateVO item = new DiagnosisTypeTemplateVO();
89
+        // 将模板对象的属性复制到VO对象
90
+        BeanUtils.copyProperties(template, item);
91
+        // 获取模板适用的部门ID字符串
92
+        String applyDept = template.getApplyDept();
93
+        // 检查适用部门信息是否非空
94
+        if (StringUtils.isNotBlank(applyDept)) {
95
+            // 初始化部门名称列表
96
+            List<String> deptNameList = new ArrayList<>();
97
+            // 将适用部门ID字符串分割为数组
98
+            String[] deptIds = applyDept.split(",");
99
+            // 遍历部门ID数组,获取每个部门的名称
100
+            for (String deptId : deptIds) {
101
+                deptNameList.add(UserCacheUtil.getSysDeptById(deptId).getDeptName());
101 102
             }
102
-            if (MedicalHistoryDiseaseTypeEnum.FAMILY_HISTORY.getInfo().equals(li.getTemplateName())) {
103
-                medicalHistoryService.findMedicalHistory(patientId, MedicalHistoryDiseaseTypeEnum.FAMILY_HISTORY.getCode(), dto);
103
+            // 将部门名称列表转换为逗号分隔的字符串,并设置到VO对象
104
+            item.setApplyDept(String.join(",", deptNameList));
105
+            // 再次检查适用部门信息是否非空,实际上此处的判断是多余的,因为已经在上面判断过一次
106
+            // 这里可能是代码的重复检查,或者是出于代码风格的考虑,保持对适用部门非空性的强调
107
+            if (StringUtils.isNotBlank(applyDept)) {
108
+                // 将适用部门ID列表设置到VO对象
109
+                item.setApplyDeptList(Arrays.stream(deptIds).map(Long::valueOf).collect(Collectors.toList()));
104 110
             }
105
-            return dto;
106
-        }).collect(Collectors.toList());
107
-        return success(collect);
111
+        }
112
+        // 返回创建的诊断类型模板VO对象
113
+        return item;
108 114
     }
109 115
 
116
+
110 117
     /**
111 118
      * 获取诊断分类模板详细信息
112 119
      */
113 120
     @GetMapping(value = "/detail")
114 121
     @ApiOperation("获取诊断分类模板详细信息")
115 122
     public AjaxResult detail(String id) {
116
-        return success(diagnosisTypeTemplateService.getById(id));
123
+        return success(getDiagnosisTypeTemplateVO(diagnosisTypeTemplateService.getById(id)));
117 124
     }
118 125
 
119 126
     /**
@@ -122,21 +129,9 @@ public class DiagnosisTypeTemplateController extends BaseController {
122 129
     @Log(title = "新增诊断分类模板", businessType = BusinessType.INSERT)
123 130
     @PostMapping
124 131
     @ApiOperation("新增诊断分类模板")
125
-    public AjaxResult add(@ApiParam(value = "entry") @Valid @RequestBody DiagnosisTypeTemplateSaveVO entry) {
126
-        List<DiagnosisTypeTemplateVO> diagnosisTypeTemplateList = entry.getDiagnosisTypeTemplateList();
127
-        if (CollectionUtils.isEmpty(diagnosisTypeTemplateList)) {
128
-            return error("诊断模板为空");
129
-        }
130
-        String diagnosisTypeId = entry.getDiagnosisTypeId();
131
-        if (StringUtils.isBlank(diagnosisTypeId)) {
132
-            return error("必填项不能为空");
133
-        }
134
-        long typeCount = diagnosisTypeService.count(Wrappers.<DiagnosisType>lambdaQuery().eq(DiagnosisType::getParentId, diagnosisTypeId));
135
-        if (typeCount > 0) {
136
-            return error("存在子类型,不允许添加模板");
137
-        }
138
-        diagnosisTypeTemplateService.remove(Wrappers.<DiagnosisTypeTemplate>lambdaQuery().eq(DiagnosisTypeTemplate::getDiagnosisTypeId, diagnosisTypeId));
139
-        return toAjax(diagnosisTypeTemplateService.add(entry));
132
+    public AjaxResult add(@Valid @RequestBody DiagnosisTypeTemplateSaveVO entry) {
133
+        diagnosisTypeTemplateService.add(entry);
134
+        return success();
140 135
     }
141 136
 
142 137
     /**
@@ -148,19 +143,18 @@ public class DiagnosisTypeTemplateController extends BaseController {
148 143
     @Log(title = "导入诊断分类模板", businessType = BusinessType.INSERT)
149 144
     @PostMapping("/importTemplate")
150 145
     @ApiOperation("导入诊断分类模板")
151
-    public void importTemplate(@RequestParam("file") @ApiParam(name = "file", value = "上传文件") MultipartFile file, String diagnosisTypeId, HttpServletResponse response) throws IOException {
152
-        if (StringUtils.isBlank(diagnosisTypeId)) {
153
-            throw new IllegalArgumentException("必填项不能为空");
154
-        }
155
-        long typeCount = diagnosisTypeService.count(Wrappers.<DiagnosisType>lambdaQuery().eq(DiagnosisType::getParentId, diagnosisTypeId));
156
-        if (typeCount > 0) {
157
-            throw new IllegalArgumentException("存在子类型,不允许添加模板");
146
+    public void importTemplate(@RequestParam("file") MultipartFile file, String diagnosisTypeId, HttpServletResponse response) throws IOException {
147
+        // 1.解析excel
148
+        ExcelUtil<DiagnosisTypeTemplateExcel> util = new ExcelUtil<>(DiagnosisTypeTemplateExcel.class);
149
+        List<DiagnosisTypeTemplateExcel> list = util.importExcel(file.getInputStream());
150
+        // 2.如果解析数据为空则返回错误信息
151
+        if (CollectionUtils.isEmpty(list)) {
152
+            throw new RuntimeException("上传数据为空,请填写");
158 153
         }
159 154
         // 解析模板
160
-        List<DiagnosisTypeTemplateExcel> diagnosisTypeTemplateExcels = diagnosisTypeTemplateService.importTemplate(file, diagnosisTypeId);
155
+        List<DiagnosisTypeTemplateExcel> diagnosisTypeTemplateExcels = diagnosisTypeTemplateService.importTemplate(list, diagnosisTypeId);
161 156
         // 导出错误模板
162 157
         if (CollectionUtils.isNotEmpty(diagnosisTypeTemplateExcels)) {
163
-            ExcelUtil<DiagnosisTypeTemplateExcel> util = new ExcelUtil<>(DiagnosisTypeTemplateExcel.class);
164 158
             util.exportExcel(response, diagnosisTypeTemplateExcels, "模板错误");
165 159
         }
166 160
     }
@@ -171,14 +165,9 @@ public class DiagnosisTypeTemplateController extends BaseController {
171 165
     @Log(title = "修改诊断分类模板", businessType = BusinessType.UPDATE)
172 166
     @PutMapping
173 167
     @ApiOperation("修改诊断分类模板")
174
-    public AjaxResult edit(@Valid @RequestBody DiagnosisTypeTemplate diagnosisTypeTemplate) {
175
-        String templateExample = diagnosisTypeTemplate.getTemplateExample();
176
-        if (StringUtils.isNotBlank(templateExample)) {
177
-            diagnosisTypeTemplate.setTemplateOption(diagnosisTypeTemplateService.findTemplateOptionJson(templateExample));
178
-            diagnosisTypeTemplate.setTemplateInfo(diagnosisTypeTemplateService.findTemplateInfo(templateExample));
179
-        }
180
-        diagnosisTypeTemplate.setReviewStatus(DiagnosisTypeTemplateReviewStatusEnum.ALREADY_AUDITING.getCode());
181
-        return toAjax(diagnosisTypeTemplateService.updateById(diagnosisTypeTemplate));
168
+    public AjaxResult edit(@Valid @RequestBody DiagnosisTypeTemplateSaveVO entry) {
169
+        diagnosisTypeTemplateService.edit(entry);
170
+        return success();
182 171
     }
183 172
 
184 173
     /**

+ 180 - 88
eitc-patient-pc/src/main/java/com/eitc/patient/controller/MedicalRecordController.java

@@ -1,5 +1,6 @@
1 1
 package com.eitc.patient.controller;
2 2
 
3
+import com.alibaba.fastjson2.JSONObject;
3 4
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 5
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
5 6
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -14,24 +15,33 @@ import com.eitc.common.enums.BusinessType;
14 15
 import com.eitc.common.utils.PatientBaseUtil;
15 16
 import com.eitc.common.utils.PdfUtil;
16 17
 import com.eitc.common.utils.bean.BeanUtils;
17
-import com.eitc.patient.domain.DiagnosisType;
18
+import com.eitc.patient.domain.DiagnosisManage;
19
+import com.eitc.patient.domain.DiagnosisTypeTemplate;
20
+import com.eitc.patient.domain.MedicalHistory;
18 21
 import com.eitc.patient.domain.MedicalRecord;
19 22
 import com.eitc.patient.domain.MedicalRecordDetails;
20 23
 import com.eitc.patient.domain.Patient;
21 24
 import com.eitc.patient.domain.ProtocolTemplate;
22
-import com.eitc.patient.dto.MedicalRecordDto;
25
+import com.eitc.patient.dto.DiagnosisTypeTemplateDto;
23 26
 import com.eitc.patient.dto.MedicalRecordHistoryDto;
24 27
 import com.eitc.patient.dto.MedicalRecordListDto;
25 28
 import com.eitc.patient.dto.PatientTeethInfoDto;
26
-import com.eitc.patient.service.IDiagnosisTypeService;
29
+import com.eitc.patient.enums.MedicalHistoryDiseaseSourceEnum;
30
+import com.eitc.patient.enums.MedicalHistoryDiseaseTypeEnum;
31
+import com.eitc.patient.param.MedicalRecordListParam;
32
+import com.eitc.patient.param.MedicalRecordParam;
33
+import com.eitc.patient.param.MedicalRecordSaveParam;
34
+import com.eitc.patient.service.IDiagnosisManageService;
35
+import com.eitc.patient.service.IDiagnosisTypeTemplateService;
36
+import com.eitc.patient.service.IMedicalHistoryService;
27 37
 import com.eitc.patient.service.IMedicalRecordDetailsService;
28 38
 import com.eitc.patient.service.IMedicalRecordService;
29 39
 import com.eitc.patient.service.IPatientService;
30 40
 import com.eitc.patient.service.IProtocolTemplateService;
31
-import com.eitc.patient.utils.PatientUtil;
32
-import com.eitc.patient.vo.MedicalRecordDetailsVO;
33
-import com.eitc.patient.vo.MedicalRecordParamVO;
34
-import com.eitc.patient.vo.MedicalRecordTemplateVO;
41
+import com.eitc.patient.vo.MedicalRecordListVO;
42
+import com.eitc.patient.vo.MedicalRecordNoteVO;
43
+import com.eitc.patient.vo.MedicalRecordToPdf;
44
+import com.eitc.patient.vo.MedicalRecordToothVO;
35 45
 import com.eitc.system.utils.UserCacheUtil;
36 46
 import freemarker.template.Template;
37 47
 import freemarker.template.TemplateException;
@@ -62,7 +72,6 @@ import java.util.ArrayList;
62 72
 import java.util.Arrays;
63 73
 import java.util.Collections;
64 74
 import java.util.HashMap;
65
-import java.util.LinkedHashMap;
66 75
 import java.util.List;
67 76
 import java.util.Map;
68 77
 import java.util.Objects;
@@ -86,9 +95,13 @@ public class MedicalRecordController extends BaseController {
86 95
     @Resource
87 96
     private IMedicalRecordDetailsService medicalRecordDetailsService;
88 97
     @Resource
89
-    private IPatientService patientService;
98
+    private IMedicalHistoryService medicalHistoryService;
99
+    @Resource
100
+    private IDiagnosisTypeTemplateService diagnosisTypeTemplateService;
90 101
     @Resource
91
-    private IDiagnosisTypeService diagnosisTypeService;
102
+    private IDiagnosisManageService diagnosisManageService;
103
+    @Resource
104
+    private IPatientService patientService;
92 105
     @Resource
93 106
     private IProtocolTemplateService protocolTemplateService;
94 107
 
@@ -107,21 +120,7 @@ public class MedicalRecordController extends BaseController {
107 120
      */
108 121
     @PostMapping(value = "/html2Pdf")
109 122
     @ApiOperation("打印病历")
110
-    public void html2Pdf(@RequestBody MedicalRecordTemplateVO vo, HttpServletResponse response) throws IOException, TemplateException {
111
-        // 过滤出标记为需要包含在PDF中的病历细节。
112
-        Map<String, List<MedicalRecordDetailsVO>> listMap = vo.getListMap();
113
-        for (String s : listMap.keySet()) {
114
-            List<MedicalRecordDetailsVO> vos = listMap.get(s);
115
-            if (CollectionUtils.isEmpty(vos)) {
116
-                continue;
117
-            }
118
-            List<MedicalRecordDetailsVO> collect = vos.stream().filter(MedicalRecordDetailsVO::isFlagCheck).collect(Collectors.toList());
119
-            if (CollectionUtils.isNotEmpty(collect)) {
120
-                collect.forEach(li -> li.setToothPosition(PatientUtil.initToothPosition(li.getToothPosition())));
121
-            }
122
-            listMap.put(s, collect);
123
-        }
124
-
123
+    public void html2Pdf(@RequestBody MedicalRecordToPdf vo, HttpServletResponse response) throws IOException, TemplateException {
125 124
         // 准备Freemarker模板渲染所需的参数。
126 125
         Map<String, Object> paramMap = new HashMap<>();
127 126
         paramMap.put("companyName", UserCacheUtil.getClinicName() + "口腔科病历");
@@ -157,7 +156,7 @@ public class MedicalRecordController extends BaseController {
157 156
     @GetMapping("/findMedicalInfo")
158 157
     @ApiOperation("打印病历详情")
159 158
     public AjaxResult findMedicalInfo(String medicalRecordId, String protocolTemplateId) throws ParseException {
160
-        MedicalRecordTemplateVO mrt = new MedicalRecordTemplateVO();
159
+        MedicalRecordToPdf mrt = new MedicalRecordToPdf();
161 160
         // 根据病历ID查询病历信息
162 161
         MedicalRecord medicalRecord = medicalRecordService.getById(medicalRecordId);
163 162
         // 检查病历是否存在
@@ -173,41 +172,25 @@ public class MedicalRecordController extends BaseController {
173 172
                 // 根据身份证号计算患者年龄
174 173
                 mrt.setAge(PatientBaseUtil.findAge(patient.getIdentificationCard()));
175 174
             }
176
-            // 根据病历ID查询病历详情列表
177
-            List<MedicalRecordDetailsVO> list = medicalRecordDetailsService.findMedicalRecordDetailsVOByMedicalRecordId(medicalRecordId);
178
-            // 根据模板名称分组聚合病历详情
179
-            Map<String, List<MedicalRecordDetailsVO>> collect = list.stream().collect(Collectors.groupingBy(MedicalRecordDetailsVO::getTemplateName));
180
-            // 使用LinkedHashMap保持插入顺序
181
-            Map<String, List<MedicalRecordDetailsVO>> linkedMap = new LinkedHashMap<>();
182
-            // 遍历诊断类型模板键列表
183
-            for (String s : PatientUtil.diagnosisTypeTemplateKeyList()) {
184
-                // 对特定的模板类型进行处理
185
-                if ("主诉".equals(s) || "现病史".equals(s) || "既往史".equals(s) || "家族史".equals(s) || "过敏史".equals(s)) {
186
-                    List<MedicalRecordDetailsVO> vos = collect.get(s);
187
-                    // 检查是否存在对应的病历详情
188
-                    if (CollectionUtils.isNotEmpty(vos)) {
189
-                        MedicalRecordDetailsVO vo = vos.get(0);
190
-                        // 对既往史、家族史、过敏史进行格式化处理
191
-                        if ("既往史".equals(s) || "家族史".equals(s) || "过敏史".equals(s)) {
192
-                            if (Objects.nonNull(vo.getFormattedPartsList())) {
193
-                                vo.setContentInfo(String.join(",", vo.getFormattedPartsList()));
194
-                            } else {
195
-                                vo.setContentInfo("");
196
-                            }
197
-                        }
198
-                        // 将处理后的病历详情添加到linkedMap中
199
-                        linkedMap.put(s, Collections.singletonList(vo));
200
-                    } else {
201
-                        // 如果不存在对应的病历详情,则添加空列表
202
-                        linkedMap.put(s, new ArrayList<>());
203
-                    }
204
-                } else {
205
-                    // 对其他模板类型,直接添加到linkedMap中
206
-                    linkedMap.put(s, collect.get(s));
207
-                }
175
+
176
+            mrt.setChiefComplaintContent(medicalRecord.getChiefComplaintContent());
177
+            mrt.setPresentIllnessContent(medicalRecord.getPresentIllnessContent());
178
+            mrt.setInspectContent(medicalRecord.getInspectContent());
179
+            mrt.setTreatmentPlanningContent(medicalRecord.getTreatmentPlanningContent());
180
+            mrt.setDisposeContent(medicalRecord.getDisposeContent());
181
+            mrt.setDiagnosisContent(medicalRecord.getDiagnosisContent());
182
+            mrt.setNoteContent(medicalRecord.getNoteContent());
183
+
184
+            List<MedicalHistory> histories = medicalHistoryService.list(Wrappers.<MedicalHistory>lambdaQuery().eq(MedicalHistory::getPatientId, patientId));
185
+
186
+            if (CollectionUtils.isNotEmpty(histories)) {
187
+                mrt.setAllergyHistory(histories.stream().filter(l -> MedicalHistoryDiseaseTypeEnum.ALLERGY_HISTORY.getCode().equals(l.getDiseaseType()))
188
+                        .map(MedicalHistory::getDiseaseContent).collect(Collectors.joining(",")));
189
+                mrt.setPastHistory(histories.stream().filter(l -> MedicalHistoryDiseaseTypeEnum.PAST_HISTORY.getCode().equals(l.getDiseaseType()))
190
+                        .map(MedicalHistory::getDiseaseContent).collect(Collectors.joining(",")));
191
+                mrt.setFamilyHistory(histories.stream().filter(l -> MedicalHistoryDiseaseTypeEnum.FAMILY_HISTORY.getCode().equals(l.getDiseaseType()))
192
+                        .map(MedicalHistory::getDiseaseContent).collect(Collectors.joining(",")));
208 193
             }
209
-            // 设置处理后的病历详情列表到病历模板VO中
210
-            mrt.setListMap(linkedMap);
211 194
         }
212 195
         mrt.setCompanyName(UserCacheUtil.getClinicName() + "口腔科病历");
213 196
 
@@ -224,7 +207,7 @@ public class MedicalRecordController extends BaseController {
224 207
      */
225 208
     @GetMapping("/list")
226 209
     @ApiOperation("查询病历")
227
-    public AjaxResult list(MedicalRecordDto medicalRecord) {
210
+    public AjaxResult list(MedicalRecordListParam medicalRecord) {
228 211
         LambdaQueryWrapper<MedicalRecord> wrapper = Wrappers.<MedicalRecord>lambdaQuery()
229 212
                 .eq(MedicalRecord::getPatientId, medicalRecord.getPatientId())
230 213
                 .orderByDesc(MedicalRecord::getCreateDate);
@@ -234,13 +217,15 @@ public class MedicalRecordController extends BaseController {
234 217
             LocalDateTime dateTime = LocalDateTime.now().minusMonths(queryScope);
235 218
             wrapper.ge(MedicalRecord::getCreateDate, dateTime);
236 219
         }
237
-        List<MedicalRecordParamVO> voList = new ArrayList<>();
238 220
         List<MedicalRecord> list = medicalRecordService.list(wrapper);
239
-        if (Objects.nonNull(list)) {
221
+
222
+        List<MedicalRecordListVO> voList = new ArrayList<>();
223
+        if (CollectionUtils.isNotEmpty(list)) {
240 224
             for (MedicalRecord record : list) {
241
-                voList.add(medicalRecordService.getMedicalRecordVO(record));
225
+                voList.add(getMedicalRecordListVO(record));
242 226
             }
243 227
         }
228
+
244 229
         return success(voList);
245 230
     }
246 231
 
@@ -251,7 +236,52 @@ public class MedicalRecordController extends BaseController {
251 236
     @ApiOperation("获取病历详细信息")
252 237
     public AjaxResult detail(String id) {
253 238
         MedicalRecord medicalRecord = medicalRecordService.getById(id);
254
-        return success(medicalRecordService.getMedicalRecordVO(medicalRecord));
239
+        return success(getMedicalRecordListVO(medicalRecord));
240
+    }
241
+
242
+
243
+    /**
244
+     * 根据病历对象构建病历列表视图对象
245
+     *
246
+     * @param medicalRecord 病历对象,用于从数据库中查询相关的病史信息
247
+     * @return MedicalRecordListVO 返回填充了病史信息的病历列表视图对象
248
+     */
249
+    private MedicalRecordListVO getMedicalRecordListVO(MedicalRecord medicalRecord) {
250
+        MedicalRecordListVO vo = new MedicalRecordListVO();
251
+        BeanUtils.copyProperties(medicalRecord, vo);
252
+
253
+        // 根据病历ID查询相关的病史信息,并根据类型进行处理
254
+        List<MedicalHistory> histories = medicalHistoryService.list(Wrappers.<MedicalHistory>lambdaQuery()
255
+                .eq(MedicalHistory::getMedicalRecordId, medicalRecord.getId()));
256
+        if (CollectionUtils.isNotEmpty(histories)) {
257
+            // 处理医生记录的病史
258
+            vo.setDoctorAllergyHistory(histories.stream()
259
+                    .filter(l -> MedicalHistoryDiseaseTypeEnum.ALLERGY_HISTORY.getCode().equals(l.getDiseaseType()))
260
+                    .map(MedicalHistory::getDiseaseContent).collect(Collectors.toList()));
261
+            vo.setDoctorFamilyHistory(histories.stream()
262
+                    .filter(l -> MedicalHistoryDiseaseTypeEnum.FAMILY_HISTORY.getCode().equals(l.getDiseaseType()))
263
+                    .map(MedicalHistory::getDiseaseContent).collect(Collectors.toList()));
264
+            vo.setDoctorPastHistory(histories.stream()
265
+                    .filter(l -> MedicalHistoryDiseaseTypeEnum.PAST_HISTORY.getCode().equals(l.getDiseaseType()))
266
+                    .map(MedicalHistory::getDiseaseContent).collect(Collectors.toList()));
267
+
268
+            // 处理病人自述的病史
269
+            List<MedicalHistory> patientMedicalHistory = histories.stream()
270
+                    .filter(l -> MedicalHistoryDiseaseSourceEnum.PATIENT.getCode().equals(l.getDiseaseSource())).collect(Collectors.toList());
271
+            vo.setPatientAllergyHistory(patientMedicalHistory.stream()
272
+                    .filter(l -> MedicalHistoryDiseaseTypeEnum.ALLERGY_HISTORY.getCode().equals(l.getDiseaseType()))
273
+                    .map(MedicalHistory::getDiseaseContent).collect(Collectors.toList()));
274
+            vo.setPatientFamilyHistory(patientMedicalHistory.stream()
275
+                    .filter(l -> MedicalHistoryDiseaseTypeEnum.FAMILY_HISTORY.getCode().equals(l.getDiseaseType()))
276
+                    .map(MedicalHistory::getDiseaseContent).collect(Collectors.toList()));
277
+            vo.setPatientPastHistory(patientMedicalHistory.stream()
278
+                    .filter(l -> MedicalHistoryDiseaseTypeEnum.PAST_HISTORY.getCode().equals(l.getDiseaseType()))
279
+                    .map(MedicalHistory::getDiseaseContent).collect(Collectors.toList()));
280
+        }
281
+
282
+        vo.setRecordDetailsList(medicalRecordDetailsService.list(Wrappers.<MedicalRecordDetails>lambdaQuery()
283
+                .eq(MedicalRecordDetails::getMedicalRecordId, medicalRecord.getId())));
284
+        return vo;
255 285
     }
256 286
 
257 287
     /**
@@ -260,11 +290,8 @@ public class MedicalRecordController extends BaseController {
260 290
     @Log(title = "新增病历", businessType = BusinessType.INSERT)
261 291
     @PostMapping
262 292
     @ApiOperation("新增病历")
263
-    public AjaxResult add(@Valid @RequestBody MedicalRecordParamVO vo) {
264
-        if (CollectionUtils.isEmpty(vo.getDataList())) {
265
-            return error("无数据");
266
-        }
267
-        medicalRecordService.addOrEdit(vo);
293
+    public AjaxResult add(@Valid @RequestBody MedicalRecordSaveParam param) {
294
+        medicalRecordService.addOrEdit(param);
268 295
         return success();
269 296
     }
270 297
 
@@ -274,14 +301,11 @@ public class MedicalRecordController extends BaseController {
274 301
     @Log(title = "修改病历", businessType = BusinessType.UPDATE)
275 302
     @PutMapping
276 303
     @ApiOperation("修改病历")
277
-    public AjaxResult edit(@Valid @RequestBody MedicalRecordParamVO vo) {
278
-        if (StringUtils.isEmpty(vo.getId())) {
304
+    public AjaxResult edit(@Valid @RequestBody MedicalRecordSaveParam param) {
305
+        if (StringUtils.isEmpty(param.getId())) {
279 306
             return error();
280 307
         }
281
-        if (CollectionUtils.isEmpty(vo.getDataList())) {
282
-            return error("无数据");
283
-        }
284
-        medicalRecordService.addOrEdit(vo);
308
+        medicalRecordService.addOrEdit(param);
285 309
         return success();
286 310
     }
287 311
 
@@ -353,9 +377,9 @@ public class MedicalRecordController extends BaseController {
353 377
                     dto.setMedicalRecordDetailsId(medicalRecordDetails.getId());
354 378
 
355 379
                     // 根据医疗记录详情中的诊断类型ID,查询并设置诊断类型名称
356
-                    DiagnosisType diagnosisType = diagnosisTypeService.getById(medicalRecordDetails.getDiagnosisTypeId());
357
-                    if (Objects.nonNull(diagnosisType)) {
358
-                        dto.setDiagnosisTypeName(diagnosisType.getDiagnosisName());
380
+                    DiagnosisManage manage = diagnosisManageService.getById(medicalRecordDetails.getDiagnosisManageId());
381
+                    if (Objects.nonNull(manage)) {
382
+                        dto.setDiagnosisTypeName(manage.getDiagnosisName());
359 383
                     }
360 384
 
361 385
                     // 设置医疗记录的创建日期
@@ -372,7 +396,7 @@ public class MedicalRecordController extends BaseController {
372 396
 
373 397
 
374 398
     @GetMapping("/medical-record-list")
375
-    @ApiOperation("查询病历列表")
399
+    @ApiOperation("就诊记录-查询病历列表")
376 400
     public TableDataInfo medicalRecordList(@RequestParam(name = "searchParam", required = false) String searchParam) {
377 401
         PageDomain pageDomain = TableSupport.buildPageRequest();
378 402
         Integer pageNum = pageDomain.getPageNum();
@@ -388,25 +412,93 @@ public class MedicalRecordController extends BaseController {
388 412
         MedicalRecordHistoryDto dto = new MedicalRecordHistoryDto();
389 413
         dto.setPatientId(patientId);
390 414
         dto.setToothPositionList(Collections.singletonList(toothPosition));
391
-        List<MedicalRecord> list = medicalRecordDetailsService.findListByToothPosition(dto);
415
+        List<MedicalRecord> list = medicalRecordService.findListByToothPosition(dto);
392 416
         return success(Objects.nonNull(list) && list.size() > 0);
393 417
     }
394 418
 
395 419
     @PostMapping("/findListByToothPosition")
396
-    @ApiOperation("通过牙位获取病历列表")
420
+    @ApiOperation("历史病例")
397 421
     public AjaxResult findListByToothPosition(@RequestBody MedicalRecordHistoryDto dto) {
398
-        List<MedicalRecordParamVO> voList = new ArrayList<>();
399
-        if (CollectionUtils.isNotEmpty(dto.getToothPositionList())) {
400
-            List<MedicalRecord> list = medicalRecordDetailsService.findListByToothPosition(dto);
401
-            if (Objects.nonNull(list)) {
402
-                for (MedicalRecord record : list) {
403
-                    voList.add(medicalRecordService.getMedicalRecordVO(record));
422
+        List<MedicalRecord> list = medicalRecordService.findListByToothPosition(dto);
423
+        List<MedicalRecordListVO> voList = new ArrayList<>();
424
+        if (CollectionUtils.isNotEmpty(list)) {
425
+            for (MedicalRecord record : list) {
426
+                voList.add(getMedicalRecordListVO(record));
427
+            }
428
+        }
429
+        return success(voList);
430
+    }
431
+
432
+    @PostMapping("/findNoteList")
433
+    @ApiOperation("便签列表")
434
+    public AjaxResult findNoteList(@RequestBody MedicalRecordHistoryDto dto) {
435
+        List<MedicalRecordNoteVO> voList = new ArrayList<>();
436
+        MedicalRecordNoteVO vo;
437
+        List<MedicalRecord> recordList = medicalRecordService.findListByToothPosition(dto);
438
+        if (CollectionUtils.isNotEmpty(recordList)) {
439
+            for (MedicalRecord medicalRecord : recordList) {
440
+                vo = new MedicalRecordNoteVO();
441
+                vo.setCreateDate(medicalRecord.getCreateDate());
442
+                vo.setNoteContent(medicalRecord.getNoteContent());
443
+                vo.setDiagnosisContent(medicalRecord.getDiagnosisContent());
444
+                List<MedicalRecordDetails> list = medicalRecordDetailsService.list(Wrappers.<MedicalRecordDetails>lambdaQuery()
445
+                        .eq(MedicalRecordDetails::getMedicalRecordId, medicalRecord.getId()));
446
+
447
+                if (CollectionUtils.isNotEmpty(list)) {
448
+                    List<MedicalRecordToothVO> toothList = new ArrayList<>();
449
+                    MedicalRecordToothVO toothVO;
450
+                    for (MedicalRecordDetails medicalRecordDetails : list) {
451
+                        toothVO = new MedicalRecordToothVO();
452
+                        BeanUtils.copyProperties(medicalRecordDetails, toothVO);
453
+                        toothList.add(toothVO);
454
+                    }
455
+                    vo.setToothList(toothList);
404 456
                 }
457
+                voList.add(vo);
405 458
             }
406 459
         }
460
+
407 461
         return success(voList);
408 462
     }
409 463
 
464
+    @PostMapping("/getInfoByDiagnosisTypeTemplateId")
465
+    @ApiOperation("通过诊断模板id获取病例数据")
466
+    public AjaxResult getInfoByDiagnosisTypeTemplateId(@RequestBody MedicalRecordParam param) {
467
+        DiagnosisTypeTemplate diagnosisTypeTemplate = diagnosisTypeTemplateService.getById(param.getDiagnosisTypeTemplateId());
468
+        String patientId = param.getPatientId();
469
+        // 封装模板信息
470
+        DiagnosisTypeTemplateDto dto = new DiagnosisTypeTemplateDto();
471
+        dto.setPatientId(patientId);
472
+        dto.setMainDiagnosis(diagnosisTypeTemplate.getDiagnosisManageName());
473
+        dto.setMainDiagnosisId(diagnosisTypeTemplate.getDiagnosisManageId());
474
+        dto.setPatientAllergyHistory(medicalHistoryService.findMedicalHistory(patientId, MedicalHistoryDiseaseTypeEnum.ALLERGY_HISTORY.getCode()));
475
+        dto.setPatientPastHistory(medicalHistoryService.findMedicalHistory(patientId, MedicalHistoryDiseaseTypeEnum.PAST_HISTORY.getCode()));
476
+        dto.setPatientFamilyHistory(medicalHistoryService.findMedicalHistory(patientId, MedicalHistoryDiseaseTypeEnum.FAMILY_HISTORY.getCode()));
477
+        dto.setChiefComplaintOption(JSONObject.parseObject(diagnosisTypeTemplate.getChiefComplaintOption()));
478
+        dto.setPresentIllnessOption(JSONObject.parseObject(diagnosisTypeTemplate.getPresentIllnessOption()));
479
+        dto.setInspectOption(JSONObject.parseObject(diagnosisTypeTemplate.getInspectOption()));
480
+        dto.setTreatmentPlanningOption(JSONObject.parseObject(diagnosisTypeTemplate.getTreatmentPlanningOption()));
481
+        dto.setDisposeOption(JSONObject.parseObject(diagnosisTypeTemplate.getDisposeOption()));
482
+        dto.setNoteOption(JSONObject.parseObject(diagnosisTypeTemplate.getNoteOption()));
483
+
484
+        dto.setChiefComplaintContent(JSONObject.parseObject(diagnosisTypeTemplate.getChiefComplaintOption()).getString("text"));
485
+        dto.setPresentIllnessContent(JSONObject.parseObject(diagnosisTypeTemplate.getPresentIllnessOption()).getString("text"));
486
+        dto.setInspectContent(JSONObject.parseObject(diagnosisTypeTemplate.getInspectOption()).getString("text"));
487
+        dto.setTreatmentPlanningContent(JSONObject.parseObject(diagnosisTypeTemplate.getTreatmentPlanningOption()).getString("text"));
488
+        dto.setDisposeContent(JSONObject.parseObject(diagnosisTypeTemplate.getDisposeOption()).getString("text"));
489
+        dto.setNoteContent(JSONObject.parseObject(diagnosisTypeTemplate.getNoteOption()).getString("text"));
490
+
491
+        dto.setId(diagnosisTypeTemplate.getId());
492
+
493
+        List<String> otherDiagnosisTypeTemplateIdList = param.getOtherDiagnosisTypeTemplateIdList();
494
+        if (CollectionUtils.isNotEmpty(otherDiagnosisTypeTemplateIdList)) {
495
+            List<DiagnosisTypeTemplate> list = diagnosisTypeTemplateService.listByIds(otherDiagnosisTypeTemplateIdList);
496
+            dto.setOtherDiagnosis(list.stream().map(DiagnosisTypeTemplate::getDiagnosisManageName).collect(Collectors.toList()));
497
+        }
498
+
499
+        return success(dto);
500
+    }
501
+
410 502
     //subList手动分页,page为第几页,rows为每页个数
411 503
     public static TableDataInfo subList(List<MedicalRecordListDto> list, int page, int rows) {
412 504
         List<MedicalRecordListDto> listSort = new ArrayList<>();

+ 3 - 2
eitc-patient-pc/src/main/java/com/eitc/patient/controller/NoticeManageController.java

@@ -49,8 +49,9 @@ public class NoticeManageController extends BaseController {
49 49
         startPage();
50 50
         LambdaQueryWrapper<NoticeManage> wrapper = Wrappers.<NoticeManage>lambdaQuery().orderByDesc(NoticeManage::getCreateDate)
51 51
                 .like(StringUtils.isNotBlank(noticeManage.getNoticeTitle()), NoticeManage::getNoticeTitle, noticeManage.getNoticeTitle())
52
-                .like(Objects.nonNull(noticeManage.getPublishStatus()), NoticeManage::getPublishStatus, noticeManage.getPublishStatus())
53
-                .like(Objects.nonNull(noticeManage.getDisplayStatus()), NoticeManage::getDisplayStatus, noticeManage.getDisplayStatus());
52
+                .eq(Objects.nonNull(noticeManage.getPublishStatus()), NoticeManage::getPublishStatus, noticeManage.getPublishStatus())
53
+                .eq(Objects.nonNull(noticeManage.getDisplayStatus()), NoticeManage::getDisplayStatus, noticeManage.getDisplayStatus());
54
+        wrapper.orderByDesc(NoticeManage::getCreateDate);
54 55
         List<NoticeManage> list = noticeManageService.list(wrapper);
55 56
         return getDataTable(list);
56 57
     }

+ 1 - 1
eitc-patient-pc/src/main/java/com/eitc/patient/controller/OperationsAnalysisController.java

@@ -130,7 +130,7 @@ public class OperationsAnalysisController extends BaseController {
130 130
         result.put("patientAppointmentStatus", patientAppointmentStatusList);
131 131
 
132 132
         // 诊断统计(列出诊断类型前十名及个数)
133
-        List<Map<String, String>> diagnosisCountList = medicalRecordDetailsService.countByDiagnosisTypeName();
133
+        List<Map<String, String>> diagnosisCountList = medicalRecordService.countByDiagnosisTypeName();
134 134
         result.put("diagnosisCount", diagnosisCountList);
135 135
 
136 136
         return success(result);

+ 18 - 5
eitc-patient-pc/src/main/java/com/eitc/patient/controller/PatientController.java

@@ -8,6 +8,7 @@ import com.eitc.common.core.controller.BaseController;
8 8
 import com.eitc.common.core.domain.AjaxResult;
9 9
 import com.eitc.common.core.domain.entity.SysUser;
10 10
 import com.eitc.common.enums.BusinessType;
11
+import com.eitc.common.utils.PatientBaseUtil;
11 12
 import com.eitc.common.utils.bean.BeanUtils;
12 13
 import com.eitc.patient.domain.MedicalHistory;
13 14
 import com.eitc.patient.domain.Patient;
@@ -33,6 +34,7 @@ import org.springframework.web.bind.annotation.RestController;
33 34
 
34 35
 import javax.annotation.Resource;
35 36
 import javax.validation.Valid;
37
+import java.text.ParseException;
36 38
 import java.util.ArrayList;
37 39
 import java.util.Arrays;
38 40
 import java.util.List;
@@ -72,7 +74,7 @@ public class PatientController extends BaseController {
72 74
      */
73 75
     @GetMapping("/list")
74 76
     @ApiOperation("查询患者")
75
-    public AjaxResult list(@RequestParam(name = "searchParam", required = false) String searchParam) {
77
+    public AjaxResult list(@RequestParam(name = "searchParam", required = false) String searchParam) throws ParseException {
76 78
         LambdaQueryWrapper<Patient> eq = Wrappers.<Patient>lambdaQuery()
77 79
                 .like(StringUtils.isNotBlank(searchParam), Patient::getPatientPhone, searchParam).or()
78 80
                 .like(StringUtils.isNotBlank(searchParam), Patient::getLinkPhone, searchParam).or()
@@ -107,12 +109,12 @@ public class PatientController extends BaseController {
107 109
      * @param li Patient实体类对象,代表一个患者的信息。
108 110
      * @return 返回填充了预约信息和病史信息的PatientVO对象。
109 111
      */
110
-    private PatientVO getPatientVO(Patient li) {
112
+    private PatientVO getPatientVO(Patient li) throws ParseException {
111 113
         // 创建一个PatientVO对象,用于存储患者的信息。
112 114
         PatientVO vo = new PatientVO();
113 115
         // 使用BeanUtils工具类,将Patient对象的属性值复制到PatientVO对象中。
114 116
         BeanUtils.copyProperties(li, vo);
115
-
117
+        vo.setAge(PatientBaseUtil.findAge(li.getIdentificationCard()));
116 118
         // 查询该患者的所有预约信息,并按照创建日期降序排列。
117 119
         List<PatientAppointment> list = patientAppointmentService.list(Wrappers.<PatientAppointment>lambdaQuery()
118 120
                 .eq(PatientAppointment::getAppointmentPersonId, li.getId())
@@ -171,9 +173,20 @@ public class PatientController extends BaseController {
171 173
      */
172 174
     @GetMapping(value = "/detail")
173 175
     @ApiOperation("获取患者详细信息")
174
-    public AjaxResult detail(String id) {
176
+    public AjaxResult detail(String id) throws ParseException {
175 177
         Patient patient = patientService.getById(id);
176
-        return success(getPatientVO(patient));
178
+        PatientVO vo = getPatientVO(patient);
179
+        List<SysUser> sysUserList = PatientUtil.findUserListByLoginUser();
180
+        String visitingPhysicianSet = vo.getVisitingPhysicianSet();
181
+        long count = 0L;
182
+        if (StringUtils.isNotBlank(visitingPhysicianSet)) {
183
+            count = sysUserList.stream().filter(user -> visitingPhysicianSet.contains(user.getNickName())).count();
184
+        }
185
+        if (CollectionUtils.isEmpty(sysUserList) || count > 0) {
186
+            return success(vo);
187
+        }
188
+
189
+        return success(new PatientVO());
177 190
     }
178 191
 
179 192
     /**

+ 1 - 1
eitc-patient-pc/src/main/java/com/eitc/patient/controller/SchedulingDetailsController.java

@@ -112,7 +112,7 @@ public class SchedulingDetailsController extends BaseController {
112 112
             List<Map<String, String>> dataList = new ArrayList<>();
113 113
             int actualMaximum = instance.getActualMaximum(Calendar.DAY_OF_MONTH);
114 114
             List<SchedulingDetails> detailsList = listMap.get(String.valueOf(user.getUserId()));
115
-            for (int i = 1; i < actualMaximum; i++) {
115
+            for (int i = 1; i < actualMaximum + 1; i++) {
116 116
                 instance.set(Calendar.DAY_OF_MONTH, i);
117 117
                 int d = instance.get(Calendar.DAY_OF_MONTH);
118 118
                 int w = instance.get(Calendar.DAY_OF_WEEK);

+ 1 - 1
eitc-quartz/src/main/java/com/eitc/quartz/task/SchedulingConfigurationTask.java

@@ -44,7 +44,7 @@ public class SchedulingConfigurationTask {
44 44
             Map<Integer, String> collect = listMap.get(doctorId).stream()
45 45
                     .collect(Collectors.toMap(SchedulingConfiguration::getWeekNum, SchedulingConfiguration::getWorkStatus));
46 46
 
47
-            for (int day = 1; day <= actualMaximum; day++) {
47
+            for (int day = 1; day <= actualMaximum + 1; day++) {
48 48
                 instance.set(Calendar.DAY_OF_MONTH, day);
49 49
                 int week = instance.get(Calendar.DAY_OF_WEEK);
50 50
 

+ 21 - 12
eitc-system/src/main/java/com/eitc/system/utils/SendSmsUtil.java

@@ -1,5 +1,6 @@
1 1
 package com.eitc.system.utils;
2 2
 
3
+import com.alibaba.fastjson2.JSON;
3 4
 import com.aliyuncs.DefaultAcsClient;
4 5
 import com.aliyuncs.IAcsClient;
5 6
 import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
@@ -9,11 +10,14 @@ import com.aliyuncs.http.MethodType;
9 10
 import com.aliyuncs.profile.DefaultProfile;
10 11
 import com.aliyuncs.profile.IClientProfile;
11 12
 import com.eitc.common.core.domain.entity.SysDictData;
13
+import com.eitc.common.utils.StringUtils;
12 14
 import com.eitc.common.utils.spring.SpringUtils;
13 15
 import com.eitc.system.service.ISysDictDataService;
14 16
 import org.springframework.stereotype.Component;
15 17
 
18
+import java.util.HashMap;
16 19
 import java.util.List;
20
+import java.util.Map;
17 21
 import java.util.Objects;
18 22
 
19 23
 /**
@@ -48,31 +52,31 @@ public class SendSmsUtil {
48 52
      * @date: 2024/7/31 11:24
49 53
      */
50 54
     public static void sendSms(String phoneNum, String code, String templateCodeToDict) throws ClientException {
51
-        String accessKeyId = "access-key-id";
52
-        String accessKeySecret = "access-key-secret";
53
-        String signName = "sign-name";
54
-        String templateCode = "template-code";
55
+        String accessKeyId = "access-key-id", accessKeyIdContent = null;
56
+        String accessKeySecret = "access-key-secret", accessKeySecretContent = null;
57
+        String signName = "sign-name", signNameContent = null;
58
+        String templateCodeContent = null;
55 59
 
56 60
         ISysDictDataService dictDataService = SpringUtils.getBean(ISysDictDataService.class);
57 61
         List<SysDictData> ermSms = dictDataService.selectDictDataByType("erm_sms");
58 62
         for (SysDictData ermSm : ermSms) {
59 63
             if (Objects.equals(accessKeyId, ermSm.getDictLabel())) {
60
-                accessKeyId = ermSm.getDictValue();
64
+                accessKeyIdContent = ermSm.getDictValue();
61 65
             }
62 66
             if (Objects.equals(accessKeySecret, ermSm.getDictLabel())) {
63
-                accessKeySecret = ermSm.getDictValue();
67
+                accessKeySecretContent = ermSm.getDictValue();
64 68
             }
65 69
             if (Objects.equals(signName, ermSm.getDictLabel())) {
66
-                signName = ermSm.getDictValue();
70
+                signNameContent = ermSm.getDictValue();
67 71
             }
68 72
             if (Objects.equals(templateCodeToDict, ermSm.getDictLabel())) {
69
-                templateCode = ermSm.getDictValue();
73
+                templateCodeContent = ermSm.getDictValue();
70 74
             }
71 75
         }
72 76
 
73 77
         final String product = "Dysmsapi";
74 78
         final String endpoint = "dysmsapi.aliyuncs.com";
75
-        IClientProfile profile = DefaultProfile.getProfile("cn-beijing", accessKeyId, accessKeySecret);
79
+        IClientProfile profile = DefaultProfile.getProfile("cn-beijing", accessKeyIdContent, accessKeySecretContent);
76 80
         DefaultProfile.addEndpoint("cn-beijing", product, endpoint);
77 81
         IAcsClient client = new DefaultAcsClient(profile);
78 82
 
@@ -80,9 +84,14 @@ public class SendSmsUtil {
80 84
         SendSmsRequest request = new SendSmsRequest();
81 85
         request.setSysMethod(MethodType.POST);
82 86
         request.setPhoneNumbers(phoneNum);
83
-        request.setSignName(signName);
84
-        request.setTemplateCode(templateCode);
85
-        request.setOutId(code);
87
+        if (StringUtils.isNotEmpty(signNameContent)) {
88
+            request.setSignName(signNameContent);
89
+        }
90
+        request.setTemplateCode(templateCodeContent);
91
+
92
+        Map<String, String> jsonParam = new HashMap<>();
93
+        jsonParam.put("code", code);
94
+        request.putQueryParameter("TemplateParam", JSON.toJSONString(jsonParam));
86 95
 
87 96
         SendSmsResponse response = client.getAcsResponse(request);
88 97
         if (!"OK".equals(response.getCode())) {

+ 17 - 0
pom.xml

@@ -297,6 +297,23 @@
297 297
                 <artifactId>aliyun-java-sdk-dysmsapi</artifactId>
298 298
                 <version>1.0.0</version>
299 299
             </dependency>
300
+
301
+            <!-- 第三方拼音依赖包,配合 hutool-all 包中的 PinyinUtil 拼音工具使用 start -->
302
+            <dependency>
303
+                <groupId>com.belerweb</groupId>
304
+                <artifactId>pinyin4j</artifactId>
305
+                <version>2.5.0</version>
306
+            </dependency>
307
+            <dependency>
308
+                <groupId>io.github.biezhi</groupId>
309
+                <artifactId>TinyPinyin</artifactId>
310
+                <version>2.0.3.RELEASE</version>
311
+            </dependency>
312
+            <dependency>
313
+                <groupId>com.github.stuxuhai</groupId>
314
+                <artifactId>jpinyin</artifactId>
315
+                <version>1.1.8</version>
316
+            </dependency>
300 317
         </dependencies>
301 318
     </dependencyManagement>
302 319