Sfoglia il codice sorgente

实际住院天数填写错误

daiyi 3 anni fa
parent
commit
fa734f339d

+ 67 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/hospital/changshaxy/firstpagerecord/FIRP03269.java

@@ -0,0 +1,67 @@
+package com.lantone.qc.kernel.catalogue.hospital.changshaxy.firstpagerecord;
+
+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.util.StringUtil;
+import org.springframework.stereotype.Component;
+import rx.subjects.PublishSubject;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Map;
+/**
+ * @ClassName : FIRP03269
+ * @Description : 实际住院天数填写错误
+ * @Author : dy
+ * @Date: 2021-11-23 17:04
+ */
+@Component
+public class FIRP03269 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) throws ParseException {
+        status.set("0");
+        if (inputInfo.getFirstPageRecordDoc()!=null && inputInfo.getFirstPageRecordDoc().getStructureMap()!=null){
+            Map<String, String> structureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
+            Map<String, String> structureMap1 = inputInfo.getFirstPageRecordDoc().getStructureMap();
+            Map<String, String> structureMap2 = inputInfo.getFirstPageRecordDoc().getStructureMap();
+            if (structureMap!=null && structureMap1!=null && structureMap2!=null){
+                String actual = structureMap.get("实际住院天数");
+                String dischargeTime = structureMap1.get("出院时间");
+                String admissionTime = structureMap2.get("入院时间");
+                if (StringUtil.isNotBlank(actual) || !actual.equals("-")){
+                    status.set("-1");
+                }
+                if (StringUtil.isNotBlank(admissionTime) && StringUtil.isNotBlank(dischargeTime)) {
+                    Date date = StringUtil.parseDateTime(dischargeTime);
+                    Date date1 = StringUtil.parseDateTime(admissionTime);
+                    daysBetween(date1,date);
+                    status.set("-1");
+                    return;
+                }
+            }
+
+        }
+    }
+    /**
+     * 计算两个日期之间相差的天数
+     * @param smdate 较小的时间
+     * @param bdate  较大的时间
+     * @return 相差天数
+     * @throws ParseException
+     */
+    public static int daysBetween(Date smdate, Date bdate) throws ParseException
+    {
+        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
+        smdate=sdf.parse(sdf.format(smdate));
+        bdate=sdf.parse(sdf.format(bdate));
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(smdate);
+        long time1 = cal.getTimeInMillis();
+        cal.setTime(bdate);
+        long time2 = cal.getTimeInMillis();
+        long between_days=(time2-time1)/(1000*3600*24);
+        return Integer.parseInt(String.valueOf(between_days));
+    }
+}