|
@@ -1,15 +1,31 @@
|
|
|
package com.lantone.qc.kernel.catalogue.firstpagerecord;
|
|
|
|
|
|
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.DoctorAdviceDoc;
|
|
|
import com.lantone.qc.pub.model.doc.FirstPageRecordDoc;
|
|
|
+import com.lantone.qc.pub.model.doc.InvasiveOperationDoc;
|
|
|
+import com.lantone.qc.pub.model.doc.operation.OperationDiscussionDoc;
|
|
|
import com.lantone.qc.pub.model.doc.operation.OperationDoc;
|
|
|
+import com.lantone.qc.pub.model.doc.operation.OperationRecordDoc;
|
|
|
+import com.lantone.qc.pub.model.doc.operation.OperationSafetyChecklistDoc;
|
|
|
+import com.lantone.qc.pub.util.StringUtil;
|
|
|
+import org.apache.commons.lang3.ObjectUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
+import org.thymeleaf.util.MapUtils;
|
|
|
+import springfox.documentation.schema.Collections;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
+import java.util.Optional;
|
|
|
+import java.util.regex.Matcher;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @ClassName : FIRP0191
|
|
@@ -19,17 +35,57 @@ import java.util.Map;
|
|
|
*/
|
|
|
@Component
|
|
|
public class FIRP0191 extends QCCatalogue {
|
|
|
-
|
|
|
public void start(InputInfo inputInfo, OutputInfo outputInfo) {
|
|
|
status.set("0");
|
|
|
+ //获取病案首页
|
|
|
FirstPageRecordDoc firstPageRecordDoc = inputInfo.getFirstPageRecordDoc();
|
|
|
+ //病案首页结构化
|
|
|
+ Map<String, Object> firstPageRecordDocStructureMap = firstPageRecordDoc.getStructureExtMap();
|
|
|
+ //获取有创操作记录
|
|
|
+ List<InvasiveOperationDoc> invasiveOperationDocs = inputInfo.getInvasiveOperationDocs();
|
|
|
+ //获取手术中的(术后首次病程及谈话记录、手术记录、手术安全核查表)
|
|
|
List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
|
|
|
- if (firstPageRecordDoc == null || operationDocs.size() == 0) {
|
|
|
+ //获取手术信息(手术信息的第一行为“主要手术及操作名称”)
|
|
|
+ List<Map<String, String>> mapList = (List<Map<String, String>>) firstPageRecordDocStructureMap.get(Content.operative_information);
|
|
|
+ String operationName = mapList.get(0).get("名称");
|
|
|
+ //病案首页和病案首页结构化数据任一为空则通过
|
|
|
+ if (null == firstPageRecordDoc || firstPageRecordDocStructureMap.isEmpty()) {
|
|
|
return;
|
|
|
}
|
|
|
- Map<String, Object> firstPageRecordDocStructureMap = firstPageRecordDoc.getStructureExtMap();
|
|
|
- List<Map<String, String>> mapList = (List<Map<String, String>>) firstPageRecordDocStructureMap.get(Content.operative_information);
|
|
|
- if (mapList == null || mapList.size() == 0) {
|
|
|
+ if (null != operationName) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Boolean flag = false;
|
|
|
+ if (invasiveOperationDocs.size() == 0) {
|
|
|
+ flag = true;
|
|
|
+ }
|
|
|
+ //【手术记录/术后首次病程及谈话记录/手术安全核查表/有创操作记录】不存在,则返回
|
|
|
+ for (OperationDoc operation : operationDocs) {
|
|
|
+ if (null == firstPageRecordDoc
|
|
|
+ && null == operation.getOperationDiscussionDoc()
|
|
|
+ && null == operation.getOperationRecordDoc()
|
|
|
+ && null == operation.getOperationSafetyChecklistDoc()
|
|
|
+ && flag) {
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ if (null == operationName) {//【手术记录/术后首次病程及谈话记录/手术安全核查表/有创操作记录】存在,【主要手术及操作名称】必填。
|
|
|
+ status.set("-1");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //【病案首页】>>【手术费】大于0时,【主要手术及操作名称】必填。
|
|
|
+ if (Double.parseDouble(firstPageRecordDocStructureMap.get("手术费").toString()) > 0 && null ==operationName) {
|
|
|
+ status.set("-1");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //【临时医嘱类型(医嘱处方类型)为“手术”的存在,且医嘱状态不为“作废”、“删除”、“取消”任一】的医嘱条目,【主要手术及操作名称】必填
|
|
|
+ List<DoctorAdviceDoc> DoctorAdviceDocList = inputInfo.getDoctorAdviceDocs().stream().filter((item) -> {
|
|
|
+ return Content.statOrder.equals(item.getStructureMap().get(Content.doctorAdviceType))//医嘱类型判别为临时医嘱
|
|
|
+ && !Content.cancellationOrderList.contains(item.getStructureMap().get(Content.doctorAdviceState))//医嘱状态判别不为"作废", "删除", "取消","停止","已停止"
|
|
|
+ && item.getStructureMap().get(Content.prescriptionType).contains("手术");//医嘱处方类型包含手术
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ if (DoctorAdviceDocList.size() > 0 && StringUtil.isEmpty(operationName)) {
|
|
|
status.set("-1");
|
|
|
return;
|
|
|
}
|