YbService.java 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  1. package cn.hnthyy.thmz.service.yb;
  2. import cn.hnthyy.thmz.Utils.HttpUtil;
  3. import cn.hnthyy.thmz.entity.his.zy.ZyActpatient;
  4. import cn.hnthyy.thmz.entity.jy.ResultVo;
  5. import cn.hnthyy.thmz.entity.yb.*;
  6. import cn.hnthyy.thmz.mapper.his.yb.SelinfoSoldMapper;
  7. import cn.hnthyy.thmz.mapper.his.zy.ZyActpatientMapper;
  8. import cn.hnthyy.thmz.service.taobao.TaobaoService;
  9. import com.alibaba.fastjson.JSONArray;
  10. import com.alibaba.fastjson.JSONObject;
  11. import com.alibaba.fastjson.serializer.SerializerFeature;
  12. import lombok.extern.slf4j.Slf4j;
  13. import org.apache.commons.lang3.StringUtils;
  14. import org.springframework.beans.BeanUtils;
  15. import org.springframework.beans.factory.annotation.Autowired;
  16. import org.springframework.beans.factory.annotation.Value;
  17. import org.springframework.stereotype.Service;
  18. import org.yaml.snakeyaml.util.UriEncoder;
  19. import java.text.SimpleDateFormat;
  20. import java.util.*;
  21. @Slf4j
  22. @Service
  23. public class YbService {
  24. @Value("${siInventoryServiceUrl}")
  25. private String siInventoryServiceUrl;
  26. @Autowired
  27. private TaobaoService taobaoService;
  28. @Autowired
  29. private SelinfoSoldMapper selinfoSoldMapper;
  30. @Autowired
  31. private ZyActpatientMapper zyActpatientMapper;
  32. /**
  33. * 医保商品销售接口
  34. * 功能说明:将发药信息上报给医保系统,实现医保结算
  35. *
  36. * 关联字段说明:
  37. * - patientId: 患者ID,来自 mz_charge_detail.patient_id
  38. * - times: 就诊次数,来自 mz_charge_detail.times
  39. * - receiptNo: 发票分票号,来自 mz_charge_detail.receipt_no
  40. * - orderNo: 处方号,来自 mz_charge_detail.order_no
  41. * - chargeItemCode: 收费项目编码,来自 mz_charge_detail.charge_item_code
  42. * - realNo: 流水号,来自 mz_charge_detail.real_no
  43. *
  44. * 关联查询接口:
  45. * - /thmz/getDispensingRecordByAssociation: 通过关联字段查询发药记录
  46. *
  47. * 关联数据表:
  48. * - yp_mz_fytj: 发药统计表,记录发药数量、金额等统计信息
  49. * - mz_drug_trac_codg: 药品追溯码表,记录药品追溯码信息
  50. * - mz_charge_detail: 收费明细表,记录收费项目详细信息
  51. *
  52. * 业务流程:
  53. * 1. 前端发药页面调用 /thmz/sendMedicineProcessing 进行发药处理
  54. * 2. 发药成功后调用此接口上报医保系统
  55. * 3. 医保系统记录关联字段,便于后续查询和审计
  56. * 4. 可通过关联字段查询具体的发药记录和追溯码信息
  57. *
  58. * @param selinfoSoldTotal 医保销售信息对象,包含关联字段和药品追溯码信息
  59. * @return ResultVo 医保接口调用结果
  60. */
  61. public ResultVo saleGoodsItem(SelinfoSoldTotal selinfoSoldTotal) {
  62. ResultVo response = null;
  63. SelinfoSold selInfo = selinfoSoldTotal.getSelinfoSold();
  64. List<DrugTracCodg> drugTracCodgList = selinfoSoldTotal.getDrugtracinfo();
  65. // 记录关联字段信息(用于关联发药记录)
  66. // 这些字段用于后续查询发药记录,确保医保记录与发药记录的一一对应
  67. log.info("医保接口调用 - 关联字段: patientId={}, times={}, receiptNo={}, orderNo={}, chargeItemCode={}, realNo={}, drugTracCodgList={}",
  68. selInfo.getPatientId(), selInfo.getTimes(), selInfo.getReceiptNo(),
  69. selInfo.getOrderNo(), selInfo.getChargeItemCode(), selInfo.getRealNo(), JSONObject.toJSONString(drugTracCodgList));
  70. if(drugTracCodgList == null || drugTracCodgList.isEmpty()) {
  71. response = new ResultVo(-1, "追溯码不能为空");
  72. return response;
  73. }
  74. String drugTracCodg = drugTracCodgList.get(0).getDrugTracCodg();
  75. String result = taobaoService.sendGet("/queryCodeDetail?codes=" + drugTracCodg);
  76. JSONObject resultJson = JSONObject.parseObject(result);
  77. Integer code = resultJson.getInteger("code");
  78. if (code == 200) {
  79. JSONObject data = resultJson.getJSONObject("data");
  80. Integer dataCode = data.getInteger("code");
  81. if (dataCode == 0) {
  82. JSONArray content = data.getJSONArray("data");
  83. if(content != null && content.size() > 0) {
  84. JSONObject item = content.getJSONObject(0);
  85. JSONArray produceInfoList = item.getJSONObject("codeProduceInfoDTO").getJSONArray("produceInfoList");
  86. JSONObject drugEntBase = item.getJSONObject("drugEntBaseDTO");
  87. if(drugEntBase != null) {
  88. selInfo.setFixmedinsHilistName(drugEntBase.getString("physicName"));
  89. }
  90. if(produceInfoList != null && produceInfoList.size() > 0) {
  91. JSONObject produceInfo = produceInfoList.getJSONObject(0);
  92. selInfo.setManuLotnum(produceInfo.getString("batchNo"));
  93. selInfo.setManuDate(produceInfo.getString("produceDateStr"));
  94. }
  95. }
  96. }
  97. }
  98. int randomNumber = new Random().nextInt(90) + 10;
  99. String rtalDocno = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
  100. String mdtrtId = zyActpatientMapper.selectMdtrtId(selInfo.getPatientId(), selInfo.getTimes());
  101. if(StringUtils.isNotBlank(mdtrtId)) {
  102. selInfo.setMdtrtSn(mdtrtId);
  103. selInfo.setMdtrtSetlType("1");
  104. } else {
  105. selInfo.setMdtrtSn(rtalDocno + randomNumber);
  106. selInfo.setMdtrtSetlType("2");
  107. }
  108. selInfo.setRtalDocno(rtalDocno + randomNumber);
  109. selInfo.setFixmedinsBchno(rtalDocno + randomNumber);
  110. if("0".equals(selInfo.getTrdnFlag())) {
  111. selInfo.setSelRetnCnt(drugTracCodgList.size());
  112. }
  113. String now = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
  114. selInfo.setSelRetnTime(now);
  115. selInfo.setFixmedinsHilistId(selInfo.getMedListCodg());
  116. String id = UUID.randomUUID().toString().replaceAll("-", "");
  117. selInfo.setId(id);
  118. List<SelinfoSold> selinfoSoldList =
  119. selinfoSoldMapper.getSelinfoSoldList(selInfo.getPatientId(), selInfo.getTimes(),
  120. selInfo.getOrderNo(), selInfo.getChargeItemCode(), selInfo.getRealNo());
  121. if(selinfoSoldList != null && !selinfoSoldList.isEmpty()
  122. && selinfoSoldList.get(0).getMedListCodg().equals(selInfo.getMedListCodg())) {
  123. selInfo.setId(selinfoSoldList.get(0).getId());
  124. } else {
  125. selinfoSoldMapper.insert(selInfo);
  126. }
  127. selInfo.setPsnName(UriEncoder.encode(selInfo.getPsnName()));
  128. selInfo.setPrscDrName(UriEncoder.encode(selInfo.getPrscDrName()));
  129. selInfo.setPharName(UriEncoder.encode(selInfo.getPharName()));
  130. selInfo.setSelRetnOpterName(UriEncoder.encode(selInfo.getSelRetnOpterName()));
  131. selInfo.setFixmedinsHilistName(UriEncoder.encode(selInfo.getFixmedinsHilistName()));
  132. // 构建关联键(用于后续查询发药记录)
  133. // 关联键格式:patientId=xxx&times=xxx&receiptNo=xxx&orderNo=xxx&chargeItemCode=xxx&realNo=xxx
  134. // 用途:用于日志记录和后续查询发药记录,确保医保记录与发药记录的可追溯性
  135. // 查询接口:/thmz/getDispensingRecordByAssociation 可通过此关联键查询具体的发药记录
  136. String associationKey = String.format("patientId=%s&times=%s&receiptNo=%s&orderNo=%s&chargeItemCode=%s&realNo=%s",
  137. selInfo.getPatientId(), selInfo.getTimes(), selInfo.getReceiptNo(),
  138. selInfo.getOrderNo(), selInfo.getChargeItemCode(), selInfo.getRealNo());
  139. log.info("医保接口 - 关联键: {}", associationKey);
  140. String realUrl = siInventoryServiceUrl + "/saleGoodsItem";
  141. Selinfo selinfoParam = new Selinfo();
  142. BeanUtils.copyProperties(selInfo, selinfoParam);
  143. if("0".equals(selInfo.getTrdnFlag())) {
  144. selinfoParam.setDrugtracinfo(drugTracCodgList);
  145. }
  146. try {
  147. String jsonString = JSONObject.toJSONString(selinfoParam, SerializerFeature.WriteNonStringKeyAsString);
  148. String ybResult = HttpUtil.sendHttpPost(realUrl, jsonString, 8000);
  149. JSONObject ybResultJson = JSONObject.parseObject(ybResult);
  150. int responseCode = 0;
  151. if(ybResultJson.getInteger("code") != 200) {
  152. responseCode = ybResultJson.getInteger("code");
  153. }
  154. String successFlag = "0";
  155. JSONObject data = ybResultJson.getJSONObject("data");
  156. log.info("3505医保接口调用结果 - 结果: {}", JSONObject.toJSONString(data));
  157. if(data != null) {
  158. String infcode = data.getString("infcode");
  159. successFlag = "0".equals(infcode) ? "1" : "0";
  160. }
  161. response = new ResultVo(responseCode, ybResultJson.getString("message"));
  162. for(DrugTracCodg codg : drugTracCodgList) {
  163. String itemId = UUID.randomUUID().toString().replaceAll("-", "");
  164. /*String successFlag = "0";
  165. Map<String, String> param = new HashMap<>();
  166. param.put("med_list_codg", selInfo.getMedListCodg());
  167. param.put("trac_codg", codg.getDrugTracCodg());
  168. try {
  169. JSONObject selinfoResult = getGoodsItemByCode(param);
  170. JSONObject data = selinfoResult.getJSONObject("data");
  171. if(selinfoResult.getInteger("code") == 200) {
  172. JSONArray output = data.getJSONArray("output");
  173. if(output != null && !output.isEmpty()) {
  174. successFlag = "1";
  175. }
  176. }
  177. } catch (Exception e) {
  178. e.printStackTrace();
  179. log.error("医保接口调用失败 - 关联键: {}, 错误: {}", associationKey, e.getMessage());
  180. }*/
  181. selinfoSoldMapper.insertSelinfoSoldDrugtrac(itemId, selInfo.getId(), codg.getDrugTracCodg(), successFlag);
  182. }
  183. // 记录医保接口调用结果
  184. // 通过关联键可以快速定位具体的发药记录,便于问题排查和审计
  185. log.info("医保接口调用结果 - 关联键: {}, 结果: {}", associationKey, response);
  186. } catch (Exception e) {
  187. e.printStackTrace();
  188. response = new ResultVo(-1, "商品销售失败");
  189. // 记录错误信息时包含关联键,便于快速定位问题
  190. log.error("医保接口调用失败 - 关联键: {}, 错误: {}", associationKey, e.getMessage());
  191. }
  192. return response;
  193. }
  194. /**
  195. * 医保商品退货接口
  196. * 功能说明:将退药信息上报给医保系统,实现医保退费结算
  197. *
  198. * 关联字段说明:
  199. * - patientId: 患者ID,来自 mz_charge_detail.patient_id
  200. * - times: 就诊次数,来自 mz_charge_detail.times
  201. * - receiptNo: 发票分票号,来自 mz_charge_detail.receipt_no
  202. * - orderNo: 处方号,来自 mz_charge_detail.order_no
  203. * - chargeItemCode: 收费项目编码,来自 mz_charge_detail.charge_item_code
  204. * - realNo: 流水号,来自 mz_charge_detail.real_no
  205. *
  206. * 关联查询接口:
  207. * - /thmz/getDispensingRecordByAssociation: 通过关联字段查询退药记录
  208. *
  209. * 关联数据表:
  210. * - yp_mz_fytj: 退药统计表,记录退药数量、金额等统计信息
  211. * - mz_drug_trac_codg: 药品追溯码表,记录药品追溯码信息
  212. * - mz_charge_detail: 收费明细表,记录收费项目详细信息
  213. *
  214. * 业务流程:
  215. * 1. 前端退药页面调用 /thmz/refundMedicineProcessing 进行退药处理
  216. * 2. 退药成功后调用此接口上报医保系统
  217. * 3. 医保系统记录关联字段,便于后续查询和审计
  218. * 4. 可通过关联字段查询具体的退药记录和追溯码信息
  219. *
  220. * 必填参数:
  221. * - selRetnOpterName: 销售/退货经办人姓名(字符型,50位)
  222. * - drugtracinfo: 溯源码节点信息,包含药品追溯码
  223. *
  224. * @param selinfoReturn 医保退货信息对象,包含关联字段和药品追溯码信息
  225. * @return ResultVo 医保接口调用结果
  226. */
  227. public ResultVo returnGoodsItem(SelinfoReturn selinfoReturn) {
  228. ResultVo response = null;
  229. List<DrugTracCodg> drugTracCodgList = selinfoReturn.getDrugtracinfo();
  230. if(drugTracCodgList == null || drugTracCodgList.size() == 0) {
  231. response = new ResultVo(-1, "追溯码不能为空");
  232. return response;
  233. }
  234. // 记录关联字段信息(用于关联退药记录)
  235. // 这些字段用于后续查询退药记录,确保医保记录与退药记录的一一对应
  236. log.info("医保退药接口调用 - 关联字段: patientId={}, times={}, receiptNo={}, orderNo={}, chargeItemCode={}, realNo={}",
  237. selinfoReturn.getPatientId(), selinfoReturn.getTimes(), selinfoReturn.getReceiptNo(),
  238. selinfoReturn.getOrderNo(), selinfoReturn.getChargeItemCode(), selinfoReturn.getRealNo());
  239. // 构建关联键(用于后续查询退药记录)
  240. // 关联键格式:patientId=xxx&times=xxx&receiptNo=xxx&orderNo=xxx&chargeItemCode=xxx&realNo=xxx
  241. // 用途:用于日志记录和后续查询退药记录,确保医保记录与退药记录的可追溯性
  242. // 查询接口:/thmz/getDispensingRecordByAssociation 可通过此关联键查询具体的退药记录
  243. String associationKey = String.format("patientId=%s&times=%s&receiptNo=%s&orderNo=%s&chargeItemCode=%s&realNo=%s",
  244. selinfoReturn.getPatientId(), selinfoReturn.getTimes(), selinfoReturn.getReceiptNo(),
  245. selinfoReturn.getOrderNo(), selinfoReturn.getChargeItemCode(), selinfoReturn.getRealNo());
  246. log.info("医保退药接口 - 关联键: {}", associationKey);
  247. // 处理追溯码信息(如果有的话)
  248. /*if(drugTracCodgList != null && !drugTracCodgList.isEmpty()) {
  249. String drugTracCodg = drugTracCodgList.get(0).getDrugTracCodg();
  250. String result = taobaoService.sendGet("/queryCodeDetail?codes=" + drugTracCodg);
  251. JSONObject resultJson = JSONObject.parseObject(result);
  252. Integer code = resultJson.getInteger("code");
  253. if (code == 200) {
  254. JSONObject data = resultJson.getJSONObject("data");
  255. Integer dataCode = data.getInteger("code");
  256. if (dataCode == 0) {
  257. JSONArray content = data.getJSONArray("data");
  258. if(content != null && content.size() > 0) {
  259. JSONObject item = content.getJSONObject(0);
  260. JSONArray produceInfoList = item.getJSONObject("codeProduceInfoDTO").getJSONArray("produceInfoList");
  261. if(produceInfoList != null && produceInfoList.size() > 0) {
  262. JSONObject produceInfo = produceInfoList.getJSONObject(0);
  263. selinfoReturn.setManuLotnum(produceInfo.getString("batchNo"));
  264. selinfoReturn.setManuDate(produceInfo.getString("produceDateStr"));
  265. }
  266. }
  267. }
  268. }
  269. } else {
  270. log.warn("退药操作没有追溯码信息,继续处理");
  271. }*/
  272. List<SelinfoSold> selinfoSoldList =
  273. selinfoSoldMapper.getSelinfoSoldList(selinfoReturn.getPatientId(), selinfoReturn.getTimes(),
  274. selinfoReturn.getOrderNo(), selinfoReturn.getChargeItemCode(), selinfoReturn.getRealNo());
  275. if(selinfoSoldList == null || selinfoSoldList.size() == 0) {
  276. response = new ResultVo(-1, "关联追溯码上传失败");
  277. return response;
  278. }
  279. SelinfoSold selinfoSold = selinfoSoldList.get(0);
  280. // selinfoReturn.setSelRetnCnt(drugTracCodgList != null ? drugTracCodgList.size() : 0);
  281. String now = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
  282. selinfoReturn.setMedListCodg(selinfoSold.getMedListCodg());
  283. selinfoReturn.setSelRetnTime(now);
  284. selinfoReturn.setMdtrtSn(selinfoSold.getMdtrtSn());
  285. selinfoReturn.setFixmedinsBchno(selinfoSold.getFixmedinsBchno());
  286. selinfoReturn.setManuLotnum(selinfoSold.getManuLotnum());
  287. selinfoReturn.setManuDate(selinfoSold.getManuDate());
  288. selinfoReturn.setRxFlag(selinfoSold.getRxFlag());
  289. selinfoReturn.setTrdnFlag(selinfoSold.getTrdnFlag());
  290. selinfoReturn.setSelRetnOpterName(UriEncoder.encode(selinfoReturn.getSelRetnOpterName()));
  291. String realUrl = siInventoryServiceUrl + "/returnGoodsItem";
  292. try {
  293. String jsonString = JSONObject.toJSONString(selinfoReturn, SerializerFeature.WriteNonStringKeyAsString);
  294. String ybResult = HttpUtil.sendHttpPost(realUrl, jsonString, 8000);
  295. JSONObject ybResultJson = JSONObject.parseObject(ybResult);
  296. int responseCode = 0;
  297. if(ybResultJson.getInteger("code") != 200) {
  298. responseCode = ybResultJson.getInteger("code");
  299. }
  300. response = new ResultVo(responseCode, ybResultJson.getString("message"));
  301. // 记录医保接口调用结果
  302. // 通过关联键可以快速定位具体的退药记录,便于问题排查和审计
  303. log.info("医保退药接口调用结果 - 关联键: {}, 结果: {}", associationKey, response);
  304. } catch (Exception e) {
  305. e.printStackTrace();
  306. response = new ResultVo(-1, "商品销售撤销失败");
  307. // 记录错误信息时包含关联键,便于快速定位问题
  308. log.error("医保退药接口调用失败 - 关联键: {}, 错误: {}", associationKey, e.getMessage());
  309. }
  310. return response;
  311. }
  312. public ResultVo getGoods(SelinfoSold selinfoSold) {
  313. ResultVo response = null;
  314. List<SelinfoSold> selinfoSoldList =
  315. selinfoSoldMapper.getSelinfoSoldList(selinfoSold.getPatientId(), selinfoSold.getTimes(),
  316. selinfoSold.getOrderNo(), selinfoSold.getChargeItemCode(), selinfoSold.getRealNo());
  317. if(selinfoSoldList == null || selinfoSoldList.size() == 0) {
  318. response = new ResultVo(-1, "关联追溯码上传失败");
  319. return response;
  320. }
  321. List<Object> datas = new ArrayList<>();
  322. String realUrl = siInventoryServiceUrl + "/selectSalesGoodsItem";
  323. for(SelinfoSold sold : selinfoSoldList) {
  324. List<Map<String, String>> selinfoSoldDrugtracById = selinfoSoldMapper.getSelinfoSoldDrugtracById(sold.getId());
  325. for(Map<String, String> map : selinfoSoldDrugtracById) {
  326. Map<String, String> param = new HashMap<>();
  327. param.put("med_list_codg", sold.getMedListCodg());
  328. param.put("drug_trac_codg", map.get("trac_codg"));
  329. try {
  330. String jsonString = JSONObject.toJSONString(param, SerializerFeature.WriteNonStringKeyAsString);
  331. String ybResult = HttpUtil.sendHttpPost(realUrl, jsonString, 8000);
  332. JSONObject ybResultJson = JSONObject.parseObject(ybResult);
  333. int responseCode = 0;
  334. if(ybResultJson.getInteger("code") != 200) {
  335. responseCode = ybResultJson.getInteger("code");
  336. }
  337. // response = new ResultVo(responseCode, ybResultJson.getString("message"), ybResultJson.get("data"));
  338. JSONObject data = ybResultJson.getJSONObject("data");
  339. JSONArray output = data.getJSONArray("output");
  340. if(output != null && !output.isEmpty()) {
  341. datas.add(output.get(0));
  342. }
  343. // 记录医保接口调用结果
  344. // 通过关联键可以快速定位具体的退药记录,便于问题排查和审计
  345. log.info("医保退药接口调用结果 - 结果: {}", response);
  346. } catch (Exception e) {
  347. e.printStackTrace();
  348. response = new ResultVo(-1, "商品销售查询失败");
  349. // 记录错误信息时包含关联键,便于快速定位问题
  350. log.error("医保退药接口调用失败 - 错误: {}", e.getMessage());
  351. }
  352. }
  353. }
  354. response = new ResultVo(0, "查询成功", datas);
  355. return response;
  356. }
  357. public ResultVo getGoodsByCode(Map<String, String> map) {
  358. ResultVo response = null;
  359. JSONArray output = null;
  360. try {
  361. JSONObject ybResultJson = getGoodsItemByCode(map);
  362. JSONObject data = ybResultJson.getJSONObject("data");
  363. if(ybResultJson.getInteger("code") == 200) {
  364. output = data.getJSONArray("output");
  365. response = new ResultVo(0, "查询成功", output);
  366. }
  367. // 记录医保接口调用结果
  368. // 通过关联键可以快速定位具体的退药记录,便于问题排查和审计
  369. log.info("医保查询接口调用结果 - 结果: {}", response);
  370. } catch (Exception e) {
  371. e.printStackTrace();
  372. response = new ResultVo(-1, "商品销售查询失败");
  373. // 记录错误信息时包含关联键,便于快速定位问题
  374. log.error("医保查询接口调用失败 - 错误: {}", e.getMessage());
  375. }
  376. return response;
  377. }
  378. public JSONObject getGoodsItemByCode(Map<String, String> map) throws Exception {
  379. String realUrl = siInventoryServiceUrl + "/selectSalesGoodsItem";
  380. String jsonString = JSONObject.toJSONString(map, SerializerFeature.WriteNonStringKeyAsString);
  381. String ybResult = HttpUtil.sendHttpPost(realUrl, jsonString, 8000);
  382. return JSONObject.parseObject(ybResult);
  383. }
  384. public ResultVo getErrorCodes() {
  385. List<Map<String, String>> errors = new ArrayList<>();
  386. List<Map<String, String>> selinfoSoldDrugtracList = selinfoSoldMapper.getSelinfoSoldDrugtracById(null);
  387. for(Map<String, String> drug : selinfoSoldDrugtracList) {
  388. Map<String, String> param = new HashMap<>();
  389. param.put("med_list_codg", drug.get("med_list_codg"));
  390. param.put("trac_codg", drug.get("trac_codg"));
  391. try {
  392. JSONObject result = getGoodsItemByCode(param);
  393. JSONObject data = result.getJSONObject("data");
  394. if(result.getInteger("code") == 200) {
  395. JSONArray output = data.getJSONArray("output");
  396. if(output == null || output.isEmpty()) {
  397. errors.add(drug);
  398. }
  399. }
  400. } catch (Exception e) {
  401. throw new RuntimeException(e);
  402. }
  403. }
  404. return new ResultVo(0, "查询成功", errors);
  405. }
  406. }