|
@@ -105,12 +105,30 @@ public class YbService {
|
|
|
selInfo.setRtalDocno(rtalDocno + randomNumber);
|
|
|
selInfo.setFixmedinsBchno(rtalDocno + randomNumber);
|
|
|
selInfo.setSelRetnCnt(drugTracCodgList.size());
|
|
|
+ String now = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
|
|
+ selInfo.setSelRetnTime(now);
|
|
|
+
|
|
|
+ String id = UUID.randomUUID().toString().replaceAll("-", "");
|
|
|
+ selInfo.setId(id);
|
|
|
+ List<SelinfoSold> selinfoSoldList =
|
|
|
+ selinfoSoldMapper.getSelinfoSoldList(selInfo.getPatientId(), selInfo.getTimes(),
|
|
|
+ selInfo.getOrderNo(), selInfo.getChargeItemCode(), selInfo.getRealNo());
|
|
|
+ if(selinfoSoldList != null && !selinfoSoldList.isEmpty()
|
|
|
+ && selinfoSoldList.get(0).getMedListCodg().equals(selInfo.getMedListCodg())) {
|
|
|
+ selInfo.setId(selinfoSoldList.get(0).getId());
|
|
|
+ } else {
|
|
|
+ selinfoSoldMapper.insert(selInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ for(DrugTracCodg codg : drugTracCodgList) {
|
|
|
+ String itemId = UUID.randomUUID().toString().replaceAll("-", "");
|
|
|
+ selinfoSoldMapper.insertSelinfoSoldDrugtrac(itemId, id, codg.getDrugTracCodg());
|
|
|
+ }
|
|
|
+
|
|
|
selInfo.setPsnName(UriEncoder.encode(selInfo.getPsnName()));
|
|
|
selInfo.setPrscDrName(UriEncoder.encode(selInfo.getPrscDrName()));
|
|
|
selInfo.setPharName(UriEncoder.encode(selInfo.getPharName()));
|
|
|
selInfo.setSelRetnOpterName(UriEncoder.encode(selInfo.getSelRetnOpterName()));
|
|
|
- String now = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
|
|
- selInfo.setSelRetnTime(now);
|
|
|
|
|
|
// 构建关联键(用于后续查询发药记录)
|
|
|
// 关联键格式:patientId=xxx×=xxx&receiptNo=xxx&orderNo=xxx&chargeItemCode=xxx&realNo=xxx
|
|
@@ -146,15 +164,7 @@ public class YbService {
|
|
|
log.error("医保接口调用失败 - 关联键: {}, 错误: {}", associationKey, e.getMessage());
|
|
|
}
|
|
|
|
|
|
- String id = UUID.randomUUID().toString().replaceAll("-", "");
|
|
|
- selInfo.setId(id);
|
|
|
- int insertSelinfo = selinfoSoldMapper.insert(selInfo);
|
|
|
- if(insertSelinfo > 0) {
|
|
|
- for(DrugTracCodg codg : drugTracCodgList) {
|
|
|
- String itemId = UUID.randomUUID().toString().replaceAll("-", "");
|
|
|
- selinfoSoldMapper.insertSelinfoSoldDrugtrac(itemId, id, codg.getDrugTracCodg());
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
|
|
|
return response;
|
|
@@ -254,7 +264,7 @@ public class YbService {
|
|
|
|
|
|
selinfoReturn.setSelRetnCnt(drugTracCodgList != null ? drugTracCodgList.size() : 0);
|
|
|
String now = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
|
|
- selinfoReturn.setMedListCodg(selinfoSold.getMedListCodg());
|
|
|
+ selinfoReturn.setMedListCodg("XB01ACL190A001060100553");
|
|
|
selinfoReturn.setSelRetnTime(now);
|
|
|
selinfoReturn.setMdtrtSn(selinfoSold.getMdtrtSn());
|
|
|
selinfoReturn.setFixmedinsBchno(selinfoSold.getFixmedinsBchno());
|
|
@@ -302,44 +312,87 @@ public class YbService {
|
|
|
}
|
|
|
|
|
|
List<Object> datas = new ArrayList<>();
|
|
|
- SelinfoSold sold = selinfoSoldList.get(0);
|
|
|
- List<Map<String, String>> selinfoSoldDrugtracById = selinfoSoldMapper.getSelinfoSoldDrugtracById(sold.getId());
|
|
|
- String realUrl = siInventoryServiceUrl + "/selectSalesGoodsItem";
|
|
|
- for(Map<String, String> map : selinfoSoldDrugtracById) {
|
|
|
- Map<String, String> param = new HashMap<>();
|
|
|
- param.put("med_list_codg", sold.getMedListCodg());
|
|
|
-
|
|
|
- param.put("drug_trac_codg", map.get("trac_codg"));
|
|
|
-
|
|
|
|
|
|
- try {
|
|
|
- String jsonString = JSONObject.toJSONString(param, SerializerFeature.WriteNonStringKeyAsString);
|
|
|
- String ybResult = HttpUtil.sendHttpPost(realUrl, jsonString, 8000);
|
|
|
- JSONObject ybResultJson = JSONObject.parseObject(ybResult);
|
|
|
- int responseCode = 0;
|
|
|
- if(ybResultJson.getInteger("code") != 200) {
|
|
|
- responseCode = ybResultJson.getInteger("code");
|
|
|
- }
|
|
|
+ String realUrl = siInventoryServiceUrl + "/selectSalesGoodsItem";
|
|
|
+ for(SelinfoSold sold : selinfoSoldList) {
|
|
|
+ List<Map<String, String>> selinfoSoldDrugtracById = selinfoSoldMapper.getSelinfoSoldDrugtracById(sold.getId());
|
|
|
+ for(Map<String, String> map : selinfoSoldDrugtracById) {
|
|
|
+ Map<String, String> param = new HashMap<>();
|
|
|
+ param.put("med_list_codg", sold.getMedListCodg());
|
|
|
+
|
|
|
+ param.put("drug_trac_codg", map.get("trac_codg"));
|
|
|
+
|
|
|
+ try {
|
|
|
+ String jsonString = JSONObject.toJSONString(param, SerializerFeature.WriteNonStringKeyAsString);
|
|
|
+ String ybResult = HttpUtil.sendHttpPost(realUrl, jsonString, 8000);
|
|
|
+ JSONObject ybResultJson = JSONObject.parseObject(ybResult);
|
|
|
+ int responseCode = 0;
|
|
|
+ if(ybResultJson.getInteger("code") != 200) {
|
|
|
+ responseCode = ybResultJson.getInteger("code");
|
|
|
+ }
|
|
|
// response = new ResultVo(responseCode, ybResultJson.getString("message"), ybResultJson.get("data"));
|
|
|
- JSONObject data = ybResultJson.getJSONObject("data");
|
|
|
- JSONArray output = data.getJSONArray("output");
|
|
|
- if(output != null && !output.isEmpty()) {
|
|
|
- datas.add(output.get(0));
|
|
|
+ JSONObject data = ybResultJson.getJSONObject("data");
|
|
|
+ JSONArray output = data.getJSONArray("output");
|
|
|
+ if(output != null && !output.isEmpty()) {
|
|
|
+ datas.add(output.get(0));
|
|
|
+ }
|
|
|
+ // 记录医保接口调用结果
|
|
|
+ // 通过关联键可以快速定位具体的退药记录,便于问题排查和审计
|
|
|
+ log.info("医保退药接口调用结果 - 结果: {}", response);
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ response = new ResultVo(-1, "商品销售查询失败");
|
|
|
+ // 记录错误信息时包含关联键,便于快速定位问题
|
|
|
+ log.error("医保退药接口调用失败 - 错误: {}", e.getMessage());
|
|
|
}
|
|
|
- // 记录医保接口调用结果
|
|
|
- // 通过关联键可以快速定位具体的退药记录,便于问题排查和审计
|
|
|
- log.info("医保退药接口调用结果 - 结果: {}", response);
|
|
|
-
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- response = new ResultVo(-1, "商品销售查询失败");
|
|
|
- // 记录错误信息时包含关联键,便于快速定位问题
|
|
|
- log.error("医保退药接口调用失败 - 错误: {}", e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
response = new ResultVo(0, "查询成功", datas);
|
|
|
|
|
|
return response;
|
|
|
}
|
|
|
|
|
|
+ public ResultVo getGoodsByCode(Map<String, String> map) {
|
|
|
+ ResultVo response = null;
|
|
|
+
|
|
|
+ String realUrl = siInventoryServiceUrl + "/selectSalesGoodsItem";
|
|
|
+ JSONArray output = null;
|
|
|
+ try {
|
|
|
+ String jsonString = JSONObject.toJSONString(map, SerializerFeature.WriteNonStringKeyAsString);
|
|
|
+ String ybResult = HttpUtil.sendHttpPost(realUrl, jsonString, 8000);
|
|
|
+ JSONObject ybResultJson = JSONObject.parseObject(ybResult);
|
|
|
+ int responseCode = 0;
|
|
|
+ if(ybResultJson.getInteger("code") != 200) {
|
|
|
+ responseCode = ybResultJson.getInteger("code");
|
|
|
+ }
|
|
|
+// response = new ResultVo(responseCode, ybResultJson.getString("message"), ybResultJson.get("data"));
|
|
|
+ JSONObject data = ybResultJson.getJSONObject("data");
|
|
|
+ output = data.getJSONArray("output");
|
|
|
+ // 记录医保接口调用结果
|
|
|
+ // 通过关联键可以快速定位具体的退药记录,便于问题排查和审计
|
|
|
+ log.info("医保查询接口调用结果 - 结果: {}", response);
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ response = new ResultVo(-1, "商品销售查询失败");
|
|
|
+ // 记录错误信息时包含关联键,便于快速定位问题
|
|
|
+ log.error("医保查询接口调用失败 - 错误: {}", e.getMessage());
|
|
|
+ }
|
|
|
+ response = new ResultVo(0, "查询成功", output);
|
|
|
+
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+
|
|
|
+ public ResultVo getGoodsByCode() {
|
|
|
+ ResultVo response = null;
|
|
|
+ List<SelinfoSold> selinfoSoldListNoWhere = selinfoSoldMapper.getSelinfoSoldListNoWhere();
|
|
|
+ for(SelinfoSold sold : selinfoSoldListNoWhere) {
|
|
|
+ selinfoSoldMapper.getSelinfoSoldDrugtracById(sold.getId());
|
|
|
+ }
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+
|
|
|
}
|