|
@@ -13,6 +13,7 @@ import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.yaml.snakeyaml.util.UriEncoder;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
@@ -104,6 +105,10 @@ public class YbService {
|
|
|
selInfo.setRtalDocno(rtalDocno + randomNumber);
|
|
|
selInfo.setFixmedinsBchno(rtalDocno + randomNumber);
|
|
|
selInfo.setSelRetnCnt(drugTracCodgList.size());
|
|
|
+ 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);
|
|
|
|
|
@@ -257,6 +262,7 @@ public class YbService {
|
|
|
selinfoReturn.setManuDate(selinfoSold.getManuDate());
|
|
|
selinfoReturn.setRxFlag(selinfoSold.getRxFlag());
|
|
|
selinfoReturn.setTrdnFlag(selinfoSold.getTrdnFlag());
|
|
|
+ selinfoReturn.setSelRetnOpterName(UriEncoder.encode(selinfoReturn.getSelRetnOpterName()));
|
|
|
|
|
|
String realUrl = siInventoryServiceUrl + "/returnGoodsItem";
|
|
|
try {
|
|
@@ -295,31 +301,43 @@ public class YbService {
|
|
|
return response;
|
|
|
}
|
|
|
|
|
|
+ List<Object> datas = new ArrayList<>();
|
|
|
SelinfoSold sold = selinfoSoldList.get(0);
|
|
|
- Map<String, String> param = new HashMap<>();
|
|
|
- param.put("med_list_codg", sold.getMedListCodg());
|
|
|
-
|
|
|
+ List<Map<String, String>> selinfoSoldDrugtracById = selinfoSoldMapper.getSelinfoSoldDrugtracById(sold.getId());
|
|
|
String realUrl = siInventoryServiceUrl + "/selectSalesGoodsItem";
|
|
|
- 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"));
|
|
|
+ for(Map<String, String> map : selinfoSoldDrugtracById) {
|
|
|
+ Map<String, String> param = new HashMap<>();
|
|
|
+ param.put("med_list_codg", sold.getMedListCodg());
|
|
|
|
|
|
- // 记录医保接口调用结果
|
|
|
- // 通过关联键可以快速定位具体的退药记录,便于问题排查和审计
|
|
|
- log.info("医保退药接口调用结果 - 结果: {}", response);
|
|
|
+ param.put("drug_trac_codg", map.get("trac_codg"));
|
|
|
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- response = new ResultVo(-1, "商品销售查询失败");
|
|
|
- // 记录错误信息时包含关联键,便于快速定位问题
|
|
|
- log.error("医保退药接口调用失败 - 错误: {}", e.getMessage());
|
|
|
+
|
|
|
+ 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));
|
|
|
+ }
|
|
|
+ // 记录医保接口调用结果
|
|
|
+ // 通过关联键可以快速定位具体的退药记录,便于问题排查和审计
|
|
|
+ log.info("医保退药接口调用结果 - 结果: {}", response);
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ response = new ResultVo(-1, "商品销售查询失败");
|
|
|
+ // 记录错误信息时包含关联键,便于快速定位问题
|
|
|
+ log.error("医保退药接口调用失败 - 错误: {}", e.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
+ response = new ResultVo(0, "查询成功", datas);
|
|
|
|
|
|
return response;
|
|
|
}
|