Forráskód Böngészése

电子病历解析,医技费用录入查询新增字段

xiaochan 3 hónapja
szülő
commit
970e2b83b1

+ 1 - 1
src/main/java/thyyxxk/webserver/dao/his/inpatient/xmlr/XiangMuLuRuDao.java

@@ -851,7 +851,7 @@ public interface XiangMuLuRuDao extends BaseMapper<ZyDetailCharge> {
             "                        a.zy_serial_no,\n" +
             "                        a.mz_no,\n" +
             "                        rtrim(a.intern_code)     as intern_code,\n" +
-            "                        a.zk_ward\n" +
+            "                        a.zk_ward,birthDate=(select t.birth_date from a_patient_mi t where t.inpatient_no = a.inpatient_no) " +
             "FROM ${tableName} a\n" +
             "${ew.customSqlSegment};")
     ZyActpatient getPatientInfo(@Param("ew") QueryWrapper<?> qw, @Param("tableName") String tableName);

+ 7 - 0
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyisheng/emr/EmrPatientDao.java

@@ -567,4 +567,11 @@ public interface EmrPatientDao extends BaseMapper<EmrPatientData> {
             "order by create_date desc")
     String obtainAdmissionDiagnosis(String patNo, Integer times);
 
+
+    @Select("select top 1 emr_data_element\n" +
+            "from emr_patient_data\n" +
+            "where emr_category_code = '${code}' and pat_no = #{patNo} and times = #{times} " +
+            "order by create_date desc")
+    String findEmrByCode(String patNo, Integer times, String code);
+
 }

+ 9 - 0
src/main/java/thyyxxk/webserver/entity/CodeName.java

@@ -0,0 +1,9 @@
+package thyyxxk.webserver.entity;
+
+import lombok.Data;
+
+@Data
+public class CodeName {
+    private String code;
+    private String name;
+}

+ 12 - 0
src/main/java/thyyxxk/webserver/entity/inpatient/ZyActpatient.java

@@ -890,6 +890,18 @@ public class ZyActpatient implements Serializable {
     //住院缴费记录
     List<ZyDepositFile> zyDepositFiles;
 
+    // 电子病历入院记录的主要诊断
+    private String emrDiagStr;
+
+    private Integer age;
+
+    /**
+     * 出生日期
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date birthDate;
+
     /**
      * 违规费用
      */

+ 5 - 1
src/main/java/thyyxxk/webserver/service/inpatient/xmlr/XiangMuLuRuService.java

@@ -34,6 +34,7 @@ import thyyxxk.webserver.service.PublicServer;
 import thyyxxk.webserver.service.hutoolcache.UserCache;
 import thyyxxk.webserver.service.hutoolcache.ZyBillItemCache;
 import thyyxxk.webserver.service.medicalinsurance.SiZyService;
+import thyyxxk.webserver.service.zhuyuanyisheng.emr.EmrServer;
 import thyyxxk.webserver.utils.*;
 
 import javax.servlet.http.HttpServletResponse;
@@ -61,7 +62,7 @@ public class XiangMuLuRuService {
     private final SiSettleApplyDao siSettleApplyDao;
     private final UserCache userCache;
     private final ZyBillItemCache zyBillItemCache;
-
+    private final EmrServer emrServer;
 
     private XiangMuLuRuService getThis() {
         return SpringUtil.getBean(this.getClass());
@@ -94,6 +95,9 @@ public class XiangMuLuRuService {
         if (patientInfo == null) {
             return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
         }
+        String emrByCode = emrServer.findEmrByCode(patientInfo.getInpatientNo(), patientInfo.getAdmissTimes(), "ruyuanjiluzhuanyong");
+        patientInfo.setAge(DateUtil.calculateAge(patientInfo.getBirthDate(), patientInfo.getAdmissDate()));
+        patientInfo.setEmrDiagStr(EmrJsonUtils.businessCodeValueStr(emrByCode, "入院诊断"));
         return ResultVoUtil.success(patientInfo);
     }
 

+ 4 - 0
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/emr/EmrServer.java

@@ -1057,4 +1057,8 @@ public class EmrServer {
         return ResultVoUtil.success(ExceptionEnum.LOGICAL_ERROR, "重命名失败。");
     }
 
+    public String findEmrByCode(String patNo, Integer times, String code) {
+        return dao.findEmrByCode(patNo, times, code);
+    }
+
 }

+ 51 - 0
src/main/java/thyyxxk/webserver/utils/EmrJsonUtils.java

@@ -0,0 +1,51 @@
+package thyyxxk.webserver.utils;
+
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONObject;
+import cn.hutool.json.JSONUtil;
+import thyyxxk.webserver.entity.CodeName;
+
+import java.util.List;
+
+public class EmrJsonUtils {
+    public static String businessCodeValueStr(String jsonStr, String businessCode) {
+        if (StrUtil.isBlank(jsonStr)) {
+            return "";
+        }
+        JSONObject jsonValue = JSONUtil.toBean(jsonStr, JSONObject.class);
+        List<CodeName> codeNames = analysisValueIsArr(jsonValue, businessCode);
+        if (ListUtil.notBlank(codeNames)) {
+            return codeNames.get(0).getName();
+        }
+        String value = analysisValueIsStr(jsonValue, businessCode);
+        if (!"null".equals(value)) {
+            return value;
+        }
+        return "";
+    }
+
+    /**
+     * 返回值如果是 "null" 就说明报错了
+     *
+     * @param json         json 数据
+     * @param businessCode 业务编码
+     * @return
+     */
+    public static String analysisValueIsStr(JSONObject json, String businessCode) {
+        try {
+            return json.getByPath(businessCode + ".value", String.class);
+        } catch (Exception e) {
+            return "null";
+        }
+    }
+
+    public static List<CodeName> analysisValueIsArr(JSONObject json, String businessCode) {
+        try {
+            return json.getByPath(businessCode + ".value", JSONArray.class).toList(CodeName.class);
+        } catch (Exception e1) {
+            return null;
+        }
+    }
+
+}