|
@@ -0,0 +1,117 @@
|
|
|
+package com.lantone.qc.kernel.catalogue.hospital.wenfuyi.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.model.InputInfo;
|
|
|
+import com.lantone.qc.pub.model.OutputInfo;
|
|
|
+import com.lantone.qc.pub.model.doc.FirstCourseRecordDoc;
|
|
|
+import com.lantone.qc.pub.model.doc.MedicalRecordInfoDoc;
|
|
|
+import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
|
|
|
+import com.lantone.qc.pub.model.doc.ward.AttendingDoctorWardDoc;
|
|
|
+import com.lantone.qc.pub.model.doc.ward.DirectorDoctorWardDoc;
|
|
|
+import com.lantone.qc.pub.util.DateUtil;
|
|
|
+import com.lantone.qc.pub.util.SpringContextUtil;
|
|
|
+import com.lantone.qc.pub.util.StringUtil;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @ClassName : THR0126
|
|
|
+ * @Description : 主治以上职称医师首次查房未在患者入院48小时内完成
|
|
|
+ * @Author : 贺聪聪
|
|
|
+ * @Date: 2020-07-07 16:50
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class THR0126 extends QCCatalogue {
|
|
|
+ public void start(InputInfo inputInfo, OutputInfo outputInfo) {
|
|
|
+
|
|
|
+ MedicalRecordInfoDoc medicalRecordInfoDoc = inputInfo.getMedicalRecordInfoDoc();
|
|
|
+ if (medicalRecordInfoDoc != null && medicalRecordInfoDoc.getStructureMap() != null) {
|
|
|
+ //入院日期
|
|
|
+ String admisTime = medicalRecordInfoDoc.getStructureMap().get("behospitalDate");
|
|
|
+ //出院日期
|
|
|
+ String dischargeTime = medicalRecordInfoDoc.getStructureMap().get("leaveHospitalDate");
|
|
|
+ if (CatalogueUtil.isEmpty(admisTime)) {
|
|
|
+ status.set("0");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!CatalogueUtil.compareTime(
|
|
|
+ StringUtil.parseDateTime(admisTime),
|
|
|
+ StringUtil.parseDateTime(DateUtil.nowString()),
|
|
|
+ Long.valueOf(48 * 60))) {//如果入院未超过48小时,规则不判断
|
|
|
+ status.set("0");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //如果住院天数小于2天则不判断该条规则
|
|
|
+ if (StringUtil.isNotBlank(dischargeTime) && DateUtil.parseDate(dischargeTime) != null && StringUtil.isNotEmpty(dischargeTime) &&
|
|
|
+ !CatalogueUtil.compareTime(StringUtil.parseDateTime(admisTime), StringUtil.parseDateTime(dischargeTime), (long) (48 * 60))) {
|
|
|
+ status.set("0");
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ if (inputInfo.getThreeLevelWardDocs().size() == 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //开始时间(入院时间)
|
|
|
+ Date beginDate = StringUtil.parseDateTime(admisTime);
|
|
|
+ if (beginDate == null) {
|
|
|
+ status.set("0");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ /* 首次病程录如果是主治或者主任写的,也算主治查房 */
|
|
|
+ FirstCourseRecordDoc firstCourseRecordDoc = inputInfo.getFirstCourseRecordDoc();//首次病程录
|
|
|
+ if (firstCourseRecordDoc != null) {
|
|
|
+ String doctorSign = firstCourseRecordDoc.getStructureMap().get("医生签名");
|
|
|
+ String firstCourseProfessor = getFirstCourseProfessor(doctorSign);
|
|
|
+ if (StringUtil.isNotBlank(firstCourseProfessor) && firstCourseProfessor.contains("主治")) {
|
|
|
+ String recordDateStr = firstCourseRecordDoc.getStructureMap().get("记录时间");
|
|
|
+ if (StringUtil.isNotBlank(recordDateStr)) {
|
|
|
+ if (!CatalogueUtil.compareTime(StringUtil.parseDateTime(admisTime), StringUtil.parseDateTime(recordDateStr), 48 * 60L)) {
|
|
|
+ status.set("0");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ThreeLevelWardDoc threeLevelWardDoc = inputInfo.getThreeLevelWardDocs().get(0);//查房记录
|
|
|
+ List<AttendingDoctorWardDoc> attendingDoctorWardDocs = threeLevelWardDoc.getAttendingDoctorWardDocs();//主治医生查房
|
|
|
+ List<DirectorDoctorWardDoc> directorDoctorWardDocs = threeLevelWardDoc.getDirectorDoctorWardDocs();//主任医生查房
|
|
|
+ if (attendingDoctorWardDocs.size() > 0 || directorDoctorWardDocs.size() > 0) {
|
|
|
+ AttendingDoctorWardDoc firstAttending = attendingDoctorWardDocs.get(0);
|
|
|
+ DirectorDoctorWardDoc directorDoctorWardDoc = directorDoctorWardDocs.get(0);
|
|
|
+ String wardDateStr = firstAttending.getStructureMap().get("查房日期");
|
|
|
+ String doctorDate = directorDoctorWardDoc.getStructureMap().get("查房日期");
|
|
|
+ if (!CatalogueUtil.compareTime(StringUtil.parseDateTime(admisTime), StringUtil.parseDateTime(wardDateStr), 48 * 60L) ||
|
|
|
+ !CatalogueUtil.compareTime(StringUtil.parseDateTime(admisTime), StringUtil.parseDateTime(doctorDate), 48 * 60L)) {
|
|
|
+ status.set("0");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } else if (!CatalogueUtil.compareTime(StringUtil.parseDateTime(admisTime), new Date(), 48 * 60L)) {
|
|
|
+ status.set("0");//没有主治医师查房,若入院时间和系统当前时间对比,相差48小时则报错
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private String getFirstCourseProfessor(String doctorSign) {
|
|
|
+ String professor = "";
|
|
|
+ if (StringUtil.isBlank(doctorSign)) {
|
|
|
+ return professor;
|
|
|
+ }
|
|
|
+ SpecialStorageUtil specialStorageUtil = SpringContextUtil.getBean("specialStorageUtil");
|
|
|
+ Map<String, Object> surgeon = specialStorageUtil.getJsonStringValue(KernelConstants.HOSPITAL_DOCTOR_MAP);
|
|
|
+ if (surgeon != null) {
|
|
|
+ Map<String, String> doctor = (Map) surgeon.get(doctorSign);
|
|
|
+ if (doctor != null) {
|
|
|
+ professor = doctor.get("professor");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return professor;
|
|
|
+ }
|
|
|
+}
|