@ -1,16 +1,15 @@
package com.ynxbd.common.service ;
import com.alibaba.fastjson.JSONObject ;
import com.ynxbd.ali.enums.AliEnergyEnum ;
import com.ynxbd.ali.enums.AliMsgEnum ;
import com.ynxbd.ali.helper.* ;
import com.ynxbd.ali.helper.AliHelper ;
import com.ynxbd.ali.helper.AliMessageHelper ;
import com.ynxbd.common.action.pay.PEnum ;
import com.ynxbd.common.bean.sms.SmsRegTem ;
import com.ynxbd.common.bean.enums.HospEnum ;
import com.ynxbd.common.bean.enums.MerchantEnum ;
import com.ynxbd.common.bean.pay.Order ;
import com.ynxbd.common.bean.pay.Register ;
import com.ynxbd.common.bean.sms.SmsTemplate ;
import com.ynxbd.common.bean.sms.SmsReg Tem ;
import com.ynxbd.common.dao.RefundDao ;
import com.ynxbd.common.dao.RegisterDao ;
import com.ynxbd.common.dao.his.HisAccountDao ;
@ -20,7 +19,10 @@ import com.ynxbd.common.helper.common.DateHelper;
import com.ynxbd.common.helper.common.JsonHelper ;
import com.ynxbd.common.helper.common.SmsHelper ;
import com.ynxbd.common.helper.his.HisHelper ;
import com.ynxbd.common.result.* ;
import com.ynxbd.common.result.JsonResult ;
import com.ynxbd.common.result.Result ;
import com.ynxbd.common.result.ResultEnum ;
import com.ynxbd.common.result.ServiceException ;
import com.ynxbd.wx.config.MessagePushConfig ;
import com.ynxbd.wx.config.MiddleOfficeConfig ;
import com.ynxbd.wx.config.WeChatConfig ;
@ -35,7 +37,6 @@ import java.math.BigDecimal;
import java.util.Date ;
import java.util.HashMap ;
import java.util.Map ;
import java.util.Objects ;
/ * *
* 挂号业务层
@ -147,6 +148,7 @@ public class RegService {
log . info ( "{} 开始调用HIS挂号:patientId={}, bankTransNo={}" , merchantEnum . NAME , patientId , bankTransNo ) ;
String hisTransNo = null , treatNum = null , hisQueueNo , callNum = null , invoiceTransNo = null ;
// 挂号类型:1:预约挂号,2:现场挂号;3:分时段预约挂号,4:分时段现场挂号
JsonResult jsonResult ;
@ -206,25 +208,23 @@ public class RegService {
log . info ( "{} [挂号]更新HIS挂号信息成功 patientId={}" , merchantEnum . NAME , patientId ) ;
}
if ( HospEnum . isHosp ( HospEnum . 红河州人民医院 ) & & "0503" . equals ( reg . getDeptCode ( ) ) ) {
MessagePushConfig . regObsDocument ( merchantEnum , reg ) ;
if ( HospEnum . isHosp ( HospEnum . 红河州人民医院 ) & & "0503" . equals ( reg . getDeptCode ( ) ) ) {
MessagePushConfig . regObsDocument ( merchantEnum , reg ) ;
}
// 短信通知
smsNotice ( reg ) ;
if ( MerchantEnum . WX . equals ( merchantEnum ) ) {
MessagePushConfig . regPush ( merchantEnum , reg ) ;
MessagePushConfig . regAI ( merchantEnum , reg ) ;
MessagePushConfig . regAI ( merchantEnum , reg ) ;
// 挂号导航推送
MessagePushConfig . regNavigatePush ( merchantEnum , reg ) ;
// 电子健康卡上报数据
HCodeService . regPayReportHISData ( openid , patientId , reg . getDeptName ( ) , reg . getRegDate ( ) ) ;
}
@ -234,7 +234,6 @@ public class RegService {
String title = "挂号 " + reg . getDeptName ( ) ;
AliMessageHelper . hospitalOrder ( openid , title , AliMsgEnum . MERCHANT_PREORDER_SUCCESS , reg . getUpdateTime ( ) , true , totalFee , outTradeNo , reg . getRegDate ( ) , reg . getBegTime ( ) , reg . getDeptCode ( ) , reg . getDeptName ( ) , reg . getDoctName ( ) ,
AliHelper . getLink ( link , null ) ) ;
}
@ -362,14 +361,13 @@ public class RegService {
}
boolean isResult = false ;
if ( HospEnum . isHosp ( HospEnum . 德宏州中医医院 ) ) {
SmsRegTem sms = new SmsRegTem ( ) ;
sms . setHosp_tel ( "0692-2991794" ) ;
sms . setTime ( date + " " + begTime + "-" + endTime ) ;
sms . setAddress ( reg . getAddress ( ) = = null ? "" : reg . getAddress ( ) . replace ( " " , "" ) . replace ( "(" , "(" ) . replace ( ")" , ")" ) ) ;
sms . setAddress ( reg . getAddress ( ) = = null ? "" : reg . getAddress ( ) . replace ( " " , "" ) . replace ( "(" , "(" ) . replace ( ")" , ")" ) ) ;
sms . setDeptName ( reg . getDeptName ( ) ) ;
sms . setDoctorName ( reg . getDoctName ( ) ) ;
sms . setSeq ( reg . getQueueNum ( ) ) ;
@ -496,7 +494,7 @@ public class RegService {
return Result . error ( "今日挂号支付信息的参数为空" ) ;
}
if ( "OK" . equals ( reg . getRefundResult ( ) ) ) {
if ( "OK" . equals ( reg . getRefundResult ( ) ) ) {
return Result . error ( "已退费,请不要重复退费" ) ;
}
@ -504,7 +502,7 @@ public class RegService {
return Result . error ( "支付方式未匹配 outTradeNo=" + outTradeNo ) ;
}
if ( HospEnum . isHosp ( HospEnum . 红河州人民医院 ) ) {
if ( HospEnum . isHosp ( HospEnum . 红河州人民医院 ) ) {
if ( MiddleOfficeConfig . MIDDLE_OFFICE_URL ! = null ) {
MiddleOfficeConfig . uploadTreatNum ( "JH0105" , reg . getTreatNum ( ) ) ;
}
@ -677,17 +675,17 @@ public class RegService {
* @param hisResult 记录信息
* /
public Result regAutoRefund ( MerchantEnum merchantEnum , JsonResult JsonResult , String openid , BigDecimal totalFee , String outTradeNo , String tradeNo , String hisResult , String pushInfo , Date tradeDate ) {
log . info ( "[预约挂号/挂号失败自动退费][开始退费]---merchantEnum-{},JsonResult-{},openid-{},totalFee-{},outTradeNo-{},tradeNo-{},hisResult-{},pushInfo-{},tradeDate-{}" , merchantEnum , JsonResult , openid , totalFee , outTradeNo , tradeNo , hisResult , pushInfo , tradeDate ) ;
return regRefund ( merchantEnum , JsonResult , openid , totalFee , outTradeNo , tradeNo , hisResult , pushInfo , tradeDate , false ) ;
log . info ( "[预约挂号/挂号失败自动退费][开始退费]---merchantEnum-{},JsonResult-{},openid-{},totalFee-{},outTradeNo-{},tradeNo-{},hisResult-{},pushInfo-{},tradeDate-{}" , merchantEnum , JsonResult , openid , totalFee , outTradeNo , tradeNo , hisResult , pushInfo , tradeDate ) ;
return regRefund ( merchantEnum , JsonResult , openid , totalFee , outTradeNo , tradeNo , hisResult , pushInfo , tradeDate , false ) ;
}
public Result refundTodayRegister ( MerchantEnum merchantEnum , JsonResult JsonResult , String openid , BigDecimal totalFee , String outTradeNo , String tradeNo , String hisResult , String pushInfo , Date tradeDate ) {
log . info ( "[今日挂号][开始退费]---merchantEnum-{},JsonResult-{},openid-{},totalFee-{},outTradeNo-{},tradeNo-{},hisResult-{},pushInfo-{},tradeDate-{}" , merchantEnum , JsonResult , openid , totalFee , outTradeNo , tradeNo , hisResult , pushInfo , tradeDate ) ;
return regRefund ( merchantEnum , JsonResult , openid , totalFee , outTradeNo , tradeNo , hisResult , pushInfo , tradeDate , true ) ;
public Result refundTodayRegister ( MerchantEnum merchantEnum , JsonResult JsonResult , String openid , BigDecimal totalFee , String outTradeNo , String tradeNo , String hisResult , String pushInfo , Date tradeDate ) {
log . info ( "[今日挂号][开始退费]---merchantEnum-{},JsonResult-{},openid-{},totalFee-{},outTradeNo-{},tradeNo-{},hisResult-{},pushInfo-{},tradeDate-{}" , merchantEnum , JsonResult , openid , totalFee , outTradeNo , tradeNo , hisResult , pushInfo , tradeDate ) ;
return regRefund ( merchantEnum , JsonResult , openid , totalFee , outTradeNo , tradeNo , hisResult , pushInfo , tradeDate , true ) ;
}
public Result regRefund ( MerchantEnum merchantEnum , JsonResult JsonResult , String openid , BigDecimal totalFee , String outTradeNo , String tradeNo , String hisResult , String pushInfo , Date tradeDate , boolean isToday ) {
public Result regRefund ( MerchantEnum merchantEnum , JsonResult JsonResult , String openid , BigDecimal totalFee , String outTradeNo , String tradeNo , String hisResult , String pushInfo , Date tradeDate , boolean isToday ) {
RegisterDao regDao = new RegisterDao ( ) ;
String code = JsonResult . getCode ( ) ;
@ -701,7 +699,7 @@ public class RegService {
return Result . error ( "[挂号不退费]HIS请求超时" ) ;
}
if ( ! isToday ) {
if ( ! isToday ) {
// 如果HIS交过费返回true-->就不向下执行(自动退款)
String dateShort = DateGenerate . getStringDateShort ( ) ;
String paidTip = new HisAccountDao ( ) . isPaid ( DateGenerate . getNextDay ( dateShort , "-7" ) , DateGenerate . getNextDay ( dateShort , "7" ) , tradeNo ) ;
@ -754,7 +752,7 @@ public class RegService {
String sourceId = reg . getSourceId ( ) ;
// 占用查询开关被开启
if ( isOccupySource ! = null & & isOccupySource ) {
JsonResult result = HisRegisterDao . isOccupySource ( patientId , sourceId , merchantEnum ) ;
JsonResult result = HisRegisterDao . isOccupySource ( patientId , sourceId , merchantEnum ) ;
if ( ! result . success ( ) ) {
return Result . error ( result . getMessage ( ) ) ;
}
@ -804,7 +802,7 @@ public class RegService {
if ( respJson = = null ) {
return Result . error ( ResultEnum . PAY_ERROR ) ; // 支付异常
}
respJson . put ( "outTradeNo" , outTradeNo ) ;
respJson . put ( "outTradeNo" , outTradeNo ) ;
return Result . success ( respJson ) ;
}