Browse Source

修改厦门 THR03010 入院连续三天首次病程录算进去,当天算进去
OPE0587 术后连续三天,术后首次病程录算进去,当天算进去两条规则

easi 4 years ago
parent
commit
b84eaa58cf

+ 19 - 3
kernel/src/main/java/com/lantone/qc/kernel/catalogue/xiamen/operationdiscussion/OPE0587.java

@@ -6,6 +6,7 @@ import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
 import com.lantone.qc.pub.model.doc.operation.OperationDoc;
 import com.lantone.qc.pub.model.doc.operation.OperationRecordDoc;
+import com.lantone.qc.pub.model.entity.Operation;
 import com.lantone.qc.pub.util.DateUtil;
 import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
@@ -38,9 +39,24 @@ public class OPE0587 extends QCCatalogue {
         if (inputInfo.getMedicalRecordInfoDoc() == null || inputInfo.getMedicalRecordInfoDoc().getStructureMap().size() == 0) {
             return;
         }
-        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
+        SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd");
         //取出所有查房时间
         List<String> roundsDate = new ArrayList<>();
+
+        //获取术后首次病程及谈话记录时间
+        if(inputInfo.getOperationDocs()!=null&&inputInfo.getOperationDocs().size()>0)  //有手术记录
+        {
+            for(OperationDoc operationDoc:inputInfo.getOperationDocs())
+            {
+                if(operationDoc.getOperationDiscussionDoc()!=null&&
+                    StringUtil.isNotBlank(operationDoc.getOperationDiscussionDoc().getStructureMap().get("记录时间")))
+                {
+                    Date threeLevelDate = StringUtil.parseDateTime
+                            (operationDoc.getOperationDiscussionDoc().getStructureMap().get("记录时间"));
+                    roundsDate.add(formatter.format(threeLevelDate));
+                }
+            }
+        }
         for (ThreeLevelWardDoc t : threeLevelWardDocs) {
             Date threeLevelDate = StringUtil.parseDateTime(t.getStructureMap().get("查房日期"));
             roundsDate.add(formatter.format(threeLevelDate));
@@ -69,7 +85,7 @@ public class OPE0587 extends QCCatalogue {
         for (OperationDoc opera : operationDocs) {
             OperationRecordDoc operationRecordDoc = opera.getOperationRecordDoc();
             if (operationRecordDoc != null) {
-                String operDate = operationRecordDoc.getStructureMap().get("手术日期") == null ? null : operationRecordDoc.getStructureMap().get("手术日期");
+                String operDate = operationRecordDoc.getStructureMap().get("手术日期");
                 if (StringUtil.isNotBlank(operDate)) {
                     operDateList.add(operDate);
                 }
@@ -85,7 +101,7 @@ public class OPE0587 extends QCCatalogue {
                 if (day > 3) {
                     List<String> operDatesNew = new ArrayList<>();
                     //用手术时间加三天
-                    for (int i = 1; i < 4; i++) {
+                    for (int i = 0; i < 4; i++) {
                         Date firstTimeOfDay = DateUtil.getFirstTimeOfDay(DateUtil.addDay(oper, i));
                         operDatesNew.add(formatter.format(firstTimeOfDay));
                     }

+ 61 - 26
kernel/src/main/java/com/lantone/qc/kernel/catalogue/xiamen/threelevelward/THR03010.java

@@ -3,9 +3,11 @@ package com.lantone.qc.kernel.catalogue.xiamen.threelevelward;
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.FirstCourseRecordDoc;
 import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
 import com.lantone.qc.pub.util.DateUtil;
 import com.lantone.qc.pub.util.StringUtil;
+import org.apache.commons.lang3.time.DateUtils;
 import org.springframework.stereotype.Component;
 
 import java.text.SimpleDateFormat;
@@ -17,6 +19,7 @@ import java.util.Map;
 /**
  * @author wangfeng
  * @Description:入院后没有连续记录3天
+ * 记录分为:首次病程记录+查房记录
  * @date 2020-06-29 17:16
  */
 @Component
@@ -33,48 +36,80 @@ public class THR03010 extends QCCatalogue {
         String behospitalDate = structureMap.get("入院日期") == null ? null : structureMap.get("入院日期");
         //String leaveHospitalDate = structureMap.get("leaveHospitalDate") == null ? null : structureMap.get("leaveHospitalDate");
         Map<String, String> structureMaps = inputInfo.getFirstPageRecordDoc().getStructureMap();
-        String leaveHospitalDate = structureMaps.get("出院时间")== null ? null : structureMap.get("leaveHospitalDate");
+        String leaveHospitalDate = structureMaps.get("出院时间")!= null ?
+                structureMaps.get("出院时间") :inputInfo.getMedicalRecordInfoDoc().getStructureMap().get("leaveHospitalDate");
         if (behospitalDate != null && leaveHospitalDate != null) {
             Date beDate = StringUtil.parseDateTime(behospitalDate);
             Date leaveDate = StringUtil.parseDateTime(leaveHospitalDate);
             long l = (leaveDate.getTime() - beDate.getTime()) / (24 * 60 * 60 * 1000);
+            //如果入院时间和出院时间相差3天以上
             if (l > 3) {
-                List<String> stringDate = new ArrayList<>();
+                /*****从住院当天算起 首次病程记录时间+查房时间连续时间>=3天*/
 
-                SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
-                for (int i = 1; i < 4; i++) {
-                    Date firstTimeOfDay = DateUtil.getFirstTimeOfDay(DateUtil.addDay(beDate, i));
-                    stringDate.add(formatter.format(firstTimeOfDay));
+                //从住院开始连续的时间列表
+                List<Date> stringDate = new ArrayList<>();
+                //当天算进去所以从零开始
+                for (int i = 0; i < 4; i++) {
+                    stringDate.add(DateUtil.getFirstTimeOfDay(DateUtil.addDay(beDate, i)));
                 }
-                List<String> stringList = new ArrayList<>();
+
+                //获取首次病程记录的时间+查房时间
+                List<Date> wordDateList = new ArrayList<>();
+                //获取首次病程记录时间
+                FirstCourseRecordDoc firstCourseRecordDoc = inputInfo.getFirstCourseRecordDoc();
+                if(firstCourseRecordDoc!=null
+                        &&StringUtil.isNotBlank(firstCourseRecordDoc.getStructureMap().get("病历日期"))) {
+                    String firstCourseRecorTime = firstCourseRecordDoc.getStructureMap().get("病历日期");
+                    if(StringUtil.isNotBlank(firstCourseRecorTime))
+                    {
+                        wordDateList.add(StringUtil.parseDateTime(firstCourseRecorTime));
+                    }
+                }
+                //获取查房时间
                 List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs().get(0).getAllDoctorWradDocs();
                 for (ThreeLevelWardDoc t : threeLevelWardDocs) {
                     Date threeLevelDate = StringUtil.parseDateTime(t.getStructureMap().get("查房日期"));
-                    stringList.add(formatter.format(threeLevelDate));
+                    //去重,同一天就存一次
+                    if(threeLevelDate!=null&&wordDateList.get(wordDateList.size()-1)!=null
+                            &&!DateUtils.isSameDay(wordDateList.get(wordDateList.size()-1),threeLevelDate))
+                    {
+                        wordDateList.add(threeLevelDate);
+                    }
+                }
+                //如果记录时间没有3天
+                if(wordDateList.size()<3)
+                {
+                    status.set("-1");
+                    return;
                 }
-                if (stringList.size() > 2) {//查房日期取出没有3天时间, 直接报错
-                    //去重
-                    List<String> listTemp = new ArrayList<String>();
-                    for (int i = 0; i < stringList.size(); i++) {
-                        if (!listTemp.contains(stringList.get(i))) {
-                            listTemp.add(stringList.get(i));
+                //如果住院当天开始做记录
+                if(DateUtils.isSameDay(stringDate.get(0),wordDateList.get(0)))
+                {
+                    for(int i = 1;i<=2;i++)
+                    {
+                        //如果时间不相等则时间不连续
+                        if(!DateUtils.isSameDay(stringDate.get(i),wordDateList.get(i)))
+                        {
+                            status.set("-1");
+                            return;
                         }
                     }
-                    int i = 0;
-                    for (String str : stringDate) {
-                        for (String s : listTemp) {
-                            if (str.equals(s)) {
-                                i++;
-                            }
+                    return;
+                }
+                //如果是住院后第二天开始
+                else
+                {
+                    for(int i = 0;i<=3;i++)
+                    {
+                        //如果时间不相等则时间不连续
+                        if(!DateUtils.isSameDay(stringDate.get(i+1),wordDateList.get(i)))
+                        {
+                            status.set("-1");
+                            return;
                         }
                     }
-                    if (i < 3) {
-                        status.set("-1");
-                    }
-                } else {
-                    status.set("-1");
+                    return;
                 }
-
             }
         }