|
@@ -6,8 +6,12 @@ import com.lantone.qc.pub.model.InputInfo;
|
|
import com.lantone.qc.pub.model.OutputInfo;
|
|
import com.lantone.qc.pub.model.OutputInfo;
|
|
import com.lantone.qc.pub.model.doc.MedicalRecordInfoDoc;
|
|
import com.lantone.qc.pub.model.doc.MedicalRecordInfoDoc;
|
|
import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
|
|
import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
|
|
|
|
+import com.lantone.qc.pub.model.doc.transferrecord.TransferIntoDoc;
|
|
|
|
+import com.lantone.qc.pub.model.doc.transferrecord.TransferOutDoc;
|
|
|
|
+import com.lantone.qc.pub.model.doc.transferrecord.TransferRecordDoc;
|
|
import com.lantone.qc.pub.model.doc.ward.DirectorDoctorWardDoc;
|
|
import com.lantone.qc.pub.model.doc.ward.DirectorDoctorWardDoc;
|
|
import com.lantone.qc.pub.util.DateUtil;
|
|
import com.lantone.qc.pub.util.DateUtil;
|
|
|
|
+import com.lantone.qc.pub.util.ListUtil;
|
|
import com.lantone.qc.pub.util.StringUtil;
|
|
import com.lantone.qc.pub.util.StringUtil;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
@@ -23,142 +27,165 @@ import java.util.List;
|
|
@Component
|
|
@Component
|
|
public class THR0125 extends QCCatalogue {
|
|
public class THR0125 extends QCCatalogue {
|
|
public void start(InputInfo inputInfo, OutputInfo outputInfo) {
|
|
public void start(InputInfo inputInfo, OutputInfo outputInfo) {
|
|
-
|
|
|
|
|
|
+ //若是第一次转科与入院时间间隔72小时则期间需要查房,若是多次转科,则第一次转科与第二次转科间隔72小时也需要查房,若是最后一次转科与出院时间间隔72小时也需要查房
|
|
|
|
+ status.set("0");
|
|
MedicalRecordInfoDoc medicalRecordInfoDoc = inputInfo.getMedicalRecordInfoDoc();
|
|
MedicalRecordInfoDoc medicalRecordInfoDoc = inputInfo.getMedicalRecordInfoDoc();
|
|
if (medicalRecordInfoDoc != null && medicalRecordInfoDoc.getStructureMap() != null) {
|
|
if (medicalRecordInfoDoc != null && medicalRecordInfoDoc.getStructureMap() != null) {
|
|
//入院日期
|
|
//入院日期
|
|
String admisTime = medicalRecordInfoDoc.getStructureMap().get("behospitalDate");
|
|
String admisTime = medicalRecordInfoDoc.getStructureMap().get("behospitalDate");
|
|
//出院日期
|
|
//出院日期
|
|
String dischargeTime = medicalRecordInfoDoc.getStructureMap().get("leaveHospitalDate");
|
|
String dischargeTime = medicalRecordInfoDoc.getStructureMap().get("leaveHospitalDate");
|
|
- if (CatalogueUtil.isEmpty(admisTime) || CatalogueUtil.isEmpty(dischargeTime)) {
|
|
|
|
- status.set("0");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- if (!CatalogueUtil.compareTime(
|
|
|
|
- StringUtil.parseDateTime(admisTime),
|
|
|
|
- StringUtil.parseDateTime(DateUtil.nowString()),
|
|
|
|
- Long.valueOf(72 * 60))) {//如果入院未超过72小时,规则不判断
|
|
|
|
- status.set("0");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- //如果住院天数小于3天则不判断该条规则
|
|
|
|
- if (DateUtil.parseDate(dischargeTime) != null &&
|
|
|
|
- !CatalogueUtil.compareTime(StringUtil.parseDateTime(admisTime), StringUtil.parseDateTime(dischargeTime), (long) (72 * 60))) {
|
|
|
|
- status.set("0");
|
|
|
|
- return;
|
|
|
|
|
|
+
|
|
|
|
+ //判断是否为转科病人,若为转科病人则从转科时间开始算,不能从入院时间开始
|
|
|
|
+ TransferRecordDoc transferRecordDocs = inputInfo.getTransferRecordDocs();
|
|
|
|
+ if (transferRecordDocs != null) {
|
|
|
|
+ List<TransferOutDoc> transferOutDocs = transferRecordDocs.getTransferOutDocs();
|
|
|
|
+ if (ListUtil.isNotEmpty(transferOutDocs)) {
|
|
|
|
+ //若只有一次转科
|
|
|
|
+ if (transferOutDocs.size() == 1) {
|
|
|
|
+ //转出存在
|
|
|
|
+ TransferOutDoc transferOutDoc = transferOutDocs.get(0);
|
|
|
|
+ //获取第一次转入时间判断其与入院时间相比是否超过了72小时
|
|
|
|
+ String intoTime = transferOutDoc.getStructureMap().get("转入日期");
|
|
|
|
+ if (CatalogueUtil.compareTime(StringUtil.parseDateTime(admisTime), StringUtil.parseDateTime(intoTime), 72 * 60L)) {
|
|
|
|
+ //超过72小时则期间需要有一次查房
|
|
|
|
+ boolean directorRounds = getDirectorRounds(admisTime, dischargeTime, inputInfo);
|
|
|
|
+ if (!directorRounds) {
|
|
|
|
+ status.set("-1");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //转出之后也需要判断主任查房(若离现在时间未72小时则不会触发规则)
|
|
|
|
+ boolean b = judgeDirectorRounds(intoTime,dischargeTime, inputInfo);
|
|
|
|
+ if(!b){
|
|
|
|
+ status.set("-1");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //若含有多次转科
|
|
|
|
+ if(transferOutDocs.size()>1){
|
|
|
|
+ //转出存在
|
|
|
|
+ TransferOutDoc transferOutDoc = transferOutDocs.get(0);
|
|
|
|
+ //获取第一次转入时间判断其与入院时间相比是否超过了72小时
|
|
|
|
+ String intoTime = transferOutDoc.getStructureMap().get("转入日期");
|
|
|
|
+ if (CatalogueUtil.compareTime(StringUtil.parseDateTime(admisTime), StringUtil.parseDateTime(intoTime), 72 * 60L)) {
|
|
|
|
+ //超过72小时则期间需要有一次查房
|
|
|
|
+ boolean directorRounds = getDirectorRounds(admisTime, dischargeTime, inputInfo);
|
|
|
|
+ if (!directorRounds) {
|
|
|
|
+ status.set("-1");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //第一次转出和第二次转出时间比较是否超过72小时
|
|
|
|
+ for (int i = 0; i < transferOutDocs.size(); i++) {
|
|
|
|
+ //最后一次结束
|
|
|
|
+ if(i==transferOutDocs.size()-1){
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ String admisTimes = transferOutDocs.get(i).getStructureMap().get("转入日期");
|
|
|
|
+ String intoTimes = transferOutDocs.get(i+1).getStructureMap().get("转入日期");
|
|
|
|
+ //两次转出间隔72小时
|
|
|
|
+ if (CatalogueUtil.compareTime(StringUtil.parseDateTime(admisTimes), StringUtil.parseDateTime(intoTimes), 72 * 60L)) {
|
|
|
|
+ boolean b = judgeDirectorRounds(admisTimes,intoTimes,inputInfo);
|
|
|
|
+ if(!b){
|
|
|
|
+ status.set("-1");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //获取最后一次转出
|
|
|
|
+ TransferOutDoc transferOutDocEnd = transferOutDocs.get(transferOutDocs.size() - 1);
|
|
|
|
+ String endTime = transferOutDocEnd.getStructureMap().get("转入日期");
|
|
|
|
+ boolean b = judgeDirectorRounds(endTime,dischargeTime, inputInfo);
|
|
|
|
+ if(!b){
|
|
|
|
+ status.set("-1");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
- if (inputInfo.getThreeLevelWardDocs().size() == 0) {
|
|
|
|
|
|
+ //不存在转科情况
|
|
|
|
+ boolean directorRounds = getDirectorRounds(admisTime, dischargeTime, inputInfo);
|
|
|
|
+ if (!directorRounds) {
|
|
|
|
+ status.set("-1");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// if (inputInfo.getBeHospitalizedDoc() != null) {
|
|
|
|
-// Map<String, String> beHospitalStructureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
|
|
|
|
-// String admisTime = beHospitalStructureMap.get("入院日期");
|
|
|
|
- if (CatalogueUtil.isEmpty(admisTime)) {
|
|
|
|
- status.set("0");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- if (!CatalogueUtil.compareTime(
|
|
|
|
- StringUtil.parseDateTime(admisTime),
|
|
|
|
- StringUtil.parseDateTime(DateUtil.nowString()),
|
|
|
|
- Long.valueOf(72 * 60))) {//如果入院未超过72小时,规则不判断
|
|
|
|
- status.set("0");
|
|
|
|
- return;
|
|
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //判断期间是否有主任查房
|
|
|
|
+ private boolean getDirectorRounds(String admisTime, String dischargeTime,InputInfo inputInfo) {
|
|
|
|
+ if (CatalogueUtil.isEmpty(admisTime) || CatalogueUtil.isEmpty(dischargeTime)) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if (!CatalogueUtil.compareTime(
|
|
|
|
+ StringUtil.parseDateTime(admisTime),
|
|
|
|
+ StringUtil.parseDateTime(DateUtil.nowString()),
|
|
|
|
+ Long.valueOf(72 * 60))) {//如果入院未超过72小时,规则不判断
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ //如果住院天数小于3天则不判断该条规则
|
|
|
|
+ if (DateUtil.parseDate(dischargeTime) != null &&
|
|
|
|
+ !CatalogueUtil.compareTime(StringUtil.parseDateTime(admisTime), StringUtil.parseDateTime(dischargeTime), (long) (72 * 60))) {
|
|
|
|
+ return true;
|
|
|
|
+ } else {
|
|
|
|
+ if (inputInfo.getThreeLevelWardDocs().size() == 0) {
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
- //开始时间(入院时间)
|
|
|
|
- Date beginDate = StringUtil.parseDateTime(admisTime);
|
|
|
|
- if (beginDate == null) {
|
|
|
|
- status.set("0");
|
|
|
|
- return;
|
|
|
|
|
|
+ }
|
|
|
|
+ if (CatalogueUtil.isEmpty(admisTime)) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if (!CatalogueUtil.compareTime(
|
|
|
|
+ StringUtil.parseDateTime(admisTime),
|
|
|
|
+ StringUtil.parseDateTime(DateUtil.nowString()),
|
|
|
|
+ Long.valueOf(72 * 60))) {//如果入院未超过72小时,规则不判断
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ //开始时间(入院时间)
|
|
|
|
+ Date beginDate = StringUtil.parseDateTime(admisTime);
|
|
|
|
+ if (beginDate == null) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ ThreeLevelWardDoc threeLevelWardDoc = inputInfo.getThreeLevelWardDocs().get(0);
|
|
|
|
+ List<DirectorDoctorWardDoc> directorDoctorWardDocs = threeLevelWardDoc.getDirectorDoctorWardDocs();
|
|
|
|
+ if (directorDoctorWardDocs.size() > 0) {
|
|
|
|
+ DirectorDoctorWardDoc firstDirector = directorDoctorWardDocs.get(0);
|
|
|
|
+ String wardDateStr = firstDirector.getStructureMap().get("查房日期");
|
|
|
|
+ if (!CatalogueUtil.compareTime(StringUtil.parseDateTime(admisTime), StringUtil.parseDateTime(wardDateStr), 72 * 60L)) {
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
- ThreeLevelWardDoc threeLevelWardDoc = inputInfo.getThreeLevelWardDocs().get(0);
|
|
|
|
- List<DirectorDoctorWardDoc> directorDoctorWardDocs = threeLevelWardDoc.getDirectorDoctorWardDocs();
|
|
|
|
- if (directorDoctorWardDocs.size() > 0) {
|
|
|
|
- DirectorDoctorWardDoc firstDirector = directorDoctorWardDocs.get(0);
|
|
|
|
- String wardDateStr = firstDirector.getStructureMap().get("查房日期");
|
|
|
|
- if (!CatalogueUtil.compareTime(StringUtil.parseDateTime(admisTime), StringUtil.parseDateTime(wardDateStr), 72 * 60L)) {
|
|
|
|
- status.set("0");
|
|
|
|
- return;
|
|
|
|
|
|
+ } else if (!CatalogueUtil.compareTime(StringUtil.parseDateTime(admisTime), new Date(), 72 * 60L)) {
|
|
|
|
+ //没有主任医师查房,若入院时间和系统当前时间对比,相差72小时则报错
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ //判断转入时间内72小时内是否含有主任查房
|
|
|
|
+ private boolean judgeDirectorRounds(String admisTime,String dischargeTime,InputInfo inputInfo){
|
|
|
|
+ ThreeLevelWardDoc threeLevelWardDoc = inputInfo.getThreeLevelWardDocs().get(0);
|
|
|
|
+ List<DirectorDoctorWardDoc> directorDoctorWardDocs = threeLevelWardDoc.getDirectorDoctorWardDocs();
|
|
|
|
+ if (directorDoctorWardDocs.size() > 0) {
|
|
|
|
+ for (DirectorDoctorWardDoc directorDoctorWardDoc : directorDoctorWardDocs) {
|
|
|
|
+ String wardDateStr = directorDoctorWardDoc.getStructureMap().get("查房日期");
|
|
|
|
+ if (!CatalogueUtil.compareTime(StringUtil.parseDateTime(admisTime), StringUtil.parseDateTime(wardDateStr), 72 * 60L)
|
|
|
|
+ && StringUtil.parseDateTime(wardDateStr).after(StringUtil.parseDateTime(admisTime))
|
|
|
|
+ ) {
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
- } else if (!CatalogueUtil.compareTime(StringUtil.parseDateTime(admisTime), new Date(), 72 * 60L)) {
|
|
|
|
- status.set("0");//没有主任医师查房,若入院时间和系统当前时间对比,相差72小时则报错
|
|
|
|
- return;
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
- /* 如果存在手术记录,判断主刀医生是否为主治医生 */
|
|
|
|
-// String operatorName = "";
|
|
|
|
-// List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
|
|
|
|
-// if (operationDocs != null) {
|
|
|
|
-// for (OperationDoc operationDoc : operationDocs) {
|
|
|
|
-// if (operationDoc.getOperationRecordDoc() != null) {
|
|
|
|
-// Map<String, String> operationDocStructureMap = operationDoc.getOperationRecordDoc().getStructureMap();
|
|
|
|
-// if (StringUtil.isBlank(operatorName)) {
|
|
|
|
-// operatorName = operationDocStructureMap.get("主刀医师");
|
|
|
|
-// if (StringUtil.isBlank(operatorName) && StringUtil.isNotBlank(operationDocStructureMap.get("手术者及助手名称"))) {
|
|
|
|
-// operatorName = operationDocStructureMap.get("手术者及助手名称").split("、")[0];
|
|
|
|
-// if (operatorName.contains("主刀:") && operatorName.split(":").length > 1) {
|
|
|
|
-// operatorName = operatorName.split(":")[1];
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDoc.getAllDoctorWradDocs();
|
|
|
|
-// for (ThreeLevelWardDoc threeLevelWard : allDoctorWradDocs) {
|
|
|
|
-// Map<String, String> structureMap = threeLevelWard.getStructureMap();
|
|
|
|
-// String wardDateStr = structureMap.get("查房日期");
|
|
|
|
-// if (!CatalogueUtil.compareTime(StringUtil.parseDateTime(admisTime), StringUtil.parseDateTime(wardDateStr), 72 * 60L)) {
|
|
|
|
-// String makeTitle = structureMap.get("查房标题");
|
|
|
|
-// String pathography = structureMap.get("病情记录");
|
|
|
|
-// //判断标题
|
|
|
|
-// visitingPhysicianHouse(operatorName, makeTitle);
|
|
|
|
-// //判断病情记录
|
|
|
|
-// visitingPhysicianHouse(operatorName, pathography);
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
|
|
+ } else if (!CatalogueUtil.compareTime(StringUtil.parseDateTime(admisTime), new Date(), 72 * 60L)) {
|
|
|
|
+ //没有主任医师查房,若入院时间和系统当前时间对比,相差72小时则报错
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
|
|
+ //与出院时间/下次转出时间比较若没有72小时则不触发规则
|
|
|
|
+ if (!CatalogueUtil.compareTime(StringUtil.parseDateTime(admisTime),StringUtil.parseDateTime(dischargeTime), 72 * 60L)) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ //没有查房并且转科时间与现阶段时间超过72小时触发规则
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
|
|
|
|
-// /**
|
|
|
|
-// * 判断查房记录是否含有主任医师查房
|
|
|
|
-// *
|
|
|
|
-// * @param operatorName 主刀医师
|
|
|
|
-// * @param titlePathography 查房标题或病情记录
|
|
|
|
-// */
|
|
|
|
-// private void visitingPhysicianHouse(String operatorName, String titlePathography) {
|
|
|
|
-// if (StringUtil.isNotBlank(titlePathography)) {
|
|
|
|
-// if (titlePathography.contains("主任")) {
|
|
|
|
-// status.set("0");
|
|
|
|
-// return;
|
|
|
|
-// } else if (StringUtil.isNotBlank(operatorName) && (titlePathography.contains(operatorName) || titlePathography.contains("主刀"))) {
|
|
|
|
-// String operationProfessor = getCourseProfessor(operatorName);
|
|
|
|
-// if (operationProfessor.contains("主任")) {
|
|
|
|
-// status.set("0");
|
|
|
|
-// return;
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
-// private String getCourseProfessor(String operatorName) {
|
|
|
|
-// String professor = "";
|
|
|
|
-// if (StringUtil.isBlank(operatorName)) {
|
|
|
|
-// 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(operatorName);
|
|
|
|
-// if (doctor != null) {
|
|
|
|
-// professor = doctor.get("professor");
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// }
|
|
|
|
-// return professor;
|
|
|
|
-// }
|
|
|
|
}
|
|
}
|