|
@@ -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;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|