|
@@ -0,0 +1,97 @@
|
|
|
+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.Content;
|
|
|
+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.StringUtil;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @ClassName : THR0127
|
|
|
+ * @Description : 每周无2次副主任医师/主任医师查房记录
|
|
|
+ * @Author : 胡敬
|
|
|
+ * @Date: 2020-03-19 15:52
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class THR0127 extends QCCatalogue {
|
|
|
+ public void start(InputInfo inputInfo, OutputInfo outputInfo) {
|
|
|
+ status = "0";
|
|
|
+ if (inputInfo.getBeHospitalizedDoc() != null && inputInfo.getBeHospitalizedDoc().getStructureMap() != null
|
|
|
+ && inputInfo.getThreeLevelWardDocs().size() > 0) {
|
|
|
+ Map<String, String> beHospitalStructureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
|
|
|
+ String admisTime = beHospitalStructureMap.get(Content.admisDate);
|
|
|
+ if (CatalogueUtil.isEmpty(admisTime)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
|
|
|
+ int hoursPerWeek = 7 * 24 * 60;
|
|
|
+ String roundRecordThisWeek = "";
|
|
|
+ List<String> roundRecordEveryWeek = new ArrayList<>();
|
|
|
+ //开始时间(入院时间)
|
|
|
+ Date beginDate = StringUtil.parseDateTime(admisTime);
|
|
|
+ int i = 1;
|
|
|
+ //每周的病历记录
|
|
|
+ while (i >= 1) {
|
|
|
+ roundRecordThisWeek = extractWardRecord(threeLevelWardDocs, beginDate, hoursPerWeek);
|
|
|
+ if (CatalogueUtil.isEmpty(roundRecordThisWeek)) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ roundRecordEveryWeek.add(roundRecordThisWeek);
|
|
|
+ beginDate = DateUtil.addDate(beginDate, 7);
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ for (String roundRecord : roundRecordEveryWeek) {
|
|
|
+ int directorNum = CatalogueUtil.appearNumber(roundRecord.split(","), Content.director);
|
|
|
+ int dept_doctorNum = CatalogueUtil.appearNumber(roundRecord.split(","), Content.dept_doctor);
|
|
|
+ if (directorNum + dept_doctorNum < 2) {
|
|
|
+ //每周无2次主任医师查房记录/科主任查房记录
|
|
|
+ status = "-1";
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 抽取duration分钟内所有查房标题
|
|
|
+ * 抽取一周内所有查房标题,若一周内记录少于6天,则返回""
|
|
|
+ *
|
|
|
+ * @param threeLevelWardDocs
|
|
|
+ * @param admisDate
|
|
|
+ * @param duration
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private static String extractWardRecord(List<ThreeLevelWardDoc> threeLevelWardDocs, Date admisDate, int duration) {
|
|
|
+ String recordTime = "", recordTitle = "";
|
|
|
+ List<Date> dateList = new ArrayList();
|
|
|
+ for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
|
|
|
+ Map<String, String> threeLevelWardStructureMap = threeLevelWardDoc.getStructureMap();
|
|
|
+ recordTime = threeLevelWardStructureMap.get("查房日期");
|
|
|
+ Date recordDate = StringUtil.parseDateTime(recordTime);
|
|
|
+ if (recordDate == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (admisDate.before(recordDate) && !CatalogueUtil.compareTime(admisDate, recordDate, Long.valueOf(duration))) {
|
|
|
+ String wardTitle = CatalogueUtil.removeSpecialChar(threeLevelWardStructureMap.get("查房标题"));
|
|
|
+ recordTitle += wardTitle + ",";
|
|
|
+ dateList.add(recordDate);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (dateList.size() >= 2) {
|
|
|
+ dateList.sort(Date::compareTo);
|
|
|
+ if (CatalogueUtil.compareTime(admisDate, dateList.get(dateList.size() - 1), Long.valueOf(6 * 24 * 60))) {
|
|
|
+ return recordTitle;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+}
|