|
@@ -3,26 +3,29 @@ package thyyxxk.webserver.service.zhuyuanyisheng;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
+import com.google.gson.JsonObject;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.web.client.RestTemplate;
|
|
|
import thyyxxk.webserver.config.exception.ExceptionEnum;
|
|
|
import thyyxxk.webserver.constants.EmrType;
|
|
|
import thyyxxk.webserver.dao.his.zhuyuanyisheng.EmrPatientDao;
|
|
|
import thyyxxk.webserver.entity.ResultVo;
|
|
|
+import thyyxxk.webserver.entity.drg.AuxiliaryFillingOfDiagnosis;
|
|
|
import thyyxxk.webserver.entity.zhuyuanyisheng.emr.EmrDataElement;
|
|
|
import thyyxxk.webserver.entity.zhuyuanyisheng.emr.EmrDataExtract;
|
|
|
import thyyxxk.webserver.entity.zhuyuanyisheng.emr.EmrPatientData;
|
|
|
import thyyxxk.webserver.service.PublicServer;
|
|
|
import thyyxxk.webserver.service.externalhttp.emr.EmrEditor;
|
|
|
-import thyyxxk.webserver.utils.ListUtil;
|
|
|
-import thyyxxk.webserver.utils.ResultVoUtil;
|
|
|
-import thyyxxk.webserver.utils.TokenUtil;
|
|
|
-
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import thyyxxk.webserver.utils.*;
|
|
|
+
|
|
|
+import java.beans.BeanInfo;
|
|
|
+import java.beans.IntrospectionException;
|
|
|
+import java.beans.Introspector;
|
|
|
+import java.beans.PropertyDescriptor;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
@@ -289,15 +292,53 @@ public class EmrServer {
|
|
|
|
|
|
|
|
|
public ResultVo<String> getDrgIntelligentGrouping(String patNo, Integer times) {
|
|
|
+ // 获取诊断
|
|
|
JSONArray diagnosis = getEmrData(patNo, times, EmrType.DIAGNOSIS);
|
|
|
+ // 获取手术
|
|
|
+ JSONArray operation = getEmrData(patNo, times, EmrType.OPERATION);
|
|
|
int ledgerSn = publicServer.getLedgerSn(patNo, times);
|
|
|
- Map<String, String> map = dao.drgPatientInfo(patNo, times, ledgerSn);
|
|
|
- log.info("患者数据:{}", JSON.toJSON(map));
|
|
|
+ // 获取患者数据
|
|
|
+ Map<String, String> mapData = dao.drgPatientInfo(patNo, times, ledgerSn);
|
|
|
+
|
|
|
+ mapData.put("visit_id", patNo + "_" + times + "_" + ledgerSn);
|
|
|
+ mapData.put("bah", patNo + "_" + times);
|
|
|
+ for (int i = 0; i < diagnosis.size(); i++) {
|
|
|
+ JSONObject item = diagnosis.getJSONObject(i);
|
|
|
+ if (i == 0) {
|
|
|
+ mapData.put("jbdm", item.getString("code"));
|
|
|
+ mapData.put("zyzd", item.getString("name"));
|
|
|
+ } else {
|
|
|
+ mapData.put("jbdm" + i, item.getString("code"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Map<String, JSONObject> surgicalSequencing = new TreeMap<>();
|
|
|
+ for (int i = 0; i < operation.size(); i++) {
|
|
|
+ JSONObject item = operation.getJSONObject(i);
|
|
|
+ String key = DateUtil.formatDatetime(item.getJSONObject("手术日期").getDate("value"));
|
|
|
+ surgicalSequencing.put(key, item);
|
|
|
+ }
|
|
|
+ int operationIndex = 1;
|
|
|
+ for (Map.Entry<String, JSONObject> o : surgicalSequencing.entrySet()) {
|
|
|
+ JSONObject item = o.getValue();
|
|
|
+ JSONArray list = item.getJSONObject("手术名称").getJSONArray("value");
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ JSONObject valueList = list.getJSONObject(i);
|
|
|
+ mapData.put("ssjczbm" + operationIndex, valueList.getString("code"));
|
|
|
+ if (operationIndex == 1) {
|
|
|
+ mapData.put("ssjczmc" + operationIndex, valueList.getString("name"));
|
|
|
+ }
|
|
|
+ operationIndex++;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- log.info("诊断数据:{}", JSON.toJSONString(diagnosis));
|
|
|
+ AuxiliaryFillingOfDiagnosis data = EntityCopy.Copy(mapData, AuxiliaryFillingOfDiagnosis.class);
|
|
|
+
|
|
|
+ String url = "http://172.16.32.126:8080/drg_web/localHelp/drg_dagns/list.action";
|
|
|
+ RestTemplate template = new RestTemplate();
|
|
|
+ String res = template.postForObject(url, JSON.parseObject(JSON.toJSONString(data, SerializerFeature.WriteNullStringAsEmpty)), String.class);
|
|
|
+ log.info("返回数据:{}", res);
|
|
|
+ log.info("数据:{}", JSON.toJSONString(data));
|
|
|
|
|
|
- JSONArray operation = getEmrData(patNo, times, EmrType.OPERATION);
|
|
|
- log.info("手术数据:{}", JSON.toJSONString(operation));
|
|
|
return ResultVoUtil.success();
|
|
|
}
|
|
|
|