浏览代码

病案首页

‘chenzhilei’ 1 天之前
父节点
当前提交
168c004799

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

@@ -255,6 +255,11 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
             "group by charge_code")
     List<CodeName> selectPatCharges(String bah, int times);
 
+//    查询转科相关医嘱
+    @Select("select yz.act_order_no,yz.exec_time,zk.old_dept,zk.new_dept from yz_act_order yz " +
+            "left join zy_order_zk zk on yz.act_order_no=zk.act_order_no where yz.inpatient_no=#{patNo} and yz.admiss_times=#{times}")
+    List<Map<String,Object>> selectZkOrderList(String patNo, int times);
+
     @Select("select no=rtrim(dis_diag_no), name=rtrim(dis_diag_comment), " +
             "code=rtrim(dis_diag), admissStatus=rtrim(admiss_status), " +
             "dismissStatus=rtrim(dis_diag_status) from ba_first_page1 with(nolock) " +
@@ -301,7 +306,8 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
             "relation_name=#{contactName}, " +
             "relation_code=#{contactRelation}, " +
             "relation_street=#{contactAddrName}, " + // max 32 char
-            "relation_tel=#{contactPhone} " +
+            "relation_tel=#{contactPhone}, " +
+            "psn_cert_type=#{psnCertificateType} " +
             "where inpatient_no=#{bah}")
     void updateAPatientMi(CaseFrontsheetMain sheet);
 

+ 5 - 2
src/main/java/thyyxxk/webserver/dao/his/inpatient/casefrontsheet/SheetCreatedDao.java

@@ -41,7 +41,7 @@ public interface SheetCreatedDao extends BaseMapper<CaseFrontsheetDisdiag> {
     @Select("select rtrim(code) code, rtrim(name) name from zy_zd_admiss_way with(nolock)")
     List<CodeName> getAdmissWay();
 
-    @Select("select rtrim(code) code, rtrim(name) name from zd_blood_type with(nolock) union select code='',name=''")
+    @Select("select rtrim(code) code, rtrim(name) name from zd_blood_type with(nolock)")
     List<CodeName> getBloodType();
 
     @Select("select rtrim(code) code, rtrim(name) name from zd_anaesthesia with(nolock)")
@@ -59,7 +59,7 @@ public interface SheetCreatedDao extends BaseMapper<CaseFrontsheetDisdiag> {
     @Select("select rtrim(code) code, rtrim(name) name from zd_dis_diag_status with(nolock)")
     List<CodeName> getDisdiagStatus();
 
-    @Select("select rtrim(code) code, rtrim(name) name from zd_hbsag with(nolock) union select code='',name=''")
+    @Select("select rtrim(code) code, rtrim(name) name from zd_hbsag with(nolock)")
     List<CodeName> getHbsag();
 
     @Select("select rtrim(code) code, rtrim(name) name from zd_diag_conform with(nolock)")
@@ -118,4 +118,7 @@ public interface SheetCreatedDao extends BaseMapper<CaseFrontsheetDisdiag> {
 
     @Select("select rtrim(code) code, rtrim(code) name from zd_tnm with(nolock) where stage=1 union select code='',name=''")
     List<CodeName> getTumorLevel();
+
+    @Select("select rtrim(code) code,rtrim(name) name from t_zd_psn_cert_type with(nolock)")
+    List<CodeName> getPsnCertType();
 }

+ 38 - 27
src/main/java/thyyxxk/webserver/entity/casefrontsheet/CaseFrontsheetMain.java

@@ -8,6 +8,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import org.springframework.format.annotation.DateTimeFormat;
 import thyyxxk.webserver.entity.casefrontsheet.state.AuditState;
+import thyyxxk.webserver.entity.casefrontsheet.tcmsheet.TcmFrontSheetIcuinfo;
 
 import java.util.ArrayList;
 import java.util.Date;
@@ -128,9 +129,13 @@ public class CaseFrontsheetMain implements Serializable {
     private String nation;
 
     /**
-     * 身份
+     * 证件号码
      */
     private String socialNo;
+    /**
+     * 证件类型
+     */
+    private String psnCertificateType;
 
     /**
      * 职业
@@ -544,72 +549,72 @@ public class CaseFrontsheetMain implements Serializable {
     /**
      * 一般医疗服务费
      */
-    private String generalMedicalServiceFee;
+    private String generalMedicalServiceFee = "0.0";
 
     /**
      * 一般治疗操作费
      */
-    private String generalTreatmentOperatingFee;
+    private String generalTreatmentOperatingFee = "0.0";
 
     /**
      * 护理费
      */
-    private String careFee;
+    private String careFee = "0.0";
 
     /**
      * 其他费
      */
-    private String elseFee;
+    private String elseFee = "0.0";
 
     /**
      * 病理诊断费
      */
-    private String pathologicDiagFee;
+    private String pathologicDiagFee = "0.0";
 
     /**
      * 实验室诊断费
      */
-    private String experimentDiagFee;
+    private String experimentDiagFee = "0.0";
 
     /**
      * 影像学诊断费
      */
-    private String ctDiagFee;
+    private String ctDiagFee = "0.0";
 
     /**
      * 临床诊断项目费
      */
-    private String clinicalDiagFee;
+    private String clinicalDiagFee = "0.0";
 
     /**
      * 非手术治疗项目费
      */
-    private String notSurgicalFee;
+    private String notSurgicalFee = "0.0";
 
     /**
      * 临床物理治疗费
      */
-    private String clinicalPhysicalFee;
+    private String clinicalPhysicalFee = "0.0";
 
     /**
      * 手术治疗费
      */
-    private String surgicalFee;
+    private String surgicalFee = "0.0";
 
     /**
      * 麻醉费
      */
-    private String anesthetizeFee;
+    private String anesthetizeFee = "0.0";
 
     /**
      * 手术费
      */
-    private String surgeryFee;
+    private String surgeryFee = "0.0";
 
     /**
      * 康复费
      */
-    private String recoverFee;
+    private String recoverFee = "0.0";
 
     /**
      * 中医治疗费
@@ -619,62 +624,65 @@ public class CaseFrontsheetMain implements Serializable {
     /**
      * 西药费
      */
-    private String westMedicineFee;
+    private String westMedicineFee = "0.0";
+
+    // 抗菌药物费用
+    private String kjywFee = "0.0";
 
     /**
      * 中成药费
      */
-    private String chinesePatentMedicineFee;
+    private String chinesePatentMedicineFee = "0.0";
 
     /**
      * 中草药费
      */
-    private String chineseHerbalMedicineFee;
+    private String chineseHerbalMedicineFee = "0.0";
 
     /**
      * 血费
      */
-    private String bloodFee;
+    private String bloodFee = "0.0";
 
     /**
      * 白蛋白类制品费
      */
-    private String albuminProductsFee;
+    private String albuminProductsFee = "0.0";
 
     /**
      * 球蛋白类制品费
      */
-    private String globulinProductsFee;
+    private String globulinProductsFee = "0.0";
 
     /**
      * 凝血因子类制品费
      */
-    private String coagulationFactorProductsFee;
+    private String coagulationFactorProductsFee = "0.0";
 
     /**
      * 细胞因子类制品费
      */
-    private String cytokineProductsFee;
+    private String cytokineProductsFee = "0.0";
 
     /**
      * 检查用一次性医用材料费
      */
-    private String costOfDisposableMedicalMaterialsForExamination;
+    private String costOfDisposableMedicalMaterialsForExamination = "0.0";
 
     /**
      * 治疗用一次性医用材料费
      */
-    private String costOfDisposableMedicalMaterialsForTreatment;
+    private String costOfDisposableMedicalMaterialsForTreatment = "0.0";
 
     /**
      * 手术用一次性医用材料费
      */
-    private String costOfDisposableMedicalMaterialsForOperation;
+    private String costOfDisposableMedicalMaterialsForOperation = "0.0";
 
     /**
      * 其他费
      */
-    private String otherFees;
+    private String otherFees = "0.0";
 
     /**
      * 门诊与出院
@@ -856,6 +864,9 @@ public class CaseFrontsheetMain implements Serializable {
     @TableField(exist = false)
     private FrontSheetSupplement supplement;
 
+    @TableField(exist = false)
+    private List<TcmFrontSheetIcuinfo> icuInfoList;
+
     public List<CaseFrontsheetDisdiag> getDisdiagList() {
         return null == disdiagList ? new ArrayList<>() : disdiagList;
     }

+ 65 - 1
src/main/java/thyyxxk/webserver/service/inpatient/casefrontsheet/CaseFrontSheetMainService.java

@@ -14,6 +14,8 @@ import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.constants.sidicts.Insutype;
 import thyyxxk.webserver.constants.sidicts.MedType;
 import thyyxxk.webserver.dao.his.LoginDao;
+import thyyxxk.webserver.dao.his.datamodify.YzActOrderModifyVerifyDao;
+import thyyxxk.webserver.dao.his.inpatient.TransferInOfExpensesDao;
 import thyyxxk.webserver.dao.his.inpatient.casefrontsheet.BasSelectOverviewDao;
 import thyyxxk.webserver.dao.his.inpatient.casefrontsheet.CaseFrontSheetDao;
 import thyyxxk.webserver.dao.his.inpatient.casefrontsheet.SheetCreatedDao;
@@ -26,18 +28,22 @@ import thyyxxk.webserver.entity.casefrontsheet.response.BaOpLog;
 import thyyxxk.webserver.entity.casefrontsheet.response.LendOutSheet;
 import thyyxxk.webserver.entity.casefrontsheet.state.AuditState;
 import thyyxxk.webserver.entity.casefrontsheet.state.State;
+import thyyxxk.webserver.entity.casefrontsheet.tcmsheet.TcmFrontSheetIcuinfo;
 import thyyxxk.webserver.entity.covid.Region;
 import thyyxxk.webserver.entity.dictionary.CodeName;
 import thyyxxk.webserver.entity.dictionary.HisWjwMatchEntity;
+import thyyxxk.webserver.entity.medicalinsurance.inpatient.ZyPatientInfo;
 import thyyxxk.webserver.http.drg.DrgWebApi;
 import thyyxxk.webserver.service.externalhttp.PowersiSrvc;
 import thyyxxk.webserver.service.zhuyuanyisheng.emr.EmrServer;
 import thyyxxk.webserver.utils.*;
 
+import javax.validation.constraints.NotBlank;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.util.*;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.stream.Collectors;
 
 @Slf4j
 @Service
@@ -50,9 +56,10 @@ public class CaseFrontSheetMainService {
     private final PowersiSrvc srvc;
     private final EmrServer emrService;
     private final DrgWebApi drgWebApi;
+    private final TransferInOfExpensesDao transferInOfExpensesDao;
 
     public CaseFrontSheetMainService(SheetCreatedDao createdDao, CaseFrontSheetDao dao, BasSelectOverviewDao basDao,
-                                     LoginDao userDao, PowersiSrvc srvc, EmrServer emrService, DrgWebApi drgWebApi) {
+                                     LoginDao userDao, PowersiSrvc srvc, EmrServer emrService, DrgWebApi drgWebApi, TransferInOfExpensesDao transferInOfExpensesDao) {
         this.dao = dao;
         this.createdDao = createdDao;
         this.basDao = basDao;
@@ -60,6 +67,7 @@ public class CaseFrontSheetMainService {
         this.srvc = srvc;
         this.emrService = emrService;
         this.drgWebApi = drgWebApi;
+        this.transferInOfExpensesDao = transferInOfExpensesDao;
         if (allDictionary == null) {
             allDictionary = new ConcurrentHashMap<>();
         }
@@ -100,6 +108,7 @@ public class CaseFrontSheetMainService {
                 allDictionary.put("getCountry", createdDao.getCountry());
                 allDictionary.put("getNation", createdDao.getNation());
                 allDictionary.put("getPayMethod", createdDao.getPayMethod());
+                allDictionary.put("getPsnCertType", createdDao.getPsnCertType());
             } catch (Exception e) {
                 log.error("病案字典提取出错", e);
                 allDictionary.clear();
@@ -330,6 +339,7 @@ public class CaseFrontSheetMainService {
         sheet.setDisdiagList(getSheetDisDiags(bah, times, State.FileStatus.UNSIGNED));
         sheet.setSurgeryList(getSheetSurgeries(bah, times, State.FileStatus.UNSIGNED));
         sheet.setSupplement(getSheetSupplement(bah, times));
+        sheet.setIcuInfoList(getSheetIcuinfos(bah, times));
         if (null == standardAddressMember) {
             sheet.setLivePlaceCombo(sheet.getLivePlace());
         } else {
@@ -352,6 +362,60 @@ public class CaseFrontSheetMainService {
         return sheet;
     }
 
+    private List<TcmFrontSheetIcuinfo> getSheetIcuinfos(String bah, Integer times) {
+        List<TcmFrontSheetIcuinfo> icuinfos = new ArrayList<>();
+
+        String icuCode = "1000503";
+        List<Map<String,Object>> yzActOrderList = dao.selectZkOrderList(bah, times);
+        List<Map<String,Object>> yzActOrderFilterList = yzActOrderList.stream().filter(e-> icuCode.equals(e.get("old_dept")) || icuCode.equals(e.get("new_dept")) ).collect(Collectors.toList());
+        List<Map<String,Object>> yzActOrderSortList = yzActOrderFilterList.stream().sorted(Comparator.comparing(e->(Date)e.get("exec_time"))).collect(Collectors.toList());
+        ZyPatientInfo zyPatientInfo = transferInOfExpensesDao.getPatientHospitalStay(bah);
+//        StringBuffer inTime = new StringBuffer("");
+//        StringBuffer outTime = new StringBuffer("");
+//        yzActOrderList.stream().sorted(Comparator.comparing(e->{
+//            if (icuCode.equals(e.get("old_dept"))) {
+//                tcmFrontSheetIcuinfo.setStartTime(DateUtil.parse(e.get("exec_time"),"yyyy-MM-dd HH:mm"));
+//            }
+//        })).collect(Collectors.toList());
+//        for (int i = 0; i < yzActOrderSortList.size(); i++) {
+//            if(i == 0 && icuCode.equals(yzActOrderSortList.get(i).get("old_dept"))){
+//                tcmFrontSheetIcuinfo.setStartTime(DateUtil.parse(String.valueOf(zyPatientInfo.getDisDate()),"yyyy-MM-dd HH:mm"));
+//                tcmFrontSheetIcuinfo.setEndTime(DateUtil.parse(yzActOrderSortList.get(i).get("exec_time"),"yyyy-MM-dd HH:mm"));
+//            } else {
+//                if (icuCode.equals(yzActOrderSortList.get(i).get("old_dept"))) {
+//                    tcmFrontSheetIcuinfo.setStartTime(DateUtil.parse(yzActOrderSortList.get(i).get("exec_time"),"yyyy-MM-dd HH:mm"));
+//                }
+//                outTime.append(DateUtil.parse(yzActOrderSortList.get(i).get("exec_time"),"yyyy-MM-dd HH:mm"));
+//            }
+//        }
+        List<Date> list = new ArrayList<>();
+
+        if(icuCode.equals(yzActOrderSortList.get(0).get("old_dept"))){
+            Map<String,String> map = new HashMap<>();
+            list.add(zyPatientInfo.getAdmissDate());
+        }
+        if(icuCode.equals(yzActOrderSortList.get(yzActOrderSortList.size()-1).get("new_dept"))){
+            Map<String,String> map = new HashMap<>();
+            list.add(zyPatientInfo.getDisDate());
+        }
+        for (int i = 0; i < list.size(); i++) {
+            TcmFrontSheetIcuinfo tcmFrontSheetIcuinfo = new TcmFrontSheetIcuinfo();
+            tcmFrontSheetIcuinfo.setIcuName("ICU");
+            tcmFrontSheetIcuinfo.setStartTime(list.get(i));
+            if (i+1 < list.size()) {
+                tcmFrontSheetIcuinfo.setEndTime(list.get(i+1));
+            }
+
+            icuinfos.add(tcmFrontSheetIcuinfo);
+            i++;
+        }
+
+        while (icuinfos.size() < 3) {
+            icuinfos.add(new TcmFrontSheetIcuinfo());
+        }
+        return icuinfos;
+    }
+
     private void autoFillPart(CaseFrontsheetMain sheet) {
         String patNo = sheet.getBah();
         int times = sheet.getAdmissTimes();