@ -6,14 +6,19 @@ import com.ynxbd.ali.helper.AliUploadHelper;
import com.ynxbd.common.action.base.BaseAction ;
import com.ynxbd.common.bean.Dept ;
import com.ynxbd.common.bean.Doctor ;
import com.ynxbd.common.bean.Patient ;
import com.ynxbd.common.bean.RegSign ;
import com.ynxbd.common.bean.enums.MerchantEnum ;
import com.ynxbd.common.bean.pay.Register ;
import com.ynxbd.common.dao.RegisterDao ;
import com.ynxbd.common.dao.his.HisRegisterDao ;
import com.ynxbd.common.helper.common.DateHelper ;
import com.ynxbd.common.result.JsonResult ;
import com.ynxbd.common.result.Result ;
import com.ynxbd.common.result.ResultEnum ;
import com.ynxbd.common.service.DoctorService ;
import com.ynxbd.common.service.MedToolService ;
import com.ynxbd.common.service.PatientService ;
import com.ynxbd.common.service.RegService ;
import com.ynxbd.wx.wxfactory.ReqParamHelper ;
import lombok.extern.slf4j.Slf4j ;
@ -200,7 +205,7 @@ public class RegisterAction extends BaseAction {
if ( patientId = = null | | begDate = = null | | endDate = = null ) {
return Result . error ( ResultEnum . PARAM_IS_DEFECT ) ;
}
List < Register > resultList = new HisRegisterDao ( ) . getRegReserveHistory ( patientId , null ) ;
List < Register > resultList = new HisRegisterDao ( ) . getRegReserveRecords ( patientId , null ) ;
return Result . success ( resultList ) ;
}
@ -216,7 +221,7 @@ public class RegisterAction extends BaseAction {
}
patientId = getDecodeString ( patientId ) ;
List < Register > regRecords = new RegService ( ) . getHisRegRecords ( patientId , begDate , endDate ) ;
List < Register > regRecords = new RegService ( ) . getHisRegRecordsByRegDate ( patientId , begDate , endDate ) ;
return Result . success ( regRecords ) ;
} catch ( Exception e ) {
return Result . error ( e ) ;
@ -224,10 +229,10 @@ public class RegisterAction extends BaseAction {
}
/ * *
* [ 挂号 ] 查询挂号历史
* [ 挂号 ] 查询挂号历史记录
* /
@Action ( "getHis RegRecords" )
public Result getRegHistory ( String begDate , String endDate , String patientId ) {
@Action ( "getRegHistory Records" )
public Result getRegHistoryRecords ( String begDate , String endDate , String patientId ) {
try {
log . info ( "[挂号]查询挂号记录 patientId={}, begDate={},endDate={}" , patientId , begDate , endDate ) ;
if ( patientId = = null | | begDate = = null | | endDate = = null ) {
@ -235,7 +240,7 @@ public class RegisterAction extends BaseAction {
}
patientId = getDecodeString ( patientId ) ;
List < Register > regRecords = new RegService ( ) . getHisRegRecords ( patientId , begDate , endDate ) ;
List < Register > regRecords = new RegService ( ) . getHisRegRecordsByRegDate ( patientId , begDate , endDate ) ;
return Result . success ( regRecords ) ;
} catch ( Exception e ) {
return Result . error ( e ) ;
@ -243,7 +248,7 @@ public class RegisterAction extends BaseAction {
}
/ * *
* [ 预约挂号 ] 获取 预约记录
* [ 预约挂号 ] 查询 预约记录
* /
@Action ( "getHisRegReserveRecords" )
public Result getHisRegReserveRecords ( String begDate , String endDate , String patientId ) {
@ -371,7 +376,7 @@ public class RegisterAction extends BaseAction {
begDate = DateHelper . getCurDate ( ) + " 06:00:00" ;
endDate = DateHelper . getCurDate ( ) + " 23:59:59" ;
}
JSONArray dataList = new HisRegisterDao ( ) . getReLineSignInRecord ( begDate , endDate ) ;
JSONArray dataList = new HisRegisterDao ( ) . getReg LineSignInRecordsOl d ( begDate , endDate ) ;
Map < String , Object > dataMap = new HashMap < > ( ) ;
dataMap . put ( "date" , DateHelper . getCurDateTime ( ) ) ;
if ( dataList = = null | | dataList . isEmpty ( ) ) {
@ -383,8 +388,47 @@ public class RegisterAction extends BaseAction {
return Result . success ( dataMap ) ;
}
/ * *
* 执行预约签到
* 根据患者id , 查询挂号待签到记录
*
* @param begDate 开始时间
* @param endDate 结束时间
* @return 待预约记录
* /
@Action ( "getRegSignInByPatientId" )
public Result getRegSignInByPatientId ( String patientId , String begDate , String endDate ) {
patientId = getDecodeString ( patientId ) ;
log . info ( "[挂号待签到记录]查询 patientId={} begDate={}, endDate={}" , patientId , begDate , endDate ) ;
if ( patientId = = null ) {
return Result . error ( ResultEnum . PARAM_IS_INVALID ) ;
}
List < RegSign > records = new RegService ( ) . getRegLineSignInRecordsByPatientId ( patientId , begDate , endDate ) ;
return Result . success ( records ) ;
}
/ * *
* 根据门诊号 , 查询挂号待签到记录
*
* @param treatNum 门诊号
* @return 待预约记录
* /
@Action ( "getRegSignInByTreatNum" )
public Result getRegSignInByTreatNum ( String treatNum ) {
treatNum = getDecodeString ( treatNum ) ;
log . info ( "[挂号待签到记录]查询 treatNum={}" , treatNum ) ;
if ( treatNum = = null ) {
return Result . error ( ResultEnum . PARAM_IS_INVALID ) ;
}
RegSign record = new RegService ( ) . getRegLineSignInRecordByTreatNum ( treatNum ) ;
if ( record = = null ) {
return Result . error ( ResultEnum . DATA_NOT_FOUND ) ;
}
return Result . success ( record ) ;
}
/ * *
* 执行预约签到 ( 将废弃 )
*
* @param treatNum 门诊号
* @return 预约签到结果
@ -398,6 +442,28 @@ public class RegisterAction extends BaseAction {
return Result . success ( new HisRegisterDao ( ) . handleLineSignIn ( treatNum ) ) ;
}
/ * *
* 执行预约签到
*
* @param treatNum 门诊号
* @return 预约签到结果
* /
@Action ( "regSignIn" )
public Result regSignIn ( String treatNum ) {
log . info ( "[执行挂号签到(只进行分诊叫号)] treatNum={}" , treatNum ) ;
if ( treatNum = = null ) {
return Result . error ( ResultEnum . PARAM_IS_DEFECT ) ;
}
JsonResult jsonResult = new HisRegisterDao ( ) . handleLineSignIn ( treatNum ) ;
if ( ! jsonResult . success ( ) ) {
return Result . error ( jsonResult . getMessage ( ) ) ;
}
String fzNum = jsonResult . getDataMapString ( "FZNum" ) ; // 分诊号
Map < Object , Object > dataMap = new HashMap < > ( ) ;
dataMap . put ( "fzNum" , fzNum ) ;
return Result . success ( dataMap ) ;
}
/ * *
* 查询预约今天号源的患者信息 , 用以推送候诊信息
*
@ -416,25 +482,54 @@ public class RegisterAction extends BaseAction {
/ * *
* [ 就医助手 ] 根据挂号 日期范围 , 查询挂号记录
* [ 就医助手 ] 根据日期范围 , 查询待诊的 挂号记录
* /
@Action ( "getRegRecordsByOpenId " )
public Result getRegRecordsByOpenId ( String begDate , String endDate , String openid ) {
@Action ( "getHisWait RegRecords" )
public Result getHisWait RegRecords ( String openid ) {
try {
log . info ( "[就医助手]根据挂号日期范围,查询挂号记录 begDate={}, endDate={}, openid={}" , begDate , endDate , openid ) ;
if ( begDate = = null | | endDate = = null | | openid = = null ) {
log . info ( "[就医助手]根据挂号日期范围,查询待诊的 挂号记录 openid={}" , openid ) ;
if ( openid = = null ) {
return Result . error ( ResultEnum . PARAM_IS_DEFECT ) ;
}
List < Register > regList = new RegisterDao ( ) . selectListByRegDate ( begDate , endDate , openid ) ;
for ( Register item : regList ) {
item . setEnId ( ReqParamHelper . encode ( String . valueOf ( item . getId ( ) ) ) ) ;
item . setId ( null ) ;
item . filterInfo ( ) ; // 数据过滤
List < Register > regList = new ArrayList < > ( ) ;
List < Patient > patients = new PatientService ( ) . queryPatientIdsByOpenId ( openid ) ;
if ( patients . isEmpty ( ) ) {
return Result . success ( regList ) ;
}
Map < String , Object > dataMap = new HashMap < > ( ) ;
dataMap . put ( "date" , DateHelper . getCurDateTime ( ) ) ;
dataMap . put ( "list" , regList ) ;
return Result . success ( dataMap ) ;
String curDate = DateHelper . getCurDate ( ) ;
for ( Patient pItem : patients ) {
String patientId = pItem . getPatientId ( ) ;
List < Register > hisWaitRegRecords = new RegService ( ) . getHisWaitRegRecords ( patientId ) ;
if ( hisWaitRegRecords ! = null & & ! hisWaitRegRecords . isEmpty ( ) ) {
for ( Register regItem : hisWaitRegRecords ) {
if ( regItem . hasIsTake ( - 1 ) | | regItem . hasIsTreat ( - 1 ) ) { // 过滤退号的挂号数据
continue ;
}
String regDate = regItem . getRegDate ( ) ;
if ( ! ObjectUtils . isEmpty ( regDate ) ) {
Date date = DateHelper . strToDate ( regDate , DateHelper . DateEnum . yyyy_MM_dd ) ;
if ( date ! = null ) {
regItem . setQueryBegDate ( DateHelper . getMoveDate ( date , - 7 ) ) ;
regItem . setQueryEndDate ( DateHelper . getMoveDate ( date , 7 ) ) ;
}
}
regItem . setCurDate ( curDate ) ;
regItem . setPatientId ( patientId ) ;
regItem . setEnPatientId ( ReqParamHelper . encode ( patientId ) ) ;
regItem . setPatientName ( pItem . getName ( ) ) ;
regItem . setBirthday ( pItem . getBirthday ( ) ) ;
regItem . setSex ( pItem . getSex ( ) ) ;
regItem . setIdCardNo ( pItem . getIdCardNo ( ) ) ;
regItem . setTel ( pItem . getTel ( ) ) ;
regItem . filterInfo ( ) ;
regList . add ( regItem ) ;
}
}
}
return Result . success ( regList ) ;
} catch ( Exception e ) {
return Result . error ( e ) ;
}
@ -451,34 +546,76 @@ public class RegisterAction extends BaseAction {
return Result . error ( ResultEnum . PARAM_IS_DEFECT ) ;
}
try {
Register record = new RegService ( ) . findHisRegRecord ( patientId , regDate , hisTransNo ) ;
Map < String , Object > dataMap = new HashMap < > ( ) ;
dataMap . put ( "date" , DateHelper . getCurDateTime ( ) ) ;
dataMap . put ( "info" , record ) ;
return Result . success ( dataMap ) ;
Register record = new RegService ( ) . findHisRegRecordByHisTransNo ( patientId , regDate , hisTransNo ) ;
return Result . success ( record ) ;
} catch ( Exception e ) {
return Result . error ( e ) ;
}
}
/ * *
* [ 就医助手 ] 修改流程状态
* [ 挂号订单 ] 查询信息
* /
@Action ( "updateRegMedToolMark " )
public Result updateRegMedToolMark ( String id , String medToolMark , String openId ) {
id = getDecodeString ( id ) ;
log . info ( "[就医助手]修改流程状态 id={}, medToolMark={}, openId={}" , id , medToolMark , openId ) ;
if ( ObjectUtils . isEmpty ( id ) | | medToolMark = = null ) {
@Action ( "getRegOrder " )
public Result getRegOrder ( String pat ientI d, String tradeNo , String hisTransNo ) {
pat ientI d = getDecodeString ( pat ientI d) ;
log . info ( "[挂号订单]查询信息 patientId={}, tradeNo={}, hisTransNo={}" , patientId , tradeNo , hisTransNo ) ;
if ( ObjectUtils . isEmpty ( pat ientI d) | | ObjectUtils . isEmpty ( hisTransNo ) ) {
return Result . error ( ResultEnum . PARAM_IS_DEFECT ) ;
}
try {
boolean isOK = new RegService ( ) . updateRegMedToolMark ( id , medToolMark , openId ) ;
return Result . isOK ( isOK ) ;
Register register = new RegService ( ) . queryRegByHisInfo ( patientId , tradeNo , hisTransNo ) ;
if ( register = = null ) {
return Result . error ( "未找到[线上挂号]的订单信息" ) ;
}
register . filterInfo ( ) ;
return Result . success ( register ) ;
} catch ( Exception e ) {
return Result . error ( e ) ;
}
}
/ * *
* [ 就医助手 ] 修改流程标记
* /
@Action ( "completeRegTreatNum" )
public Result completeRegTreatNum ( String treatNum , String processMark , String openId , String patientId , String tradeNo , String hisTransNo , String orderFromOwner ) {
try {
patientId = getDecodeString ( patientId ) ;
log . info ( "[就医助手]修改流程标记 treatNum={}, processMark={}, openId={}, patientId={}, tradeNo={}, hisTransNo={}, orderFromOwner={}" , treatNum , processMark , openId , patientId , tradeNo , hisTransNo , orderFromOwner ) ;
if ( ObjectUtils . isEmpty ( treatNum ) | | ObjectUtils . isEmpty ( patientId ) ) {
return Result . error ( ResultEnum . PARAM_IS_DEFECT ) ;
}
new RegService ( ) . completeRegTreatNum ( treatNum , openId , patientId , tradeNo , hisTransNo , orderFromOwner ) ;
new MedToolService ( ) . saveMedToolMarkByTreatNum ( treatNum , 1 , processMark ) ;
return Result . success ( ) ;
} catch ( Exception e ) {
return Result . error ( e ) ;
}
}
// /**
// * [就医助手]根据挂号日期范围,查询挂号记录
// */
// @Action("getRegRecordsByOpenId")
// public Result getRegRecordsByOpenId(String begDate, String endDate, String openid) {
// try {
// log.info("[就医助手]根据挂号日期范围,查询挂号记录 begDate={}, endDate={}, openid={}", begDate, endDate, openid);
// if (begDate == null || endDate == null || openid == null) {
// return Result.error(ResultEnum.PARAM_IS_DEFECT);
// }
// List<Register> regList = new RegisterDao().selectListByRegDate(begDate, endDate, openid);
// for (Register item : regList) {
// item.setEnId(ReqParamHelper.encode(String.valueOf(item.getId())));
// item.setId(null);
// item.filterInfo(); // 数据过滤
// }
// return Result.success(regList);
// } catch (Exception e) {
// return Result.error(e);
// }
// }
// /**
// * [预约挂号]获取指定科室医生信息