|
@@ -4,17 +4,20 @@ package com.lantone.qc.kernel.catalogue.threelevelward;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.lantone.qc.kernel.catalogue.QCCatalogue;
|
|
|
import com.lantone.qc.kernel.util.RegexUtil;
|
|
|
+import com.lantone.qc.pub.Content;
|
|
|
import com.lantone.qc.pub.model.InputInfo;
|
|
|
import com.lantone.qc.pub.model.OutputInfo;
|
|
|
import com.lantone.qc.pub.model.doc.DoctorAdviceDoc;
|
|
|
import com.lantone.qc.pub.model.doc.FirstCourseRecordDoc;
|
|
|
import com.lantone.qc.pub.model.doc.LeaveHospitalDoc;
|
|
|
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.PropertiesUtil;
|
|
|
import com.lantone.qc.pub.util.StringUtil;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.io.InputStream;
|
|
|
+import java.io.InputStreamReader;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -48,7 +51,7 @@ public class THR03236 extends QCCatalogue {
|
|
|
doctorAdviceDocs = doctorAdviceDocs.stream()
|
|
|
.filter(Objects::nonNull)
|
|
|
.filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("医嘱处方类型"))
|
|
|
- && i.getStructureMap().get("医嘱处方类型").contains("药品"))
|
|
|
+ && i.getStructureMap().get("医嘱处方类型").equals("药品"))
|
|
|
.collect(Collectors.toList());
|
|
|
if (ListUtil.isEmpty(doctorAdviceDocs)) {
|
|
|
status.set("0");
|
|
@@ -57,12 +60,22 @@ public class THR03236 extends QCCatalogue {
|
|
|
|
|
|
|
|
|
String regex1 = "口服|静滴|静推";
|
|
|
- List<String> chineseMedicine = Lists.newArrayList();
|
|
|
- PropertiesUtil propertiesUtil = new PropertiesUtil("medicine.properties");
|
|
|
- String medicineStr = propertiesUtil.getProperty("chinesemedicine");
|
|
|
+ List<String> chineseMedicine = Content.CHINESEMEDICINE;
|
|
|
+ /*Lists.newArrayList();
|
|
|
+ Properties properties = new Properties();
|
|
|
+ InputStream in = Thread.currentThread().getContextClassLoader()
|
|
|
+ .getResourceAsStream("medicine.properties");
|
|
|
+ try {
|
|
|
+ properties.load(new InputStreamReader(in, "UTF-8"));
|
|
|
+ } catch (Exception e) {
|
|
|
+
|
|
|
+ }
|
|
|
+ String medicineStr = properties.getProperty("chinesemedicine");
|
|
|
if (StringUtil.isNotBlank(medicineStr)) {
|
|
|
chineseMedicine = Arrays.stream(medicineStr.split(",")).collect(Collectors.toList());
|
|
|
}
|
|
|
+ */
|
|
|
+
|
|
|
Boolean isRecord = false;
|
|
|
List<DoctorAdviceDoc> recordList = Lists.newLinkedList();
|
|
|
for (DoctorAdviceDoc item : doctorAdviceDocs) {
|
|
@@ -95,32 +108,23 @@ public class THR03236 extends QCCatalogue {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- String[] dateFormats = new String[]{"yyyy年MM月dd日", "yyyy-MM-dd", "yyyy-MM-dd"};
|
|
|
-
|
|
|
- List<Date> dateList = date.stream().map(i -> StringUtil.parseDateTime(i, dateFormats))
|
|
|
+ List<Date> dateList = date.stream().map(i -> StringUtil.parseDateTime(i))
|
|
|
.filter(Objects::nonNull)
|
|
|
.sorted(Comparator.comparing(i -> i))
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
- Calendar c1 = Calendar.getInstance();
|
|
|
- c1.setTime(dateList.get(0));
|
|
|
- c1.add(Calendar.DAY_OF_MONTH, -1);
|
|
|
- Calendar c2 = Calendar.getInstance();
|
|
|
- c1.setTime(dateList.get(dateList.size() - 1));
|
|
|
- c1.add(Calendar.DAY_OF_MONTH, 2);
|
|
|
-
|
|
|
- Date startDate = c1.getTime();
|
|
|
- Date endDate = c2.getTime();
|
|
|
+ Date startDate = DateUtil.getFirstTimeOfDay(DateUtil.addDate(dateList.get(0), -1));
|
|
|
+ Date endDate = DateUtil.getFirstTimeOfDay(DateUtil.addDate(dateList.get(dateList.size() - 1), 2));
|
|
|
|
|
|
String regex = "中医辨病辨证依据|中医辩证";
|
|
|
|
|
|
//首次诊疗计划
|
|
|
if (null != firstCourseRecordDoc) {
|
|
|
String treatPlan = firstCourseRecordDoc.getStructureMap().get("诊疗计划");
|
|
|
- Date treatPlanDate = StringUtil.parseDateTime(firstCourseRecordDoc.getStructureMap().get("病历日期"), dateFormats);
|
|
|
+ Date treatPlanDate = DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(firstCourseRecordDoc.getStructureMap().get("病历日期")));
|
|
|
if (StringUtil.isNotBlank(treatPlan)
|
|
|
- && treatPlanDate.after(startDate)
|
|
|
- && treatPlanDate.before(endDate)
|
|
|
+ && (!treatPlanDate.after(startDate)
|
|
|
+ || !treatPlanDate.before(endDate))
|
|
|
&& RegexUtil.getRegexRes(treatPlan, regex, 2)) {
|
|
|
status.set("0");
|
|
|
return;
|
|
@@ -132,8 +136,8 @@ public class THR03236 extends QCCatalogue {
|
|
|
threeLevelWardDocs = threeLevelWardDocs.stream()
|
|
|
.filter(Objects::nonNull)
|
|
|
.filter(i -> i.getStructureMap().containsKey("查房日期") && i.getStructureMap().containsKey("病情记录"))
|
|
|
- .filter(i -> StringUtil.parseDateTime(i.getStructureMap().get("查房日期"), dateFormats).after(startDate)
|
|
|
- && StringUtil.parseDateTime(i.getStructureMap().get("查房日期"), dateFormats).before(endDate))
|
|
|
+ .filter(i -> !DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(i.getStructureMap().get("查房日期"))).after(startDate)
|
|
|
+ || !DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(i.getStructureMap().get("查房日期"))).before(endDate))
|
|
|
.collect(Collectors.toList());
|
|
|
if (ListUtil.isNotEmpty(threeLevelWardDocs)) {
|
|
|
for (ThreeLevelWardDoc item : threeLevelWardDocs) {
|
|
@@ -148,10 +152,10 @@ public class THR03236 extends QCCatalogue {
|
|
|
//出院小结
|
|
|
if (null != leaveHospitalDoc) {
|
|
|
String leaveHosText = leaveHospitalDoc.getStructureMap().get("出院医嘱");
|
|
|
- Date leaveHospitalDate = StringUtil.parseDateTime(firstCourseRecordDoc.getStructureMap().get("出院日期"), dateFormats);
|
|
|
+ Date leaveHospitalDate = DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(firstCourseRecordDoc.getStructureMap().get("出院日期")));
|
|
|
if (StringUtil.isNotBlank(leaveHosText)
|
|
|
- && leaveHospitalDate.after(startDate)
|
|
|
- && leaveHospitalDate.before(endDate)
|
|
|
+ && (!leaveHospitalDate.after(startDate)
|
|
|
+ || !leaveHospitalDate.before(endDate))
|
|
|
&& RegexUtil.getRegexRes(leaveHosText, regex, 2)) {
|
|
|
status.set("0");
|
|
|
return;
|