|
@@ -1,6 +1,7 @@
|
|
|
package thyyxxk.webserver.service.heliyongyao;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -48,8 +49,7 @@ public class RationalUseServer {
|
|
|
this.publicServer = publicServer;
|
|
|
}
|
|
|
|
|
|
- public ResultVo<JSONObject> jiaoYan(XinZhenYiZhu param) {
|
|
|
- log.info("数据:{}", JSON.toJSONString(param));
|
|
|
+ public Map<String, List<String>> jiaoYan(XinZhenYiZhu param) {
|
|
|
String userCode = "99999".equals(TokenUtil.getTokenUserId()) ? param.getUserCode() : TokenUtil.getTokenUserId();
|
|
|
// 医生信息
|
|
|
Map<String, String> doctMap = yiShenXinXi(userCode);
|
|
@@ -76,13 +76,31 @@ public class RationalUseServer {
|
|
|
String detailsXml = yaoPinXinXi(param.getInpatientNo(), param.getAdmissTimes(), param.getCfType(), yp, doct, yaoPinMap);
|
|
|
String js = String.format("{\"BaseXml\": \"%s\", \"DetailsXml\" : \"%s\"}", baseXml, detailsXml);
|
|
|
log.info("上传数据:{} ", js);
|
|
|
+ Map<String, List<String>> map = new HashMap<>();
|
|
|
try {
|
|
|
- JSONObject fanHuiXinXi = http.rationalUse(js);
|
|
|
- log.info("返回的数据:{}", fanHuiXinXi);
|
|
|
- return ResultVoUtil.success(fanHuiXinXi);
|
|
|
+ // log.info("返回的数据:{}", fanHuiXinXi);
|
|
|
+ JSONObject json = http.rationalUse(js);
|
|
|
+ log.info("返回的数据:{}", json);
|
|
|
+ if (json.getInteger("result_lv") > 0) {
|
|
|
+ JSONArray data = json.getJSONObject("result_xml").getJSONObject("ui_results_xml").getJSONObject("result_data").getJSONArray("result");
|
|
|
+ for (int i = 0; i < data.size(); i++) {
|
|
|
+ JSONObject item = data.getJSONObject(i);
|
|
|
+ String[] orderNos = item.getString("oeridid").split("、");
|
|
|
+ List<String> errorMsg = new ArrayList<>();
|
|
|
+ errorMsg.add(item.getString("result_title"));
|
|
|
+ errorMsg.add(item.getString("title"));
|
|
|
+ errorMsg.add(item.getString("detail"));
|
|
|
+ for (String str : orderNos) {
|
|
|
+ map.put(str, errorMsg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ log.info("合理用药数据:{}", data);
|
|
|
+ }
|
|
|
+
|
|
|
+ return map;
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "网络错误");
|
|
|
+ return map;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -189,8 +207,20 @@ public class RationalUseServer {
|
|
|
sb.append("</skintest_data>");
|
|
|
// 诊断
|
|
|
sb.append("<diagnose_data>");
|
|
|
+ List<XunHuanJieDian> zhenDuanShuJu = new ArrayList<>();
|
|
|
+ JSONObject medicalRecordDiagnosticData = JSONObject.parseObject(dao.medicalRecordDiagnosticData(patNo, times));
|
|
|
+ if (medicalRecordDiagnosticData != null) {
|
|
|
+ JSONArray arr = medicalRecordDiagnosticData.getJSONArray("入院诊断");
|
|
|
+ for (int i = 0; i < arr.size(); i++) {
|
|
|
+ JSONObject item = arr.getJSONObject(i);
|
|
|
+ XunHuanJieDian temp = new XunHuanJieDian();
|
|
|
+ temp.setType("0");
|
|
|
+ temp.setCode(item.getString("code"));
|
|
|
+ temp.setName(item.getString("name"));
|
|
|
+ zhenDuanShuJu.add(temp);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- List<XunHuanJieDian> zhenDuanShuJu = dao.zhenDuan(patNo, times);
|
|
|
// 诊断节点
|
|
|
xunHuanJieDian(sb, zhenDuanShuJu, "diagnose");
|
|
|
sb.append("</diagnose_data>")
|
|
@@ -216,8 +246,7 @@ public class RationalUseServer {
|
|
|
// 因为我要入库才能生成医嘱号所以这里用雪花算法
|
|
|
sb.append("<medicine>")
|
|
|
.append("<cf_id>").append("0").append("</cf_id>")
|
|
|
- // 因为我要入库才能生成医嘱号所以这里用雪花算法
|
|
|
- .append("<oeridid>").append(item.getRationalDrugUseId()).append("</oeridid>")
|
|
|
+ .append("<oeridid>").append(item.getActOrderNo().stripTrailingZeros().toPlainString()).append("</oeridid>")
|
|
|
.append("<is_current>").append("1").append("</is_current>")
|
|
|
.append("<pres_type>").append("ONCE".equals(item.getFrequCode()) ? "T" : "L").append("</pres_type>")
|
|
|
.append("<pres_time>").append(DateUtil.formatDatetime(item.getOrderTime())).append("</pres_time>")
|