|
@@ -0,0 +1,219 @@
|
|
|
+package com.lantone.qc.kernel.catalogue.threelevelward;
|
|
|
+
|
|
|
+import com.lantone.qc.dbanaly.util.KernelConstants;
|
|
|
+import com.lantone.qc.dbanaly.util.SpecialStorageUtil;
|
|
|
+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.*;
|
|
|
+import com.lantone.qc.pub.util.ListUtil;
|
|
|
+import com.lantone.qc.pub.util.StringUtil;
|
|
|
+import org.apache.commons.lang3.time.DateUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @ClassName : THR03150
|
|
|
+ * @Description : 危重患者上级医师(副高及以上)查房记录不及时
|
|
|
+ * @Author : Mark
|
|
|
+ * @Date: 2020-04-07 17:06
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class THR03150 extends QCCatalogue {
|
|
|
+ @Autowired
|
|
|
+ private SpecialStorageUtil specialStorageUtil;
|
|
|
+ public void start(InputInfo inputInfo, OutputInfo outputInfo) {
|
|
|
+ /**
|
|
|
+ * 如果有未在6小时内完成的去首次病程里找有没有,请示**上级医生,字段,如果没有就算他未及时
|
|
|
+ *
|
|
|
+ * 1.先判断是否是危重患者p5,排除死亡患者p9,排除出院时间和病危时间为同一天。2.医嘱内下达【病危/病重】开始时间,延后6小时内,是否有上级医师查房p11,
|
|
|
+ * 若有不报,若无3.去【首次病程记录/抢救记录】内找是否有包含【上级医师姓名】/【主任】字段,若无报出
|
|
|
+ *p5
|
|
|
+ * 1.【临时医嘱/长期医嘱】包含【病危/病重】医嘱
|
|
|
+ * 或2.【病危通知书/病重通知书】文书
|
|
|
+ *p9
|
|
|
+ * 符合下列情况的任意一种则成立:
|
|
|
+ * 1.病历包含【死亡记录】
|
|
|
+ * 2.【临时医嘱】包含【死亡】医嘱
|
|
|
+ *p11
|
|
|
+ * 【查房记录】标题为【主任*查房】或【主任级别的姓名查房】
|
|
|
+ */
|
|
|
+ status.set("0");
|
|
|
+ boolean falg=false;
|
|
|
+ String doctorStartTime="";
|
|
|
+ List<DoctorAdviceDoc> doctorAdviceDocs = inputInfo.getDoctorAdviceDocs();
|
|
|
+ //病危通知书
|
|
|
+ List<CriticallyIllNoticeDoc> criticallyIllNoticeDocs = inputInfo.getCriticallyIllNoticeDocs();
|
|
|
+ //病重通知书
|
|
|
+ List<SeriouslyIllNoticeDoc> seriouslyIllNoticeDocs = inputInfo.getSeriouslyIllNoticeDocs();
|
|
|
+ //死亡记录不为空
|
|
|
+ DeathRecordDoc deathRecordDoc = inputInfo.getDeathRecordDoc();
|
|
|
+ if(deathRecordDoc!=null){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ MedicalRecordInfoDoc medicalRecordInfoDoc = inputInfo.getMedicalRecordInfoDoc();
|
|
|
+
|
|
|
+ if(ListUtil.isNotEmpty(doctorAdviceDocs)){
|
|
|
+ for (DoctorAdviceDoc doctorAdviceDoc : doctorAdviceDocs) {
|
|
|
+ //取长期临时医嘱,不为作废医嘱
|
|
|
+ if(doctorAdviceDoc.getStructureMap()==null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Map<String, String> doctorAdviceDocStructureMap = doctorAdviceDoc.getStructureMap();
|
|
|
+ String adviceType = doctorAdviceDocStructureMap.get(Content.doctorAdviceType);
|
|
|
+ if (StringUtil.isEmpty(adviceType)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (adviceType.equals(Content.standingOrder) || adviceType.equals(Content.statOrder)) {
|
|
|
+ String adviceState = doctorAdviceDocStructureMap.get(Content.doctorAdviceState);
|
|
|
+ if (StringUtil.isEmpty(adviceState)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (!Content.cancellationOrderList.contains(adviceState)) {
|
|
|
+ //死亡医嘱
|
|
|
+ String medicalOrderName = doctorAdviceDoc.getStructureMap().get(Content.medicalOrderName);
|
|
|
+ if(StringUtil.isBlank(medicalOrderName)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (medicalOrderName.contains("死亡")) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //医嘱中判断为病危病重患者
|
|
|
+ if (medicalOrderName.contains("病危")||medicalOrderName.contains("病重")) {
|
|
|
+ falg=true;
|
|
|
+ //获取医嘱开始时间
|
|
|
+ doctorStartTime = doctorAdviceDocStructureMap.get("医嘱开始时间");
|
|
|
+ if(StringUtil.isBlank(doctorStartTime)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Date doctorStartDate = StringUtil.parseDateTime(doctorStartTime);
|
|
|
+ //判断与出院时间是否为同一天
|
|
|
+ if(medicalRecordInfoDoc!=null){
|
|
|
+ //获取出院时间
|
|
|
+ String leaveHospitalTime = medicalRecordInfoDoc.getStructureMap().get("leaveHospitalDate");
|
|
|
+ if(StringUtil.isNotBlank(leaveHospitalTime)){
|
|
|
+ Date leaveHospitalDate = StringUtil.parseDateTime(leaveHospitalTime);
|
|
|
+ if(DateUtils.isSameDay(leaveHospitalDate, doctorStartDate)){
|
|
|
+ //出院和下达病危、病重为同一天则跳过
|
|
|
+ doctorStartTime="";
|
|
|
+ continue;
|
|
|
+ }else {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(ListUtil.isNotEmpty(criticallyIllNoticeDocs)||ListUtil.isNotEmpty(seriouslyIllNoticeDocs)){
|
|
|
+ //为一个病危病重患者
|
|
|
+ falg=true;
|
|
|
+ if(StringUtil.isBlank(doctorStartTime)){
|
|
|
+ if(ListUtil.isNotEmpty(criticallyIllNoticeDocs)){
|
|
|
+ doctorStartTime = criticallyIllNoticeDocs.get(0).getStructureMap().get("审核日期");
|
|
|
+ }
|
|
|
+ if(ListUtil.isNotEmpty(seriouslyIllNoticeDocs)){
|
|
|
+ doctorStartTime = seriouslyIllNoticeDocs.get(0).getStructureMap().get("审核日期");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(falg){
|
|
|
+ if(StringUtil.isBlank(doctorStartTime)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Date doctorStartDate = StringUtil.parseDateTime(doctorStartTime);
|
|
|
+ if(getAllSaveDoctor(inputInfo,outputInfo,doctorStartDate)){
|
|
|
+ return;
|
|
|
+ }else {
|
|
|
+ //去【抢救记录】内找是否有包含【上级医师姓名】/【主任】字段,若无报出
|
|
|
+ List<RescueDoc> rescueDocs = inputInfo.getRescueDocs();
|
|
|
+ if(ListUtil.isNotEmpty(rescueDocs)) {
|
|
|
+ for (RescueDoc rescueDoc : rescueDocs) {
|
|
|
+ String text = rescueDoc.getText();
|
|
|
+ if (StringUtil.isNotBlank(text)) {
|
|
|
+ if (!text.contains("主任") && !judgeContainsDoctor(text)) {
|
|
|
+ status.set("-1");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //首次病程录
|
|
|
+ FirstCourseRecordDoc firstCourseRecordDoc = inputInfo.getFirstCourseRecordDoc();
|
|
|
+ if(firstCourseRecordDoc!=null){
|
|
|
+ String text = firstCourseRecordDoc.getText();
|
|
|
+ if (StringUtil.isNotBlank(text)) {
|
|
|
+ if (!text.contains("主任") && !judgeContainsDoctor(text)) {
|
|
|
+ status.set("-1");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //抢救6小时内 找标题为【主任*查房】或【主任级别的姓名查房】
|
|
|
+ public boolean getAllSaveDoctor(InputInfo inputInfo, OutputInfo outputInfo,Date saveDate ) {
|
|
|
+ List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
|
|
|
+ if (ListUtil.isEmpty(threeLevelWardDocs)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDocs.get(0).getAllDoctorWradDocs();
|
|
|
+ if (ListUtil.isEmpty(allDoctorWradDocs)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ for (ThreeLevelWardDoc allDoctorWradDoc : allDoctorWradDocs) {
|
|
|
+ Map<String, String> structureMap = allDoctorWradDoc.getStructureMap();
|
|
|
+ String checkTime = structureMap.get("查房日期");
|
|
|
+ if(StringUtil.isBlank(checkTime)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (!CatalogueUtil.compareTime(
|
|
|
+ saveDate,
|
|
|
+ StringUtil.parseDateTime(checkTime),
|
|
|
+ Long.valueOf(6 * 60))) {
|
|
|
+ //不大于抢救开始时间6小时内,取查房标题
|
|
|
+ String wardRoundTitle = structureMap.get("查房标题");
|
|
|
+ //【主任*查房】或【主任级别的姓名查房】
|
|
|
+ if(StringUtil.isBlank(wardRoundTitle)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if(wardRoundTitle.contains("主任")){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if(judgeContainsDoctor(wardRoundTitle)){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ //判断是否含有主任医师姓名
|
|
|
+ private boolean judgeContainsDoctor(String string) {
|
|
|
+ Map<String, Map<String, Object>> hospitalDoctorMap = specialStorageUtil.getJsonStringValue(KernelConstants.HOSPITAL_DOCTOR_MAP);
|
|
|
+ if (hospitalDoctorMap == null) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ for (String keyStr : hospitalDoctorMap.keySet()) {
|
|
|
+ if (string.contains(keyStr)) {
|
|
|
+ Object professor = hospitalDoctorMap.get(keyStr).get("professor");
|
|
|
+ if (professor != null) {
|
|
|
+ if (professor.toString().contains("主任")) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+}
|