You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
158 lines
7.0 KiB
158 lines
7.0 KiB
package com.ynxbd.common.service.params;
|
|
|
|
import com.ynxbd.common.bean.pay.Register;
|
|
import com.ynxbd.common.result.ResultEnum;
|
|
import com.ynxbd.common.result.ServiceException;
|
|
import com.ynxbd.common.service.RegService;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import java.math.BigDecimal;
|
|
|
|
@Slf4j
|
|
public class RegParams {
|
|
|
|
/**
|
|
* * // * @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 request
|
|
* @param isDesc
|
|
*/
|
|
public static Register getRegParams(HttpServletRequest request, boolean isDesc) throws ServiceException {
|
|
Register reg = new Register();
|
|
RequestParams params = new RequestParams(request);
|
|
|
|
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 ? "分时段挂号" : "普通挂号"));
|
|
|
|
reg.setIsSplitTime(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);
|
|
}
|
|
|
|
reg.setTName(tName);
|
|
reg.setBegTime(begTime);
|
|
reg.setEndTime(endTime);
|
|
reg.setSourceId(sourceId);
|
|
reg.setQueueNum(queueNum);
|
|
} else {
|
|
String clinicCode = params.getString("clinicCode");
|
|
if (clinicCode == null) {
|
|
log.info("[普通挂号]参数缺失clinicCode");
|
|
throw new ServiceException(ResultEnum.PARAM_IS_DEFECT);
|
|
}
|
|
reg.setClinicCode(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);
|
|
}
|
|
reg.setRegFee(regFee);
|
|
reg.setClinicFee(clinicFee);
|
|
|
|
reg.setTel(tel);
|
|
reg.setAddress(address);
|
|
reg.setHospitalArea(hospitalArea);
|
|
reg.setDeptName(deptName);
|
|
reg.setDoctName(doctName);
|
|
|
|
reg.setRegType(RegService.setRegType(regDate, isSplitTime));
|
|
}
|
|
|
|
reg.setRegCode(regCode);
|
|
reg.setPayMoney(payMoney);
|
|
// 信息
|
|
reg.setPatientId(patientId);
|
|
reg.setOpenid(openid);
|
|
reg.setIdCardNo(cardNo);
|
|
|
|
reg.setDeptCode(deptCode);
|
|
reg.setSubDeptCode(subDeptCode);
|
|
reg.setDoctCode(doctCode);
|
|
reg.setRegDate(regDate);
|
|
reg.setTid(tid);
|
|
reg.setPayMoney(payMoney);
|
|
reg.setTotalFee(totalFee);
|
|
|
|
return reg;
|
|
}
|
|
}
|
|
|