|
@@ -3,14 +3,23 @@ package com.lantone.qc.kernel.catalogue.firstpagerecord;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.lantone.qc.kernel.catalogue.QCCatalogue;
|
|
|
+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.StringUtils;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @ClassName : FIRP02844
|
|
@@ -22,26 +31,57 @@ import java.util.Map;
|
|
|
public class FIRP02844 extends QCCatalogue {
|
|
|
public void start(InputInfo inputInfo, OutputInfo outputInfo) {
|
|
|
status.set("0");
|
|
|
- if (inputInfo.getFirstPageRecordDoc() == null) {
|
|
|
+ //获取病案首页
|
|
|
+ FirstPageRecordDoc firstPageRecordDoc = inputInfo.getFirstPageRecordDoc();
|
|
|
+ //病案首页结构化
|
|
|
+ Map<String, Object> firstPageRecordDocStructureMap = firstPageRecordDoc.getStructureExtMap();
|
|
|
+ //获取有创操作记录
|
|
|
+ List<InvasiveOperationDoc> invasiveOperationDocs = inputInfo.getInvasiveOperationDocs();
|
|
|
+ //获取手术中的(术后首次病程及谈话记录、手术记录、手术安全核查表)
|
|
|
+ List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
|
|
|
+ //获取手术信息(手术信息的第一行为“主要手术及操作编码”)
|
|
|
+ List<Map<String, String>> mapList = (List<Map<String, String>>) firstPageRecordDocStructureMap.get(Content.operative_information);
|
|
|
+ String operationCode = mapList.get(0).get("编码");
|
|
|
+ //病案首页和病案首页结构化数据任一为空则通过
|
|
|
+ if (null == firstPageRecordDoc || firstPageRecordDocStructureMap.isEmpty()) {
|
|
|
return;
|
|
|
}
|
|
|
- if (inputInfo.getFirstPageRecordDoc().getStructureMap() != null) {
|
|
|
- List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
|
|
|
- long count = operationDocs.stream().filter(x -> x.getOperationRecordDoc() != null).count();
|
|
|
- Map<String, Object> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureExtMap();
|
|
|
- JSONArray out_diag = (JSONArray)firstpageStructureMap.get("手术信息");
|
|
|
- if (out_diag != null && out_diag.size() > 0) {
|
|
|
- for (int i=0;i<out_diag.size();i++) {
|
|
|
- JSONObject jsonObject = out_diag.getJSONObject(i);
|
|
|
- String diag_code = (String)jsonObject.get("手术编码");
|
|
|
- if(StringUtils.isBlank(diag_code)){
|
|
|
- status.set("-1");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
+ if (null != operationCode) {
|
|
|
+ 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 == operationCode) {//【手术记录/术后首次病程及谈话记录/手术安全核查表/有创操作记录】存在,【主要手术及操作编码】必填。
|
|
|
+ status.set("-1");
|
|
|
+ return;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
+ //【病案首页】>>【手术费】大于0时,【主要手术及操作编码】必填。
|
|
|
+ if (Double.parseDouble(firstPageRecordDocStructureMap.get("手术费").toString()) > 0 && null == operationCode) {
|
|
|
+ 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(operationCode)){
|
|
|
+ status.set("-1");
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
}
|