|
@ -30,6 +30,7 @@ import com.yihu.jw.util.date.DateUtil;
|
|
|
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
|
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
|
import com.yihu.jw.util.http.HttpClientUtil;
|
|
|
import com.ylzinfo.ehc.common.utils.DateUtils;
|
|
|
import net.sf.json.util.JSONTokener;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
@ -637,34 +638,43 @@ public class HealthCareService {
|
|
|
if (outpatientDO == null){
|
|
|
throw new Exception("门诊信息不存在");
|
|
|
}
|
|
|
JSONObject data = new JSONObject();
|
|
|
data.put("order_code","");//订单号
|
|
|
data.put("order_time",DateUtil.dateToStrLong(outpatientDO.getCreateTime()));//订单时间
|
|
|
|
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByOutPatientIdList(outpatientId);
|
|
|
if(wlyyPrescriptionDOS.size()==0){
|
|
|
throw new Exception("处方信息不存在");
|
|
|
}
|
|
|
data.put("prescription_code",wlyyPrescriptionDOS.get(0).getRealOrder());//医院处方编号
|
|
|
data.put("channel","1");//1、微信公众号,2、app,3、web
|
|
|
// data.put("insurance_ticket_no","");//医保收费单据号 String N 订单结算后的收费单据号
|
|
|
data.put("order_state","");//订单状态 --1待发货、2配送中、3已签收、4已取消 String Y
|
|
|
List<WlyyPrescriptionExpressageDO> expressageDOList = prescriptionExpressageDao.findByOutpatientId(outpatientId);
|
|
|
if(expressageDOList.size()==0){
|
|
|
throw new Exception("收获信息不存在");
|
|
|
}
|
|
|
|
|
|
BasePatientDO patientDO = patientDao.findById(outpatientDO.getPatient());
|
|
|
if(patientDO==null){
|
|
|
throw new Exception("居民信息不存在");
|
|
|
}
|
|
|
WlyyPrescriptionExpressageDO expressageDO = expressageDOList.get(0);
|
|
|
data.put("order_addr_detail",expressageDO.getAddress());//订单详细地址
|
|
|
JSONObject data = new JSONObject();
|
|
|
data.put("order_code",outpatientDO.getRegisterNo());//订单号
|
|
|
data.put("order_time",DateUtil.dateToStrFormatLong(expressageDO.getCreateTime()));//订单时间
|
|
|
|
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByOutPatientIdList(outpatientId);
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
|
|
|
if(wlyyPrescriptionDOS.size()==0){
|
|
|
throw new Exception("处方信息不存在");
|
|
|
}
|
|
|
WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
|
|
|
data.put("prescription_code",wlyyPrescriptionDO.getRealOrder());//医院处方编号
|
|
|
data.put("channel","1");//1、微信公众号,2、app,3、web
|
|
|
data.put("insurance_ticket_no",ylzMedicalRelationDO.getBillSerial());//医保收费单据号 String N 订单结算后的收费单据号
|
|
|
String order_state = "";
|
|
|
if (wlyyPrescriptionDO.getStatus()==30){
|
|
|
order_state = "1";
|
|
|
}else if (wlyyPrescriptionDO.getStatus()==31){
|
|
|
order_state = "2";
|
|
|
}else if (wlyyPrescriptionDO.getStatus()==100){
|
|
|
order_state = "3";
|
|
|
}
|
|
|
data.put("order_state",order_state);//订单状态 --1待发货、2配送中、3已签收、4已取消 String Y
|
|
|
data.put("order_addr_detail",expressageDO.getProvinceName()+expressageDO.getCityName()+expressageDO.getTownName()+expressageDO.getStreetName()+expressageDO.getAddress());//订单详细地址
|
|
|
data.put("order_owner",expressageDO.getName());
|
|
|
data.put("order_owner_idcard",patientDO.getIdcard());
|
|
|
data.put("order_owner_phone",patientDO.getMobile());
|
|
|
|
|
|
Map<String,String> map = LatitudeUtils.getGeocoderLatitude(expressageDO.getAddress());
|
|
|
Map<String,String> map = LatitudeUtils.getGeocoderLatitude(expressageDO.getProvinceName()+expressageDO.getCityName()+expressageDO.getTownName()+expressageDO.getStreetName()+expressageDO.getAddress());
|
|
|
data.put("addr_lat",map.get("lat"));//收货地址纬度
|
|
|
data.put("addr_lng",map.get("lng"));//收货地址经度
|
|
|
if(expressageDO.getOneselfPickupFlg()==1){
|
|
@ -676,12 +686,12 @@ public class HealthCareService {
|
|
|
//非自取
|
|
|
data.put("delivery_way","1");//配送方式 1.网订配送,2.网订自取
|
|
|
data.put("delivery_number",expressageDO.getMailno());//配送单号
|
|
|
data.put("delivery_org","");//配送单位
|
|
|
data.put("delivery_take_time","");//配送接单时间
|
|
|
data.put("delivery_name","");//配送人姓名
|
|
|
data.put("delivery_id_card","");//配送人身份证
|
|
|
data.put("delivery_org","顺丰");//配送单位
|
|
|
data.put("delivery_take_time",DateUtil.dateToStrFormatLong(wlyyPrescriptionDO.getPayTime()));//配送接单时间
|
|
|
data.put("delivery_name","顺丰");//配送人姓名
|
|
|
data.put("delivery_id_card","顺丰");//配送人身份证
|
|
|
// data.put("delivery_phone","");//配送人联系电话 N
|
|
|
data.put("getmedical_time","");//骑手取药记录
|
|
|
data.put("getmedical_time",DateUtil.dateToStrFormatLong(wlyyPrescriptionDO.getPayTime()));//骑手取药记录
|
|
|
data.put("delivery_money","");//配送费
|
|
|
|
|
|
}
|
|
@ -689,17 +699,26 @@ public class HealthCareService {
|
|
|
// apothecary_id_card 药师身份证 String N
|
|
|
// apothecary_audit 药师审核时间 String N
|
|
|
|
|
|
data.put("money","");//商品金额
|
|
|
data.put("settlement_time","");//结算时间
|
|
|
data.put("data_source","");//数据来源
|
|
|
data.put("delivery_time","");//发单时间
|
|
|
data.put("money",ylzMedicalRelationDO.getTotalAmount());//商品金额
|
|
|
data.put("settlement_time",DateUtil.dateToStrFormatLong(ylzMedicalRelationDO.getPayDate()));//结算时间
|
|
|
data.put("data_source",ylzMedicalRelationDO.getDataSource());//数据来源
|
|
|
data.put("delivery_time",DateUtil.dateToStrFormatLong(wlyyPrescriptionDO.getPayTime()));//发单时间
|
|
|
|
|
|
data.put("elec_prescription_code",wlyyPrescriptionDOS.get(0).getId());//平台处方编号
|
|
|
data.put("prescription_code",wlyyPrescriptionDOS.get(0).getRealOrder());//医院处方编号
|
|
|
data.put("elec_prescription_code",wlyyPrescriptionDO.getId());//平台处方编号
|
|
|
data.put("prescription_code",wlyyPrescriptionDO.getRealOrder());//医院处方编号
|
|
|
// data.put("insurance_serial",outpatientDO.getInsuranceSerial());//医保门诊流水号
|
|
|
data.put("his_serial","");//门诊业务流水号
|
|
|
|
|
|
|
|
|
data.put("his_serial",ylzMedicalRelationDO.getHisSerial());//门诊业务流水号
|
|
|
JSONArray array = new JSONArray();
|
|
|
List<YlzMedicalMxDO> ylzMedicalMxDOS = ylzMedicailMxDao.findByMedicalId(ylzMedicalRelationDO.getId());
|
|
|
for (YlzMedicalMxDO ylzMedicalMxDO:ylzMedicalMxDOS){
|
|
|
JSONObject object = new JSONObject();
|
|
|
object.put("order_id",outpatientDO.getRegisterNo());
|
|
|
object.put("settlement_no",ylzMedicalRelationDO.getHisBillSerial());
|
|
|
object.put("item_name",ylzMedicalMxDO.getItemName());
|
|
|
object.put("item_code",ylzMedicalMxDO.getItemCode());
|
|
|
array.add(object);
|
|
|
}
|
|
|
data.put("MXLIST",array);
|
|
|
// mxlist 药品明细 MXLIST N
|
|
|
// MXLIST
|
|
|
// order_id 订单号 String Y
|
|
@ -1144,13 +1163,13 @@ public class HealthCareService {
|
|
|
*
|
|
|
* 返回值
|
|
|
*
|
|
|
* @param registerNo 挂号号
|
|
|
* @param outpatientId 系统id
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String register(String registerNo) throws Exception{
|
|
|
public String register(String outpatientId) throws Exception{
|
|
|
String funid = "N20.17.04.01";
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(registerNo);
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
|
|
|
if (ylzMedicalRelationDO==null){
|
|
|
throw new Exception("上传医保挂号失败:结算信息为空!");
|
|
|
}
|
|
@ -1177,6 +1196,8 @@ public class HealthCareService {
|
|
|
JSONObject encryptData = object.getJSONObject("encrypt_data");
|
|
|
String insuranceSerial = encryptData.getString("insurance_serial");
|
|
|
ylzMedicalRelationDO.setInsuranceSerial(insuranceSerial);
|
|
|
ylzMedicalRelationDO.setInsuranceType(encryptData.getString("insurance_type"));
|
|
|
ylzMedicalRelationDO.setInsuranceTypeName(encryptData.getString("insurance_type_name"));
|
|
|
ylzMedicailRelationDao.save(ylzMedicalRelationDO);
|
|
|
logger.info("医保挂号流水号保存成功");
|
|
|
}
|
|
@ -1188,14 +1209,14 @@ public class HealthCareService {
|
|
|
*
|
|
|
* 返回值
|
|
|
*
|
|
|
* @param registerNo 挂号号
|
|
|
* @param outpatientId 门诊id
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String registerToEntrance(String registerNo) throws Exception{
|
|
|
public String registerToEntrance(String outpatientId) throws Exception{
|
|
|
String result = "";
|
|
|
String response="";
|
|
|
String url = entranceHealthCareUrl+"register?registerNo="+registerNo;
|
|
|
String url = entranceHealthCareUrl+"register?outpatientId="+outpatientId;
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
logger.info("response:"+response);
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
@ -1210,13 +1231,13 @@ public class HealthCareService {
|
|
|
*
|
|
|
* 返回值
|
|
|
*
|
|
|
* @param registerNo 挂号号
|
|
|
* @param outpatientId 挂号号
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String registerBack(String registerNo) throws Exception{
|
|
|
public String registerBack(String outpatientId) throws Exception{
|
|
|
String funid = "N20.17.04.02";
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(registerNo);
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
|
|
|
if (ylzMedicalRelationDO==null){
|
|
|
throw new Exception("医保挂号冲销失败:结算信息为空!");
|
|
|
}
|
|
@ -1249,14 +1270,14 @@ public class HealthCareService {
|
|
|
*
|
|
|
* 返回值
|
|
|
*
|
|
|
* @param registerNo 挂号号
|
|
|
* @param outpatientId 挂号号
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String registerBackToEntrance(String registerNo) throws Exception{
|
|
|
public String registerBackToEntrance(String outpatientId) throws Exception{
|
|
|
String result = "";
|
|
|
String response="";
|
|
|
String url = entranceHealthCareUrl+"registerBack?registerNo="+registerNo;
|
|
|
String url = entranceHealthCareUrl+"registerBack?outpatientId="+outpatientId;
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
logger.info("response:"+response);
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
@ -1269,13 +1290,13 @@ public class HealthCareService {
|
|
|
/**
|
|
|
* 2.5.3医保费用明细上传(N20.17.04.03)
|
|
|
*
|
|
|
* @param registerNo 挂号号
|
|
|
* @param outpatientId 挂号号
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String feeDetailUpload(String registerNo) throws Exception{
|
|
|
public String feeDetailUpload(String outpatientId) throws Exception{
|
|
|
String funid = "N20.17.04.03";
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(registerNo);
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
|
|
|
if (ylzMedicalRelationDO==null){
|
|
|
throw new Exception("医保费用明细上传:结算信息为空!");
|
|
|
}
|
|
@ -1353,14 +1374,14 @@ public class HealthCareService {
|
|
|
/**
|
|
|
* 2.5.3医保费用明细上传(N20.17.04.03)
|
|
|
*
|
|
|
* @param registerNo 挂号号
|
|
|
* @param outpatientId 挂号号
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String feeDetailUploadToEntrance(String registerNo) throws Exception{
|
|
|
public String feeDetailUploadToEntrance(String outpatientId) throws Exception{
|
|
|
String result = "";
|
|
|
String response="";
|
|
|
String url = entranceHealthCareUrl+"feeDetailUpload?registerNo="+registerNo;
|
|
|
String url = entranceHealthCareUrl+"feeDetailUpload?outpatientId="+outpatientId;
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
logger.info("response:"+response);
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
@ -1375,13 +1396,13 @@ public class HealthCareService {
|
|
|
*
|
|
|
* 返回值
|
|
|
*
|
|
|
* @param registerNo 挂号号
|
|
|
* @param outpatientId 挂号号
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String feeDetailRefund(String registerNo,String remark) throws Exception{
|
|
|
public String feeDetailRefund(String outpatientId,String remark) throws Exception{
|
|
|
String funid = "N20.17.04.04";
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(registerNo);
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
|
|
|
if (ylzMedicalRelationDO==null){
|
|
|
throw new Exception("医保费用明细上传:结算信息为空!");
|
|
|
}
|
|
@ -1413,14 +1434,14 @@ public class HealthCareService {
|
|
|
*
|
|
|
* 返回值
|
|
|
*
|
|
|
* @param registerNo 挂号号
|
|
|
* @param outpatientId 门诊id
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String feeDetailRefundToEntrance(String registerNo,String remark) throws Exception{
|
|
|
public String feeDetailRefundToEntrance(String outpatientId,String remark) throws Exception{
|
|
|
String result = "";
|
|
|
String response="";
|
|
|
String url = entranceHealthCareUrl+"feeDetailRefund?registerNo="+registerNo+"&remark="+remark;
|
|
|
String url = entranceHealthCareUrl+"feeDetailRefund?outpatientId="+outpatientId+"&remark="+remark;
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
logger.info("response:"+response);
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
@ -1435,13 +1456,13 @@ public class HealthCareService {
|
|
|
*
|
|
|
* 返回值
|
|
|
*
|
|
|
* @param registerNo 挂号号
|
|
|
* @param outpatientId 挂号号
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public YlzMedicalRelationDO preSettlement(String registerNo) throws Exception{
|
|
|
public YlzMedicalRelationDO preSettlement(String outpatientId) throws Exception{
|
|
|
String funid = "N20.17.04.05";
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(registerNo);
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
|
|
|
if (ylzMedicalRelationDO==null){
|
|
|
throw new Exception("医保费用明细上传:结算信息为空!");
|
|
|
}
|
|
@ -1474,8 +1495,69 @@ public class HealthCareService {
|
|
|
String result = requestYlz(data,funid,"医保预结算服务");
|
|
|
if (result==null){
|
|
|
throw new Exception("医保预结算服务失败!");
|
|
|
}
|
|
|
}else {
|
|
|
JSONObject resObj = JSONObject.parseObject(result);
|
|
|
if (resObj.getString("flag").equalsIgnoreCase("1")){
|
|
|
JSONObject jsonObject = resObj.getJSONObject("encrypt_data");
|
|
|
ylzMedicalRelationDO.setAccountBalance(jsonObject.getString("account_balance"));
|
|
|
ylzMedicalRelationDO.setBillSerial(jsonObject.getString("bill_serial"));
|
|
|
ylzMedicalRelationDO.setPersonalCode(jsonObject.getString("personal_code"));
|
|
|
ylzMedicalRelationDO.setSex(jsonObject.getString("sex"));
|
|
|
ylzMedicalRelationDO.setSexMc(jsonObject.getString("sex_mc"));
|
|
|
ylzMedicalRelationDO.setPersonCash(jsonObject.getString("person_cash"));
|
|
|
ylzMedicalRelationDO.setPersonAccount(jsonObject.getString("person_account"));
|
|
|
ylzMedicalRelationDO.setFundPrice(jsonObject.getString("fund_price"));
|
|
|
ylzMedicalRelationDO.setJkzhPay(jsonObject.getString("own_jkzh_pay"));
|
|
|
ylzMedicalRelationDO.setOwnPay(jsonObject.getString("own_pay"));
|
|
|
ylzMedicalRelationDO.setCardNo(jsonObject.getString("card_no"));
|
|
|
ylzMedicalRelationDO.setHospitalizationQty(jsonObject.getString("hospitalization_times"));
|
|
|
ylzMedicalRelationDO.setPayDate(DateUtil.strToDate(jsonObject.getString("pay_date")+jsonObject.getString("pay_time")));
|
|
|
ylzMedicalRelationDO.setInvoiceJj(jsonObject.getString("invoice_jj"));
|
|
|
ylzMedicalRelationDO.setInvoiceXj(jsonObject.getString("invoice_xj"));
|
|
|
ylzMedicalRelationDO.setInvoiceZh(jsonObject.getString("invoice_zh"));
|
|
|
ylzMedicalRelationDO.setDiseaseCode(jsonObject.getString("disease_code"));
|
|
|
ylzMedicalRelationDO.setTreatmentType(jsonObject.getString("treatment_type"));
|
|
|
ylzMedicalRelationDO.setTreatmentTypeName(jsonObject.getString("treatment_type_name"));
|
|
|
ylzMedicalRelationDO.setAllopatryType(jsonObject.getString("allopatry_type"));
|
|
|
ylzMedicalRelationDO.setAllopatryTypeName(jsonObject.getString("allopatry_type_name"));
|
|
|
ylzMedicalRelationDO.setAdministrativeArea(jsonObject.getString("administrative_area"));
|
|
|
ylzMedicalRelationDO.setPayStandard(jsonObject.getString("pay_standard"));
|
|
|
ylzMedicalRelationDO.setTcjjPay(jsonObject.getString("tcjj_pay"));
|
|
|
ylzMedicalRelationDO.setSbjjPay(jsonObject.getString("sbjj_pay"));
|
|
|
ylzMedicalRelationDO.setGwyPay(jsonObject.getString("gwy_pay"));
|
|
|
ylzMedicalRelationDO.setJzfpPay(jsonObject.getString("jzfp_pay"));
|
|
|
ylzMedicalRelationDO.setYljzPay(jsonObject.getString("yljz_pay"));
|
|
|
ylzMedicalRelationDO.setOtherPay(jsonObject.getString("other_pay"));
|
|
|
ylzMedicalRelationDO.setEnterpriseSupplement(jsonObject.getString("enterprise_supplement"));
|
|
|
ylzMedicalRelationDO.setJtgjPay(jsonObject.getString("jtgj_pay"));
|
|
|
ylzMedicalRelationDO.setCollector(jsonObject.getString("collector"));
|
|
|
Double price= Double.parseDouble(ylzMedicalRelationDO.getTcjjPay())+Double.parseDouble(ylzMedicalRelationDO.getSbjjPay())+
|
|
|
Double.parseDouble(ylzMedicalRelationDO.getJzfpPay())+Double.parseDouble(ylzMedicalRelationDO.getYljzPay())+
|
|
|
Double.parseDouble(ylzMedicalRelationDO.getOtherPay())+Double.parseDouble(ylzMedicalRelationDO.getEnterpriseSupplement());
|
|
|
ylzMedicalRelationDO.setMedicalPrice(price+"");
|
|
|
ylzMedicalRelationDO = ylzMedicailRelationDao.save(ylzMedicalRelationDO);
|
|
|
JSONArray jsonArray = jsonObject.getJSONArray("fplist");
|
|
|
for (int i=0;i<jsonArray.size();i++){
|
|
|
JSONObject jsonObject1 = jsonArray.getJSONObject(i);
|
|
|
YlzMedicalBillDO ylzMb = new YlzMedicalBillDO();
|
|
|
ylzMb.setMedicalId(ylzMedicalRelationDO.getId());
|
|
|
ylzMb.setInvoicePay(jsonObject1.getString("invoice_pay"));
|
|
|
ylzMb.setInvoiceType(jsonObject1.getString("invoice_type"));
|
|
|
ylzMb.setInvoiceTypeName(jsonObject1.getString("invoice_type_name"));
|
|
|
ylzMb.setProjectPay(jsonObject1.getString("project_pay"));
|
|
|
ylzMb.setOwnPay(jsonObject1.getString("own_pay"));
|
|
|
ylzMb.setSpecialPay(jsonObject1.getString("special_pay"));
|
|
|
ylzMb.setUninsurancePay(jsonObject1.getString("uninsurance_pay"));
|
|
|
ylzMb.setCreateTime(new Date());
|
|
|
ylzMedicailBillDao.save(ylzMb);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
List<YlzMedicalIcdDO> icdDOList = ylzMedicailIcdDao.findByMedicalId(ylzMedicalRelationDO.getId());
|
|
|
List<YlzMedicalMxDO> mxDOList = ylzMedicailMxDao.findByMedicalId(ylzMedicalRelationDO.getId());
|
|
|
ylzMedicalRelationDO.setYlzMedicalIcdDOList(icdDOList);
|
|
|
ylzMedicalRelationDO.setYlzMedicalMxDOList(mxDOList);
|
|
|
return ylzMedicalRelationDO;
|
|
|
}
|
|
|
|
|
@ -1484,12 +1566,12 @@ public class HealthCareService {
|
|
|
*
|
|
|
* 返回值
|
|
|
*
|
|
|
* @param registerNo 挂号号
|
|
|
* @param outpatientId 门诊id
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public YlzMedicalRelationDO preSettlementToEntrance(String registerNo) throws Exception{
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(registerNo);
|
|
|
public YlzMedicalRelationDO preSettlementToEntrance(String outpatientId) throws Exception{
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
|
|
|
if (ylzMedicalRelationDO==null){
|
|
|
throw new Exception("医保费用明细上传:结算信息为空!");
|
|
|
}
|
|
@ -1503,7 +1585,7 @@ public class HealthCareService {
|
|
|
}
|
|
|
String result = "";
|
|
|
String response="";
|
|
|
String url = entranceHealthCareUrl+"preSettlement?registerNo="+registerNo;
|
|
|
String url = entranceHealthCareUrl+"preSettlement?outpatientId="+outpatientId;
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
logger.info("response:"+response);
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
@ -1557,14 +1639,14 @@ public class HealthCareService {
|
|
|
*
|
|
|
* 返回值
|
|
|
*
|
|
|
* @param registerNo
|
|
|
* @param outpatientId
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String preSettlementRefundToEntrance(String registerNo) throws Exception{
|
|
|
public String preSettlementRefundToEntrance(String outpatientId) throws Exception{
|
|
|
String result = "";
|
|
|
String response="";
|
|
|
String url = entranceHealthCareUrl+"feeDetailRefund?registerNo="+registerNo;
|
|
|
String url = entranceHealthCareUrl+"feeDetailRefund?outpatientId="+outpatientId;
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
logger.info("response:"+response);
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
@ -1579,13 +1661,13 @@ public class HealthCareService {
|
|
|
*
|
|
|
* 返回值
|
|
|
*
|
|
|
* @param registerNo
|
|
|
* @param outpatientId
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String preSettlementRefund(String registerNo) throws Exception{
|
|
|
public String preSettlementRefund(String outpatientId) throws Exception{
|
|
|
String funid = "N20.17.04.06";
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(registerNo);
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
|
|
|
if (ylzMedicalRelationDO==null){
|
|
|
throw new Exception("医保结算冲销上传:结算信息为空!");
|
|
|
}
|
|
@ -1596,7 +1678,7 @@ public class HealthCareService {
|
|
|
data.put("cert_type",ylzMedicalRelationDO.getCertType());//证件类型
|
|
|
data.put("medical_mode",ylzMedicalRelationDO.getMedicalMode());//医疗就诊方式
|
|
|
data.put("bill_serial",ylzMedicalRelationDO.getBillSerial());//医保收费流水号
|
|
|
data.put("his_bill_serial",ylzMedicalRelationDO.getHisSerial());//his收费单据流水号
|
|
|
data.put("his_bill_serial",ylzMedicalRelationDO.getHisSettleNo());//his收费单据流水号
|
|
|
data.put("insurance_serial",ylzMedicalRelationDO.getInsuranceSerial());//医保流水号
|
|
|
data.put("data_source",ylzMedicalRelationDO.getDataSource());//数据来源
|
|
|
data.put("refund_serial",ylzMedicalRelationDO.getHisSerial());//医院退费操作流水号
|
|
@ -1617,14 +1699,14 @@ public class HealthCareService {
|
|
|
*
|
|
|
* 返回值
|
|
|
*
|
|
|
* @param registerNo 挂号号
|
|
|
* @param outpatientId 挂号号
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String getSettlementResultUrl(String registerNo) throws Exception{
|
|
|
public String getSettlementResultUrl(String outpatientId) throws Exception{
|
|
|
String funid = "N20.17.04.07";
|
|
|
JSONObject data = new JSONObject();
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(registerNo);
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
|
|
|
if (ylzMedicalRelationDO==null){
|
|
|
throw new Exception("获取医保结算页面地址:结算信息为空!");
|
|
|
}
|
|
@ -1640,13 +1722,13 @@ public class HealthCareService {
|
|
|
data.put("medical_type",ylzMedicalRelationDO.getMedicalType());//医疗类别
|
|
|
data.put("insurance_serial",ylzMedicalRelationDO.getInsuranceSerial());//
|
|
|
data.put("his_bill_serial",ylzMedicalRelationDO.getHisBillSerial());//his收费单据流水号
|
|
|
data.put("date",DateUtil.dateToStrFormatLong(ylzMedicalRelationDO.getDate()));//实际就诊日期
|
|
|
data.put("date",DateUtil.dateToStrFormatShort(ylzMedicalRelationDO.getDate()));//实际就诊日期
|
|
|
data.put("leave_method","09");//离院方式
|
|
|
data.put("pre_count",ylzMedicalRelationDO.getPreCount());//处方项目数
|
|
|
data.put("total_amount",ylzMedicalRelationDO.getTotalAmount());//医疗费总金额
|
|
|
data.put("person_cash",ylzMedicalRelationDO.getPersonCash());//个人现金支付金额(实付现金)
|
|
|
data.put("person_account",ylzMedicalRelationDO.getPersonAccount());//个人账户支付金额
|
|
|
data.put("fund_price",ylzMedicalRelationDO.getFundPrice());//基金支付总额
|
|
|
data.put("fund_price",ylzMedicalRelationDO.getMedicalPrice());//基金支付总额
|
|
|
data.put("data_source",ylzMedicalRelationDO.getDataSource());//数据来源
|
|
|
data.put("his_serial",ylzMedicalRelationDO.getHisSerial());//his流水号
|
|
|
data.put("doctor_level",ylzMedicalRelationDO.getDoctorLevel());//医师诊查费等级
|
|
@ -1656,9 +1738,19 @@ public class HealthCareService {
|
|
|
object.put("detail_serial",ylzMedicalRelationDO.getDetailSerial());
|
|
|
array.add(object);
|
|
|
data.put("cflist",array);
|
|
|
String result = requestYlz(data,funid,"获取医保结算结果");
|
|
|
String result = requestYlz(data,funid,"获取医保结算页面地址");
|
|
|
if (result==null){
|
|
|
throw new Exception("获取医保结算结果失败!");
|
|
|
throw new Exception("获取医保结算页面地址失败!");
|
|
|
}else {
|
|
|
JSONObject resObj = JSONObject.parseObject(result);
|
|
|
if (resObj.getString("flag").equalsIgnoreCase("1")){
|
|
|
JSONObject jsonObject = resObj.getJSONObject("encrypt_data");
|
|
|
String link_url = jsonObject.getString("link_url");
|
|
|
String str1=link_url.substring(0, link_url.indexOf("="));
|
|
|
String str2=link_url.substring(str1.length()+1, link_url.length());
|
|
|
ylzMedicalRelationDO.setPageCode(str2);
|
|
|
ylzMedicailRelationDao.save(ylzMedicalRelationDO);
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
@ -1669,14 +1761,14 @@ public class HealthCareService {
|
|
|
*
|
|
|
* 返回值
|
|
|
*
|
|
|
* @param registerNo 挂号号
|
|
|
* @param outpatientId 挂号号
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String getSettlementResultUrlToEntrance(String registerNo) throws Exception{
|
|
|
public String getSettlementResultUrlToEntrance(String outpatientId) throws Exception{
|
|
|
String result = "";
|
|
|
String response="";
|
|
|
String url = entranceHealthCareUrl+"getSettlementResultUrl?registerNo="+registerNo;
|
|
|
String url = entranceHealthCareUrl+"getSettlementResultUrl?outpatientId="+outpatientId;
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
logger.info("response:"+response);
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
@ -1693,14 +1785,14 @@ public class HealthCareService {
|
|
|
*
|
|
|
* 返回值
|
|
|
*
|
|
|
* @param registerNo 挂号号
|
|
|
* @param outpatientId 挂号号
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String getSettlementResultUrlBase64(String registerNo) throws Exception{
|
|
|
public String getSettlementResultUrlBase64(String outpatientId) throws Exception{
|
|
|
String funid = "N20.17.04.08";
|
|
|
JSONObject data = new JSONObject();
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(registerNo);
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
|
|
|
if (ylzMedicalRelationDO==null){
|
|
|
throw new Exception("获取医保结算页面地址:结算信息为空!");
|
|
|
}
|
|
@ -1716,20 +1808,20 @@ public class HealthCareService {
|
|
|
data.put("medical_type",ylzMedicalRelationDO.getMedicalType());//医疗类别
|
|
|
data.put("insurance_serial",ylzMedicalRelationDO.getInsuranceSerial());//
|
|
|
data.put("his_bill_serial",ylzMedicalRelationDO.getHisBillSerial());//his收费单据流水号
|
|
|
data.put("date",DateUtil.dateToStrFormatLong(ylzMedicalRelationDO.getDate()));//实际就诊日期
|
|
|
data.put("date",DateUtil.dateToStrFormatShort(ylzMedicalRelationDO.getDate()));//实际就诊日期
|
|
|
data.put("leave_method","09");//离院方式
|
|
|
data.put("pre_count",ylzMedicalRelationDO.getPreCount());//处方项目数
|
|
|
data.put("total_amount",ylzMedicalRelationDO.getTotalAmount());//医疗费总金额
|
|
|
data.put("person_cash",ylzMedicalRelationDO.getPersonCash());//个人现金支付金额(实付现金)
|
|
|
data.put("person_account",ylzMedicalRelationDO.getPersonAccount());//个人账户支付金额
|
|
|
data.put("fund_price",ylzMedicalRelationDO.getFundPrice());//基金支付总额
|
|
|
data.put("fund_price",ylzMedicalRelationDO.getMedicalPrice());//基金支付总额
|
|
|
data.put("data_source",ylzMedicalRelationDO.getDataSource());//数据来源
|
|
|
data.put("his_serial",ylzMedicalRelationDO.getHisSerial());//his流水号
|
|
|
data.put("doctor_level",ylzMedicalRelationDO.getDoctorLevel());//医师诊查费等级
|
|
|
data.put("redirect_url",wlyyHospitalSysDictDO.getDictValue());//回调地址
|
|
|
String result = requestYlz(data,funid,"获取医保结算结果");
|
|
|
String result = requestYlz(data,funid,"获取医保结算页面地址");
|
|
|
if (result==null){
|
|
|
throw new Exception("获取医保结算结果失败!");
|
|
|
throw new Exception("获取医保结算页面地址失败!");
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
@ -1740,14 +1832,14 @@ public class HealthCareService {
|
|
|
*
|
|
|
* 返回值
|
|
|
*
|
|
|
* @param registerNo 挂号号
|
|
|
* @param outpatientId 挂号号
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String getSettlementResultUrlBase64ToEntrance(String registerNo) throws Exception{
|
|
|
public String getSettlementResultUrlBase64ToEntrance(String outpatientId) throws Exception{
|
|
|
String result = "";
|
|
|
String response="";
|
|
|
String url = entranceHealthCareUrl+"getSettlementResultUrlBase64?registerNo="+registerNo;
|
|
|
String url = entranceHealthCareUrl+"getSettlementResultUrlBase64?outpatientId="+outpatientId;
|
|
|
response = httpClientUtil.get(url,"GBK");
|
|
|
logger.info("response:"+response);
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
@ -1777,6 +1869,19 @@ public class HealthCareService {
|
|
|
if (result==null){
|
|
|
throw new Exception("获取医保结算结果失败!");
|
|
|
}
|
|
|
com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
|
|
|
if (object.getString("flag").equalsIgnoreCase("1")){
|
|
|
JSONObject jsonObject = object.getJSONObject("encrypt_data");
|
|
|
String insuranceSerial = jsonObject.getString("insurance_serial");
|
|
|
String billSerial = jsonObject.getString("bill_serial");
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByInsuranceSerial(insuranceSerial);
|
|
|
if (ylzMedicalRelationDO!=null){
|
|
|
ylzMedicalRelationDO.setStatus(1);
|
|
|
ylzMedicalRelationDO.setBillSerial(billSerial);
|
|
|
ylzMedicalRelationDO.setPayDate(DateUtil.strToDate(jsonObject.getString("pay_date")+jsonObject.getString("pay_time")));
|
|
|
ylzMedicailRelationDao.save(ylzMedicalRelationDO);
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|