Browse Source

预产期和末次月经相关规则更新

wangsy 3 years atrás
parent
commit
7fb4c0c345

+ 20 - 14
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH03330.java

@@ -8,11 +8,13 @@ import com.lantone.qc.pub.model.doc.BeHospitalizedDoc;
 import com.lantone.qc.pub.model.entity.Diag;
 import com.lantone.qc.pub.model.label.DiagLabel;
 import com.lantone.qc.pub.model.label.PastLabel;
+import com.lantone.qc.pub.util.DateUtil;
 import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 
@@ -42,22 +44,31 @@ public class BEH03330 extends QCCatalogue {
         String eDOC = beHospitalizedDoc.getStructureMap().get("预产期");
         //末次月经
         String lastMP = beHospitalizedDoc.getStructureMap().get("末次月经");
-        //末次月经月份
-        String lastMPMonth = beHospitalizedDoc.getStructureMap().get("末次月经月份");
-        //末次月经日
-        String lastMPDay = beHospitalizedDoc.getStructureMap().get("末次月经日");
-        if (StringUtil.isBlank(eDOC) || StringUtil.isBlank(lastMP) || StringUtil.isBlank(lastMPMonth) || StringUtil.isBlank(lastMPDay)) {
+        if (StringUtil.isBlank(eDOC) || StringUtil.isBlank(lastMP)) {
+            return;
+        }
+        Date eDOCDate = StringUtil.parseDateTime(eDOC);
+        Date lastMPDate = StringUtil.parseDateTime(lastMP);
+        if (eDOCDate == null || lastMPDate == null) {
             return;
         }
-
         try {
-            int lastMPMonthNum = strConvertInt(lastMPMonth) + 9 > 12 ? strConvertInt(lastMPMonth) - 3 : strConvertInt(lastMPMonth) + 9;
-            int lastMPDayNum = strConvertInt(lastMPDay) + 7;
+            //预产期月份
+            int eDOCMonth = DateUtil.getMonth(eDOCDate);
+            //预产期日
+            int eDOCDay = DateUtil.getDay(eDOCDate);
+            //末次月经月份
+            int lastMPMonth = DateUtil.getMonth(lastMPDate);
+            //末次月经日
+            int lastMPDay = DateUtil.getDay(lastMPDate);
+
+            int lastMPMonthNum = lastMPMonth + 9 > 12 ? lastMPMonth - 3 : lastMPMonth + 9;
+            int lastMPDayNum = lastMPDay + 7;
             if (lastMPDayNum > 30) {
                 lastMPMonthNum = lastMPMonthNum + 1;
                 lastMPDayNum = lastMPDayNum - 30;
             }
-            if (lastMPMonthNum != lastMPDayNum) {
+            if (eDOCMonth != lastMPMonthNum || eDOCDay != lastMPDayNum) {
                 status.set("-1");
                 return;
             }
@@ -67,9 +78,4 @@ public class BEH03330 extends QCCatalogue {
 
     }
 
-    //String转int
-    private int strConvertInt(String str) {
-        return Integer.parseInt(str);
-    }
-
 }

+ 21 - 15
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstcourserecord/FIRC03331.java

@@ -3,11 +3,13 @@ package com.lantone.qc.kernel.catalogue.firstcourserecord;
 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.BeHospitalizedDoc;
 import com.lantone.qc.pub.model.doc.FirstCourseRecordDoc;
+import com.lantone.qc.pub.util.DateUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
+import java.util.Date;
+
 
 /**
  * @ClassName : FIRC03331
@@ -35,22 +37,31 @@ public class FIRC03331 extends QCCatalogue {
         String eDOC = firstCourseRecordDoc.getStructureMap().get("预产期");
         //末次月经
         String lastMP = firstCourseRecordDoc.getStructureMap().get("末次月经");
-        //末次月经月份
-        String lastMPMonth = firstCourseRecordDoc.getStructureMap().get("末次月经月份");
-        //末次月经日
-        String lastMPDay = firstCourseRecordDoc.getStructureMap().get("末次月经日");
-        if (StringUtil.isBlank(eDOC) || StringUtil.isBlank(lastMP) || StringUtil.isBlank(lastMPMonth) || StringUtil.isBlank(lastMPDay)) {
+        if (StringUtil.isBlank(eDOC) || StringUtil.isBlank(lastMP)) {
+            return;
+        }
+        Date eDOCDate = StringUtil.parseDateTime(eDOC);
+        Date lastMPDate = StringUtil.parseDateTime(lastMP);
+        if (eDOCDate == null || lastMPDate == null) {
             return;
         }
-
         try {
-            int lastMPMonthNum = strConvertInt(lastMPMonth) + 9 > 12 ? strConvertInt(lastMPMonth) - 3 : strConvertInt(lastMPMonth) + 9;
-            int lastMPDayNum = strConvertInt(lastMPDay) + 7;
+            //预产期月份
+            int eDOCMonth = DateUtil.getMonth(eDOCDate);
+            //预产期日
+            int eDOCDay = DateUtil.getDay(eDOCDate);
+            //末次月经月份
+            int lastMPMonth = DateUtil.getMonth(lastMPDate);
+            //末次月经日
+            int lastMPDay = DateUtil.getDay(lastMPDate);
+
+            int lastMPMonthNum = lastMPMonth + 9 > 12 ? lastMPMonth - 3 : lastMPMonth + 9;
+            int lastMPDayNum = lastMPDay + 7;
             if (lastMPDayNum > 30) {
                 lastMPMonthNum = lastMPMonthNum + 1;
                 lastMPDayNum = lastMPDayNum - 30;
             }
-            if (lastMPMonthNum != lastMPDayNum) {
+            if (eDOCMonth != lastMPMonthNum || eDOCDay != lastMPDayNum) {
                 status.set("-1");
                 return;
             }
@@ -60,9 +71,4 @@ public class FIRC03331 extends QCCatalogue {
 
     }
 
-    //String转int
-    private int strConvertInt(String str) {
-        return Integer.parseInt(str);
-    }
-
 }