|  | @ -1,15 +1,18 @@
 | 
	
		
			
				|  |  | package com.yihu.jw.base.service.a3service;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSON;
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONArray;
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.healthCare.YlzMedicalIcdDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.healthCare.YlzMedicalMxDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.healthCare.YlzMedicalRelationDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.healthCare.YlzMedicalResponse;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.util.AesEncryptUtils;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.healthCare.YlzMedicailIcdDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.healthCare.YlzMedicailMxDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.healthCare.YlzMedicailRelationDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.healthCare.YlzMedicalResponseDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.date.DateUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.wlyy.wlyyhttp.WlyyHttpService;
 | 
	
	
		
			
				|  | @ -17,7 +20,9 @@ import org.slf4j.Logger;
 | 
	
		
			
				|  |  | import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Value;
 | 
	
		
			
				|  |  | import org.springframework.jdbc.core.JdbcTemplate;
 | 
	
		
			
				|  |  | import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | import org.springframework.transaction.annotation.Propagation;
 | 
	
		
			
				|  |  | import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import java.util.*;
 | 
	
	
		
			
				|  | @ -42,6 +47,10 @@ public class JwService {
 | 
	
		
			
				|  |  |     private YlzMedicailMxDao ylzMedicailMxDao;
 | 
	
		
			
				|  |  |     @Value("${spring.profiles}")
 | 
	
		
			
				|  |  |     private String springProfiles;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private YlzMedicalResponseDao ylzMedicalResponseDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private JdbcTemplate jdbcTemplate;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 获取智业待结算数据接口--自助机
 | 
	
	
		
			
				|  | @ -84,7 +93,7 @@ public class JwService {
 | 
	
		
			
				|  |  |         param.put("msgBody",msgBody.toJSONString());
 | 
	
		
			
				|  |  |         JSONObject re = null;
 | 
	
		
			
				|  |  |         if ("jwtest".equals(springProfiles)){
 | 
	
		
			
				|  |  |             re = JSONObject.parseObject("{\"msg\":\"success\",\"data\":{\"CODE\":\"1\",\"returnData\":[{\"result\":\"1\"}],\"byRefParaData\":[{\"dispBalance\":\"100\"}]},\"status\":200}\n");
 | 
	
		
			
				|  |  |             re = JSONObject.parseObject("{\"msg\":\"success\",\"data\":{\"CODE\":\"1\",\"returnData\":[{\"result\":\"1\"}],\"byRefParaData\":[{\"dispBalance\":\"5.5\"}]},\"status\":200}\n");
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             re = wlyyHttpService.sendWlyyMes("callEhrInterfaceYG", null,param);
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -104,147 +113,197 @@ public class JwService {
 | 
	
		
			
				|  |  |      * @param
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  |     public JSONObject executeSickSettleMultiNew(String recipe_no) throws Exception {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Transactional(propagation= Propagation.NOT_SUPPORTED)
 | 
	
		
			
				|  |  |     public boolean executeSickSettleMultiNew(String recipe_no) throws Exception {
 | 
	
		
			
				|  |  |         String   sql = " select dict_code,dict_value from wlyy_hospital_sys_dict where dict_name='his_settlement' ";
 | 
	
		
			
				|  |  |         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)) {//获取调式模拟数据
 | 
	
		
			
				|  |  |             YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByLog_no(recipe_no);
 | 
	
		
			
				|  |  |             if(null==ylzMedicalRelationDO){
 | 
	
		
			
				|  |  |                return true;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             ylzMedicalRelationDO.setState(1);
 | 
	
		
			
				|  |  |             ylzMedicailRelationDao.save(ylzMedicalRelationDO);
 | 
	
		
			
				|  |  |             return true;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByLog_no(recipe_no);
 | 
	
		
			
				|  |  |         if (null==recipe_no){
 | 
	
		
			
				|  |  |             throw new Exception("无结算信息");
 | 
	
		
			
				|  |  |            return true;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (ylzMedicalRelationDO.getState()==1){
 | 
	
		
			
				|  |  |             throw new Exception("订单已结算,无法重复结算");
 | 
	
		
			
				|  |  |             return true;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         List<YlzMedicalMxDO> ylzMedicalMxDOList = ylzMedicailMxDao.findByMedicalId(ylzMedicalRelationDO.getId());
 | 
	
		
			
				|  |  |         List<YlzMedicalIcdDO> ylzMedicalIcdDOList = ylzMedicailIcdDao.findByMedicalId(ylzMedicalRelationDO.getId());
 | 
	
		
			
				|  |  |         JSONObject msgBody = new JSONObject();
 | 
	
		
			
				|  |  |         JSONArray insurVisitInfo = new JSONArray();
 | 
	
		
			
				|  |  |         JSONArray insurResult = new JSONArray(); //医保结算信息 自费病人没有产生医保收费记录,insurResult节点不传自费结算信息
 | 
	
		
			
				|  |  |         JSONArray insurResult = new JSONArray(); //自费病人没有产生医保收费记录,insurResult节点不传自费结算信息
 | 
	
		
			
				|  |  |         msgBody.put("cardNo",ylzMedicalRelationDO.getCardNo());//病人卡号
 | 
	
		
			
				|  |  |         msgBody.put("settleDept",ylzMedicalRelationDO.getDeptCode());//结算科室编码
 | 
	
		
			
				|  |  |         msgBody.put("settleOperator",ylzMedicalRelationDO.getCollector());//结算人员编码
 | 
	
		
			
				|  |  |         msgBody.put("visitNo","");//结算人员编码
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if (0==ylzMedicalRelationDO.getMedicalState()){//自费
 | 
	
		
			
				|  |  |             msgBody.put("insurResult",insurResult);//todo
 | 
	
		
			
				|  |  |             msgBody.put("insurResult",insurResult);
 | 
	
		
			
				|  |  |         }else if (1==ylzMedicalRelationDO.getMedicalState()){//医保
 | 
	
		
			
				|  |  |             for (YlzMedicalMxDO medicalMxDO:ylzMedicalMxDOList){
 | 
	
		
			
				|  |  |                 JSONObject insurResultTmp = new JSONObject();
 | 
	
		
			
				|  |  |                 insurResultTmp.put("visitNo",ylzMedicalRelationDO.getRelationCode()); //院内挂号号
 | 
	
		
			
				|  |  |                 insurResultTmp.put("insurSettleSort",medicalMxDO.getInsurSettleSort()); //医保结算序号
 | 
	
		
			
				|  |  |                 insurResultTmp.put("setl_msgid",medicalMxDO.getSetlMsgid()); //发送方报文ID
 | 
	
		
			
				|  |  |                 insurResultTmp.put("fee_msgid",medicalMxDO.getFeeMsgid()); //费用上传发送方报文ID
 | 
	
		
			
				|  |  |                 insurResultTmp.put("dise_msgid",""); //就诊信息上传发送方报文ID todo
 | 
	
		
			
				|  |  |                 insurResultTmp.put("chrg_bchno",medicalMxDO.getChrgBchno());   //收费批次号
 | 
	
		
			
				|  |  |                 insurResultTmp.put("insuplc_admdvs",ylzMedicalRelationDO.getRegionCode()); //参保地医保区划【窗口冲销有用】
 | 
	
		
			
				|  |  |                 insurResultTmp.put("card_sn",""); //卡识别码 todo
 | 
	
		
			
				|  |  |                 insurResultTmp.put("mdtrt_cert_no",ylzMedicalRelationDO.getCardNo()); //就诊凭证编号
 | 
	
		
			
				|  |  |                 insurResultTmp.put("fm_acct_balc",""); //家庭共济账户余额 todo
 | 
	
		
			
				|  |  |                 insurResultTmp.put("hl_acct_balc",""); //健康账户余额 todo
 | 
	
		
			
				|  |  |                 insurResultTmp.put("cvl_acct_balc",""); //公务员账户余额 todo
 | 
	
		
			
				|  |  |                 insurResultTmp.put("acct_used_flag","1"); //个人账户使用标志【窗口目前默认固定1,后续可开放前端选择传入】
 | 
	
		
			
				|  |  |                 insurResultTmp.put("mdtrt_id",ylzMedicalRelationDO.getHisSerial()); //就诊 ID
 | 
	
		
			
				|  |  |                 insurResultTmp.put("setl_id",""); //结算ID   todo
 | 
	
		
			
				|  |  |                 insurResultTmp.put("psn_no","1"); //人员编号   医保人员基本信息获取接口返回
 | 
	
		
			
				|  |  |                 insurResultTmp.put("psn_name",ylzMedicalRelationDO.getName()); //人员姓名
 | 
	
		
			
				|  |  |                 insurResultTmp.put("psn_cert_type",""); //人员证件类型 todo
 | 
	
		
			
				|  |  |                 insurResultTmp.put("certno",""); //证件号码 todo
 | 
	
		
			
				|  |  |                 insurResultTmp.put("gend",""); //性别 todo
 | 
	
		
			
				|  |  |                 insurResultTmp.put("naty",""); //民族 todo
 | 
	
		
			
				|  |  |                 insurResultTmp.put("brdy",""); //出生日期 todo
 | 
	
		
			
				|  |  |                 insurResultTmp.put("age",""); //年龄 todo
 | 
	
		
			
				|  |  |                 insurResultTmp.put("insutype","310"); //险种类型
 | 
	
		
			
				|  |  |                 insurResultTmp.put("psn_type","11"); //人员类别"
 | 
	
		
			
				|  |  |                 insurResultTmp.put("cvlserv_flag","0"); //公务员标志
 | 
	
		
			
				|  |  |                 insurResultTmp.put("setl_time", DateUtil.getStringDateShort());    //结算时间
 | 
	
		
			
				|  |  |                 insurResultTmp.put("mdtrt_cert_type","03");  //就诊凭证类型
 | 
	
		
			
				|  |  |                 insurResultTmp.put("med_type",ylzMedicalRelationDO.getMedType()); //医疗类别
 | 
	
		
			
				|  |  |                 insurResultTmp.put("medfee_sumamt","");  //医疗费总额 todo
 | 
	
		
			
				|  |  |                 insurResultTmp.put("fulamt_ownpay_amt",ylzMedicalRelationDO.getOwnPay()); //全自费金额 todo
 | 
	
		
			
				|  |  |                 insurResultTmp.put("overlmt_selfpay","");  //超限价自费费用 todo
 | 
	
		
			
				|  |  |                 insurResultTmp.put("preselfpay_amt","");   //先行自付金额 todo
 | 
	
		
			
				|  |  |                 insurResultTmp.put("inscp_scp_amt","");    //符合政策范围金额 todo
 | 
	
		
			
				|  |  |                 insurResultTmp.put("act_pay_dedc",""); //实际支付起付线 todo
 | 
	
		
			
				|  |  |                 insurResultTmp.put("hifp_pay",""); //基本医疗保险统筹基金支出
 | 
	
		
			
				|  |  |                 insurResultTmp.put("pool_prop_selfpay","");    //基本医疗保险统筹基金支付比例 todo
 | 
	
		
			
				|  |  |                 insurResultTmp.put("cvlserv_pay","");  //公务员医疗补助资金支出 todo
 | 
	
		
			
				|  |  |                 insurResultTmp.put("hifes_pay","");    //企业补充医疗保险基金支出
 | 
	
		
			
				|  |  |                 insurResultTmp.put("hifmi_pay","");    //居民大病保险资金支出
 | 
	
		
			
				|  |  |                 insurResultTmp.put("hifob_pay","");    //职工大额医疗费用补助基金支出
 | 
	
		
			
				|  |  |                 insurResultTmp.put("maf_pay","");  //医疗救助基金支出
 | 
	
		
			
				|  |  |                 insurResultTmp.put("oth_pay","");  //其他支出
 | 
	
		
			
				|  |  |                 insurResultTmp.put("fund_pay_sumamt","");  //基金支付总额
 | 
	
		
			
				|  |  |                 insurResultTmp.put("psn_part_amt",""); //个人负担总金额
 | 
	
		
			
				|  |  |                 insurResultTmp.put("acct_pay",""); //个人账户支出
 | 
	
		
			
				|  |  |                 insurResultTmp.put("psn_cash_pay",""); //个人现金支出
 | 
	
		
			
				|  |  |                 insurResultTmp.put("hosp_part_amt","");    //医院负担金额
 | 
	
		
			
				|  |  |                 insurResultTmp.put("balc",""); //余额
 | 
	
		
			
				|  |  |                 insurResultTmp.put("acct_mulaid_pay","");  //个人账户共济支付金额
 | 
	
		
			
				|  |  |                 insurResultTmp.put("medins_setl_id",medicalMxDO.getSetlMsgid());   //医药机构结算ID(应跟setl_msgid值一致)
 | 
	
		
			
				|  |  |                 insurResultTmp.put("clr_optins","");   //清算经办机构
 | 
	
		
			
				|  |  |                 insurResultTmp.put("clr_way","");  //清算方式
 | 
	
		
			
				|  |  |                 insurResultTmp.put("clr_type","11"); //清算类别
 | 
	
		
			
				|  |  |                 insurResultTmp.put("hifdm_pay","0");    //伤残人员医疗保障基金支出
 | 
	
		
			
				|  |  |                 insurResultTmp.put("exp_content","");  //
 | 
	
		
			
				|  |  |             YlzMedicalResponse ylzMedicalResponse = ylzMedicalResponseDao.findByMedicalId(ylzMedicalRelationDO.getId());
 | 
	
		
			
				|  |  |             if (null==ylzMedicalResponse){
 | 
	
		
			
				|  |  |                 throw new Exception("未查询到医保结算信息");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             JSONArray ylzResponse = JSONArray.parseArray(ylzMedicalResponse.getValue());
 | 
	
		
			
				|  |  |             JSONObject ylzResponseData = null;
 | 
	
		
			
				|  |  |             JSONObject ylzResponseOutPut = null;
 | 
	
		
			
				|  |  |             JSONObject setlinfo = null;
 | 
	
		
			
				|  |  |             if (ylzResponse.size()>0){
 | 
	
		
			
				|  |  |                 for (int i=0;i<ylzResponse.size();i++){
 | 
	
		
			
				|  |  |                     JSONObject ylzResponse0 = ylzResponse.getJSONObject(i);
 | 
	
		
			
				|  |  |                     ylzResponseData = ylzResponse0.getJSONObject("data");
 | 
	
		
			
				|  |  |                     ylzResponseOutPut = ylzResponseData.getJSONObject("output");
 | 
	
		
			
				|  |  |                     setlinfo =  ylzResponseOutPut.getJSONObject("setlinfo");
 | 
	
		
			
				|  |  |                     JSONArray outPutSetldetail = ylzResponseOutPut.getJSONArray("setldetail");
 | 
	
		
			
				|  |  |                     JSONArray outPutResult = ylzResponseOutPut.getJSONArray("result");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     YlzMedicalMxDO medicalMxDO = ylzMedicalMxDOList.get(0);
 | 
	
		
			
				|  |  |                     JSONObject insurResultTmp = new JSONObject();
 | 
	
		
			
				|  |  |                     insurResultTmp.put("visitNo",ylzMedicalRelationDO.getRelationCode()); //院内挂号号
 | 
	
		
			
				|  |  |                     insurResultTmp.put("insurSettleSort",medicalMxDO.getInsurSettleSort()); //医保结算序号
 | 
	
		
			
				|  |  |                     insurResultTmp.put("setl_msgid",medicalMxDO.getSetlMsgid()); //发送方报文ID
 | 
	
		
			
				|  |  |                     insurResultTmp.put("fee_msgid",medicalMxDO.getFeeMsgid()); //费用上传发送方报文ID
 | 
	
		
			
				|  |  |                     insurResultTmp.put("dise_msgid",ylzMedicalIcdDOList.get(0).getDiseMsgid()); //就诊信息上传发送方报文ID
 | 
	
		
			
				|  |  |                     insurResultTmp.put("chrg_bchno",medicalMxDO.getChrgBchno());   //收费批次号
 | 
	
		
			
				|  |  |                     insurResultTmp.put("insuplc_admdvs",ylzMedicalRelationDO.getRegionCode()); //参保地医保区划【窗口冲销有用】
 | 
	
		
			
				|  |  |                     insurResultTmp.put("card_sn",ylzMedicalRelationDO.getCardSn()); //卡识别码
 | 
	
		
			
				|  |  |                     insurResultTmp.put("mdtrt_cert_no",ylzMedicalRelationDO.getCardNo()); //就诊凭证编号
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     JSONObject setlinfoEexpContent = JSONObject.parseObject(setlinfo.getString("exp_content"));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 JSONArray setldetail  = new JSONArray();
 | 
	
		
			
				|  |  |                 JSONObject setldetailTmp = new JSONObject();
 | 
	
		
			
				|  |  |                 setldetailTmp.put("fund_pay_type","");  //基金支付类型
 | 
	
		
			
				|  |  |                 setldetailTmp.put("inscp_scp_amt","");  //符合政策范围金额
 | 
	
		
			
				|  |  |                 setldetailTmp.put("crt_payb_lmt_amt","");   //本次可支付限额金额
 | 
	
		
			
				|  |  |                 setldetailTmp.put("fund_payamt","");    //基金支付金额
 | 
	
		
			
				|  |  |                 setldetailTmp.put("fund_pay_type_name",""); //基金支付类型名称
 | 
	
		
			
				|  |  |                 setldetailTmp.put("setl_proc_info",""); //结算过程信息
 | 
	
		
			
				|  |  |                 setldetail.add(setldetailTmp);
 | 
	
		
			
				|  |  |                     insurResultTmp.put("fm_acct_balc",setlinfoEexpContent.get("fm_acct_balc").toString()); //家庭共济账户余额
 | 
	
		
			
				|  |  |                     insurResultTmp.put("hl_acct_balc",setlinfoEexpContent.get("hl_acct_balc").toString()); //健康账户余额
 | 
	
		
			
				|  |  |                     insurResultTmp.put("cvl_acct_balc",setlinfoEexpContent.get("cvl_acct_balc").toString()); //公务员账户余额
 | 
	
		
			
				|  |  |                     insurResultTmp.put("acct_used_flag","1"); //个人账户使用标志【窗口目前默认固定1,后续可开放前端选择传入】
 | 
	
		
			
				|  |  |                     insurResultTmp.put("mdtrt_id",setlinfo.get("mdtrt_id")); //就诊 ID
 | 
	
		
			
				|  |  |                     insurResultTmp.put("setl_id",setlinfo.get("setl_id")); //结算ID
 | 
	
		
			
				|  |  |                     insurResultTmp.put("psn_no",setlinfo.get("psn_no")); //人员编号   医保人员基本信息获取接口返回
 | 
	
		
			
				|  |  |                     insurResultTmp.put("psn_name",setlinfo.get("psn_name")); //人员姓名
 | 
	
		
			
				|  |  |                     insurResultTmp.put("psn_cert_type",setlinfo.get("psn_cert_type")); //人员证件类型
 | 
	
		
			
				|  |  |                     insurResultTmp.put("certno",setlinfo.get("certno")); //证件号码
 | 
	
		
			
				|  |  |                     insurResultTmp.put("gend",setlinfo.get("gend")); //性别
 | 
	
		
			
				|  |  |                     insurResultTmp.put("naty",setlinfo.get("naty")); //民族
 | 
	
		
			
				|  |  |                     insurResultTmp.put("brdy",setlinfo.get("brdy")); //出生日期
 | 
	
		
			
				|  |  |                     insurResultTmp.put("age",setlinfo.get("age").toString()); //年龄
 | 
	
		
			
				|  |  |                     insurResultTmp.put("insutype","310"); //险种类型
 | 
	
		
			
				|  |  |                     insurResultTmp.put("psn_type","11"); //人员类别"
 | 
	
		
			
				|  |  |                     insurResultTmp.put("cvlserv_flag","0"); //公务员标志
 | 
	
		
			
				|  |  |                     insurResultTmp.put("setl_time", setlinfo.get("setl_time"));    //结算时间
 | 
	
		
			
				|  |  |                     insurResultTmp.put("mdtrt_cert_type","03");  //就诊凭证类型
 | 
	
		
			
				|  |  |                     insurResultTmp.put("med_type",setlinfo.get("med_type")); //医疗类别
 | 
	
		
			
				|  |  |                     insurResultTmp.put("medfee_sumamt",setlinfo.get("medfee_sumamt").toString());  //医疗费总额
 | 
	
		
			
				|  |  |                     insurResultTmp.put("fulamt_ownpay_amt",setlinfo.get("fulamt_ownpay_amt").toString()); //全自费金额
 | 
	
		
			
				|  |  |                     insurResultTmp.put("overlmt_selfpay",setlinfo.get("overlmt_selfpay").toString());  //超限价自费费用
 | 
	
		
			
				|  |  |                     insurResultTmp.put("preselfpay_amt",setlinfo.get("preselfpay_amt").toString());   //先行自付金额
 | 
	
		
			
				|  |  |                     insurResultTmp.put("inscp_scp_amt",setlinfo.get("inscp_scp_amt").toString());    //符合政策范围金额
 | 
	
		
			
				|  |  |                     insurResultTmp.put("act_pay_dedc",setlinfo.get("act_pay_dedc").toString()); //实际支付起付线
 | 
	
		
			
				|  |  |                     insurResultTmp.put("hifp_pay",setlinfo.get("hifp_pay").toString()); //基本医疗保险统筹基金支出
 | 
	
		
			
				|  |  |                     insurResultTmp.put("pool_prop_selfpay",setlinfo.get("pool_prop_selfpay").toString());    //基本医疗保险统筹基金支付比例
 | 
	
		
			
				|  |  |                     insurResultTmp.put("cvlserv_pay",setlinfo.get("cvlserv_pay").toString());  //公务员医疗补助资金支出
 | 
	
		
			
				|  |  |                     insurResultTmp.put("hifes_pay",setlinfo.get("hifes_pay").toString());    //企业补充医疗保险基金支出
 | 
	
		
			
				|  |  |                     insurResultTmp.put("hifmi_pay",setlinfo.get("hifmi_pay").toString());    //居民大病保险资金支出
 | 
	
		
			
				|  |  |                     insurResultTmp.put("hifob_pay",setlinfo.get("hifob_pay").toString());    //职工大额医疗费用补助基金支出
 | 
	
		
			
				|  |  |                     insurResultTmp.put("maf_pay",setlinfo.get("maf_pay").toString());  //医疗救助基金支出
 | 
	
		
			
				|  |  |                     insurResultTmp.put("oth_pay",setlinfo.get("oth_pay").toString());  //其他支出
 | 
	
		
			
				|  |  |                     insurResultTmp.put("fund_pay_sumamt",setlinfo.get("fund_pay_sumamt").toString());  //基金支付总额
 | 
	
		
			
				|  |  |                     insurResultTmp.put("psn_part_amt",setlinfo.get("psn_part_amt").toString()); //个人负担总金额
 | 
	
		
			
				|  |  |                     insurResultTmp.put("acct_pay",setlinfo.get("acct_pay").toString()); //个人账户支出
 | 
	
		
			
				|  |  |                     insurResultTmp.put("psn_cash_pay",setlinfo.get("psn_cash_pay").toString()); //个人现金支出
 | 
	
		
			
				|  |  |                     insurResultTmp.put("hosp_part_amt",setlinfo.get("hosp_part_amt").toString());    //医院负担金额
 | 
	
		
			
				|  |  |                     insurResultTmp.put("balc",setlinfo.get("balc").toString()); //余额
 | 
	
		
			
				|  |  |                     insurResultTmp.put("acct_mulaid_pay",setlinfo.get("acct_mulaid_pay").toString());  //个人账户共济支付金额
 | 
	
		
			
				|  |  |                     insurResultTmp.put("medins_setl_id",setlinfo.get("medins_setl_id"));   //医药机构结算ID(应跟setl_msgid值一致)
 | 
	
		
			
				|  |  |                     insurResultTmp.put("clr_optins",setlinfo.get("clr_optins"));   //清算经办机构
 | 
	
		
			
				|  |  |                     insurResultTmp.put("clr_way",setlinfo.get("clr_way"));  //清算方式
 | 
	
		
			
				|  |  |                     insurResultTmp.put("clr_type",setlinfo.get("clr_type")); //清算类别
 | 
	
		
			
				|  |  |                     insurResultTmp.put("hifdm_pay",setlinfo.get("setlinfo").toString());    //伤残人员医疗保障基金支出
 | 
	
		
			
				|  |  |                     insurResultTmp.put("exp_content",setlinfo.get("exp_content"));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 JSONArray fpdetail  = new JSONArray();
 | 
	
		
			
				|  |  |                 JSONObject fpdetailTmp  = new JSONObject();
 | 
	
		
			
				|  |  |                 fpdetailTmp.put("chrgitmType",""); //发票项目类别
 | 
	
		
			
				|  |  |                 fpdetailTmp.put("chrgitmTypeName","");  //发票项目类别名称
 | 
	
		
			
				|  |  |                 fpdetailTmp.put("medChrgitmType","");   //发票项目类别
 | 
	
		
			
				|  |  |                 fpdetailTmp.put("medChrgitmName","");   //发票项目类别名称
 | 
	
		
			
				|  |  |                 fpdetailTmp.put("itemSumamt","");   //发票项目费用
 | 
	
		
			
				|  |  |                 fpdetailTmp.put("itemClaaAmt","");  //医保发票费用
 | 
	
		
			
				|  |  |                 fpdetailTmp.put("itemClabAmt","");  //医保个人费用
 | 
	
		
			
				|  |  |                 fpdetailTmp.put("itemOthAmt","");   //特殊项目发票费用
 | 
	
		
			
				|  |  |                 fpdetailTmp.put("itemOwnpayAmt","");    //非医保发票费用
 | 
	
		
			
				|  |  |                 fpdetail.add(fpdetailTmp);
 | 
	
		
			
				|  |  |                     JSONArray setldetail  = new JSONArray();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 JSONArray feedetail_result  = new JSONArray();
 | 
	
		
			
				|  |  |                 JSONObject feedetail_resultTmp  = new JSONObject();
 | 
	
		
			
				|  |  |                 feedetail_resultTmp.put("feedetl_sn",medicalMxDO.getHisDetailSn());   // 费用明细流水
 | 
	
		
			
				|  |  |                 feedetail_resultTmp.put("det_item_fee_sumamt",medicalMxDO.getTotalMoney()); //明细项目费用总额
 | 
	
		
			
				|  |  |                 feedetail_resultTmp.put("cnt",medicalMxDO.getAmount()); //数量
 | 
	
		
			
				|  |  |                 feedetail_resultTmp.put("pric",medicalMxDO.getPrice()); //单价
 | 
	
		
			
				|  |  |                 feedetail_resultTmp.put("pric_uplmt_amt",""); //定价上限金额
 | 
	
		
			
				|  |  |                 feedetail_resultTmp.put("selfpay_prop",""); //自付比例
 | 
	
		
			
				|  |  |                 feedetail_resultTmp.put("fulamt_ownpay_amt",""); //全自费金额
 | 
	
		
			
				|  |  |                 feedetail_resultTmp.put("overlmt_amt",""); //超限价金额
 | 
	
		
			
				|  |  |                 feedetail_resultTmp.put("preselfpay_amt",""); //先行自付金额
 | 
	
		
			
				|  |  |                 feedetail_resultTmp.put("inscp_scp_amt",""); //符合政策范围金额
 | 
	
		
			
				|  |  |                 feedetail_resultTmp.put("chrgitm_lv",""); //收费项目等级
 | 
	
		
			
				|  |  |                 feedetail_resultTmp.put("med_chrgitm_type",""); //医疗收费项目类别
 | 
	
		
			
				|  |  |                 feedetail_resultTmp.put("bas_medn_flag",""); //基本药物标志
 | 
	
		
			
				|  |  |                 feedetail_resultTmp.put("hi_nego_drug_flag",""); //医保谈判药品标志
 | 
	
		
			
				|  |  |                 feedetail_resultTmp.put("chld_medc_flag",""); //儿童用药标志
 | 
	
		
			
				|  |  |                 feedetail_resultTmp.put("list_sp_item_flag",""); //目录特项标志
 | 
	
		
			
				|  |  |                 feedetail_resultTmp.put("lmt_used_flag",""); //限制使用标志
 | 
	
		
			
				|  |  |                 feedetail_resultTmp.put("drt_reim_flag",""); //直报标志
 | 
	
		
			
				|  |  |                 feedetail_resultTmp.put("memo",""); //备注
 | 
	
		
			
				|  |  |                 feedetail_resultTmp.put("exp_content",""); //字段扩展
 | 
	
		
			
				|  |  |                 feedetail_result.add(feedetail_resultTmp);
 | 
	
		
			
				|  |  |                     for (int j=0;j<outPutSetldetail.size();j++){
 | 
	
		
			
				|  |  |                         JSONObject outPutSetldetailTmp = outPutSetldetail.getJSONObject(j);
 | 
	
		
			
				|  |  |                         JSONObject setldetailTmp = new JSONObject();
 | 
	
		
			
				|  |  |                         setldetailTmp.put("fund_pay_type",null==outPutSetldetailTmp.get("fund_pay_type")?"":outPutSetldetailTmp.get("fund_pay_type").toString());  //基金支付类型
 | 
	
		
			
				|  |  |                         setldetailTmp.put("inscp_scp_amt",null==outPutSetldetailTmp.get("inscp_scp_amt")?"":outPutSetldetailTmp.get("inscp_scp_amt").toString());  //符合政策范围金额
 | 
	
		
			
				|  |  |                         setldetailTmp.put("crt_payb_lmt_amt",null==outPutSetldetailTmp.get("crt_payb_lmt_amt")?"":outPutSetldetailTmp.get("crt_payb_lmt_amt").toString());   //本次可支付限额金额
 | 
	
		
			
				|  |  |                         setldetailTmp.put("fund_payamt",null==outPutSetldetailTmp.get("fund_payamt")?"":outPutSetldetailTmp.get("fund_payamt").toString());    //基金支付金额
 | 
	
		
			
				|  |  |                         setldetailTmp.put("fund_pay_type_name",null==outPutSetldetailTmp.get("fund_pay_type_name")?"":outPutSetldetailTmp.get("fund_pay_type_name").toString()); //基金支付类型名称
 | 
	
		
			
				|  |  |                         setldetailTmp.put("setl_proc_info",null==outPutSetldetailTmp.get("setl_proc_info")?"":outPutSetldetailTmp.get("setl_proc_info").toString()); //结算过程信息
 | 
	
		
			
				|  |  |                         setldetail.add(setldetailTmp);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 insurResultTmp.put("setldetail",setldetail);
 | 
	
		
			
				|  |  |                 insurResultTmp.put("fpdetail",fpdetail);
 | 
	
		
			
				|  |  |                 insurResultTmp.put("feedetail_result",feedetail_result);
 | 
	
		
			
				|  |  |                     JSONArray fpdetail  = new JSONArray();
 | 
	
		
			
				|  |  |                     JSONArray fplists =  setlinfoEexpContent.getJSONArray("fplist");
 | 
	
		
			
				|  |  |                     for (int j=0;j<fplists.size();j++){
 | 
	
		
			
				|  |  |                         JSONObject fplistTmp = fplists.getJSONObject(j);
 | 
	
		
			
				|  |  |                         JSONObject fpdetailTmp  = new JSONObject();
 | 
	
		
			
				|  |  |                         fpdetailTmp.put("chrgitmType",null==fplistTmp.get("medChrgitmType")?"":fplistTmp.get("medChrgitmType").toString()); //发票项目类别
 | 
	
		
			
				|  |  |                         fpdetailTmp.put("chrgitmTypeName",null==fplistTmp.get("medChrgitmName")?"":fplistTmp.get("medChrgitmName").toString());  //发票项目类别名称
 | 
	
		
			
				|  |  |                         fpdetailTmp.put("itemSumamt",null==fplistTmp.get("itemSumamt")?"":fplistTmp.get("itemSumamt").toString());   //发票项目费用
 | 
	
		
			
				|  |  |                         fpdetailTmp.put("itemClaaAmt",null==fplistTmp.get("itemClaaAmt")?"":fplistTmp.get("itemClaaAmt").toString());  //医保发票费用
 | 
	
		
			
				|  |  |                         fpdetailTmp.put("itemClabAmt",null==fplistTmp.get("itemClabAmt")?"":fplistTmp.get("itemClabAmt").toString());  //医保个人费用
 | 
	
		
			
				|  |  |                         fpdetailTmp.put("itemOthAmt",null==fplistTmp.get("itemOthAmt")?"":fplistTmp.get("itemOthAmt").toString());   //特殊项目发票费用
 | 
	
		
			
				|  |  |                         fpdetailTmp.put("itemOwnpayAmt",null==fplistTmp.get("itemOwnpayAmt")?"":fplistTmp.get("itemOwnpayAmt").toString());    //非医保发票费用
 | 
	
		
			
				|  |  |                         fpdetail.add(fpdetailTmp);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 insurResult.add(insurResultTmp);
 | 
	
		
			
				|  |  |                     JSONArray feedetail_result  = new JSONArray();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     for (int j=0;j<outPutResult.size();j++){
 | 
	
		
			
				|  |  |                         JSONObject outPutResultTmp = outPutResult.getJSONObject(j);
 | 
	
		
			
				|  |  |                         JSONObject feedetail_resultTmp  = new JSONObject();
 | 
	
		
			
				|  |  |                         feedetail_resultTmp.put("feedetl_sn",null==outPutResultTmp.get("feedetl_sn")?"":outPutResultTmp.get("feedetl_sn").toString());   // 费用明细流水
 | 
	
		
			
				|  |  |                         feedetail_resultTmp.put("det_item_fee_sumamt",null==outPutResultTmp.get("det_item_fee_sumamt")?"":outPutResultTmp.get("det_item_fee_sumamt").toString()); //明细项目费用总额
 | 
	
		
			
				|  |  |                         feedetail_resultTmp.put("cnt",null==outPutResultTmp.get("cnt")?"":outPutResultTmp.get("cnt").toString()); //数量
 | 
	
		
			
				|  |  |                         feedetail_resultTmp.put("pric",null==outPutResultTmp.get("pric")?"":outPutResultTmp.get("pric").toString()); //单价
 | 
	
		
			
				|  |  |                         feedetail_resultTmp.put("pric_uplmt_amt",null==outPutResultTmp.get("pric_uplmt_amt")?"":outPutResultTmp.get("pric_uplmt_amt").toString()); //定价上限金额
 | 
	
		
			
				|  |  |                         feedetail_resultTmp.put("selfpay_prop",null==outPutResultTmp.get("selfpay_prop")?"":outPutResultTmp.get("selfpay_prop").toString()); //自付比例
 | 
	
		
			
				|  |  |                         feedetail_resultTmp.put("fulamt_ownpay_amt",null==outPutResultTmp.get("fulamt_ownpay_amt")?"":outPutResultTmp.get("fulamt_ownpay_amt").toString()); //全自费金额
 | 
	
		
			
				|  |  |                         feedetail_resultTmp.put("overlmt_amt",null==outPutResultTmp.get("overlmt_amt")?"":outPutResultTmp.get("overlmt_amt").toString()); //超限价金额
 | 
	
		
			
				|  |  |                         feedetail_resultTmp.put("preselfpay_amt",null==outPutResultTmp.get("preselfpay_amt")?"":outPutResultTmp.get("preselfpay_amt").toString()); //先行自付金额
 | 
	
		
			
				|  |  |                         feedetail_resultTmp.put("inscp_scp_amt",null==outPutResultTmp.get("inscp_scp_amt")?"":outPutResultTmp.get("inscp_scp_amt").toString()); //符合政策范围金额
 | 
	
		
			
				|  |  |                         feedetail_resultTmp.put("chrgitm_lv",null==outPutResultTmp.get("chrgitm_lv")?"":outPutResultTmp.get("chrgitm_lv").toString()); //收费项目等级
 | 
	
		
			
				|  |  |                         feedetail_resultTmp.put("med_chrgitm_type",null==outPutResultTmp.get("med_chrgitm_type")?"":outPutResultTmp.get("med_chrgitm_type").toString()); //医疗收费项目类别
 | 
	
		
			
				|  |  |                         feedetail_resultTmp.put("bas_medn_flag",null==outPutResultTmp.get("bas_medn_flag")?"":outPutResultTmp.get("bas_medn_flag").toString()); //基本药物标志
 | 
	
		
			
				|  |  |                         feedetail_resultTmp.put("hi_nego_drug_flag",null==outPutResultTmp.get("hi_nego_drug_flag")?"":outPutResultTmp.get("hi_nego_drug_flag").toString()); //医保谈判药品标志
 | 
	
		
			
				|  |  |                         feedetail_resultTmp.put("chld_medc_flag",null==outPutResultTmp.get("chld_medc_flag")?"":outPutResultTmp.get("chld_medc_flag").toString()); //儿童用药标志
 | 
	
		
			
				|  |  |                         feedetail_resultTmp.put("list_sp_item_flag",null==outPutResultTmp.get("list_sp_item_flag")?"":outPutResultTmp.get("list_sp_item_flag").toString()); //目录特项标志
 | 
	
		
			
				|  |  |                         feedetail_resultTmp.put("lmt_used_flag",null==outPutResultTmp.get("lmt_used_flag")?"":outPutResultTmp.get("lmt_used_flag").toString()); //限制使用标志
 | 
	
		
			
				|  |  |                         feedetail_resultTmp.put("drt_reim_flag",null==outPutResultTmp.get("drt_reim_flag")?"":outPutResultTmp.get("drt_reim_flag").toString()); //直报标志
 | 
	
		
			
				|  |  |                         feedetail_resultTmp.put("memo",null==outPutResultTmp.get("memo")?"":outPutResultTmp.get("memo").toString()); //备注
 | 
	
		
			
				|  |  |                         feedetail_resultTmp.put("exp_content",null==outPutResultTmp.get("exp_content")?"":outPutResultTmp.get("exp_content").toString()); //字段扩展
 | 
	
		
			
				|  |  |                         feedetail_result.add(feedetail_resultTmp);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     insurResultTmp.put("setldetail",setldetail);//直接取医保的返回值
 | 
	
		
			
				|  |  |                     insurResultTmp.put("fpdetail",fpdetail);
 | 
	
		
			
				|  |  |                     insurResultTmp.put("feedetail_result",feedetail_result);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     insurResult.add(insurResultTmp);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 msgBody.put("insurResult",insurResult);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             msgBody.put("insurResult",insurResult);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         JSONObject insurVisitTmp = new JSONObject();
 | 
	
		
			
				|  |  |         insurVisitTmp.put("visit_msgid",ylzMedicalRelationDO.getHisSettleNo());//发送方报文ID"
 | 
	
		
			
				|  |  |         insurVisitTmp.put("insuplc_admdvs",ylzMedicalRelationDO.getRegionCode());//参保地医保区划【窗口冲销有用】
 | 
	
		
			
				|  |  |         insurVisitTmp.put("insutype","310");//险种类型【挂号时用的险种,医保目前以此为准】
 | 
	
		
			
				|  |  |         insurVisitTmp.put("mdtrt_id",ylzMedicalRelationDO.getHisSerial());//就诊ID  医保挂号接口返回 todo
 | 
	
		
			
				|  |  |         insurVisitTmp.put("psn_no","");//人员编号   医保人员基本信息获取接口返回 todo
 | 
	
		
			
				|  |  |         insurVisitTmp.put("mdtrt_id",ylzMedicalRelationDO.getHisSerial());//就诊ID  医保挂号接口返回
 | 
	
		
			
				|  |  |         insurVisitTmp.put("psn_no",ylzMedicalRelationDO.getPsnNo());//人员编号   医保人员基本信息获取接口返回
 | 
	
		
			
				|  |  |         insurVisitTmp.put("ipt_otp_no",ylzMedicalRelationDO.getRelationCode());//门诊号
 | 
	
		
			
				|  |  |         insurVisitTmp.put("exp_content","");//字段扩展【应需要解决转义字符反斜杠被过滤问题,否则要将里面的扩展节点独立字段出
 | 
	
		
			
				|  |  |         insurVisitInfo.add(insurVisitTmp);
 | 
	
	
		
			
				|  | @ -254,7 +313,12 @@ public class JwService {
 | 
	
		
			
				|  |  |         param.put("interfaceStr","executeSickSettleMultiNew");//接口方法
 | 
	
		
			
				|  |  |         param.put("orgCode",ylzMedicalRelationDO.getOrgCode());
 | 
	
		
			
				|  |  |         param.put("msgBody",msgBody.toJSONString());
 | 
	
		
			
				|  |  |         JSONObject re = wlyyHttpService.sendWlyyMes("callEhrInterfaceYG", null,param);
 | 
	
		
			
				|  |  |         JSONObject re = null;
 | 
	
		
			
				|  |  |         if ("jwtest".equals(springProfiles)){
 | 
	
		
			
				|  |  |             String response = " ";
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             re = wlyyHttpService.sendWlyyMes("callEhrInterfaceYG", null,param);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
 | 
	
		
			
				|  |  |         wlyyHttpLogDO.setCode("callEhrInterfaceYG");
 | 
	
		
			
				|  |  |         wlyyHttpLogDO.setRequest(param.toString());
 | 
	
	
		
			
				|  | @ -263,7 +327,19 @@ public class JwService {
 | 
	
		
			
				|  |  |         wlyyHttpLogDO.setStatus("1");
 | 
	
		
			
				|  |  |         wlyyHttpLogDO.setCreateTime(new Date());
 | 
	
		
			
				|  |  |         httpLogDao.save(wlyyHttpLogDO);
 | 
	
		
			
				|  |  |         return re;
 | 
	
		
			
				|  |  |         if (re.getString("status").equalsIgnoreCase("200")) {//i健康返回值
 | 
	
		
			
				|  |  |             JSONObject responseDataTmp = re.getJSONObject("data");
 | 
	
		
			
				|  |  |             String codeTMP = responseDataTmp.getString("CODE");//智业返回值 0失败 1成功
 | 
	
		
			
				|  |  |             if (codeTMP.equalsIgnoreCase("1")) {
 | 
	
		
			
				|  |  |                 ylzMedicalRelationDO.setState(1);
 | 
	
		
			
				|  |  |                 ylzMedicailRelationDao.save(ylzMedicalRelationDO);
 | 
	
		
			
				|  |  |                 return true;
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 throw new Exception("结算失败"+responseDataTmp.getString("MESSAGE"));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             throw new Exception("结算失败"+re.getString("msg"));
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 |