|
@@ -358,19 +358,14 @@ public class YbService {
|
|
|
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 ybResultJson = getGoodsItemByCode(map);
|
|
|
JSONObject data = ybResultJson.getJSONObject("data");
|
|
|
- output = data.getJSONArray("output");
|
|
|
+ if(ybResultJson.getInteger("code") == 200) {
|
|
|
+ output = data.getJSONArray("output");
|
|
|
+ response = new ResultVo(0, "查询成功", output);
|
|
|
+ }
|
|
|
// 记录医保接口调用结果
|
|
|
// 通过关联键可以快速定位具体的退药记录,便于问题排查和审计
|
|
|
log.info("医保查询接口调用结果 - 结果: {}", response);
|
|
@@ -381,18 +376,40 @@ public class YbService {
|
|
|
// 记录错误信息时包含关联键,便于快速定位问题
|
|
|
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());
|
|
|
+ public JSONObject getGoodsItemByCode(Map<String, String> map) throws Exception {
|
|
|
+ String realUrl = siInventoryServiceUrl + "/selectSalesGoodsItem";
|
|
|
+ String jsonString = JSONObject.toJSONString(map, SerializerFeature.WriteNonStringKeyAsString);
|
|
|
+ String ybResult = HttpUtil.sendHttpPost(realUrl, jsonString, 8000);
|
|
|
+ return JSONObject.parseObject(ybResult);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public ResultVo getErrorCodes() {
|
|
|
+ List<Map<String, String>> errors = new ArrayList<>();
|
|
|
+ List<Map<String, String>> selinfoSoldDrugtracList = selinfoSoldMapper.getSelinfoSoldDrugtracById(null);
|
|
|
+ for(Map<String, String> drug : selinfoSoldDrugtracList) {
|
|
|
+ Map<String, String> param = new HashMap<>();
|
|
|
+ param.put("med_list_codg", drug.get("med_list_codg"));
|
|
|
+ param.put("trac_codg", drug.get("trac_codg"));
|
|
|
+ try {
|
|
|
+ JSONObject result = getGoodsItemByCode(param);
|
|
|
+ JSONObject data = result.getJSONObject("data");
|
|
|
+ if(result.getInteger("code") == 200) {
|
|
|
+ JSONArray output = data.getJSONArray("output");
|
|
|
+ if(output == null || output.isEmpty()) {
|
|
|
+ errors.add(drug);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
}
|
|
|
- return response;
|
|
|
+
|
|
|
+ return new ResultVo(0, "查询成功", errors);
|
|
|
}
|
|
|
|
|
|
}
|