@ -20,29 +20,29 @@ import java.math.BigDecimal;
@Slf4j
public class CasebookService {
public Result placeOrder ( MerchantEnum merchantEnum , String ip , String openid , String patientId , String treatNum , String totalFee , String applyId , String getWay , String useToName ) {
public Result placeOrder ( MerchantEnum merchantEnum , String ip , String openid , String patientId , String treatNum , String totalFee , String applyId , String getWay , String useToName ) {
if ( openid = = null | | patientId = = null | | totalFee = = null ) {
return Result . error ( ResultEnum . PARAM_IS_DEFECT ) ;
}
if ( new BigDecimal ( totalFee ) . compareTo ( BigDecimal . ZERO ) = = 0 ) {
if ( new BigDecimal ( totalFee ) . compareTo ( BigDecimal . ZERO ) = = 0 ) {
return Result . error ( ResultEnum . PAY_MONEY_IS_ZERO ) ;
}
if ( isPay ( patientId , treatNum , applyId , getWay , useToName ) ) {
log . info ( "{} [病历]订单已支付 applyId-{}, patientId={},treatNum-{},getWay-{},useToName-{}" , merchantEnum . NAME , applyId , patientId , treatNum , getWay , useToName ) ;
if ( isPay ( patientId , treatNum , applyId , getWay , useToName ) ) {
log . info ( "{} [病历]订单已支付 applyId-{}, patientId={},treatNum-{},getWay-{},useToName-{}" , merchantEnum . NAME , applyId , patientId , treatNum , getWay , useToName ) ;
return Result . error ( ResultEnum . APPLY_REPEAT ) ;
}
String outTradeNo = CodeHelper . getOutTradeNo ( merchantEnum ) ;
if ( ! isSaveCasebookInfo ( patientId , treatNum , applyId , new BigDecimal ( totalFee ) , outTradeNo , getWay , useToName ) ) {
log . info ( "{} [病历]下单信息存储失败 applyId-{}, patientId={},treatNum-{}" , merchantEnum . NAME , applyId , patientId , treatNum ) ;
if ( ! isSaveCasebookInfo ( patientId , treatNum , applyId , new BigDecimal ( totalFee ) , outTradeNo , getWay , useToName ) ) {
log . info ( "{} [病历]下单信息存储失败 applyId-{}, patientId={},treatNum-{}" , merchantEnum . NAME , applyId , patientId , treatNum ) ;
return Result . error ( ResultEnum . SPECIFIED_QUESTIONED_USER_NOT_EXIST ) ;
}
String body = "病历复印缴费 住院号=" + treatNum ;
String body = "病历复印缴费 住院号=" + treatNum ;
JSONObject respJson = PayService . createOrder ( merchantEnum , openid , patientId , totalFee , outTradeNo , PQREnum . CASEBOOK . CODE , ip , body ) ;
if ( respJson = = null ) {
@ -51,12 +51,12 @@ public class CasebookService {
return Result . success ( respJson ) ;
}
public boolean isExit ( String patientId , String treatNum , String getWay , String useToName ) {
if ( patientId = = null | | treatNum = = null ) {
log . info ( "[病历复印]唤起支付 存入 applyId失败,patientId-{},treatNum-{}," , patientId , treatNum ) ;
public boolean isExit ( String patientId , String treatNum , String getWay , String useToName ) {
if ( patientId = = null | | treatNum = = null ) {
log . info ( "[病历复印]唤起支付 存入 applyId失败,patientId-{},treatNum-{}," , patientId , treatNum ) ;
return false ;
}
return new CasebookDao ( ) . selectIsExit ( patientId , treatNum , getWay , useToName ) ;
return new CasebookDao ( ) . selectIsExit ( patientId , treatNum , getWay , useToName ) ;
}
/ * *
@ -64,33 +64,34 @@ public class CasebookService {
* @param treatNum 住院号
* @return 是否成功
* /
public boolean isSaveCasebookInfo ( String patientId , String treatNum , String applyId , BigDecimal totalFee , String outTradeNo , String getWay , String useToName ) {
if ( patientId = = null | | treatNum = = null ) {
log . info ( "[病历复印]唤起支付 存入 applyId失败,patientId-{},treatNum-{},totalFee-{}" , patientId , treatNum , totalFee ) ;
public boolean isSaveCasebookInfo ( String patientId , String treatNum , String applyId , BigDecimal totalFee , String outTradeNo , String getWay , String useToName ) {
if ( patientId = = null | | treatNum = = null ) {
log . info ( "[病历复印]唤起支付 存入 applyId失败,patientId-{},treatNum-{},totalFee-{}" , patientId , treatNum , totalFee ) ;
return false ;
}
return new CasebookDao ( ) . updatePayStatePre ( patientId , treatNum , applyId , totalFee , outTradeNo , getWay , useToName ) ;
return new CasebookDao ( ) . updatePayStatePre ( patientId , treatNum , applyId , totalFee , outTradeNo , getWay , useToName ) ;
}
public boolean isPay ( String patientId , String treatNum , String applyId , String getWay , String useToName ) {
if ( patientId = = null | | treatNum = = null ) {
log . info ( "[病历复印]查重失败,patientId-{},treatNum-{},applyId-{}" , patientId , treatNum , applyId ) ;
public boolean isPay ( String patientId , String treatNum , String applyId , String getWay , String useToName ) {
if ( patientId = = null | | treatNum = = null ) {
log . info ( "[病历复印]查重失败,patientId-{},treatNum-{},applyId-{}" , patientId , treatNum , applyId ) ;
return false ;
}
return new CasebookDao ( ) . selectIsPay ( patientId , treatNum , applyId , getWay , useToName ) ;
return new CasebookDao ( ) . selectIsPay ( patientId , treatNum , applyId , getWay , useToName ) ;
}
/ * *
* 新增预约记录首次存入
*
* @param casebook 病历订单信息
* @return 是否成功
* /
public boolean addApply ( PayCasebook casebook , String openId , String patientId ) {
public boolean addApply ( PayCasebook casebook , String openId , String patientId ) {
if ( casebook = = null ) {
log . info ( "casebook is null" ) ;
return false ;
}
return new CasebookDao ( ) . insert ( casebook , openId , patientId ) ;
return new CasebookDao ( ) . insert ( casebook , openId , patientId ) ;
}
public void payNotify ( MerchantEnum merchantEnum , String openid , BigDecimal totalFee , String outTradeNo , String bankTransNo , String payInfo ) {
@ -112,15 +113,15 @@ public class CasebookService {
log . info ( "[病历]修改支付状态失败 outTradeNo={}, bankTransNo={}, casebookId={}" , outTradeNo , bankTransNo , casebookId ) ;
}
log . info ( "[病历] 开始回调支付状态 borrowNo-{}" , casebookId ) ;
String jsonString = XBDHttpHelper . ExecMethodGet ( XBDEnum . BLSM_Appointment_SetISPay . Name , params - > {
params . put ( "borrowNo" , casebookId ) ;
log . info ( "[病历] 开始回调支付状态 borrowNo-{}" , casebookId ) ;
String jsonString = XBDHttpHelper . ExecMethodGet ( XBDEnum . BLSM_Appointment_SetISPay . Name , params - > {
params . put ( "borrowNo" , casebookId ) ;
params . put ( "payDateTime" , DateHelper . getCurDateTime ( ) ) ;
} ) ;
log . info ( "[病历]回调返回 resp={}" , jsonString ) ;
String code = JsonHelper . parseObject ( jsonString ) . getString ( "Code" ) ;
if ( code = = null ) {
if ( code = = null ) {
if ( ! casebookDao . updateNotifyOk ( outTradeNo ) ) {
log . info ( "[病历]更新订单信息失败 outTradeNo={}, bankTransNo={}, casebookId={}" , outTradeNo , bankTransNo , casebookId ) ;
}