Browse Source

慢特病登记

hsh 2 years ago
parent
commit
2167f6b241

+ 6 - 0
src/main/java/thyyxxk/webserver/constants/YbTjConstant.java

@@ -43,4 +43,10 @@ public class YbTjConstant {
      * @return: null
      **/
     public static final String MEDICAL_INSURANCE_DEPT_NAME = "医保办";
+
+    /**
+     *  慢特病泰和医院标志
+     */
+    public static final String CRM_YY_TH = "TH_";
+
 }

+ 65 - 0
src/main/java/thyyxxk/webserver/controller/chronicDisease/ChronicDiseaseController.java

@@ -0,0 +1,65 @@
+package thyyxxk.webserver.controller.chronicDisease;
+
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.chronicDisease.CrmPatientMi;
+import thyyxxk.webserver.entity.dictionary.CodeName;
+import thyyxxk.webserver.service.chronicDisease.ChronicDiseaseService;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @ClassName ChronicDiseaseController
+ * @Author Administrator
+ * @Date 2023/11/23 14:33
+ * @Version 1.0
+ * @Description 慢特病管理
+ **/
+@RestController
+@RequestMapping("/chronicDisease")
+public class ChronicDiseaseController {
+
+    private final ChronicDiseaseService service;
+
+    public ChronicDiseaseController(ChronicDiseaseService service) {
+        this.service = service;
+    }
+
+    @GetMapping("/selectCrmPatientMiByCode")
+    public ResultVo<CrmPatientMi> selectCrmPatientMiByCode(@RequestParam("keyCode") String keyCode){
+        return service.selectCrmPatientMiByCode(keyCode);
+    }
+
+    @PostMapping("/saveCrmPatientMi")
+    public ResultVo<Map<String, Object>> saveCrmPatientMi(@RequestBody @Validated CrmPatientMi mi){
+        return service.saveCrmPatientMi(mi);
+    }
+
+    @PostMapping("/updateCrmPatientMi")
+    public ResultVo<Map<String, Object>> updateCrmPatientMi(@RequestBody @Validated CrmPatientMi mi){
+        return service.updateCrmPatientMi(mi);
+    }
+
+    @GetMapping("/getCrmDictionary")
+    public ResultVo<Map<String, List<CodeName>>> getCrmDictionary(){
+        return service.getCrmDictionary();
+    }
+
+    @GetMapping("/getCrmCityByCode")
+    public ResultVo<List<CodeName>> getCrmCityByCode(@RequestParam("code") String code){
+        return service.getCrmCityByCode(code);
+    }
+
+    @GetMapping("/getCrmAreaByCode")
+    public ResultVo<List<CodeName>> getCrmAreaByCode(@RequestParam("code") String code){
+        return service.getCrmAreaByCode(code);
+    }
+
+}

+ 38 - 0
src/main/java/thyyxxk/webserver/dao/his/chronicDisease/ChronicDiseaseDao.java

@@ -0,0 +1,38 @@
+package thyyxxk.webserver.dao.his.chronicDisease;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import thyyxxk.webserver.entity.dictionary.CodeName;
+
+import java.util.List;
+
+@Mapper
+public interface ChronicDiseaseDao {
+
+    @Select("select rtrim(code) as code, rtrim(name) as name from crm_zd_visit_type with(nolock)")
+    List<CodeName> getCrmClass();
+
+    @Select("select rtrim(code) as code, rtrim(name) as name from t_region with(nolock) where level = '1' ")
+    List<CodeName> getProvince();
+
+    @Select("<script> " +
+            " select rtrim(code) as code, rtrim(name) as name from t_region with(nolock) where level = '2' " +
+            "<if test=\"parentCode != null and parentCode != '' \">" +
+            " and parent_code = #{parentCode}  " +
+            "</if>" +
+            "</script> ")
+    List<CodeName> getCity(@Param("parentCode") String parentCode);
+
+    @Select("<script> " +
+            " select rtrim(code) as code, rtrim(name) as name from t_region with(nolock) where level = '3' " +
+            "<if test=\"parentCode != null and parentCode != '' \">" +
+            " and parent_code = #{parentCode}  " +
+            "</if>" +
+            "</script> ")
+    List<CodeName> getArea(@Param("parentCode") String parentCode);
+
+    @Select("select rtrim(code) as code, rtrim(name) as name from t_zd_psn_cert_type ")
+    List<CodeName> getPsnCertType();
+
+}

+ 32 - 0
src/main/java/thyyxxk/webserver/dao/his/chronicDisease/CrmPatientMiDao.java

@@ -0,0 +1,32 @@
+package thyyxxk.webserver.dao.his.chronicDisease;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Delete;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import thyyxxk.webserver.entity.chronicDisease.CrmPatientMi;
+
+public interface CrmPatientMiDao extends BaseMapper<CrmPatientMi> {
+
+    @Select(" select mi.*, tz.height, tz.weight, tz.temperature, tz.respiratory_rate, tz.heart_rate, " +
+            " tz.blood_sugar, tz.blood_pressure_high, tz.blood_pressure_low, tz.blood_oxygen, rtrim(p.name) as referPhysicianName " +
+            " from crm_patient_mi mi" +
+            " left join crm_patient_tzxx tz on (mi.p_id = tz.p_id collate Chinese_PRC_BIN) and mi.visit_times = tz.visit_times " +
+            " left join a_employee_mi p on mi.refer_physician = p.code collate Chinese_PRC_BIN " +
+            " where mi.social_no = #{keyCode} or mi.his_mz_no = #{keyCode} or mi.his_zy_no = #{keyCode} or mi.his_tj_no = #{keyCode}" +
+            " or mi.p_name like '%${keyCode}%' or mi.p_id = #{keyCode} ")
+    CrmPatientMi selectCrmPatientMiByCode(@Param("keyCode") String keyCode);
+
+    @Select(" select * from crm_patient_mi where social_no = #{socialNo} ")
+    CrmPatientMi selectCrmPatientMiBySocialNo(@Param("socialNo") String socialNo);
+
+    @Select(" select * from crm_patient_mi where p_id = #{pId} ")
+    CrmPatientMi selectCrmPatientMiByPId(@Param("pId") String pId);
+
+    @Delete(" delete from crm_patient_mi where social_no = #{socialNo} ")
+    void deleteCrmPatientMiBySocialNo(@Param("socialNo") String socialNo);
+
+    @Delete(" delete from crm_patient_mi where p_id = #{pId} ")
+    void deleteCrmPatientMiByPId(@Param("pId") String pId);
+
+}

+ 19 - 0
src/main/java/thyyxxk/webserver/dao/his/chronicDisease/CrmPatientTzxxDao.java

@@ -0,0 +1,19 @@
+package thyyxxk.webserver.dao.his.chronicDisease;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Delete;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import thyyxxk.webserver.entity.chronicDisease.CrmPatientTzxx;
+
+@Mapper
+public interface CrmPatientTzxxDao extends BaseMapper<CrmPatientTzxx> {
+
+    @Select(" select * from crm_patient_tzxx where p_id = #{pId} and visit_times = #{visitTimes} ")
+    CrmPatientTzxx selectCrmTzxxByPid(@Param("pId") String pId, @Param("visitTimes") Integer visitTimes);
+
+    @Delete(" delete from crm_patient_tzxx where p_id = #{pId} and visit_times = #{visitTimes} ")
+    int deleteCrmTzxxByPid(@Param("pId") String pId, @Param("visitTimes") Integer visitTimes);
+
+}

+ 295 - 0
src/main/java/thyyxxk/webserver/entity/chronicDisease/CrmPatientMi.java

@@ -0,0 +1,295 @@
+package thyyxxk.webserver.entity.chronicDisease;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * @ClassName CrmPatientMi
+ * @Author Administrator
+ * @Date 2023/11/23 15:15
+ * @Version 1.0
+ * @Description 慢特病基本信息
+ **/
+@Data
+@TableName(value = "crm_patient_mi")
+public class CrmPatientMi implements Serializable {
+
+    private static final long serialVersionUID = -1L;
+
+    /**
+     * 用户ID
+     */
+//    @TableId(value = "p_id", type = IdType.AUTO)
+    @JsonProperty("pId")
+    private String pId;
+    /**
+     * 姓名
+     */
+    @JsonProperty("pName")
+    private String pName;
+    /**
+     * 性别
+     */
+    private String sex;
+    /**
+     * 出生日期
+     */
+    private String birthDate;
+    /**
+     * 病人来源
+     */
+    @JsonProperty("pType")
+    private String pType;
+    /**
+     * 所属企业
+     */
+    private String entId;
+    /**
+     * 门诊号
+     */
+    private String hisMzNo;
+    /**
+     * 住院号
+     */
+    private String hisZyNo;
+    /**
+     * 病案号
+     */
+    private String hisBaNo;
+    /**
+     * 体检号
+     */
+    private String hisTjNo;
+    /**
+     * 证件号
+     */
+    private String socialNo;
+    /**
+     * 卡号
+     */
+    private String cardNo;
+    /**
+     * 婚姻状况
+     */
+    private String marryCode;
+    /**
+     * 国籍
+     */
+    private String countryCode;
+    /**
+     * 民族
+     */
+    private String nationCode;
+    /**
+     * 职业
+     */
+    private String occupationCode;
+    /**
+     * 行业
+     */
+    private String vocationCode;
+    /**
+     * 区县编码
+     */
+    private String districtCode;
+    /**
+     * 区县e-mail
+     */
+    @JsonProperty("eMail")
+    private String eMail;
+    /**
+     * 家庭电话
+     */
+    private String homeTel;
+    /**
+     * 家庭住址
+     */
+    private String homeStreet;
+    /**
+     * 家庭邮编
+     */
+    private String homeZip;
+    /**
+     * 单位电话
+     */
+    private String empTel;
+    /**
+     * 单位名称
+     */
+    private String empName;
+    /**
+     * 单位地址
+     */
+    private String empStreet;
+    /**
+     * 单位邮编
+     */
+    private String empZip;
+    /**
+     * 联系电话
+     */
+    private String relTel;
+    /**
+     * 联系电话2
+     */
+    private String relTel2;
+    /**
+     * 联系人电话
+     */
+    private String relNameTel;
+    /**
+     * 联系人姓名
+     */
+    private String relName;
+    /**
+     * 联系人关系
+     */
+    private String relCode;
+    /**
+     * 联系人地址
+     */
+    private String relStreet;
+    /**
+     * 联系人邮编
+     */
+    private String relZip;
+    /**
+     * 最近一次医疗方式
+     */
+    private String lastType;
+    /**
+     * 最近一次医疗时间
+     */
+    private String lastDate;
+    /**
+     * 特殊备注
+     */
+    @JsonProperty("pComment")
+    private String pComment;
+    /**
+     * 病人等级
+     */
+    private String importLevel;
+    /**
+     * 等级描述
+     */
+    private String importComment;
+    /**
+     * 潜在问题(等级)
+     */
+    private String quLevel;
+    /**
+     * 潜在问题说明
+     */
+    private String quComment;
+    /**
+     * 证件类型
+     */
+    private String certificateType;
+    /**
+     * 慢特病类型
+     */
+    private String chronicDiseaseType;
+    /**
+     * 省
+     */
+    private String provinceCode;
+    /**
+     * 市
+     */
+    private String cityCode;
+    /**
+     * 详细地址
+     */
+    private String detailAdress;
+    /**
+     * 创建时间
+     */
+    private String createDate;
+    /**
+     * 创建人
+     */
+    private String creatId;
+    /**
+     * 主管医生(id)
+     */
+    private String referPhysician;
+    /**
+     * 最近一次随访次数
+     */
+    private Integer visitTimes;
+    /**
+     * 下次随访时间
+     */
+    private String visitDate;
+    /**
+     * 年龄
+     */
+    private String age;
+    /**
+     * 区(地区)
+     */
+    private String areaCode;
+    /**
+     * 身高
+     */
+    @TableField(exist = false)
+    private BigDecimal height;
+    /**
+     * 体重
+     */
+    @TableField(exist = false)
+    private BigDecimal weight;
+    /**
+     * 体温
+     */
+    @TableField(exist = false)
+    private BigDecimal temperature;
+    /**
+     * 收缩血压
+     */
+    @TableField(exist = false)
+    private Integer bloodPressureHigh;
+    /**
+     * 舒张血压
+     */
+    @TableField(exist = false)
+    private Integer bloodPressureLow;
+    /**
+     * 心率
+     */
+    @TableField(exist = false)
+    private Integer heartRate;
+    /**
+     * 血糖
+     */
+    @TableField(exist = false)
+    private BigDecimal bloodSugar;
+    /**
+     * 血氧
+     */
+    @TableField(exist = false)
+    private String bloodOxygen;
+    /**
+     * 呼吸频率
+     */
+    @TableField(exist = false)
+    private Integer respiratoryRate;
+    /**
+     * 慢特病类型组
+     */
+    @TableField(exist = false)
+    private List<String> chronicDiseaseTypeArr;
+    /**
+     * 主管医生名字(前端回显)
+     */
+    @TableField(exist = false)
+    private String referPhysicianName;
+
+}

+ 75 - 0
src/main/java/thyyxxk/webserver/entity/chronicDisease/CrmPatientTzxx.java

@@ -0,0 +1,75 @@
+package thyyxxk.webserver.entity.chronicDisease;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * @ClassName CrmPatientTzxx
+ * @Author Administrator
+ * @Date 2023/11/28 9:04
+ * @Version 1.0
+ * @Description 慢特病体征信息
+ **/
+@Data
+@TableName(value = "crm_patient_tzxx")
+public class CrmPatientTzxx implements Serializable  {
+
+    private static final long serialVersionUID = -2L;
+
+    /**
+     * 用户id
+     */
+    private String pId;
+    /**
+     * 随访次数
+     */
+    private Integer visitTimes;
+    /**
+     * 随访时间
+     */
+    private String visitDate;
+    /**
+     * 记录人id
+     */
+    private String inputId;
+    /**
+     * 体重
+     */
+    private BigDecimal height;
+    /**
+     * 身高
+     */
+    private BigDecimal weight;
+    /**
+     * 体温
+     */
+    private BigDecimal temperature;
+    /**
+     * 呼吸频率
+     */
+    private Integer respiratoryRate;
+    /**
+     * 心率
+     */
+    private Integer heartRate;
+    /**
+     * 血糖
+     */
+    private BigDecimal bloodSugar;
+    /**
+     * 收缩血压
+     */
+    private Integer bloodPressureHigh;
+    /**
+     * 舒张血压
+     */
+    private Integer bloodPressureLow;
+    /**
+     * 血氧饱和度
+     */
+    private String bloodOxygen;
+
+}

+ 277 - 0
src/main/java/thyyxxk/webserver/service/chronicDisease/ChronicDiseaseService.java

@@ -0,0 +1,277 @@
+package thyyxxk.webserver.service.chronicDisease;
+
+import lombok.extern.slf4j.Slf4j;
+import org.jetbrains.annotations.NotNull;
+import org.springframework.stereotype.Service;
+import thyyxxk.webserver.config.exception.ExceptionEnum;
+import thyyxxk.webserver.constants.YbTjConstant;
+import thyyxxk.webserver.dao.his.chronicDisease.ChronicDiseaseDao;
+import thyyxxk.webserver.dao.his.chronicDisease.CrmPatientMiDao;
+import thyyxxk.webserver.dao.his.chronicDisease.CrmPatientTzxxDao;
+import thyyxxk.webserver.dao.his.inpatient.casefrontsheet.SheetCreatedDao;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.chronicDisease.CrmPatientMi;
+import thyyxxk.webserver.entity.chronicDisease.CrmPatientTzxx;
+import thyyxxk.webserver.entity.dictionary.CodeName;
+import thyyxxk.webserver.utils.ResultVoUtil;
+import thyyxxk.webserver.utils.StringUtil;
+import thyyxxk.webserver.utils.YbReportUtil;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @ClassName ChronicDiseaseService
+ * @Author Administrator
+ * @Date 2023/11/23 14:37
+ * @Version 1.0
+ * @Description 慢特病管理
+ **/
+@Service
+@Slf4j
+public class ChronicDiseaseService {
+
+    private static Map<String, List<CodeName>> crmDictionary;
+
+    private final ChronicDiseaseDao dao;
+    private final CrmPatientMiDao cpmDao;
+    private final SheetCreatedDao createdDao;
+    private final CrmPatientTzxxDao tzxxDao;
+
+    public ChronicDiseaseService(ChronicDiseaseDao dao, CrmPatientMiDao cpmDao, SheetCreatedDao createdDao, CrmPatientTzxxDao tzxxDao) {
+        this.dao = dao;
+        this.cpmDao = cpmDao;
+        this.createdDao = createdDao;
+        this.tzxxDao = tzxxDao;
+        if (crmDictionary == null) {
+            crmDictionary = new HashMap<>();
+        }
+    }
+
+    /**
+     *  根据关键字查询慢特病基本信息
+     * @param keyCode 关键字
+     * @return 慢特病基本信息
+     */
+    public ResultVo<CrmPatientMi> selectCrmPatientMiByCode(String keyCode){
+        if(StringUtil.isBlank(keyCode)){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "查询的慢特病基本信息关键字不存在");
+        }
+        CrmPatientMi mi = cpmDao.selectCrmPatientMiByCode(keyCode);
+        if(null == mi){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, keyCode + "查询的慢特病基本信息不存在");
+        }
+
+        if(StringUtil.notBlank(mi.getChronicDiseaseType())){
+            mi.setChronicDiseaseTypeArr(Arrays.asList(mi.getChronicDiseaseType().split(",")));
+        }
+        return ResultVoUtil.success(mi);
+    }
+
+    /**
+     *  更新慢特病基本信息
+     * @param crmMi 慢特病基本信息
+     * @return map
+     */
+    public ResultVo<Map<String, Object>> updateCrmPatientMi(CrmPatientMi crmMi){
+
+        String msg = callCheckParamForCrm(crmMi);
+        if(StringUtil.notBlank(msg)){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, msg);
+        }
+
+        CrmPatientMi mi = cpmDao.selectCrmPatientMiByPId(crmMi.getPId());
+        if(null == mi){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, crmMi.getSocialNo() + "慢特病基本信息不存在,更新失败!");
+        }
+        CrmPatientTzxx crmTzXx = tzxxDao.selectCrmTzxxByPid(crmMi.getPId(), crmMi.getVisitTimes());
+        Map<String, Object> resultMap = new HashMap<>();
+        try{
+            cpmDao.deleteCrmPatientMiByPId(crmMi.getPId());
+            tzxxDao.deleteCrmTzxxByPid(crmMi.getPId(), crmMi.getVisitTimes());
+            int num = cpmDao.insert(crmMi);
+            CrmPatientTzxx tzXx = getCrmPatientTzxx(crmMi);
+            int nom = tzxxDao.insert(tzXx);
+            if(num == 0){
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "更新慢特病基本信息失败!");
+            }
+            resultMap.put("cg", "更新慢特病基本信息成功!");
+            return ResultVoUtil.success(resultMap);
+        } catch(Exception e){
+            log.info("更新慢特病基本信息失败:" + e.getMessage());
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "更新慢特病基本信息失败!");
+        }
+
+    }
+
+    /**
+     *  新增慢特病基本信息
+     * @param crmMi 慢特病基本信息
+     * @return map
+     */
+    public ResultVo<Map<String, Object>> saveCrmPatientMi(CrmPatientMi crmMi){
+
+        String msg = callCheckParamForCrm(crmMi);
+
+        if(StringUtil.notBlank(msg)){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, msg);
+        }
+
+        Map<String, Object> resultMap = new HashMap<>();
+        try{
+            if(StringUtil.notBlank(crmMi.getPId())){
+                CrmPatientMi mi = cpmDao.selectCrmPatientMiByPId(crmMi.getPId());
+                if(null != mi){
+                    cpmDao.deleteCrmPatientMiByPId(crmMi.getPId());
+                }
+            } else {
+                // 新增的时候添加pId
+                String pId = YbTjConstant.CRM_YY_TH + YbReportUtil.generateUkStr(1, 8);
+                crmMi.setPId(pId);
+            }
+            CrmPatientTzxx crmTzXx = tzxxDao.selectCrmTzxxByPid(crmMi.getPId(), crmMi.getVisitTimes());
+            if(null != crmTzXx){
+                tzxxDao.deleteCrmTzxxByPid(crmMi.getPId(), crmMi.getVisitTimes());
+            }
+            CrmPatientTzxx tzXx = getCrmPatientTzxx(crmMi);
+            int num = cpmDao.insert(crmMi);
+            int nom = tzxxDao.insert(tzXx);
+            if(num == 0){
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存慢特病基本信息失败!");
+            }
+            resultMap.put("cg", "保存慢特病基本信息成功!");
+            return ResultVoUtil.success(resultMap);
+        } catch(Exception e){
+            e.printStackTrace();
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存慢特病基本信息失败!");
+        }
+
+    }
+
+    @NotNull
+    private static CrmPatientTzxx getCrmPatientTzxx(CrmPatientMi crmMi) {
+        CrmPatientTzxx tzXx = new CrmPatientTzxx();
+        tzXx.setPId(crmMi.getPId());
+        tzXx.setVisitTimes(crmMi.getVisitTimes());
+        tzXx.setVisitDate(crmMi.getVisitDate());
+        tzXx.setInputId(crmMi.getCreatId());
+        tzXx.setHeight(crmMi.getHeight());
+        tzXx.setWeight(crmMi.getWeight());
+        tzXx.setTemperature(crmMi.getTemperature());
+        tzXx.setHeartRate(crmMi.getHeartRate());
+        tzXx.setBloodPressureLow(crmMi.getBloodPressureLow());
+        tzXx.setBloodPressureHigh(crmMi.getBloodPressureHigh());
+        tzXx.setBloodSugar(crmMi.getBloodSugar());
+        tzXx.setBloodOxygen(crmMi.getBloodOxygen());
+        tzXx.setRespiratoryRate(crmMi.getRespiratoryRate());
+        return tzXx;
+    }
+
+    public ResultVo<Map<String, List<CodeName>>> getCrmDictionary(){
+        if (crmDictionary.isEmpty()) {
+            // 性别字典
+            crmDictionary.put("getSexCode", createdDao.getSexCode());
+            // 婚姻状况字典
+            crmDictionary.put("getMarriageCode", createdDao.getMarriageCode());
+            // 来源途径
+            crmDictionary.put("getAdmissWay", createdDao.getAdmissWay());
+            // 联系人关系字典
+            crmDictionary.put("getRelations", createdDao.getRelations());
+            // 职业字典
+            crmDictionary.put("getOccupation", createdDao.getOccupation());
+            // 国家字典
+            crmDictionary.put("getCountry", createdDao.getCountry());
+            // 民族字典
+            crmDictionary.put("getNation", createdDao.getNation());
+            // 慢特病类型字典
+            crmDictionary.put("getCrmClass", dao.getCrmClass());
+            // 省
+            crmDictionary.put("getProvince", dao.getProvince());
+            // 市
+            crmDictionary.put("getCity", dao.getCity(""));
+            // 区
+            crmDictionary.put("getArea", dao.getArea(""));
+            // 证件类型字典
+            crmDictionary.put("getPsnCertType", dao.getPsnCertType());
+        }
+        return ResultVoUtil.success(crmDictionary);
+    }
+
+    /**
+     * 根据code查询市信息
+     * @param code 编码
+     * @return CodeName 市信息
+     */
+    public ResultVo<List<CodeName>> getCrmCityByCode(String code){
+        return ResultVoUtil.success(dao.getCity(code));
+    }
+
+    /**
+     * 根据code查询区信息
+     * @param code 编码
+     * @return CodeName 区信息
+     */
+    public ResultVo<List<CodeName>> getCrmAreaByCode(String code){
+        return ResultVoUtil.success(dao.getArea(code));
+    }
+
+    private String callCheckParamForCrm(@NotNull CrmPatientMi crmMi) {
+        String msg = "";
+        String s = "^\\d+$";
+        String s1 = "^\\d+(\\.\\d+)?$";
+        String sfz15 = "^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{2}$";
+        String sfz18 = "^[1-9]\\d{5}(18|19|([23]\\d))\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$";
+        if(StringUtil.isBlank(crmMi.getSocialNo())){
+            msg = "保存慢特病基本信息失败,证件号为空,请检查!";
+        } else if(StringUtil.isBlank(crmMi.getPName())){
+            msg = "保存慢特病基本信息失败,用户名称为空,请检查!";
+        } else if(StringUtil.isBlank(crmMi.getPType())){
+            msg = "保存慢特病基本信息失败,病人来源为空,请检查!";
+        } else if(StringUtil.notBlank(String.valueOf(crmMi.getHeight()))){
+            if(!crmMi.getHeight().toString().matches(s1)){
+                msg = "保存慢特病基本信息失败,病人身高填写不符合(仅限纯数字以及小数点),请检查!";
+            }
+        } else if(StringUtil.notBlank(String.valueOf(crmMi.getWeight()))){
+            if(!String.valueOf(crmMi.getWeight()).matches(s1)){
+                msg = "保存慢特病基本信息失败,病人体重填写不符合(仅限纯数字以及小数点),请检查!";
+            }
+        } else if(StringUtil.notBlank(String.valueOf(crmMi.getTemperature()))){
+            if(!String.valueOf(crmMi.getTemperature()).matches(s1)){
+                msg = "保存慢特病基本信息失败,病人体温填写不符合(仅限纯数字以及小数点),请检查!";
+            }
+        } else if(StringUtil.notBlank(String.valueOf(crmMi.getHeartRate()))){
+            if(!String.valueOf(crmMi.getHeartRate()).matches(s)){
+                msg = "保存慢特病基本信息失败,病人心率填写不符合(仅限纯数字),请检查!";
+            }
+        } else if(StringUtil.notBlank(String.valueOf(crmMi.getBloodSugar()))){
+            if(!String.valueOf(crmMi.getBloodSugar()).matches(s1)){
+                msg = "保存慢特病基本信息失败,病人血糖填写不符合(仅限纯数字以及小数点),请检查!";
+            }
+        } else if(StringUtil.notBlank(String.valueOf(crmMi.getBloodPressureLow()))){
+            if(!String.valueOf(crmMi.getBloodPressureLow()).matches(s)){
+                msg = "保存慢特病基本信息失败,病人舒张血压填写不符合(仅限纯数字),请检查!";
+            }
+        } else if(StringUtil.notBlank(String.valueOf(crmMi.getBloodPressureHigh()))){
+            if(!String.valueOf(crmMi.getBloodPressureHigh()).matches(s)){
+                msg = "保存慢特病基本信息失败,病人收缩血压填写不符合(仅限纯数字),请检查!";
+            }
+        } else if("1".equals(crmMi.getCertificateType())){
+            if(crmMi.getSocialNo().length() == 15){
+                if(!String.valueOf(crmMi.getBloodPressureHigh()).matches(sfz15)){
+                    msg = "保存慢特病基本信息失败,病人身份证号码(15位)填写不符合,请检查!";
+                }
+            } else if(crmMi.getSocialNo().length() == 18) {
+                if(!String.valueOf(crmMi.getBloodPressureHigh()).matches(sfz18)){
+                    msg = "保存慢特病基本信息失败,病人身份证号码(18位)填写不符合,请检查!";
+                }
+            } else {
+                msg = "保存慢特病基本信息失败,病人身份证号码填写不符合(不是15或18位数),请检查!";
+            }
+        }
+
+        return msg;
+    }
+
+}

+ 29 - 0
src/main/java/thyyxxk/webserver/utils/YbReportUtil.java

@@ -1,6 +1,9 @@
 package thyyxxk.webserver.utils;
 
+import cn.hutool.core.lang.Pair;
+
 import java.math.BigDecimal;
+import java.util.concurrent.ThreadLocalRandom;
 
 /**
  * @ClassName YbReportUtil
@@ -27,4 +30,30 @@ public class YbReportUtil {
         }
     }
 
+    /**
+     * 生成len个字符的唯一随机字符串,由数字大小写字母组成
+     * @param increment 唯一数字
+     * @param len 唯一随机字符长度
+     * @return 字符串
+     */
+    public static String generateUkStr(long increment, int len) {
+        char[] incrementArr = String.format("%0" + len + "d", increment).toCharArray();
+        Pair<Integer, Integer> pairA = Pair.of(17, 33);
+        Pair<Integer, Integer> pairB = Pair.of(49, 65);
+        StringBuilder result = new StringBuilder(len);
+        char s;
+        for (char c : incrementArr) {
+            int randomNum = ThreadLocalRandom.current().nextInt(0, 3);
+            if (randomNum == 0) {
+                s = c;
+            } else if (randomNum == 1) {
+                s = (char) (c + ThreadLocalRandom.current().nextInt(pairA.getKey(), pairA.getValue() + 1));
+            } else {
+                s = (char) (c + ThreadLocalRandom.current().nextInt(pairB.getKey(), pairB.getValue() + 1));
+            }
+            result.append(s);
+        }
+        return result.toString();
+    }
+
 }