|
@@ -11,7 +11,6 @@ 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.model.label.ThreeLevelWardLabel;
|
|
|
import com.lantone.qc.pub.util.DateUtil;
|
|
|
import com.lantone.qc.pub.util.ListUtil;
|
|
|
import com.lantone.qc.pub.util.StringUtil;
|
|
@@ -94,74 +93,84 @@ public class THR03233 extends QCCatalogue {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- List<Date> dateList = date.stream().map(i -> StringUtil.parseDateTime(i))
|
|
|
+ List<Date> dateList = date.stream().map(i -> DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(i)))
|
|
|
.filter(Objects::nonNull)
|
|
|
+ .distinct()
|
|
|
.sorted(Comparator.comparing(i -> i))
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
- 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 = DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(firstCourseRecordDoc.getStructureMap().get("病历日期")));
|
|
|
- if (StringUtil.isNotBlank(treatPlan)
|
|
|
- && (!treatPlanDate.after(startDate)
|
|
|
- || !treatPlanDate.before(endDate))
|
|
|
- && RegexUtil.getRegexRes(treatPlan, regex, 2)) {
|
|
|
- status.set("0");
|
|
|
- return;
|
|
|
- }
|
|
|
- if (null != firstCourseRecordDoc.getTreatPlanLabel()
|
|
|
- && firstCourseRecordDoc.getTreatPlanLabel().getText().contains("四诊")) {
|
|
|
- status.set("0");
|
|
|
- return;
|
|
|
- }
|
|
|
+ if (ListUtil.isEmpty(dateList)) {
|
|
|
+ status.set("0");
|
|
|
+ return;
|
|
|
}
|
|
|
+ for (Date daDate : dateList) {
|
|
|
+ Date startDate = DateUtil.getFirstTimeOfDay(DateUtil.addDate(daDate, -1));
|
|
|
+ Date endDate = DateUtil.getLastTimeOfDay(DateUtil.addDate(daDate, 2));
|
|
|
+ Boolean exist = false;
|
|
|
+
|
|
|
+ //首次诊疗计划
|
|
|
+ if (null != firstCourseRecordDoc) {
|
|
|
+ String treatPlan = firstCourseRecordDoc.getStructureMap().get("诊疗计划");
|
|
|
+ Date treatPlanDate = DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(firstCourseRecordDoc.getStructureMap().get("病历日期")));
|
|
|
+ if (StringUtil.isNotBlank(treatPlan)
|
|
|
+ && (treatPlanDate.getTime() >= startDate.getTime() && treatPlanDate.getTime() <= endDate.getTime())
|
|
|
+ && RegexUtil.getRegexRes(treatPlan, regex, 2)) {
|
|
|
+ exist = true;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (null != firstCourseRecordDoc.getTreatPlanLabel()
|
|
|
+ && firstCourseRecordDoc.getTreatPlanLabel().getText().contains("四诊")) {
|
|
|
+ exist = true;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- //查房记录
|
|
|
- if (ListUtil.isNotEmpty(threeLevelWardDocs)) {
|
|
|
- threeLevelWardDocs = threeLevelWardDocs.stream()
|
|
|
- .filter(Objects::nonNull)
|
|
|
- .filter(i -> i.getStructureMap().containsKey("查房日期") && i.getStructureMap().containsKey("病情记录"))
|
|
|
- .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) {
|
|
|
- if (RegexUtil.getRegexRes(item.getStructureMap().get("病情记录"), regex, 2)) {
|
|
|
- status.set("0");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- //todo 模型记录四诊(暂不处理)
|
|
|
- List<ThreeLevelWardLabel> threeLevelWardLabel = item.getThreeLevelWardLabel();
|
|
|
+ List<ThreeLevelWardDoc> threeLevelWardDocs_match = threeLevelWardDocs.stream()
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .filter(i -> ListUtil.isNotEmpty(i.getAllDoctorWradDocs()))
|
|
|
+ .flatMap(i -> i.getAllDoctorWradDocs().stream())
|
|
|
+ .distinct()
|
|
|
+ .filter(i -> i.getStructureMap().containsKey("查房日期") && i.getStructureMap().containsKey("病情记录"))
|
|
|
+ .filter(i -> StringUtil.parseDateTime(i.getStructureMap().get("查房日期")).getTime() >= startDate.getTime()
|
|
|
+ && StringUtil.parseDateTime(i.getStructureMap().get("查房日期")).getTime() <= endDate.getTime())
|
|
|
+ .filter(i -> RegexUtil.getRegexRes(i.getStructureMap().get("病情记录"), regex, 2))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (ListUtil.isNotEmpty(threeLevelWardDocs_match)) {
|
|
|
+ exist = true;
|
|
|
+ continue;
|
|
|
}
|
|
|
+
|
|
|
+ //todo 模型记录四诊(暂不处理)
|
|
|
+ //List<ThreeLevelWardLabel> threeLevelWardLabel = item.getThreeLevelWardLabel();
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- //出院小结
|
|
|
- if (null != leaveHospitalDoc) {
|
|
|
- String leaveHosText = leaveHospitalDoc.getStructureMap().get("出院医嘱");
|
|
|
- Date leaveHospitalDate = DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(firstCourseRecordDoc.getStructureMap().get("出院日期")));
|
|
|
- if (StringUtil.isNotBlank(leaveHosText)
|
|
|
- && (!leaveHospitalDate.after(startDate)
|
|
|
- || !leaveHospitalDate.before(endDate))
|
|
|
- && RegexUtil.getRegexRes(leaveHosText, regex, 2)) {
|
|
|
- status.set("0");
|
|
|
- return;
|
|
|
+ //出院小结
|
|
|
+ if (null != leaveHospitalDoc) {
|
|
|
+ String leaveHosText = leaveHospitalDoc.getStructureMap().get("出院医嘱");
|
|
|
+ Date leaveHospitalDate = DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(leaveHospitalDoc.getStructureMap().get("日期")));
|
|
|
+ if (StringUtil.isNotBlank(leaveHosText)
|
|
|
+ && (leaveHospitalDate.getTime() >= startDate.getTime() && leaveHospitalDate.getTime() <= endDate.getTime())
|
|
|
+ && RegexUtil.getRegexRes(leaveHosText, regex, 2)) {
|
|
|
+ exist = true;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (null != leaveHospitalDoc.getLeaveHospitalDoctorAdviceLabel()
|
|
|
+ && leaveHospitalDoc.getLeaveHospitalDoctorAdviceLabel().getText().contains("四诊")) {
|
|
|
+ exist = true;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
}
|
|
|
- if (null != leaveHospitalDoc.getLeaveHospitalDoctorAdviceLabel()
|
|
|
- && leaveHospitalDoc.getLeaveHospitalDoctorAdviceLabel().getText().contains("四诊")) {
|
|
|
- status.set("0");
|
|
|
+
|
|
|
+ if (!exist) {
|
|
|
+ status.set("-1");
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- status.set("-1");
|
|
|
+ status.set("0");
|
|
|
return;
|
|
|
}
|
|
|
}
|