|
@ -7337,19 +7337,30 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
Boolean flag = healthCareService.isHospitalFlag();
|
|
|
if (flag){
|
|
|
try{
|
|
|
String result = healthCareService.authorizedToEntrace(basePatientDO.getId());
|
|
|
com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
|
|
|
if (object.getString("flag").equalsIgnoreCase("1")){
|
|
|
com.alibaba.fastjson.JSONObject encryptData = object.getJSONObject("encrypt_data");
|
|
|
String state = encryptData.getString("state");
|
|
|
String auth_date = encryptData.getString("auth_date");
|
|
|
basePatientDO.setMedicalState(state);
|
|
|
basePatientDO = basePatientDao.save(basePatientDO);
|
|
|
if (wechatId.equalsIgnoreCase("xm_xzzx_wx")){
|
|
|
String result = healthCareService.authorizedToEntrace(basePatientDO.getId());
|
|
|
com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
|
|
|
if (object.getString("flag").equalsIgnoreCase("1")){
|
|
|
com.alibaba.fastjson.JSONObject encryptData = object.getJSONObject("encrypt_data");
|
|
|
String state = encryptData.getString("state");
|
|
|
String auth_date = encryptData.getString("auth_date");
|
|
|
basePatientDO.setMedicalState(state);
|
|
|
basePatientDO = basePatientDao.save(basePatientDO);
|
|
|
}
|
|
|
}else {
|
|
|
String result = healthCareService.authorized(basePatientDO.getId());
|
|
|
com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
|
|
|
if (object.getString("flag").equalsIgnoreCase("1")){
|
|
|
com.alibaba.fastjson.JSONObject encryptData = object.getJSONObject("encrypt_data");
|
|
|
String state = encryptData.getString("state");
|
|
|
String auth_date = encryptData.getString("auth_date");
|
|
|
basePatientDO.setMedicalState(state);
|
|
|
basePatientDO = basePatientDao.save(basePatientDO);
|
|
|
}
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01", patient, "1");
|
|
|
List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,patient);
|
|
@ -14047,17 +14058,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
object.put("deptName",outpatientDO.getPatientName());
|
|
|
return object;
|
|
|
}else {
|
|
|
/*entranceService.BS10108()*/
|
|
|
/*entrance(outpatientDO.getCardNo(),registerNo,sysDictDO.getDictValue());*/
|
|
|
com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
|
|
|
logger.info("获取患者待结算信息开始!");
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = new YlzMedicalRelationDO();
|
|
|
ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
|
|
|
|
|
|
/*if (ylzMedicalRelationDO!=null&&ylzMedicalRelationDO.getStatus()==1){
|
|
|
if (ylzMedicalRelationDO!=null&&ylzMedicalRelationDO.getStatus()==1){
|
|
|
//医保已结算直接返回数据
|
|
|
List<YlzMedicalMxDO> mxDOList = ylzMedicailMxDao.findByMedicalId(ylzMedicalRelationDO.getId());
|
|
|
ylzMedicalRelationDO.setYlzMedicalMxDOList(mxDOList);
|
|
|
Double totalPirce=Double.parseDouble(ylzMedicalRelationDO.getPersonCash())+Double.parseDouble(ylzMedicalRelationDO.getPersonAccount())+Double.parseDouble(ylzMedicalRelationDO.getMedicalPrice());
|
|
|
BigDecimal b1 = new BigDecimal(ylzMedicalRelationDO.getPersonCash());//个人现金
|
|
|
BigDecimal b2 = new BigDecimal(ylzMedicalRelationDO.getPersonAccount());//个人账户
|
|
|
BigDecimal b3 = new BigDecimal(ylzMedicalRelationDO.getMedicalPrice());//医保总金额
|
|
|
Double totalPirce=b1.add(b2).add(b3).doubleValue();
|
|
|
logger.info("总费用:"+totalPirce);
|
|
|
if (totalPirce!=Double.parseDouble(ylzMedicalRelationDO.getTotalAmount())){
|
|
|
object.put("code","403");
|
|
|
object.put("message","金额不对无法结算!");
|
|
@ -14067,22 +14080,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
object.put("getSettleInfo",ylzMedicalRelationDO);
|
|
|
return object;
|
|
|
}*/
|
|
|
}
|
|
|
try {
|
|
|
ylzMedicalRelationDO = entranceService.getSettleInfo(outpatientDO.getCardNo(),outpatientDO.getIdcard(),outpatientDO.getId());
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
throw new Exception(e.getMessage());
|
|
|
}
|
|
|
|
|
|
|
|
|
if (ylzMedicalRelationDO==null){
|
|
|
throw new Exception("无待结算信息");
|
|
|
}
|
|
|
/*
|
|
|
if (ylzMedicalRelationDO.getStatus()!=null&&ylzMedicalRelationDO.getStatus()==1){
|
|
|
object.put("getSettleInfo",ylzMedicalRelationDO);
|
|
|
return object;
|
|
|
}*/
|
|
|
logger.info("获取患者待结算信息结束!");
|
|
|
if(outpatientDO!=null&&outpatientDO.getMedicalState().equalsIgnoreCase("1")){
|
|
|
logger.info("医保挂号开始!");
|
|
@ -14107,18 +14113,28 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
logger.info("获取医保结算页面地址结束!");
|
|
|
object.put("getSettlementResultUrlBase64",getSettlementResultUrlBase64);
|
|
|
}
|
|
|
Double totalPirce=Double.parseDouble(ylzMedicalRelationDO.getPersonCash())+Double.parseDouble(ylzMedicalRelationDO.getPersonAccount())+Double.parseDouble(ylzMedicalRelationDO.getMedicalPrice());
|
|
|
if (totalPirce!=Double.parseDouble(ylzMedicalRelationDO.getTotalAmount())){
|
|
|
object.put("code","403");
|
|
|
object.put("message","金额不对无法结算!");
|
|
|
}else {
|
|
|
object.put("code","200");
|
|
|
object.put("message","核对金额无误!");
|
|
|
if (ylzMedicalRelationDO.getPersonCash()!=null){
|
|
|
BigDecimal b1 = new BigDecimal(ylzMedicalRelationDO.getPersonCash());//个人现金
|
|
|
BigDecimal b2 = new BigDecimal(ylzMedicalRelationDO.getPersonAccount());//个人账户
|
|
|
BigDecimal b3 = new BigDecimal(ylzMedicalRelationDO.getMedicalPrice());//医保总金额
|
|
|
Double totalPirce=b1.add(b2).add(b3).doubleValue();
|
|
|
logger.info("总费用:"+totalPirce);
|
|
|
if (totalPirce!=Double.parseDouble(ylzMedicalRelationDO.getTotalAmount())){
|
|
|
object.put("code","403");
|
|
|
object.put("message","金额不对无法结算!");
|
|
|
}else {
|
|
|
object.put("code","200");
|
|
|
object.put("message","核对金额无误!");
|
|
|
}
|
|
|
}
|
|
|
object.put("getSettleInfo",ylzMedicalRelationDO);
|
|
|
return object;
|
|
|
}else {
|
|
|
Double totalPirce=Double.parseDouble(ylzMedicalRelationDO.getPersonCash())+Double.parseDouble(ylzMedicalRelationDO.getPersonAccount())+Double.parseDouble(ylzMedicalRelationDO.getMedicalPrice());
|
|
|
BigDecimal b1 = new BigDecimal(ylzMedicalRelationDO.getPersonCash());//个人现金
|
|
|
BigDecimal b2 = new BigDecimal(ylzMedicalRelationDO.getPersonAccount());//个人账户
|
|
|
BigDecimal b3 = new BigDecimal(ylzMedicalRelationDO.getMedicalPrice());//医保总金额
|
|
|
Double totalPirce=b1.add(b2).add(b3).doubleValue();
|
|
|
logger.info("总费用:"+totalPirce);
|
|
|
if (totalPirce!=Double.parseDouble(ylzMedicalRelationDO.getTotalAmount())){
|
|
|
object.put("code","403");
|
|
|
object.put("message","金额不对无法结算!");
|
|
@ -14130,15 +14146,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
return object;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public YlzMedicalRelationDO selectByOutpatientId(String outpatientId){
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
|
|
|
return ylzMedicalRelationDO;
|
|
|
}
|
|
|
|
|
|
public String electronicPrescriptionReceiving(String outpatientId) {
|
|
|
WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
|
|
|
if (outpatientDO.getMedicalState()!=null&&outpatientDO.getMedicalState().equalsIgnoreCase("1")){
|
|
|
try {
|
|
|
return healthCareService.electronicPrescriptionReceiving(outpatientId);
|
|
|
healthCareService.electronicPrescriptionReceiving(outpatientId);
|
|
|
return "上传成功";
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@ -14208,7 +14228,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
throw new Exception("未找到待结算记录");
|
|
|
}
|
|
|
YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(outpatientDO.getAdmNo());
|
|
|
PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(outpatientDO.getPatient());
|
|
|
BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(ylzMedicalRelationDO.getId());
|
|
|
String depositType = "";
|
|
|
String depositAmount = "";
|
|
@ -14270,9 +14290,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
wlyyHisSettleVO.setMzlsh0(ylzMedicalRelationDO.getInsuranceSerial());
|
|
|
wlyyHisSettleVO.setZhzfe0(ylzMedicalRelationDO.getPersonAccount());
|
|
|
wlyyHisSettleVO.setGrzfe0(ylzMedicalRelationDO.getPersonCash());
|
|
|
/*
|
|
|
Double bcbxzg = Double.parseDouble(ylzMedicalRelationDO.getMedicalPrice())+Double.parseDouble(ylzMedicalRelationDO.getPersonAccount());
|
|
|
*/
|
|
|
wlyyHisSettleVO.setJjzfe0(ylzMedicalRelationDO.getMedicalPrice());
|
|
|
wlyyHisSettleVO.setGwybz0(ylzMedicalRelationDO.getGwyPay());
|
|
|
wlyyHisSettleVO.setFybfy0(ylzMedicalRelationDO.getPersonCash());
|
|
@ -14294,6 +14311,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
wlyyHisSettleVO.setPsnNo(ylzMedicalRelationDO.getPersonalCode());
|
|
|
wlyyHisSettleVO.setAab301(ylzMedicalRelationDO.getAdministrativeArea());
|
|
|
wlyyHisSettleVO.setInsutype(ylzMedicalRelationDO.getInsuranceType());
|
|
|
wlyyHisSettleVO.setSetlTime(DateUtil.dateToStrLong(ylzMedicalRelationDO.getPayDate()));
|
|
|
jsonArray = entranceService.BS15039(wlyyHisSettleVO,false);
|
|
|
}
|
|
|
if (jsonArray!=null&&jsonArray.size()!=0){
|
|
@ -14304,37 +14322,65 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
ylzMedicalRelationDO.setState(1);
|
|
|
ylzMedicalRelationDO.setHisBillSerial(msgInfoJson.getString("callSn"));
|
|
|
ylzMedicalRelationDO.setHisDesc(msgInfoJson.getString("jsxxts"));
|
|
|
ylzMedicalRelationDO.setSettleDate(new Date());
|
|
|
ylzMedicalRelationDO = ylzMedicailRelationDao.save(ylzMedicalRelationDO);
|
|
|
List<YlzMedicalMxDO> mxDOList = ylzMedicailMxDao.findByMedicalId(ylzMedicalRelationDO.getId());
|
|
|
boolean hisState = false;
|
|
|
for (YlzMedicalMxDO mxDO:mxDOList){
|
|
|
if (mxDO.getItemName().contains("互联网医院复诊诊查费")){
|
|
|
hisState = true;
|
|
|
}
|
|
|
}
|
|
|
logger.info("变更医保结算状态成功");
|
|
|
String realOrder = "";
|
|
|
List<WlyyOutpatientDO> wlyyOutpatientDOList = outpatientDao.findByRegisterNoList(ylzMedicalRelationDO.getHisSerial());
|
|
|
for (WlyyOutpatientDO wlyyOutpatientDO:wlyyOutpatientDOList){
|
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByOutPatientIdList(wlyyOutpatientDO.getId());
|
|
|
for (WlyyPrescriptionDO prescriptionDO:wlyyPrescriptionDOS){
|
|
|
WlyyPrescriptionLogDO prescriptionLogDO = new WlyyPrescriptionLogDO();
|
|
|
prescriptionLogDO.setCreateTime(new Date());
|
|
|
prescriptionLogDO.setStatus(30);
|
|
|
prescriptionLogDO.setOutpatientId(prescriptionDO.getOutpatientId());
|
|
|
prescriptionLogDO.setPrescriptionCode(prescriptionDO.getId());
|
|
|
prescriptionLogDO.setUserCode(prescriptionDO.getPatientCode());
|
|
|
prescriptionLogDO.setUserName(prescriptionDO.getPatientName());
|
|
|
prescriptionLogDO.setUserType(1);
|
|
|
prescriptionLogDO.setDatajson("处方结算");
|
|
|
prescriptionLogDao.save(prescriptionLogDO);
|
|
|
prescriptionDO.setStatus(30);
|
|
|
prescriptionDO.setPayTime(new Date());
|
|
|
prescriptionDao.save(prescriptionDO);
|
|
|
realOrder = prescriptionDO.getRealOrder();
|
|
|
logger.info("变更处方结算状态成功");
|
|
|
String realOrder = msgInfoJson.getString("xtgzh0");
|
|
|
List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByRealOrderAndStatusList(realOrder);
|
|
|
for (WlyyPrescriptionDO prescriptionDO:wlyyPrescriptionDOS){
|
|
|
WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
|
|
|
String title = "";
|
|
|
if (wlyyOutpatientDO.getHisStatus()==null){
|
|
|
title="您在厦门大学附属中山医院有一笔诊察/处方费用已支付完成!结算费用包含本次在线问诊的复诊诊查费:"+wlyyOutpatientDO.getFee()+"元。";
|
|
|
}else {
|
|
|
title="您在厦门大学附属中山医院有一笔诊察/处方费用已支付完成!";
|
|
|
}
|
|
|
if (hisState){
|
|
|
wlyyOutpatientDO.setHisStatus(1);
|
|
|
outpatientDao.save(wlyyOutpatientDO);
|
|
|
}
|
|
|
WlyyPrescriptionLogDO prescriptionLogDO = new WlyyPrescriptionLogDO();
|
|
|
prescriptionLogDO.setCreateTime(new Date());
|
|
|
prescriptionLogDO.setStatus(30);
|
|
|
prescriptionLogDO.setOutpatientId(prescriptionDO.getOutpatientId());
|
|
|
prescriptionLogDO.setPrescriptionCode(prescriptionDO.getId());
|
|
|
prescriptionLogDO.setUserCode(prescriptionDO.getPatientCode());
|
|
|
prescriptionLogDO.setUserName(prescriptionDO.getPatientName());
|
|
|
prescriptionLogDO.setUserType(1);
|
|
|
prescriptionLogDO.setDatajson("处方结算");
|
|
|
prescriptionLogDao.save(prescriptionLogDO);
|
|
|
prescriptionDO.setStatus(30);
|
|
|
prescriptionDO.setPayTime(new Date());
|
|
|
prescriptionDao.save(prescriptionDO);
|
|
|
logger.info("变更处方结算状态成功");
|
|
|
String fee = ylzMedicalRelationDO.getTotalAmount();
|
|
|
String pushPayLog = payInfoNoticeService.pushPrescriptionPayMedicare(wlyyOutpatientDO.getConsumer(),prescriptionDO.getDoctorName(),prescriptionDO.getVoucherNo(),prescriptionDO.getOutpatientId(),prescriptionDO.getId(),fee,ylzMedicalRelationDO.getMedicalPrice(),ylzMedicalRelationDO.getPersonCash(),title,null);
|
|
|
logger.info("处方结算成功"+pushPayLog+"====="+realOrder);
|
|
|
//2.6.1 电子处方订单接收
|
|
|
logger.info("医保电子处方订单");
|
|
|
if (ylzMedicalRelationDO.getMedicalState()!=null&&ylzMedicalRelationDO.getMedicalState()==0){
|
|
|
List<WlyyPrescriptionExpressageDO> expressageDOList = prescriptionExpressageDao.findByOutpatientId(ylzMedicalRelationDO.getRelationCode());
|
|
|
if (expressageDOList!=null&&expressageDOList.size()!=0){
|
|
|
WlyyPrescriptionExpressageDO expressageDO = expressageDOList.get(0);
|
|
|
if (expressageDO.getOneselfPickupFlg()==1){
|
|
|
healthCareService.electronicPrescriptionReceiving(ylzMedicalRelationDO.getRelationCode());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
logger.info("电子发票开具开始");
|
|
|
try {
|
|
|
/*try {
|
|
|
entranceService.dzpjServer(patientMappingDO.getMappingCode(),realOrder);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
}*/
|
|
|
logger.info("电子发票开具结束");
|
|
|
|
|
|
}
|