瀏覽代碼

Merge remote-tracking branch 'upstream/master'

hsh 2 月之前
父節點
當前提交
6fe0ab4c17

+ 3 - 0
src/main/java/thyyxxk/webserver/dao/his/inpatient/casefrontsheet/CaseFrontSheetDao.java

@@ -585,6 +585,9 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
     @Select("select name from t_region where code=#{region}")
     @Select("select name from t_region where code=#{region}")
     String selectRegionName(Integer region);
     String selectRegionName(Integer region);
 
 
+    @Select("select name from zd_district_code where code=#{code}")
+    String getDistrictName(String code);
+
     @Select("select top 1 med_type from t_si_pat_info where pat_no=#{patNo} and times=#{times} order by " +
     @Select("select top 1 med_type from t_si_pat_info where pat_no=#{patNo} and times=#{times} order by " +
             "ledger_sn desc")
             "ledger_sn desc")
     String selectMedType(String patNo, int times);
     String selectMedType(String patNo, int times);

+ 17 - 11
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyisheng/YiZhuLuRuDao.java

@@ -1399,18 +1399,24 @@ public interface YiZhuLuRuDao {
 
 
     @Select("select count(1)\n" +
     @Select("select count(1)\n" +
             "from yz_act_order\n" +
             "from yz_act_order\n" +
-            "where inpatient_no = #{patNo}\n" +
-            "  and admiss_times = #{times}\n" +
-            "  and start_time >= (select top 1 start_time\n" +
-            "                     from yz_act_order a\n" +
-            "                     where a.inpatient_no = #{patNo}\n" +
-            "                       and a.admiss_times = #{times}\n" +
-            "                       and a.order_code in (select order_code from yz_zd_order_item_confirm where item_name = N'出院')\n" +
-            "                       and serial = '00' " +
-            "  and a.act_order_no <> yz_act_order.act_order_no" +
-            "                     order by start_time desc)")
+            "where inpatient_no = '0434706'\n" +
+            "  and admiss_times = 1\n" +
+            "  and start_time >= #{start}\n" +
+            "  and act_order_no <> #{orderNo} ;")
     Integer prescribeMedicalAdviceAfterDischarge(String patNo,
     Integer prescribeMedicalAdviceAfterDischarge(String patNo,
-                                                 Integer times);
+                                                 Integer times, Date start, BigDecimal orderNo);
+
+    @Select("select top 1 start_time, act_order_no\n" +
+            "            from yz_act_order a\n" +
+            "            where a.inpatient_no = #{patNo}\n" +
+            "              and a.admiss_times = #{times}\n" +
+            "              and a.order_code in (select order_code\n" +
+            "                                   from yz_zd_order_item_confirm\n" +
+            "                                   where item_name = N'出院')\n" +
+            "              and serial = '00'\n" +
+            "            order by start_time desc")
+    YzActOrder selectFinallyOutOrderInfo(String patNo,
+                                         Integer times);
 
 
 
 
     @Select("select top 1 ward_code\n" +
     @Select("select top 1 ward_code\n" +

+ 14 - 9
src/main/java/thyyxxk/webserver/service/heliyongyao/RationalUseServer.java

@@ -237,17 +237,22 @@ public class RationalUseServer {
         List<XunHuanJieDian> diagnosticData = new ArrayList<>();
         List<XunHuanJieDian> diagnosticData = new ArrayList<>();
         JSONObject medicalRecordDiagnosticData = JSONObject.parseObject(dao.medicalRecordDiagnosticData(patNo, times));
         JSONObject medicalRecordDiagnosticData = JSONObject.parseObject(dao.medicalRecordDiagnosticData(patNo, times));
         if (medicalRecordDiagnosticData != null) {
         if (medicalRecordDiagnosticData != null) {
-            JSONArray arr = medicalRecordDiagnosticData.getJSONArray("入院诊断");
-            if (arr != null && !arr.isEmpty()) {
-                for (int i = 0; i < arr.size(); i++) {
-                    JSONObject item = arr.getJSONObject(i);
-                    XunHuanJieDian temp = new XunHuanJieDian();
-                    temp.setType("2");
-                    temp.setCode(item.getString("code"));
-                    temp.setName(item.getString("name"));
-                    diagnosticData.add(temp);
+            try {
+                JSONArray arr = medicalRecordDiagnosticData.getJSONObject("入院诊断").getJSONArray("value");
+                if (arr != null && !arr.isEmpty()) {
+                    for (int i = 0; i < arr.size(); i++) {
+                        JSONObject item = arr.getJSONObject(i);
+                        XunHuanJieDian temp = new XunHuanJieDian();
+                        temp.setType("2");
+                        temp.setCode(item.getString("code"));
+                        temp.setName(item.getString("name"));
+                        diagnosticData.add(temp);
+                    }
                 }
                 }
+            } catch (Exception e) {
+                throw new BizException(ExceptionEnum.NOT_EL_MESSAGE, "获取入院诊断错误");
             }
             }
+
         }
         }
 
 
         // 诊断节点
         // 诊断节点

+ 8 - 0
src/main/java/thyyxxk/webserver/service/inpatient/casefrontsheet/CaseFrontSheetMainService.java

@@ -804,6 +804,14 @@ public class CaseFrontSheetMainService {
         if (null == sheet.getSignStaff()) {
         if (null == sheet.getSignStaff()) {
             sheet.setSignStaff(dao.selectSignStaff(sheet.getBah(), sheet.getAdmissTimes()));
             sheet.setSignStaff(dao.selectSignStaff(sheet.getBah(), sheet.getAdmissTimes()));
         }
         }
+        if (StringUtil.notBlank(sheet.getBirthPlace()) &&
+                StringUtil.isBlank(sheet.getBirthPlaceName())) {
+            String bpName = dao.getDistrictName(sheet.getBirthPlace());
+            if (StringUtil.isBlank(bpName)) {
+                bpName = sheet.getBirthPlace();
+            }
+            sheet.setBirthPlaceName(bpName);
+        }
         dao.deleteOldSheet(sheet.getBah(), sheet.getAdmissTimes());
         dao.deleteOldSheet(sheet.getBah(), sheet.getAdmissTimes());
         //在t_case_frontsheet_main表中插入 主体的内容
         //在t_case_frontsheet_main表中插入 主体的内容
         dao.insert(sheet);
         dao.insert(sheet);

+ 14 - 0
src/main/java/thyyxxk/webserver/service/inpatient/casefrontsheet/VerifyCaseFrontSheet.java

@@ -192,6 +192,8 @@ public class VerifyCaseFrontSheet {
         }
         }
         if (StringUtil.isBlank(info.getClinicDiagCode()) || StringUtil.isBlank(info.getClinicDiagStr())) {
         if (StringUtil.isBlank(info.getClinicDiagCode()) || StringUtil.isBlank(info.getClinicDiagStr())) {
             array.add(new CodeName("clinicDiag", "患者门(急)诊诊断需要填写标准诊断,请补充。"));
             array.add(new CodeName("clinicDiag", "患者门(急)诊诊断需要填写标准诊断,请补充。"));
+        } else {
+            validateClinicDiagnose(info.getClinicDiagCode(), array);
         }
         }
         CaseFrontsheetDisdiag disdiag = info.getDisdiagList().get(0);
         CaseFrontsheetDisdiag disdiag = info.getDisdiagList().get(0);
         if (StringUtil.isBlank(disdiag.getName())) {
         if (StringUtil.isBlank(disdiag.getName())) {
@@ -552,6 +554,18 @@ public class VerifyCaseFrontSheet {
         return errors;
         return errors;
     }
     }
 
 
+    private void validateClinicDiagnose(String code, List<CodeName> errors) {
+        String fstLetter = code.substring(0, 1).toUpperCase();
+        if (isNumeric(fstLetter)) {
+            errors.add(new CodeName("clinicDiag", "门(急)诊诊断编码范围应为:A~U开头和Z开头的编码;不包括字母V、W、X、Y开头的编码。"));
+            return;
+        }
+        if (fstLetter.equals("V") || fstLetter.equals("W") ||
+                fstLetter.equals("X") || fstLetter.equals("Y")) {
+            errors.add(new CodeName("clinicDiag", "门(急)诊诊断编码范围应为:A~U开头和Z开头的编码;不包括字母V、W、X、Y开头的编码。"));
+        }
+    }
+
     private void validateMainDiagnose(String code, List<CodeName> errors) {
     private void validateMainDiagnose(String code, List<CodeName> errors) {
         if (StringUtil.isBlank(code)) {
         if (StringUtil.isBlank(code)) {
             return;
             return;

+ 10 - 4
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/YiZhuLuRuServer.java

@@ -226,8 +226,11 @@ public class YiZhuLuRuServer {
     public ResultVo<Map<String, Object>> confirmOrders(XinZhenYiZhu param) {
     public ResultVo<Map<String, Object>> confirmOrders(XinZhenYiZhu param) {
         // 判断是否开了出院医嘱后的医嘱
         // 判断是否开了出院医嘱后的医嘱
         if (!yzConfig.getPrescribeMedicalAdviceAfterDischarge()) {
         if (!yzConfig.getPrescribeMedicalAdviceAfterDischarge()) {
-            if (dao.prescribeMedicalAdviceAfterDischarge(param.getInpatientNo(), param.getAdmissTimes()) > 0) {
-                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "有医嘱开在了出院医嘱后无法确认。");
+            YzActOrder ourOrderInfo = dao.selectFinallyOutOrderInfo(param.getInpatientNo(), param.getAdmissTimes());
+            if (ourOrderInfo != null) {
+                if (dao.prescribeMedicalAdviceAfterDischarge(param.getInpatientNo(), param.getAdmissTimes(), ourOrderInfo.getStartTime(), ourOrderInfo.getActOrderNo()) > 0) {
+                    return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "有医嘱开在了出院医嘱后无法确认。");
+                }
             }
             }
         }
         }
 
 
@@ -1193,8 +1196,11 @@ public class YiZhuLuRuServer {
 
 
         // 判断是否开了出院医嘱后的医嘱
         // 判断是否开了出院医嘱后的医嘱
         if (!yzConfig.getPrescribeMedicalAdviceAfterDischarge()) {
         if (!yzConfig.getPrescribeMedicalAdviceAfterDischarge()) {
-            if (dao.prescribeMedicalAdviceAfterDischarge(patNo, times) > 0) {
-                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "有医嘱开在了出院医嘱后无法确认。");
+            YzActOrder ourOrderInfo = dao.selectFinallyOutOrderInfo(patNo, times);
+            if (ourOrderInfo != null) {
+                if (dao.prescribeMedicalAdviceAfterDischarge(patNo, times, ourOrderInfo.getStartTime(), ourOrderInfo.getActOrderNo()) > 0) {
+                    return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "有医嘱开在了出院医嘱后无法确认。");
+                }
             }
             }
         }
         }