|
@@ -0,0 +1,113 @@
|
|
|
|
+package com.lantone.qc.kernel.catalogue.firstpagerecord;
|
|
|
|
+
|
|
|
|
+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.operation.OperationDoc;
|
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
|
+
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 病案首页手术名称未填
|
|
|
|
+ * @author wangfeng
|
|
|
|
+ * @Description:
|
|
|
|
+ * @date 2020-06-28 17:10
|
|
|
|
+ */
|
|
|
|
+@Component
|
|
|
|
+public class FIRP02993 extends QCCatalogue {
|
|
|
|
+ public void start(InputInfo inputInfo, OutputInfo outputInfo) {
|
|
|
|
+ status.set("0");
|
|
|
|
+ if (inputInfo.getFirstPageRecordDoc() != null && inputInfo.getFirstPageRecordDoc().getStructureMap() != null) {
|
|
|
|
+ //取出病程信息里的手术记录的名称
|
|
|
|
+ List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
|
|
|
|
+ if (!operationDocs.isEmpty()) {
|
|
|
|
+ List<String> nameberList = new ArrayList<String>();
|
|
|
|
+ for (OperationDoc operationDoc : operationDocs
|
|
|
|
+ ) {
|
|
|
|
+ String str = operationDoc.getOperationDiscussionDoc().getStructureMap().get(Content.operative_name);//手术名称
|
|
|
|
+ String s = ClearBracket(str);
|
|
|
|
+ String[] digitalSplit = s.split("[\\+|,|、|,]");
|
|
|
|
+ for (int i = 0; i < digitalSplit.length; i++) {
|
|
|
|
+ if (!digitalSplit[i].equals("")) {
|
|
|
|
+ nameberList.add(digitalSplit[i]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //取出病案首页里的手术名称operationNameList;
|
|
|
|
+ Map<String, Object> structureExtMap = inputInfo.getFirstPageRecordDoc().getStructureExtMap();
|
|
|
|
+ Object operation = structureExtMap.get(Content.operative_information);//手术信息
|
|
|
|
+ List<String> operationNameList = new ArrayList<String>();
|
|
|
|
+ List<Map<String, String>> mapStrs = (List<Map<String, String>>) operation;
|
|
|
|
+ if (mapStrs.size() > 0) {
|
|
|
|
+ for (Map<String, String> mapStr : mapStrs
|
|
|
|
+ ) {
|
|
|
|
+ String name = mapStr.get(Content.operative_name);//手术名称
|
|
|
|
+ operationNameList.add(name);
|
|
|
|
+ }
|
|
|
|
+ //病程信息里的手术记录的名称 和 病案首页里的手术名称 对比, 找不到则报错!
|
|
|
|
+ for (String str1 : nameberList) {
|
|
|
|
+ int sun = 0;
|
|
|
|
+ for (String str2 : operationNameList) {
|
|
|
|
+ if (str2.indexOf(str1) != -1) {
|
|
|
|
+ sun++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (sun == 0) {
|
|
|
|
+ status.set("-1");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ status.set("-1");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 去除括号里的内容
|
|
|
|
+ * @param context
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private String ClearBracket(String context) {
|
|
|
|
+ // String bracket = context.substring(context.indexOf("("), context.indexOf(")") + 1);
|
|
|
|
+ // context = context.replace(bracket, "");
|
|
|
|
+ //
|
|
|
|
+ // context.substring(context.lastIndexOf())
|
|
|
|
+ //
|
|
|
|
+ // return context;
|
|
|
|
+
|
|
|
|
+ // 修改原来的逻辑,防止右括号出现在左括号前面的位置
|
|
|
|
+ int head = context.indexOf('('); // 标记第一个使用左括号的位置
|
|
|
|
+ if (head == -1) {
|
|
|
|
+ return context; // 如果context中不存在括号,什么也不做,直接跑到函数底端返回初值str
|
|
|
|
+ } else {
|
|
|
|
+ int next = head + 1; // 从head+1起检查每个字符
|
|
|
|
+ int count = 1; // 记录括号情况
|
|
|
|
+ do {
|
|
|
|
+ if (context.charAt(next) == '(') {
|
|
|
|
+ count++;
|
|
|
|
+ } else if (context.charAt(next) == ')') {
|
|
|
|
+ count--;
|
|
|
|
+ }
|
|
|
|
+ next++; // 更新即将读取的下一个字符的位置
|
|
|
|
+ if (count == 0) // 已经找到匹配的括号
|
|
|
|
+ {
|
|
|
|
+ String temp = context.substring(head, next); // 将两括号之间的内容及括号提取到temp中
|
|
|
|
+ context = context.replace(temp, ""); // 用空内容替换,复制给context
|
|
|
|
+ head = context.indexOf('('); // 找寻下一个左括号
|
|
|
|
+ next = head + 1; // 标记下一个左括号后的字符位置
|
|
|
|
+ count = 1; // count的值还原成1
|
|
|
|
+ }
|
|
|
|
+ } while (head != -1); // 如果在该段落中找不到左括号了,就终止循环
|
|
|
|
+ }
|
|
|
|
+ return context; // 返回更新后的context
|
|
|
|
+ }
|
|
|
|
+}
|