|
@@ -1,6 +1,7 @@
|
|
|
package com.lantone.qc.kernel.catalogue.threelevelward;
|
|
|
|
|
|
import com.lantone.qc.kernel.catalogue.QCCatalogue;
|
|
|
+import com.lantone.qc.kernel.util.CatalogueUtil;
|
|
|
import com.lantone.qc.pub.model.InputInfo;
|
|
|
import com.lantone.qc.pub.model.OutputInfo;
|
|
|
import com.lantone.qc.pub.model.doc.DoctorAdviceDoc;
|
|
@@ -8,8 +9,11 @@ import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
|
|
|
import com.lantone.qc.pub.util.DateUtil;
|
|
|
import com.lantone.qc.pub.util.ListUtil;
|
|
|
import com.lantone.qc.pub.util.StringUtil;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Collections;
|
|
|
import java.util.Comparator;
|
|
@@ -25,17 +29,36 @@ import java.util.Map;
|
|
|
*/
|
|
|
@Component
|
|
|
public class THR03023 extends QCCatalogue {
|
|
|
- public void start(InputInfo inputInfo, OutputInfo outputInfo) {
|
|
|
+ public void start(InputInfo inputInfo, OutputInfo outputInfo) throws ParseException {
|
|
|
/**
|
|
|
+ * 入院当天有病重医嘱,当天写首次病程录就好,不需要写查房记录。这个不应该报错。
|
|
|
* 1、有病重医嘱、查房记录。
|
|
|
* 2、第一个病重医嘱的开始时间当天有查房记录,结束时间有查房记录。
|
|
|
* 3、每2天有查房记录。
|
|
|
+ * 4、如果医嘱结束时间大于出院时间,那以出院时间为结束时间
|
|
|
+ * 5、首程也算第一次查房
|
|
|
*/
|
|
|
status.set("0");
|
|
|
if (ListUtil.isEmpty(inputInfo.getDoctorAdviceDocs()) ||
|
|
|
ListUtil.isEmpty(inputInfo.getThreeLevelWardDocs())) {
|
|
|
return;
|
|
|
}
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ String leaveDateString = "";
|
|
|
+ String inputDateString = "";
|
|
|
+ String input_data = "";
|
|
|
+ Date leaveDate = null;
|
|
|
+ if (inputInfo.getLeaveHospitalDoc() != null) {
|
|
|
+ leaveDateString = inputInfo.getLeaveHospitalDoc().getStructureMap().get("出院时间");
|
|
|
+ inputDateString = inputInfo.getLeaveHospitalDoc().getStructureMap().get("入院时间");
|
|
|
+ input_data = simpleDateFormat.format(simpleDateFormat.parse(inputDateString)).toString();
|
|
|
+ } else if (inputInfo.getDeathRecordDoc() != null) {
|
|
|
+ leaveDateString = inputInfo.getDeathRecordDoc().getStructureMap().get("死亡时间");
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(leaveDateString)) {
|
|
|
+ leaveDate = StringUtil.parseDateTime(leaveDateString);
|
|
|
+ }
|
|
|
+
|
|
|
List<DoctorAdviceDoc> doctorAdviceDocList = inputInfo.getDoctorAdviceDocs();
|
|
|
List<List<Date>> doctorAdviceDate = new ArrayList<>();
|
|
|
|
|
@@ -45,10 +68,18 @@ public class THR03023 extends QCCatalogue {
|
|
|
String name = structureMap.get("医嘱项目名称");
|
|
|
if (StringUtil.isNotBlank(name) && name.contains("病重")) {
|
|
|
String startDateStr = structureMap.get("医嘱开始时间");
|
|
|
+ String advice_date = simpleDateFormat.format(simpleDateFormat.parse(startDateStr)).toString();
|
|
|
+ if(input_data.equals(advice_date)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
String endDateStr = structureMap.get("医嘱结束时间");
|
|
|
if (StringUtil.isNotBlank(startDateStr) && StringUtil.isNotBlank(endDateStr)) {
|
|
|
Date startDate = StringUtil.parseDateTime(startDateStr);
|
|
|
Date endDate = StringUtil.parseDateTime(endDateStr);
|
|
|
+ //如果医嘱结束时间大于出院时间,那以出院时间为结束时间
|
|
|
+ if (leaveDate != null && leaveDate.before(endDate)) {
|
|
|
+ endDate = leaveDate;
|
|
|
+ }
|
|
|
if (startDate.before(endDate)) {
|
|
|
List<Date> listDate = new ArrayList<>();
|
|
|
listDate.add(DateUtil.dateZeroClear(startDate));
|
|
@@ -75,6 +106,15 @@ public class THR03023 extends QCCatalogue {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //首程也算第一次查房
|
|
|
+ if (inputInfo.getFirstCourseRecordDoc() != null) {
|
|
|
+ String recordTime = inputInfo.getFirstCourseRecordDoc().getStructureMap().get("病历日期");
|
|
|
+ if (StringUtils.isNotEmpty(recordTime)) {
|
|
|
+ Date recordDate = StringUtil.parseDateTime(recordTime);
|
|
|
+ dateRecordDay.add(DateUtil.dateZeroClear(recordDate));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (ListUtil.isEmpty(dateRecordDay)) {
|
|
|
return ;
|
|
|
}
|
|
@@ -95,17 +135,20 @@ public class THR03023 extends QCCatalogue {
|
|
|
|
|
|
// 医嘱开始时间当天有查房记录
|
|
|
if (!dateRecordDay.contains(doctorDateStart)) {
|
|
|
+ info.set(DateUtil.formatDate(doctorDateStart));
|
|
|
status.set("-1");
|
|
|
return ;
|
|
|
}
|
|
|
// 医嘱结束时间当天有查房记录
|
|
|
if (!dateRecordDay.contains(doctorDateEnd)) {
|
|
|
+ info.set(DateUtil.formatDate(doctorDateEnd));
|
|
|
status.set("-1");
|
|
|
return ;
|
|
|
}
|
|
|
int flag = 0;
|
|
|
Date nextDate = doctorDateStart;
|
|
|
int returnFlag = 0; // 防止出现死循环系统崩溃
|
|
|
+ String infoStr = "";
|
|
|
while(returnFlag <= 1000) {
|
|
|
if (!dateRecordDay.contains(nextDate)) {
|
|
|
flag++;
|
|
@@ -114,7 +157,7 @@ public class THR03023 extends QCCatalogue {
|
|
|
}
|
|
|
if (flag == 2) {
|
|
|
status.set("-1");
|
|
|
- return ;
|
|
|
+ infoStr = CatalogueUtil.concatInfo(infoStr, DateUtil.formatDate(nextDate));
|
|
|
}
|
|
|
nextDate = DateUtil.addDate(nextDate, 1);
|
|
|
if (nextDate.after(doctorDateEnd)) {
|
|
@@ -122,5 +165,8 @@ public class THR03023 extends QCCatalogue {
|
|
|
}
|
|
|
returnFlag++; // 防止出现死循环系统崩溃
|
|
|
}
|
|
|
+ if (StringUtils.isNotEmpty(infoStr)) {
|
|
|
+ info.set(infoStr);
|
|
|
+ }
|
|
|
}
|
|
|
}
|