|
@@ -1,8 +1,11 @@
|
|
|
package com.lantone.qc.trans.xiamen;
|
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
|
+import com.google.common.collect.Maps;
|
|
|
import com.lantone.qc.dbanaly.util.KernelConstants;
|
|
|
import com.lantone.qc.dbanaly.util.SpecialStorageUtil;
|
|
|
+import com.lantone.qc.pub.model.InputInfo;
|
|
|
+import com.lantone.qc.pub.model.doc.FirstPageRecordDoc;
|
|
|
import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
|
|
|
import com.lantone.qc.pub.model.doc.operation.OperationDoc;
|
|
|
import com.lantone.qc.pub.model.doc.operation.OperationRecordDoc;
|
|
@@ -20,10 +23,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections.MapUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
-import java.util.Calendar;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* @Description: 查房记录文档生成
|
|
@@ -35,15 +35,26 @@ import java.util.Map;
|
|
|
public class XiamenThreeLevelWardDocTrans extends ModelDocTrans {
|
|
|
|
|
|
private List<OperationDoc> operationDocs;
|
|
|
+ private InputInfo inputInfo;
|
|
|
|
|
|
@Override
|
|
|
public List<ThreeLevelWardDoc> extract(MedrecVo medrecVo) {
|
|
|
+
|
|
|
+ Map<String, String> PhysicianTitleMap = Maps.newHashMap();
|
|
|
+ //病案首页
|
|
|
+ FirstPageRecordDoc firstPageRecordDoc = inputInfo.getFirstPageRecordDoc();
|
|
|
+ if (firstPageRecordDoc != null && firstPageRecordDoc.getStructureMap() != null) {
|
|
|
+ Map<String, String> structureMap = firstPageRecordDoc.getStructureMap();
|
|
|
+ PhysicianTitleMap.put("主任医师", structureMap.get("主任医师"));
|
|
|
+ PhysicianTitleMap.put("主治医师", structureMap.get("主治医师"));
|
|
|
+ }
|
|
|
+
|
|
|
List<ThreeLevelWardDoc> retList = Lists.newArrayList();
|
|
|
ThreeLevelWardDoc threeLevelWardDoc = new ThreeLevelWardDoc();
|
|
|
List<Map<String, Object>> contentMaps = (List) medrecVo.getContent().get("content");
|
|
|
contentMaps.forEach(contentMap -> {
|
|
|
try {
|
|
|
- classifyThreeLevelWardDoc(threeLevelWardDoc, contentMap);
|
|
|
+ classifyThreeLevelWardDoc(threeLevelWardDoc, contentMap, PhysicianTitleMap);
|
|
|
} catch (Exception e) {
|
|
|
log.error(e.getMessage(), e);
|
|
|
}
|
|
@@ -83,7 +94,7 @@ public class XiamenThreeLevelWardDocTrans extends ModelDocTrans {
|
|
|
for (ThreeLevelWardDoc t : allDoctorWradDocs) {
|
|
|
Map<String, String> structureMap = t.getStructureMap();
|
|
|
String title = structureMap.get("查房标题");
|
|
|
- if (!title.contains("科主任") &&(title.contains("副主任") || title.contains("主任"))) {
|
|
|
+ if (!title.contains("科主任") && (title.contains("副主任") || title.contains("主任"))) {
|
|
|
// structureMap.put("查房标题", title.replace("副主任", "主治").replace("主任", "主治"));
|
|
|
AttendingDoctorWardDoc attendingDoctorWardDoc = null;
|
|
|
attendingDoctorWardDoc = new AttendingDoctorWardDoc();
|
|
@@ -105,7 +116,7 @@ public class XiamenThreeLevelWardDocTrans extends ModelDocTrans {
|
|
|
Map<String, String> structureMap = t.getStructureMap();
|
|
|
String title = structureMap.get("查房标题");
|
|
|
// structureMap.put("查房标题", title.replace("副主任", "主治"));
|
|
|
- if(title.contains("副主任")){
|
|
|
+ if (title.contains("副主任")) {
|
|
|
AttendingDoctorWardDoc attendingDoctorWardDoc = null;
|
|
|
attendingDoctorWardDoc = new AttendingDoctorWardDoc();
|
|
|
attendingDoctorWardDoc.setStructureMap(structureMap);
|
|
@@ -119,7 +130,7 @@ public class XiamenThreeLevelWardDocTrans extends ModelDocTrans {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void classifyThreeLevelWardDoc(ThreeLevelWardDoc threeLevelWardDoc, Map<String, Object> contentMap) {
|
|
|
+ private void classifyThreeLevelWardDoc(ThreeLevelWardDoc threeLevelWardDoc, Map<String, Object> contentMap, Map<String, String> PhysicianTitleMap) {
|
|
|
String content = contentMap.get("xmlText").toString();
|
|
|
Map<String, String> structureMap = null;
|
|
|
if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
|
|
@@ -166,12 +177,12 @@ public class XiamenThreeLevelWardDocTrans extends ModelDocTrans {
|
|
|
threeLevelWardDoc.addAllDoctorWradDoc(allDoctorWradDoc);
|
|
|
|
|
|
//主任医师查房
|
|
|
- DirectorDoctorWardDoc directorDoctorWardDoc = findDirectorDoctorWardDoc(structureMap);
|
|
|
+ DirectorDoctorWardDoc directorDoctorWardDoc = findDirectorDoctorWardDoc(structureMap, PhysicianTitleMap);
|
|
|
if (directorDoctorWardDoc != null) {
|
|
|
- threeLevelWardDoc.addDirectorDoctorWardDoc(findDirectorDoctorWardDoc(structureMap));
|
|
|
+ threeLevelWardDoc.addDirectorDoctorWardDoc(directorDoctorWardDoc);
|
|
|
}
|
|
|
//主治医师查房
|
|
|
- AttendingDoctorWardDoc attendingDoctorWardDoc = findAttendingDoctorWardDoc(structureMap);
|
|
|
+ AttendingDoctorWardDoc attendingDoctorWardDoc = findAttendingDoctorWardDoc(structureMap, PhysicianTitleMap);
|
|
|
if (attendingDoctorWardDoc != null) {
|
|
|
threeLevelWardDoc.addAttendingDoctorWardDoc(attendingDoctorWardDoc);
|
|
|
}
|
|
@@ -190,12 +201,16 @@ public class XiamenThreeLevelWardDocTrans extends ModelDocTrans {
|
|
|
*
|
|
|
* @param structureMap
|
|
|
*/
|
|
|
- private DirectorDoctorWardDoc findDirectorDoctorWardDoc(Map<String, String> structureMap) {
|
|
|
+ private DirectorDoctorWardDoc findDirectorDoctorWardDoc(Map<String, String> structureMap, Map<String, String> PhysicianTitleMap) {
|
|
|
String title = structureMap.get("查房标题");
|
|
|
String content = structureMap.get("病情记录");
|
|
|
String writTitle = structureMap.get("文书标题");
|
|
|
String recordDateStr = structureMap.get("查房日期");
|
|
|
Date recordDate = StringUtil.parseDateTime(recordDateStr);
|
|
|
+ String directorDoctor = "";
|
|
|
+ if (PhysicianTitleMap != null && PhysicianTitleMap.size() > 0) {
|
|
|
+ directorDoctor = PhysicianTitleMap.get("主任医师");
|
|
|
+ }
|
|
|
//标题有代字
|
|
|
DirectorDoctorWardDoc directorDoctorWardDoc = null;
|
|
|
if (StringUtil.isNotBlank(title)) {
|
|
@@ -207,7 +222,8 @@ public class XiamenThreeLevelWardDocTrans extends ModelDocTrans {
|
|
|
title = title.replace("一助", doctorTitle);
|
|
|
}
|
|
|
if ((StringUtils.isNotEmpty(subTitle(title)) && subTitle(title).contains("主任")) || findDirector(content)
|
|
|
- || title.contains("多学科联合") || endocrinologyTitle(title)) {
|
|
|
+ || title.contains("多学科联合") || endocrinologyTitle(title)
|
|
|
+ || (StringUtil.isNotEmpty(directorDoctor) && title.contains(directorDoctor))) {
|
|
|
directorDoctorWardDoc = new DirectorDoctorWardDoc();
|
|
|
directorDoctorWardDoc.setStructureMap(structureMap);
|
|
|
directorDoctorWardDoc.setPageData((Map) structureMap);
|
|
@@ -223,7 +239,8 @@ public class XiamenThreeLevelWardDocTrans extends ModelDocTrans {
|
|
|
writTitle = writTitle.replace("一助", doctorTitle);
|
|
|
}
|
|
|
if ((StringUtils.isNotEmpty(subTitle(writTitle)) && subTitle(writTitle).contains("主任")) || findDirector(content)
|
|
|
- || writTitle.contains("多学科联合") || endocrinologyTitle(writTitle)) {
|
|
|
+ || writTitle.contains("多学科联合") || endocrinologyTitle(writTitle)
|
|
|
+ || (StringUtil.isNotEmpty(directorDoctor) && writTitle.contains(directorDoctor))) {
|
|
|
directorDoctorWardDoc = new DirectorDoctorWardDoc();
|
|
|
directorDoctorWardDoc.setStructureMap(structureMap);
|
|
|
directorDoctorWardDoc.setPageData((Map) structureMap);
|
|
@@ -237,12 +254,16 @@ public class XiamenThreeLevelWardDocTrans extends ModelDocTrans {
|
|
|
*
|
|
|
* @param structureMap
|
|
|
*/
|
|
|
- private AttendingDoctorWardDoc findAttendingDoctorWardDoc(Map<String, String> structureMap) {
|
|
|
+ private AttendingDoctorWardDoc findAttendingDoctorWardDoc(Map<String, String> structureMap, Map<String, String> PhysicianTitleMap) {
|
|
|
String title = structureMap.get("查房标题");
|
|
|
String writTitle = structureMap.get("文书标题");
|
|
|
String content = structureMap.get("病情记录");
|
|
|
String recordDateStr = structureMap.get("查房日期");
|
|
|
Date recordDate = StringUtil.parseDateTime(recordDateStr);
|
|
|
+ String behospitalDoctor = "";
|
|
|
+ if (PhysicianTitleMap != null && PhysicianTitleMap.size() > 0) {
|
|
|
+ behospitalDoctor = PhysicianTitleMap.get("主治医师");
|
|
|
+ }
|
|
|
AttendingDoctorWardDoc attendingDoctorWardDoc = null;
|
|
|
//标题有代字
|
|
|
if (StringUtil.isNotBlank(title)) {
|
|
@@ -254,7 +275,8 @@ public class XiamenThreeLevelWardDocTrans extends ModelDocTrans {
|
|
|
title = title.replace("一助", doctorTitle);
|
|
|
}
|
|
|
if ((StringUtils.isNotEmpty(subTitle(title)) && subTitle(title).contains("主治"))
|
|
|
- || findAttend(content) || title.contains("多学科联合") || endocrinologyTitle(title)) {
|
|
|
+ || findAttend(content) || title.contains("多学科联合") || endocrinologyTitle(title)
|
|
|
+ || (StringUtil.isNotEmpty(behospitalDoctor) && title.contains(behospitalDoctor))) {
|
|
|
attendingDoctorWardDoc = new AttendingDoctorWardDoc();
|
|
|
attendingDoctorWardDoc.setStructureMap(structureMap);
|
|
|
attendingDoctorWardDoc.setPageData((Map) structureMap);
|
|
@@ -271,7 +293,8 @@ public class XiamenThreeLevelWardDocTrans extends ModelDocTrans {
|
|
|
writTitle = writTitle.replace("一助", doctorTitle);
|
|
|
}
|
|
|
if ((StringUtils.isNotEmpty(subTitle(writTitle)) && subTitle(writTitle).contains("主治"))
|
|
|
- || findAttend(content) || writTitle.contains("多学科联合") || endocrinologyTitle(writTitle)) {
|
|
|
+ || findAttend(content) || writTitle.contains("多学科联合") || endocrinologyTitle(writTitle)
|
|
|
+ || (StringUtil.isNotEmpty(behospitalDoctor) && writTitle.contains(behospitalDoctor))) {
|
|
|
attendingDoctorWardDoc = new AttendingDoctorWardDoc();
|
|
|
attendingDoctorWardDoc.setStructureMap(structureMap);
|
|
|
attendingDoctorWardDoc.setPageData((Map) structureMap);
|