Browse Source

优化病案首页导出

lighter 2 years ago
parent
commit
c3c6caf2cf

+ 2 - 1
src/main/java/thyyxxk/webserver/dao/his/casefrontsheet/CaseFrontSheetDao.java

@@ -111,7 +111,8 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
             "clinicDiagStr=rtrim(clinic_diag_str), " +
             "clinicDiagCode=rtrim(clinic_diag), " +
             "totalCost=total_charge, " +
-            "selfPay=(select sum(last_balance) from zy_ledger_file with(nolock) where inpatient_no=#{bah} and admiss_times=#{times})," +
+            "selfPay=(select sum(last_balance) from zy_ledger_file with(nolock) " +
+            "where inpatient_no=#{bah} and admiss_times=#{times} and ledger_sn>0)," +
             "autopsy=rtrim(autopsy_mark)," +
             "hasSurgery=rtrim(operation)," +
             "diagConform1=rtrim(diagnose_conform1)," +

+ 14 - 2
src/main/java/thyyxxk/webserver/entity/casefrontsheet/CaseFrontsheetMain.java

@@ -597,7 +597,7 @@ public class CaseFrontsheetMain implements Serializable {
     /**
      * 中医治疗费
      */
-    private String tcmTreatmentFee;
+    private String tcmTreatmentFee = "0.00";
 
     /**
      * 西药费
@@ -859,7 +859,19 @@ public class CaseFrontsheetMain implements Serializable {
     }
 
     public String getSelfPay() {
-        return isBlank(selfPay) ? "0" : selfPay.trim();
+        return isBlank(selfPay) ? "0.00" : selfPay.trim();
+    }
+
+    public String getSurgicalFee() {
+        return isBlank(surgicalFee) ? "0.00" : surgicalFee.trim();
+    }
+
+    public String getAnesthetizeFee() {
+        return isBlank(anesthetizeFee) ? "0.00" : anesthetizeFee.trim();
+    }
+
+    public String getSurgeryFee() {
+        return isBlank(surgeryFee) ? "0.00" : surgeryFee.trim();
     }
 
     public String getDismissDept() {

+ 38 - 45
src/main/java/thyyxxk/webserver/service/casefrontsheet/CaseFrontSheetExportService.java

@@ -1,5 +1,6 @@
 package thyyxxk.webserver.service.casefrontsheet;
 
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import thyyxxk.webserver.constants.frntsheet.DismissWay;
@@ -14,6 +15,7 @@ import thyyxxk.webserver.utils.StringUtil;
 
 import java.util.List;
 
+@Slf4j
 @Service
 public class CaseFrontSheetExportService {
     private final FrontSheetExportDao dao;
@@ -29,54 +31,45 @@ public class CaseFrontSheetExportService {
         String begin = month + "-01 00:00:00.000";
         String end = DateUtil.getMonthEndtime(month);
         List<CaseFrontsheetMain> list = dao.fetchSheets(begin, end);
-        list.forEach(item -> {
-            String pmtd = item.getPayMethod();
-            if (StringUtil.invalidValue(pmtd)) {
-                item.setPayMethod("9");
+        for (CaseFrontsheetMain sheet : list) {
+            sheet.setSurgeryList(selectSurgeries(sheet.getBah(), sheet.getAdmissTimes()));
+            sheet.setZyDismissWay(DismissWay.getWjwCodeByHisCode(sheet.getZyDismissWay()));
+            sheet.setHbsAg(Hbsag.getWjwCodeByHisCode(sheet.getHbsAg()));
+            String ntvplc = sheet.getNativePlace().substring(0, 2);
+            sheet.setPayMethod(filterPayMethod(sheet.getPayMethod(), sheet.getSocialNo()));
+            sheet.setRh(filterRh(sheet.getRh()));
+            sheet.setNativePlace(Provinces.getWjwCodeByHisCode(ntvplc));
+            sheet.setCountry(redis.getCountryName(sheet.getCountry()));
+            sheet.setAdmissDeptCode(redis.getWjwDepartment(sheet.getAdmissDeptCode()));
+            sheet.setZkWardCode(redis.getWjwDepartment(sheet.getZkWardCode()));
+            sheet.setDismissDeptCode(redis.getWjwDepartment(sheet.getDismissDeptCode()));
+            sheet.setNation(redis.getWjwNation(sheet.getNation()));
+            sheet.setDisdiagList(dao.fetchDiags(sheet.getBah(), sheet.getAdmissTimes()));
+        }
+
+        list.removeIf(item -> item.getSurgeryList().isEmpty());
+        return list;
+    }
+
+    private List<CaseFrontsheetSurgery> selectSurgeries(String bah, int times) {
+        List<CaseFrontsheetSurgery> surgeries = dao.fetchSurgeries(bah, times);
+        surgeries.forEach(s -> {
+            int cut = 0;
+            if (StringUtil.notBlank(s.getCut())) {
+                cut = Integer.parseInt(s.getCut());
+            }
+            int heal = 0;
+            if (StringUtil.notBlank(s.getHeal())) {
+                heal = Integer.parseInt(s.getHeal());
+            }
+            if (cut == 0 || heal == 0) {
+                s.setWjwCutHeal(0);
             } else {
-                int mtd = Integer.parseInt(pmtd);
-                if (mtd < 4) {
-                    if (item.getSocialNo().startsWith("4301")) {
-                        pmtd = pmtd + ".1";
-                    } else {
-                        pmtd = pmtd + ".2";
-                    }
-                    item.setPayMethod(pmtd);
-                }
+                int wjwCutHeal = (cut - 1) * cut + heal + negationCalculatingResidue(cut);
+                s.setWjwCutHeal(wjwCutHeal);
             }
-            item.setZyDismissWay(DismissWay.getWjwCodeByHisCode(item.getZyDismissWay()));
-            item.setHbsAg(Hbsag.getWjwCodeByHisCode(item.getHbsAg()));
-            String ntvplc = item.getNativePlace().substring(0, 2);
-            item.setPayMethod(filterPayMethod(item.getPayMethod(), item.getSocialNo()));
-            item.setRh(filterRh(item.getRh()));
-            item.setNativePlace(Provinces.getWjwCodeByHisCode(ntvplc));
-            item.setCountry(redis.getCountryName(item.getCountry()));
-            item.setAdmissDeptCode(redis.getWjwDepartment(item.getAdmissDeptCode()));
-            item.setZkWardCode(redis.getWjwDepartment(item.getZkWardCode()));
-            item.setDismissDeptCode(redis.getWjwDepartment(item.getDismissDeptCode()));
-            item.setNation(redis.getWjwNation(item.getNation()));
-            item.setDisdiagList(dao.fetchDiags(item.getBah(), item.getAdmissTimes()));
-            List<CaseFrontsheetSurgery> surgeries = dao.fetchSurgeries(item.getBah(), item.getAdmissTimes());
-            surgeries.forEach(s -> {
-                s.setAnaesthesia(redis.getWjwAnaesthesia(s.getAnaesthesia()));
-                int cut = 0;
-                if (StringUtil.notBlank(s.getCut())) {
-                    cut = Integer.parseInt(s.getCut());
-                }
-                int heal = 0;
-                if (StringUtil.notBlank(s.getHeal())) {
-                    heal = Integer.parseInt(s.getHeal());
-                }
-                if (cut == 0 || heal == 0) {
-                    s.setWjwCutHeal(0);
-                } else {
-                    int wjwCutHeal = (cut - 1) * cut + heal + negationCalculatingResidue(cut);
-                    s.setWjwCutHeal(wjwCutHeal);
-                }
-            });
-            item.setSurgeryList(surgeries);
         });
-        return list;
+        return surgeries;
     }
 
     private String filterPayMethod(String method, String idNumber) {

+ 18 - 6
src/main/java/thyyxxk/webserver/service/casefrontsheet/VerifyCaseFrontSheet.java

@@ -315,6 +315,11 @@ public class VerifyCaseFrontSheet {
     }
 
     private List<CodeName> connectedVerify(List<CodeName> array, CaseFrontsheetMain info, Integer opType) {
+        if (info.getMarriage().equals("1") || info.getMarriage().equals("3") || info.getMarriage().equals("4")) {
+            if (info.getContactRelation().equals("1")) {
+                array.add(new CodeName("contactRelation", "当婚姻状况为未婚、丧偶、离婚时,患者联系人关系不允许为配偶!"));
+            }
+        }
         if (StringUtil.notBlank(info.getZyDismissWay())) {
             if ("1".equals(info.getZyDismissWay())  || "2".equals(info.getZyDismissWay())) {
                 if (StringUtil.invalidValue(info.getDismissDestination())) {
@@ -332,6 +337,11 @@ public class VerifyCaseFrontSheet {
                 }
             }
         }
+        if ("4".equals(info.getZyDismissWay())) {
+            if (StringUtil.isBlank(info.getAutopsy())) {
+                array.add(new CodeName("autopsy", "离院方式为死亡时,尸检不能为空!"));
+            }
+        }
         if (StringUtil.validValue(info.getAutopsy()) && !"".equals(info.getAutopsy())) {
             if (!"4".equals(info.getZyDismissWay())) {
                 array.add(new CodeName("zyDismissWay","尸检不为空时,需要离院方式为死亡!"));
@@ -421,13 +431,15 @@ public class VerifyCaseFrontSheet {
         if (StringUtil.isBlank(surgery.getName())) {
             return;
         }
-        if (isHighLevelSurgery(surgery.getLevel())) {
-            if (StringUtil.isBlank(surgery.getName())) {
-                array.add(new CodeName("surgeryTable","手术" + surgery.getNo() + ",三、四级手术名称、编码不能为空!"));
-            }
-            if (StringUtil.isBlank(surgery.getOperator())) {
-                array.add(new CodeName("surgeryTable","手术" + surgery.getNo() + ",三、四级手术术者不能为空!"));
+        if (!surgery.getAnaesthesia().equals("23") && !surgery.getAnaesthesia().equals("29")) {
+            if (StringUtil.isBlank(surgery.getAnaesthesiaorName())) {
+                array.add(new CodeName("surgeryTable", "手术" + surgery.getNo() + ",麻醉医师不能为空!"));
             }
+        }
+        if (StringUtil.isBlank(surgery.getOperator())) {
+            array.add(new CodeName("surgeryTable","手术" + surgery.getNo() + ",术者不能为空!"));
+        }
+        if (isHighLevelSurgery(surgery.getLevel())) {
             if (StringUtil.isBlank(surgery.getAssistantOne())) {
                 array.add(new CodeName("surgeryTable","手术" + surgery.getNo() + ",三、四级手术I助不能为空!"));
             }