|
|
|
|
package com.ynxbd.common.bean.pay;
|
|
|
|
|
|
|
|
|
|
import com.ynxbd.common.result.ResultEnum;
|
|
|
|
|
import com.ynxbd.common.result.ServiceException;
|
|
|
|
|
import com.ynxbd.common.service.RegService;
|
|
|
|
|
import com.ynxbd.common.service.params.RequestParams;
|
|
|
|
|
import lombok.Getter;
|
|
|
|
|
import lombok.NoArgsConstructor;
|
|
|
|
|
import lombok.Setter;
|
|
|
|
|
import lombok.ToString;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Author wsq
|
|
|
|
|
* @Date 2020/11/27 10:02
|
|
|
|
|
* @Copyright @ 2020 云南新八达科技有限公司 All rights reserved.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
|
@Setter
|
|
|
|
|
@Getter
|
|
|
|
|
@ToString(callSuper = true)
|
|
|
|
|
@NoArgsConstructor
|
|
|
|
|
public class Register extends Order {
|
|
|
|
|
private Long id;
|
|
|
|
|
|
|
|
|
|
private String deptCode;
|
|
|
|
|
private String subDeptCode;
|
|
|
|
|
private String deptName;
|
|
|
|
|
private String doctCode;
|
|
|
|
|
private String doctName;
|
|
|
|
|
private String address;
|
|
|
|
|
|
|
|
|
|
private String payDate;
|
|
|
|
|
private String payTime;
|
|
|
|
|
private String payDeviceId;
|
|
|
|
|
|
|
|
|
|
private BigDecimal regFee;
|
|
|
|
|
private BigDecimal clinicFee;
|
|
|
|
|
private String clinicCode;
|
|
|
|
|
private String clinicName;
|
|
|
|
|
|
|
|
|
|
private String refundDate;
|
|
|
|
|
// 时段id
|
|
|
|
|
private String tid;
|
|
|
|
|
// 时段名
|
|
|
|
|
private String tName;
|
|
|
|
|
// 挂号类型(1:预约挂号,2:现场挂号,3:分时段预约挂号,4:分时段现场挂号)
|
|
|
|
|
private String regType;
|
|
|
|
|
// 挂号日期
|
|
|
|
|
private String regDate;
|
|
|
|
|
// 号别名
|
|
|
|
|
private String regName;
|
|
|
|
|
// 号别编码
|
|
|
|
|
private String regCode;
|
|
|
|
|
// 分时段----------------------
|
|
|
|
|
// 序号
|
|
|
|
|
private String queueNum;
|
|
|
|
|
// 号源id
|
|
|
|
|
private String sourceId;
|
|
|
|
|
private String begTime;
|
|
|
|
|
private String endTime;
|
|
|
|
|
// 【今日挂号】是否就诊[0:未就诊,1:已就诊,-1:已退号]
|
|
|
|
|
private Integer isTreat;
|
|
|
|
|
// 【预约挂号】是否取号[0:未取号,1:已取号,-1:取消预约]
|
|
|
|
|
private Integer isTake;
|
|
|
|
|
// 非分时段挂号------------------------
|
|
|
|
|
private String isCheckIn;
|
|
|
|
|
// 总号源数
|
|
|
|
|
private Integer sourceCount;
|
|
|
|
|
// 剩余号源数
|
|
|
|
|
private Integer remainCount;
|
|
|
|
|
// 0:没有号源不允许挂号;1:有号源可以挂号
|
|
|
|
|
private Integer allowReg;
|
|
|
|
|
// 是否被占用
|
|
|
|
|
private Integer isUsed;
|
|
|
|
|
// 院区
|
|
|
|
|
private String hospitalArea;
|
|
|
|
|
// 挂号订单来源平台
|
|
|
|
|
private String orderFromOwner;
|
|
|
|
|
// 判断是否为分时段挂号
|
|
|
|
|
private Boolean isSplitTime;
|
|
|
|
|
// 就医助手标记
|
|
|
|
|
private String medToolMark;
|
|
|
|
|
|
|
|
|
|
public boolean hasIsTake(int val) {
|
|
|
|
|
return isTake != null && isTake == val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean hasIsTreat(int val) {
|
|
|
|
|
return isTreat != null && isTreat == val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* * // * @param regFee 金额
|
|
|
|
|
* * // * @param clinicFee 金额
|
|
|
|
|
* * // * @param payMoney 金额
|
|
|
|
|
* * // * @param tel 电话
|
|
|
|
|
* * // * @param openid openid
|
|
|
|
|
* * // * @param idCardNo 身份证号码
|
|
|
|
|
* * // * @param patientId 患者id
|
|
|
|
|
* * // * @param deptCode 科室编码
|
|
|
|
|
* * // * @param deptName 科室名称
|
|
|
|
|
* * // * @param doctCode 医生编码
|
|
|
|
|
* * // * @param doctName 医生名
|
|
|
|
|
* * // * @param address 地址
|
|
|
|
|
* * // * @param hospitalArea 院区
|
|
|
|
|
* * // * @param tid 时段名
|
|
|
|
|
* * // * @param tName 时段名
|
|
|
|
|
* * // * @param begTime 开始时间(分时段)
|
|
|
|
|
* * // * @param endTime 开始时间(分时段)
|
|
|
|
|
* * // * @param regCode 挂号编码
|
|
|
|
|
* * // * @param regDate 挂号日期
|
|
|
|
|
* * // * @param sourceId 号源id(分时段)
|
|
|
|
|
* * // * @param queueNum 序列号(分时段)
|
|
|
|
|
* * // * @param clinicCode 编码
|
|
|
|
|
*
|
|
|
|
|
* @param params 请求参数
|
|
|
|
|
* @param isDesc
|
|
|
|
|
*/
|
|
|
|
|
public Register getRegParams(RequestParams params, boolean isDesc) throws ServiceException {
|
|
|
|
|
String openid = params.getString("openid");
|
|
|
|
|
String patientId = params.getString("patientId");
|
|
|
|
|
String cardNo = params.getString("idCardNo");
|
|
|
|
|
String patientName = params.getString("patientName");
|
|
|
|
|
if (cardNo == null) {
|
|
|
|
|
cardNo = params.getString("cardNo");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BigDecimal payMoney = params.getBigDecimal("payMoney");
|
|
|
|
|
BigDecimal totalFee = params.getBigDecimal("totalFee");
|
|
|
|
|
|
|
|
|
|
String deptCode = params.getString("deptCode");
|
|
|
|
|
String subDeptCode = params.getString("subDeptCode");
|
|
|
|
|
String doctCode = params.getString("doctCode");
|
|
|
|
|
String regCode = params.getString("regCode");
|
|
|
|
|
String regDate = params.getString("regDate");
|
|
|
|
|
String tid = params.getString("tid");
|
|
|
|
|
|
|
|
|
|
if (openid == null || patientId == null || cardNo == null || deptCode == null || doctCode == null || regDate == null || tid == null) {
|
|
|
|
|
log.info("[挂号]参数缺失 patientId={}, deptCode={}, doctCode={}, regCode={}, regDate={}, tid={}",
|
|
|
|
|
patientId, deptCode, doctCode, regCode, regDate, tid);
|
|
|
|
|
throw new ServiceException(ResultEnum.PARAM_IS_DEFECT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (payMoney == null || totalFee == null) {
|
|
|
|
|
log.info("[挂号]参数缺失 payMoney");
|
|
|
|
|
throw new ServiceException(ResultEnum.PARAM_IS_DEFECT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Boolean isSplitTime = params.getBoolean("isSplitTime");
|
|
|
|
|
if (isSplitTime == null) {
|
|
|
|
|
log.info("[挂号]挂号类型参数缺失isSplitTime");
|
|
|
|
|
throw new ServiceException(ResultEnum.PARAM_IS_DEFECT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
log.info("[挂号类型]{}", (isSplitTime ? "分时段挂号" : "普通挂号"));
|
|
|
|
|
|
|
|
|
|
this.isSplitTime = isSplitTime;
|
|
|
|
|
if (isSplitTime) { // 分时段
|
|
|
|
|
String tName = params.getString("tName");
|
|
|
|
|
String queueNum = params.getString("queueNum");
|
|
|
|
|
String sourceId = params.getString("sourceId");
|
|
|
|
|
String begTime = params.getString("begTime");
|
|
|
|
|
String endTime = params.getString("endTime");
|
|
|
|
|
if (tName == null || queueNum == null || sourceId == null || begTime == null || endTime == null) {
|
|
|
|
|
log.info("[挂号]参数缺失 tName={}, queueNum={}, sourceId={}, begTime={}, endTime={}", tName, queueNum, sourceId, begTime, endTime);
|
|
|
|
|
throw new ServiceException(ResultEnum.PARAM_IS_DEFECT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.tName = tName;
|
|
|
|
|
this.begTime = begTime;
|
|
|
|
|
this.endTime = endTime;
|
|
|
|
|
this.sourceId = sourceId;
|
|
|
|
|
this.queueNum = queueNum;
|
|
|
|
|
} else {
|
|
|
|
|
String clinicCode = params.getString("clinicCode");
|
|
|
|
|
if (clinicCode == null) {
|
|
|
|
|
log.info("[普通挂号]参数缺失clinicCode");
|
|
|
|
|
throw new ServiceException(ResultEnum.PARAM_IS_DEFECT);
|
|
|
|
|
}
|
|
|
|
|
this.clinicCode = clinicCode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isDesc) {
|
|
|
|
|
BigDecimal regFee = params.getBigDecimal("regFee");
|
|
|
|
|
BigDecimal clinicFee = params.getBigDecimal("clinicFee");
|
|
|
|
|
|
|
|
|
|
if (regFee == null || clinicFee == null) {
|
|
|
|
|
log.info("[挂号]参数缺失 regFee={}, clinicFee={}", regFee, clinicFee);
|
|
|
|
|
throw new ServiceException(ResultEnum.PARAM_IS_DEFECT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String tel = params.getString("tel");
|
|
|
|
|
String address = params.getString("address");
|
|
|
|
|
String deptName = params.getString("deptName");
|
|
|
|
|
String doctName = params.getString("doctName");
|
|
|
|
|
String hospitalArea = params.getString("hospitalArea");
|
|
|
|
|
|
|
|
|
|
if (deptName == null || doctName == null) {
|
|
|
|
|
log.info("[挂号]参数缺失 tel={}, address={}, deptName={}, hospitalArea={}", tel, address, deptName, hospitalArea);
|
|
|
|
|
throw new ServiceException(ResultEnum.PARAM_IS_DEFECT);
|
|
|
|
|
}
|
|
|
|
|
this.regFee = regFee;
|
|
|
|
|
this.clinicFee = clinicFee;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.address = address;
|
|
|
|
|
this.hospitalArea = hospitalArea;
|
|
|
|
|
this.deptName = deptName;
|
|
|
|
|
this.doctName = doctName;
|
|
|
|
|
this.regType = RegService.setRegType(regDate, isSplitTime);
|
|
|
|
|
|
|
|
|
|
this.setTel(tel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.deptCode = deptCode;
|
|
|
|
|
this.subDeptCode = subDeptCode;
|
|
|
|
|
this.doctCode = doctCode;
|
|
|
|
|
this.regCode = regCode;
|
|
|
|
|
this.regDate = regDate;
|
|
|
|
|
this.tid = tid;
|
|
|
|
|
|
|
|
|
|
// 金额
|
|
|
|
|
this.setPayMoney(payMoney);
|
|
|
|
|
this.setTotalFee(totalFee);
|
|
|
|
|
// 个人信息
|
|
|
|
|
this.setOpenid(openid);
|
|
|
|
|
this.setPatientId(patientId);
|
|
|
|
|
this.setPatientName(patientName);
|
|
|
|
|
this.setIdCardNo(cardNo);
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
}
|