|
@@ -1,9 +1,11 @@
|
|
|
package cn.hnthyy.thmz.service.yb;
|
|
|
|
|
|
import cn.hnthyy.thmz.Utils.HttpUtil;
|
|
|
+import cn.hnthyy.thmz.entity.his.zy.ZyActpatient;
|
|
|
import cn.hnthyy.thmz.entity.jy.ResultVo;
|
|
|
import cn.hnthyy.thmz.entity.yb.*;
|
|
|
import cn.hnthyy.thmz.mapper.his.yb.SelinfoSoldMapper;
|
|
|
+import cn.hnthyy.thmz.mapper.his.zy.ZyActpatientMapper;
|
|
|
import cn.hnthyy.thmz.service.taobao.TaobaoService;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -31,6 +33,9 @@ public class YbService {
|
|
|
@Autowired
|
|
|
private SelinfoSoldMapper selinfoSoldMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ZyActpatientMapper zyActpatientMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 医保商品销售接口
|
|
|
* 功能说明:将发药信息上报给医保系统,实现医保结算
|
|
@@ -98,7 +103,7 @@ public class YbService {
|
|
|
int randomNumber = new Random().nextInt(90) + 10;
|
|
|
String rtalDocno = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
|
|
|
if("1".equals(selInfo.getMdtrtSetlType())) {
|
|
|
- selInfo.setMdtrtSn("MDTRT_ID");
|
|
|
+ selInfo.setMdtrtSn(zyActpatientMapper.selectMdtrtId(selInfo.getPatientId(), selInfo.getTimes()));
|
|
|
} else {
|
|
|
selInfo.setMdtrtSn(rtalDocno + randomNumber);
|
|
|
}
|
|
@@ -120,11 +125,6 @@ public class YbService {
|
|
|
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()));
|
|
@@ -152,6 +152,26 @@ public class YbService {
|
|
|
responseCode = ybResultJson.getInteger("code");
|
|
|
}
|
|
|
response = new ResultVo(responseCode, ybResultJson.getString("message"));
|
|
|
+ for(DrugTracCodg codg : drugTracCodgList) {
|
|
|
+ String itemId = UUID.randomUUID().toString().replaceAll("-", "");
|
|
|
+ String successFlag = "0";
|
|
|
+ Map<String, String> param = new HashMap<>();
|
|
|
+ param.put("med_list_codg", selInfo.getMedListCodg());
|
|
|
+ param.put("trac_codg", codg.getDrugTracCodg());
|
|
|
+ try {
|
|
|
+ JSONObject selinfoResult = getGoodsItemByCode(param);
|
|
|
+ JSONObject data = selinfoResult.getJSONObject("data");
|
|
|
+ if(selinfoResult.getInteger("code") == 200) {
|
|
|
+ JSONArray output = data.getJSONArray("output");
|
|
|
+ if(output != null && !output.isEmpty()) {
|
|
|
+ successFlag = "1";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ selinfoSoldMapper.insertSelinfoSoldDrugtrac(itemId, id, codg.getDrugTracCodg(), successFlag);
|
|
|
+ }
|
|
|
|
|
|
// 记录医保接口调用结果
|
|
|
// 通过关联键可以快速定位具体的发药记录,便于问题排查和审计
|