|
@ -207,7 +207,7 @@ public class MedOrderService {
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public com.alibaba.fastjson.JSONArray getSettlementInfoFirst(String recipe_no) throws Exception {
|
|
|
public com.alibaba.fastjson.JSONArray getSettlementInfoFirst(String recipe_no,String card_sn) throws Exception {
|
|
|
JSONArray result = new JSONArray();
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByLog_no(recipe_no);
|
|
|
if (null==ylzMedicalRelationDO){
|
|
@ -268,6 +268,21 @@ public class MedOrderService {
|
|
|
JSONObject dataDetail = new JSONObject();
|
|
|
inputDetail.put("mdtrt_cert_type","03");
|
|
|
inputDetail.put("mdtrt_cert_no",cardNo);
|
|
|
if (StringUtils.isNotBlank(card_sn)){
|
|
|
inputDetail.put("card_sn",card_sn);
|
|
|
}else {
|
|
|
sql = " select dict_code,dict_value from wlyy_hospital_sys_dict where dict_name='ylz_card_sn' ";
|
|
|
List<Map<String,Object>> AnalogFlags = jdbcTemplate.queryForList(sql);
|
|
|
String AnalogFlag = "0";
|
|
|
if (AnalogFlags.size()>0){
|
|
|
AnalogFlag = AnalogFlags.get(0).get("dict_code").toString();
|
|
|
}
|
|
|
if ("1".equals(AnalogFlag)) {//获取调式模拟数据
|
|
|
inputDetail.put("card_sn",AnalogFlags.get(0).get("dict_value").toString());
|
|
|
}else {
|
|
|
throw new Exception("卡识别码未传入");
|
|
|
}
|
|
|
}
|
|
|
input.put("data",inputDetail);
|
|
|
dataDetail.put("input",input);
|
|
|
dataDetail.put("net_data",netData);
|
|
@ -398,6 +413,8 @@ public class MedOrderService {
|
|
|
JSONObject resultTmp = new JSONObject();
|
|
|
resultTmp.put("needCharge",true);
|
|
|
DecimalFormat format = new DecimalFormat("#.00");
|
|
|
System.out.println("readcardResult:"+readcardResult);
|
|
|
System.out.println("registerResult:"+registerResult);
|
|
|
|
|
|
if (null==ylzMedicalRelationDO){
|
|
|
throw new Exception("未找到该处方待结算记录");
|
|
@ -430,14 +447,15 @@ public class MedOrderService {
|
|
|
|
|
|
JSONObject readcardObject = JSONObject.parseObject(readcardResult);
|
|
|
if ("0000".equals(readcardObject.getString("retCode"))){
|
|
|
JSONObject outPutObj = readcardObject.getJSONObject("output");
|
|
|
JSONObject dataObj = readcardObject.getJSONObject("data");
|
|
|
JSONObject outPutObj = dataObj.getJSONObject("output");
|
|
|
JSONObject baseinfo = outPutObj.getJSONObject("baseinfo");
|
|
|
JSONObject insuinfo = outPutObj.getJSONObject("insuinfo");
|
|
|
JSONArray insuinfo = outPutObj.getJSONArray("insuinfo");
|
|
|
String psn_no = baseinfo.getString("psn_no");//人员编码
|
|
|
|
|
|
String balc = insuinfo.getDouble("balc").toString();//余额
|
|
|
String insutype = insuinfo.getString("insutype");//险种类型
|
|
|
String insuplc_admdvs = insuinfo.getString("insuplc_admdvs");//参保地医保区划
|
|
|
String balc = insuinfo.getJSONObject(0).getDouble("balc").toString();//余额
|
|
|
String insutype = insuinfo.getJSONObject(0).getString("insutype");//险种类型
|
|
|
String insuplc_admdvs = insuinfo.getJSONObject(0).getString("insuplc_admdvs");//参保地医保区划
|
|
|
ylzMedicalRelationDO.setPsnNo(psn_no);
|
|
|
ylzMedicalRelationDO.setAccountBalance(balc);
|
|
|
ylzMedicalRelationDO.setInsuranceType(insutype);
|
|
@ -458,7 +476,8 @@ public class MedOrderService {
|
|
|
|
|
|
JSONObject registerObject = JSONObject.parseObject(registerResult);
|
|
|
if ("0000".equals(registerObject.getString("retCode"))){
|
|
|
JSONObject outPutObj = registerObject.getJSONObject("output");
|
|
|
JSONObject dataObj = registerObject.getJSONObject("data");
|
|
|
JSONObject outPutObj = dataObj.getJSONObject("output");
|
|
|
JSONObject data = outPutObj.getJSONObject("data");
|
|
|
String mdtrt_id = data.getString("mdtrt_id");//就诊id
|
|
|
ylzMedicalRelationDO.setHisSerial(mdtrt_id);
|
|
@ -520,7 +539,7 @@ public class MedOrderService {
|
|
|
Double medfee_sumamt = ylzMedicalMxDOSTmp.stream().mapToDouble(e-> Double.valueOf(e.getTotalMoney())).sum();
|
|
|
|
|
|
String str = format.format(medfee_sumamt);
|
|
|
dataInfo.put("medfee_sumamt",Double.parseDouble(str));//医疗费总额-数值型16,2
|
|
|
dataInfo.put("medfee_sumamt",Double.parseDouble(str)+"");//医疗费总额-数值型16,2
|
|
|
dataInfo.put("psn_setlway",ylzMedicalMxDOSTmp.get(0).getPsnSetlway()); //个人结算方式
|
|
|
dataInfo.put("mdtrt_id",ylzMedicalRelationDO.getHisSerial()); //就诊 ID
|
|
|
dataInfo.put("chrg_bchno",key); //收费批次号
|
|
@ -537,7 +556,7 @@ public class MedOrderService {
|
|
|
for (YlzMedicalIcdDO tmp:ylzMedicalIcdDOS){
|
|
|
JSONObject diseinfoTmp = new JSONObject();
|
|
|
diseinfoTmp.put("diag_type",tmp.getDiseaseType()); //诊断类别
|
|
|
diseinfoTmp.put("diag_srt_no",Integer.valueOf(tmp.getDiseaseOrder())); //诊断排序号
|
|
|
diseinfoTmp.put("diag_srt_no",Integer.valueOf(tmp.getDiseaseOrder())+""); //诊断排序号
|
|
|
diseinfoTmp.put("diag_code",tmp.getDiseaseCodeIcd10()); //诊断代码
|
|
|
diseinfoTmp.put("diag_name",tmp.getDiseaseNameIcd10()); //诊断名称
|
|
|
diseinfoTmp.put("diag_dept",tmp.getDiagDept()); //诊断科室
|
|
@ -558,12 +577,12 @@ public class MedOrderService {
|
|
|
feedetailTmp.put("fee_ocur_time",DateUtil.dateToStrLong(tmp.getActgDate())); //费用发生时间yyyy-MM-dd HH:mm:ss
|
|
|
feedetailTmp.put("med_list_codg",tmp.getItemCode()); //医疗目录编码
|
|
|
feedetailTmp.put("medins_list_codg",tmp.getHisItemCode()); //医药机构目录编码
|
|
|
feedetailTmp.put("det_item_fee_sumamt",Double.valueOf(tmp.getTotalMoney())); //明细项目费用总额-数值型16,2
|
|
|
feedetailTmp.put("cnt",Double.valueOf(tmp.getAmount())); //数量-数值型16,4
|
|
|
feedetailTmp.put("pric",Double.valueOf(tmp.getPrice())); //单价-数值型16,6
|
|
|
feedetailTmp.put("det_item_fee_sumamt",Double.valueOf(tmp.getTotalMoney())+""); //明细项目费用总额-数值型16,2
|
|
|
feedetailTmp.put("cnt",Double.valueOf(tmp.getAmount())+""); //数量-数值型16,4
|
|
|
feedetailTmp.put("pric",Double.valueOf(tmp.getPrice())+""); //单价-数值型16,6
|
|
|
feedetailTmp.put("bilg_dept_codg",tmp.getBilgDeptCodg()); //开单科室编码
|
|
|
feedetailTmp.put("bilg_dept_name",tmp.getBilgDeptName()); //开单科室名称
|
|
|
feedetailTmp.put("bilg_dr_codg",tmp.getBilgDrCodg()); //开单医生编码
|
|
|
feedetailTmp.put("bilg_dr_codg",ylzMedicalRelationDO.getAtddrNo()); //开单医生编码
|
|
|
feedetailTmp.put("bilg_dr_name",tmp.getBilgDrName()); //开单医师姓名
|
|
|
feedetailTmp.put("hosp_appr_flag",tmp.getHospApprFlag()); //医院审批标志
|
|
|
feedetailTmp.put("rxno",tmp.getRxno()); //单据号
|
|
@ -651,7 +670,7 @@ public class MedOrderService {
|
|
|
for (YlzMedicalMxDO tmp:ylzMedicalMxDOSTmp){
|
|
|
JSONObject outputResultTmp = new JSONObject();
|
|
|
outputResultTmp.put("feedetl_sn",tmp.getHisDetailSn());//费用明细流水号
|
|
|
outputResultTmp.put("det_item_fee_sumamt",Double.valueOf(tmp.getTotalMoney()));//明细项目费用总额-数值型16,2
|
|
|
outputResultTmp.put("det_item_fee_sumamt",Double.valueOf(tmp.getTotalMoney())+"");//明细项目费用总额-数值型16,2
|
|
|
outputResultTmp.put("cnt",Double.valueOf(tmp.getAmount()));//数量-数值型16,4
|
|
|
outputResultTmp.put("pric",Double.valueOf(tmp.getPrice()));//单价-数值型16,6
|
|
|
outputResultTmp.put("pric_uplmt_amt",50.00);//定价上限金额-数值型16,6
|
|
@ -709,7 +728,8 @@ public class MedOrderService {
|
|
|
for (int i=0;i<chargeResultArr.size();i++){
|
|
|
JSONObject chargeResultTmp = chargeResultArr.getJSONObject(i);
|
|
|
if ("0000".equals(chargeResultTmp.getString("retCode"))){
|
|
|
JSONObject output = chargeResultTmp.getJSONObject("output");
|
|
|
JSONObject dataObj = chargeResultTmp.getJSONObject("data");
|
|
|
JSONObject output = dataObj.getJSONObject("output");
|
|
|
JSONObject setlinfo = output.getJSONObject("setlinfo");
|
|
|
personCash += setlinfo.getDouble("psn_cash_pay");
|
|
|
personAccount += setlinfo.getDouble("acct_pay");
|
|
@ -947,6 +967,7 @@ public class MedOrderService {
|
|
|
ylzMedicalMxDO.setBilgDrName(SETTLE_DETAIL_OBJ.getString("APPLY_OPERATOR_NAME"));
|
|
|
ylzMedicalMxDO.setHospApprFlag(SETTLE_DETAIL_OBJ.getString("hosp_appr_flag"));
|
|
|
ylzMedicalMxDO.setRxno(SETTLE_DETAIL_OBJ.getString("APPLY_NO"));
|
|
|
ylzMedicalMxDO.setPsnSetlway(SETTLE_DETAIL_OBJ.getString("psn_setlway"));
|
|
|
ylzMedicailMxDao.save(ylzMedicalMxDO);
|
|
|
mxDOList.add(ylzMedicalMxDO);
|
|
|
}
|