|
@@ -7,13 +7,17 @@ import com.lantone.qc.pub.model.InputInfo;
|
|
|
import com.lantone.qc.pub.model.OutputInfo;
|
|
|
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.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Comparator;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @ClassName : THR0127
|
|
@@ -33,6 +37,10 @@ public class THR0127 extends QCCatalogue {
|
|
|
return;
|
|
|
}
|
|
|
List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
|
|
|
+ Date maxRecordDate = getMaxRecordDate(threeLevelWardDocs);
|
|
|
+ if (maxRecordDate == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
int hoursPerWeek = 7 * 24 * 60;
|
|
|
String roundRecordThisWeek = "";
|
|
|
List<String> roundRecordEveryWeek = new ArrayList<>();
|
|
@@ -41,7 +49,7 @@ public class THR0127 extends QCCatalogue {
|
|
|
int i = 1;
|
|
|
//每周的病历记录
|
|
|
while (i >= 1) {
|
|
|
- roundRecordThisWeek = extractWardRecord(threeLevelWardDocs, beginDate, hoursPerWeek);
|
|
|
+ roundRecordThisWeek = extractWardRecord(threeLevelWardDocs, beginDate, hoursPerWeek, maxRecordDate);
|
|
|
if (CatalogueUtil.isEmpty(roundRecordThisWeek)) {
|
|
|
break;
|
|
|
}
|
|
@@ -49,7 +57,7 @@ public class THR0127 extends QCCatalogue {
|
|
|
beginDate = DateUtil.addDate(beginDate, 7);
|
|
|
i++;
|
|
|
}
|
|
|
- if (roundRecordEveryWeek.size() == 0){
|
|
|
+ if (roundRecordEveryWeek.size() == 0) {
|
|
|
status.set("0");
|
|
|
return;
|
|
|
}
|
|
@@ -65,6 +73,21 @@ public class THR0127 extends QCCatalogue {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private Date getMaxRecordDate(List<ThreeLevelWardDoc> threeLevelWardDocs) {
|
|
|
+ List<Date> recordTime = new ArrayList<>();
|
|
|
+ threeLevelWardDocs.stream()
|
|
|
+ .filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("查房日期")))
|
|
|
+ .forEach(i -> recordTime.add(StringUtil.parseDateTime(i.getStructureMap().get("查房日期"))));
|
|
|
+ List<Date> sortRecordTime = recordTime.stream()
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .sorted(Comparator.reverseOrder())
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (ListUtil.isNotEmpty(sortRecordTime) && sortRecordTime.size() > 0) {
|
|
|
+ return sortRecordTime.get(0);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 抽取duration分钟内所有查房标题
|
|
|
* 抽取一周内所有查房标题,若一周内记录少于6天,则返回""
|
|
@@ -74,7 +97,7 @@ public class THR0127 extends QCCatalogue {
|
|
|
* @param duration
|
|
|
* @return
|
|
|
*/
|
|
|
- private static String extractWardRecord(List<ThreeLevelWardDoc> threeLevelWardDocs, Date admisDate, int duration) {
|
|
|
+ private static String extractWardRecord(List<ThreeLevelWardDoc> threeLevelWardDocs, Date admisDate, int duration, Date maxRecordDate) {
|
|
|
String recordTime = "", recordTitle = "";
|
|
|
List<Date> dateList = new ArrayList();
|
|
|
for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
|
|
@@ -92,7 +115,7 @@ public class THR0127 extends QCCatalogue {
|
|
|
}
|
|
|
if (dateList.size() > 0) {
|
|
|
dateList.sort(Date::compareTo);
|
|
|
- if (CatalogueUtil.compareTime(admisDate, dateList.get(dateList.size() - 1), Long.valueOf(6 * 24 * 60))) {
|
|
|
+ if (!maxRecordDate.equals(dateList.get(dateList.size() - 1)) || CatalogueUtil.compareTime(admisDate, dateList.get(dateList.size() - 1), Long.valueOf(6 * 24 * 60))) {
|
|
|
return recordTitle;
|
|
|
}
|
|
|
}
|