|
|
@@ -14,6 +14,7 @@ import cn.hnthyy.thmz.mapper.thmz.WindowsMapper;
|
|
|
import cn.hnthyy.thmz.service.his.*;
|
|
|
import cn.hnthyy.thmz.pageDto.MzyReqrecPageDto;
|
|
|
import cn.hnthyy.thmz.service.thmz.ConfigService;
|
|
|
+import cn.hnthyy.thmz.service.thmz.HolidaysService;
|
|
|
import cn.hnthyy.thmz.service.thmz.MessageService;
|
|
|
import cn.hnthyy.thmz.service.thmz.OrderStatusChangeService;
|
|
|
import cn.hnthyy.thmz.vo.ThmzmxsrParamsVo;
|
|
|
@@ -80,113 +81,119 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
|
|
|
private MzyZdChargeTypeService mzyZdChargeTypeService;
|
|
|
@Autowired
|
|
|
private OrderStatusChangeService orderStatusChangeService;
|
|
|
+ @Autowired
|
|
|
+ private HolidaysService holidaysService;
|
|
|
+
|
|
|
//驾驶员id集合
|
|
|
- private List<String> patientIds = Arrays.asList(new String [] {"422429-4","400758-4","399163-4","400429-4","377323-4","309261-4","134402-4","209695-4"});
|
|
|
+ private List<String> patientIds = Arrays.asList(new String[]{"422429-4", "400758-4", "399163-4", "400429-4", "377323-4", "309261-4", "134402-4", "209695-4"});
|
|
|
//不做重复挂号控制的号别
|
|
|
- private List<String> jsyChargeTypes= Arrays.asList(new String [] {"26","27"});
|
|
|
+ private List<String> jsyChargeTypes = Arrays.asList(new String[]{"26", "27"});
|
|
|
+
|
|
|
@Override
|
|
|
- @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT,timeout=36000,rollbackFor=Exception.class)
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
|
|
|
public int saveMzyReqrec(MzyReqrecPageDto mzyReqrecPageDto) throws MzException {
|
|
|
- MzyReqrec mzyReqrec=mzyReqrecPageDto.getMzyReqrec();
|
|
|
- MzPatientMi mzPatientMi=mzPatientMiMapper.selectByPatientId(mzyReqrec.getPatientId());
|
|
|
- if(mzPatientMi==null){
|
|
|
+ MzyReqrec mzyReqrec = mzyReqrecPageDto.getMzyReqrec();
|
|
|
+ MzPatientMi mzPatientMi = mzPatientMiMapper.selectByPatientId(mzyReqrec.getPatientId());
|
|
|
+ if (mzPatientMi == null) {
|
|
|
throw new MzException("当前挂号的病人信息不存在,请先保存病人信息!");
|
|
|
}
|
|
|
- Windows windows=windowsMapper.selectLastWindowsByUserIdCode(mzyReqrec.getOpId());
|
|
|
- if(windows==null){
|
|
|
+ Windows windows = windowsMapper.selectLastWindowsByUserIdCode(mzyReqrec.getOpId());
|
|
|
+ if (windows == null) {
|
|
|
throw new MzException("当前操作人未设置窗口号,请先设置!");
|
|
|
}
|
|
|
- MzyZdChargeType mzyZdChargeType= mzyZdChargeTypeMapper.selectByCode(mzyReqrec.getChargeType());
|
|
|
- if(mzyZdChargeType==null){
|
|
|
+ MzyZdChargeType mzyZdChargeType = mzyZdChargeTypeMapper.selectByCode(mzyReqrec.getChargeType());
|
|
|
+ if (mzyZdChargeType == null) {
|
|
|
throw new MzException("当前号别不存在,请先设置!");
|
|
|
}
|
|
|
//MzyReqrec lastMzyReqrec = mzyReqrecMapper.selectLastMzyReqrecByPatientId(mzyReqrec.getPatientId());
|
|
|
MzVisitTable lastMzVisitTable = mzVisitTableMapper.selectLastMzVisitTableByPatientId(mzyReqrec.getPatientId());
|
|
|
int times = 0;
|
|
|
- if(lastMzVisitTable!=null && lastMzVisitTable.getTimes()!=null && lastMzVisitTable.getTimes()>times){
|
|
|
- times =lastMzVisitTable.getTimes();
|
|
|
+ if (lastMzVisitTable != null && lastMzVisitTable.getTimes() != null && lastMzVisitTable.getTimes() > times) {
|
|
|
+ times = lastMzVisitTable.getTimes();
|
|
|
}
|
|
|
- if(mzPatientMi.getTimes()!=null && mzPatientMi.getTimes()>times){
|
|
|
+ if (mzPatientMi.getTimes() != null && mzPatientMi.getTimes() > times) {
|
|
|
times = mzPatientMi.getTimes();
|
|
|
}
|
|
|
times++;
|
|
|
- int serialNo=mzSerialNoService.getMzSerialNo();
|
|
|
- MzyRequest mzyRequest=mzyRequestMapper.selectMzyRequestById(mzyReqrecPageDto.getMzyRequestId());
|
|
|
+ int serialNo = mzSerialNoService.getMzSerialNo();
|
|
|
+ MzyRequest mzyRequest = mzyRequestMapper.selectMzyRequestById(mzyReqrecPageDto.getMzyRequestId());
|
|
|
Date now = new Date();
|
|
|
MzVisitTable newMzVisitTable = getMzVisitTable(mzyReqrecPageDto, mzyReqrec, mzPatientMi, windows, times, serialNo, now);
|
|
|
mzVisitTableMapper.insertMzVisitTable(newMzVisitTable);
|
|
|
fomartReqrec(mzyReqrec, mzPatientMi, windows, mzyZdChargeType, times, serialNo, now, mzyRequest);
|
|
|
//不需要做重复挂号的校验id集合 ,只有入库的时候需要该参数
|
|
|
- mzyReqrec.setCanRepeatedly(( jsyChargeTypes.contains(mzyReqrec.getChargeType()) && patientIds.contains(mzyReqrec.getPatientId()) )?YesNoEnum.YES.code:YesNoEnum.NO.code);
|
|
|
- int num=mzyReqrecMapper.insertMzyReqrec(mzyReqrec);
|
|
|
- if(num<=0){
|
|
|
+ mzyReqrec.setCanRepeatedly((jsyChargeTypes.contains(mzyReqrec.getChargeType()) && patientIds.contains(mzyReqrec.getPatientId())) ? YesNoEnum.YES.code : YesNoEnum.NO.code);
|
|
|
+ int num = mzyReqrecMapper.insertMzyReqrec(mzyReqrec);
|
|
|
+ if (num <= 0) {
|
|
|
throw new MzException("当前病人已经挂号成功,请不要重复挂号!");
|
|
|
}
|
|
|
MzfzPatientOrder mzfzPatientOrder = getMzfzPatientOrder(mzyReqrec, mzPatientMi, times, serialNo, now);
|
|
|
mzfzPatientOrderMapper.insertMzfzPatientOrder(mzfzPatientOrder);
|
|
|
- MzPatientMi updateMzPatientMi= new MzPatientMi();
|
|
|
+ MzPatientMi updateMzPatientMi = new MzPatientMi();
|
|
|
updateMzPatientMi.setPatientId(mzPatientMi.getPatientId());
|
|
|
updateMzPatientMi.setTimes(times);
|
|
|
- updateMzPatientMi.setLvDate(mzyReqrec.getRequestDay()==null?now:mzyReqrec.getRequestDay());
|
|
|
+ updateMzPatientMi.setLvDate(mzyReqrec.getRequestDay() == null ? now : mzyReqrec.getRequestDay());
|
|
|
mzPatientMiMapper.updateMzPatientMi(updateMzPatientMi);
|
|
|
- ReqrecRequestRelation reqrecRequestRelation = new ReqrecRequestRelation(mzyRequest.getId(),serialNo);
|
|
|
+ ReqrecRequestRelation reqrecRequestRelation = new ReqrecRequestRelation(mzyRequest.getId(), serialNo);
|
|
|
reqrecRequestRelationMapper.insertReqrecRequestRelation(reqrecRequestRelation);
|
|
|
//发送挂号成功MQ
|
|
|
- orderStatusChangeService.orderStatusChange(mzyReqrec.getPatientId()+"_"+mzyReqrec.getTimes()+","+OrderStatusEnum.REGISTRATION_SUCCESS.code);
|
|
|
+ orderStatusChangeService.orderStatusChange(mzyReqrec.getPatientId() + "_" + mzyReqrec.getTimes() + "," + OrderStatusEnum.REGISTRATION_SUCCESS.code);
|
|
|
if (sendAlarmMessage(mzyRequest)) return 1;
|
|
|
return 1;
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 发送号表剩余号数预警消息
|
|
|
+ *
|
|
|
* @param mzyRequest
|
|
|
* @return
|
|
|
*/
|
|
|
private boolean sendAlarmMessage(MzyRequest mzyRequest) {
|
|
|
try {
|
|
|
- Config config=configService.queryUserByKey(Constants.ALARM_NUM_KEY);
|
|
|
- if(config==null){
|
|
|
+ Config config = configService.queryUserByKey(Constants.ALARM_NUM_KEY);
|
|
|
+ if (config == null) {
|
|
|
return true;
|
|
|
}
|
|
|
- if(mzyRequest.getLeftNum()<=Integer.valueOf(config.getConfigValue())){
|
|
|
- config=configService.queryUserByKey(Constants.ALARM_USER_KEY);
|
|
|
- if(config==null || StringUtils.isBlank(config.getConfigValue())){
|
|
|
+ if (mzyRequest.getLeftNum() <= Integer.valueOf(config.getConfigValue())) {
|
|
|
+ config = configService.queryUserByKey(Constants.ALARM_USER_KEY);
|
|
|
+ if (config == null || StringUtils.isBlank(config.getConfigValue())) {
|
|
|
return true;
|
|
|
}
|
|
|
- String [] arr = config.getConfigValue().split(",");
|
|
|
- if(arr==null || arr.length==0){
|
|
|
+ String[] arr = config.getConfigValue().split(",");
|
|
|
+ if (arr == null || arr.length == 0) {
|
|
|
return true;
|
|
|
}
|
|
|
- List<Employee> employees= employeeService.queryByCodes(Arrays.asList(arr));
|
|
|
- if(employees==null || employees.size()==0){
|
|
|
+ List<Employee> employees = employeeService.queryByCodes(Arrays.asList(arr));
|
|
|
+ if (employees == null || employees.size() == 0) {
|
|
|
return true;
|
|
|
}
|
|
|
- String codes=null;
|
|
|
- for (Employee employee:employees){
|
|
|
- if(codes==null){
|
|
|
- codes= employee.getCodeRs();
|
|
|
- }else {
|
|
|
- codes+=","+employee.getCodeRs();
|
|
|
+ String codes = null;
|
|
|
+ for (Employee employee : employees) {
|
|
|
+ if (codes == null) {
|
|
|
+ codes = employee.getCodeRs();
|
|
|
+ } else {
|
|
|
+ codes += "," + employee.getCodeRs();
|
|
|
}
|
|
|
}
|
|
|
- if(codes!=null){
|
|
|
+ if (codes != null) {
|
|
|
StringBuffer sbf = new StringBuffer("警告:日期【");
|
|
|
- sbf.append(DateUtil.fomart(mzyRequest.getRequestDay(),"yyyy-MM-dd")).append("】");
|
|
|
+ sbf.append(DateUtil.fomart(mzyRequest.getRequestDay(), "yyyy-MM-dd")).append("】");
|
|
|
sbf.append("科室【").append(zdUnitCodeService.queryDeptNameByIdInCache(mzyRequest.getUnitCode())).append("】");
|
|
|
- if(StringUtils.isNotBlank(mzyRequest.getDoctorCode())){
|
|
|
- Employee employee= employeeService.queryByUserCode(mzyRequest.getDoctorCode());
|
|
|
- if(employee!=null){
|
|
|
+ if (StringUtils.isNotBlank(mzyRequest.getDoctorCode())) {
|
|
|
+ Employee employee = employeeService.queryByUserCode(mzyRequest.getDoctorCode());
|
|
|
+ if (employee != null) {
|
|
|
sbf.append("医生【").append(employee.getEmployeeName()).append("】");
|
|
|
}
|
|
|
}
|
|
|
- if(StringUtils.isNotBlank(mzyRequest.getAmpm())){
|
|
|
- MzZdWorkTime mzZdWorkTime= mzZdWorkTimeMapper.selectMzZdWorkTimeByCode(mzyRequest.getAmpm());
|
|
|
- if(mzZdWorkTime!=null){
|
|
|
+ if (StringUtils.isNotBlank(mzyRequest.getAmpm())) {
|
|
|
+ MzZdWorkTime mzZdWorkTime = mzZdWorkTimeMapper.selectMzZdWorkTimeByCode(mzyRequest.getAmpm());
|
|
|
+ if (mzZdWorkTime != null) {
|
|
|
sbf.append("号段【").append(mzZdWorkTime.getName()).append("】");
|
|
|
}
|
|
|
}
|
|
|
- if(StringUtils.isNotBlank(mzyRequest.getChargeType())){
|
|
|
- MzyZdChargeType mzyZdChargeType1=mzyZdChargeTypeService.queryByCode(mzyRequest.getChargeType());
|
|
|
- if(mzyZdChargeType1!=null){
|
|
|
+ if (StringUtils.isNotBlank(mzyRequest.getChargeType())) {
|
|
|
+ MzyZdChargeType mzyZdChargeType1 = mzyZdChargeTypeService.queryByCode(mzyRequest.getChargeType());
|
|
|
+ if (mzyZdChargeType1 != null) {
|
|
|
sbf.append("号别【").append(mzyZdChargeType1.getName()).append("】");
|
|
|
}
|
|
|
}
|
|
|
@@ -195,21 +202,21 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
|
|
|
}
|
|
|
}
|
|
|
return false;
|
|
|
- }catch (Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
private MzfzPatientOrder getMzfzPatientOrder(MzyReqrec mzyReqrec, MzPatientMi mzPatientMi, int times, int serialNo, Date now) throws MzException {
|
|
|
- MzfzPatientOrder mzfzPatientOrder = new MzfzPatientOrder();
|
|
|
+ MzfzPatientOrder mzfzPatientOrder = new MzfzPatientOrder();
|
|
|
mzfzPatientOrder.setPatientId(mzyReqrec.getPatientId());
|
|
|
mzfzPatientOrder.setTimes(times);
|
|
|
mzfzPatientOrder.setName(mzPatientMi.getName());
|
|
|
mzfzPatientOrder.setDeptCode(mzyReqrec.getUnitCode());
|
|
|
mzfzPatientOrder.setDoctorCode(mzyReqrec.getDoctorCode());
|
|
|
mzfzPatientOrder.setGhNo(mzfzConfigService.getGhNo());
|
|
|
- mzfzPatientOrder.setVisitDate(mzyReqrec.getRequestDay()==null?now:mzyReqrec.getRequestDay());
|
|
|
+ mzfzPatientOrder.setVisitDate(mzyReqrec.getRequestDay() == null ? now : mzyReqrec.getRequestDay());
|
|
|
mzfzPatientOrder.setSlowFlag(YesNoEnum.NO.code);
|
|
|
mzfzPatientOrder.setSerialNo(serialNo);
|
|
|
mzfzPatientOrder.setReqType(mzyReqrec.getChargeType());
|
|
|
@@ -218,10 +225,10 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
|
|
|
return mzfzPatientOrder;
|
|
|
}
|
|
|
|
|
|
- private void fomartReqrec( MzyReqrec mzyReqrec, MzPatientMi mzPatientMi, Windows windows, MzyZdChargeType mzyZdChargeType, int times, int serialNo, Date now,MzyRequest mzyRequest) throws MzException {
|
|
|
+ private void fomartReqrec(MzyReqrec mzyReqrec, MzPatientMi mzPatientMi, Windows windows, MzyZdChargeType mzyZdChargeType, int times, int serialNo, Date now, MzyRequest mzyRequest) throws MzException {
|
|
|
mzyReqrec.setTimes(times);
|
|
|
mzyReqrec.setName(mzPatientMi.getName());
|
|
|
- Integer reqOrder= mzyRequestService.getReqOrder(mzyRequest);
|
|
|
+ Integer reqOrder = mzyRequestService.getReqOrder(mzyRequest);
|
|
|
mzyReqrec.setReqOrder(reqOrder);
|
|
|
|
|
|
mzyReqrec.setOpDay(now);
|
|
|
@@ -229,23 +236,21 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
|
|
|
mzyReqrec.setCancelMark(YesNoEnum.NO.code);
|
|
|
mzyReqrec.setWindowsNo(windows.getWindowsNo());
|
|
|
mzyReqrec.setSerialNo(serialNo);
|
|
|
- mzyReqrec.setDoctorCode(mzyRequest.getDoctorCode()==null?"":mzyRequest.getDoctorCode());
|
|
|
+ mzyReqrec.setDoctorCode(mzyRequest.getDoctorCode() == null ? "" : mzyRequest.getDoctorCode());
|
|
|
mzyReqrec.setReqType("0");
|
|
|
- if(mzyReqrec.getRequestDay()==null){
|
|
|
+ if (mzyReqrec.getRequestDay() == null) {
|
|
|
mzyReqrec.setRequestDay(now);
|
|
|
}
|
|
|
mzyReqrec.setPlusMark(YesNoEnum.NO.code);
|
|
|
mzyReqrec.setPrintFlag(YesNoEnum.NO.code.toString());
|
|
|
mzyReqrec.setDcountNo(YesNoEnum.NO.code);
|
|
|
mzyReqrec.setPrintDcountNo(YesNoEnum.NO.code);
|
|
|
- //周末挂号费为0,不收挂号费
|
|
|
- Calendar cal = Calendar.getInstance();
|
|
|
- cal.setTime(mzyReqrec.getRequestDay());
|
|
|
- if (Constants.BRZZJF_CODE.equals(mzyReqrec.getOpId()) && ((cal.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY && Constants.PM.equals(mzyRequest.getAmpm())) || cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY )) {
|
|
|
+ //节假日减免挂号费,不收挂号费
|
|
|
+ if (notPayGhFee(mzyReqrec.getUnitCode(), mzyReqrec.getRequestDay(), mzyRequest.getAmpm())) {
|
|
|
mzyReqrec.setOthFee(BigDecimal.ZERO);
|
|
|
mzyReqrec.setClinicFee(BigDecimal.ZERO);
|
|
|
mzyReqrec.setReqFee(BigDecimal.ZERO);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
mzyReqrec.setOthFee(mzyRequest.getCheckFee());
|
|
|
mzyReqrec.setClinicFee(mzyZdChargeType.getClinicFee());
|
|
|
mzyReqrec.setReqFee(mzyZdChargeType.getReqFee());
|
|
|
@@ -269,7 +274,7 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
|
|
|
newMzVisitTable.setReqDeptCode(mzyReqrec.getUnitCode());
|
|
|
newMzVisitTable.setReqDoctor(mzyReqrec.getDoctorCode());
|
|
|
newMzVisitTable.setWindowsNo(windows.getWindowsNo());
|
|
|
- newMzVisitTable.setFirstOrNot(times==1?YesNoEnum.NO.code:YesNoEnum.YES.code);
|
|
|
+ newMzVisitTable.setFirstOrNot(times == 1 ? YesNoEnum.NO.code : YesNoEnum.YES.code);
|
|
|
newMzVisitTable.setReceiveFlag(YesNoEnum.YES.code);
|
|
|
newMzVisitTable.setResponceType(mzyReqrecPageDto.getResponceType());
|
|
|
newMzVisitTable.setDwmc(mzPatientMi.getAddress());
|
|
|
@@ -280,7 +285,7 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
|
|
|
@Override
|
|
|
public Integer countMzyReqrec(MzyReqrecPageDto mzyReqrecPageDto) {
|
|
|
//清洗挂号数据
|
|
|
- // mzyReqrecMapper.updateCanCelMark();
|
|
|
+ // mzyReqrecMapper.updateCanCelMark();
|
|
|
return mzyReqrecMapper.countMzyReqrec(mzyReqrecPageDto);
|
|
|
}
|
|
|
|
|
|
@@ -295,9 +300,9 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT,timeout=36000,rollbackFor=Exception.class)
|
|
|
- public int modifyMzyReqrec(MzyReqrec mzyReqrec,User tokenUser) {
|
|
|
- if(YesNoEnum.YES.code.equals(mzyReqrec.getCancelMark())){
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
|
|
|
+ public int modifyMzyReqrec(MzyReqrec mzyReqrec, User tokenUser) {
|
|
|
+ if (YesNoEnum.YES.code.equals(mzyReqrec.getCancelMark())) {
|
|
|
//此时是退号,需要把就诊信息也标记成退号
|
|
|
MzVisitTable mzVisitTable = new MzVisitTable();
|
|
|
mzVisitTable.setPatientId(mzyReqrec.getPatientId());
|
|
|
@@ -305,9 +310,9 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
|
|
|
mzVisitTable.setCancelMark(mzyReqrec.getCancelMark());
|
|
|
mzVisitTableMapper.updateMzVisitTable(mzVisitTable);
|
|
|
//将原记录查出,并设置相关字段为负数,新增该记录,用于费用统计
|
|
|
- MzyReqrec dbMzyReqrec=mzyReqrecMapper.selectMzyReqrecByPatientIdAndTimes(mzyReqrec.getPatientId(),mzyReqrec.getTimes());
|
|
|
- ReqrecRequestRelation reqrecRequestRelation=reqrecRequestRelationMapper.selectReqrecRequestRelation(dbMzyReqrec.getSerialNo());
|
|
|
- if(reqrecRequestRelation!=null && reqrecRequestRelation.getRequestId()!=null){
|
|
|
+ MzyReqrec dbMzyReqrec = mzyReqrecMapper.selectMzyReqrecByPatientIdAndTimes(mzyReqrec.getPatientId(), mzyReqrec.getTimes());
|
|
|
+ ReqrecRequestRelation reqrecRequestRelation = reqrecRequestRelationMapper.selectReqrecRequestRelation(dbMzyReqrec.getSerialNo());
|
|
|
+ if (reqrecRequestRelation != null && reqrecRequestRelation.getRequestId() != null) {
|
|
|
mzyRequestMapper.updateLeftNumById(reqrecRequestRelation.getRequestId());
|
|
|
}
|
|
|
dbMzyReqrec.setTimes(-dbMzyReqrec.getTimes());
|
|
|
@@ -320,7 +325,7 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
|
|
|
dbMzyReqrec.setOpId(tokenUser.getUserIdCode());
|
|
|
dbMzyReqrec.setDcountNo(YesNoEnum.NO.code);
|
|
|
dbMzyReqrec.setClosingDate(null);
|
|
|
- if(!Constants.BYJZ.equals(dbMzyReqrec.getPaymode())){
|
|
|
+ if (!Constants.BYJZ.equals(dbMzyReqrec.getPaymode())) {
|
|
|
dbMzyReqrec.setPaymode(Constants.CASH);
|
|
|
}
|
|
|
|
|
|
@@ -332,7 +337,7 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
|
|
|
|
|
|
@Override
|
|
|
public MzyReqrec queryMzyReqrecByPatientIdAndTimes(String patientId, Integer times) {
|
|
|
- return mzyReqrecMapper.selectMzyReqrecByPatientIdAndTimes(patientId,times);
|
|
|
+ return mzyReqrecMapper.selectMzyReqrecByPatientIdAndTimes(patientId, times);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -341,17 +346,17 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT,timeout=36000,rollbackFor=Exception.class)
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
|
|
|
public int printMzyReqrecRecept(MzyReqrec mzyReqrec) throws MzException {
|
|
|
//有时候发票打印失败,需要补打,补打不增加发票号码
|
|
|
- boolean isReprint = StringUtils.isNotBlank(mzyReqrec.getReceiptBill()) && mzyReqrec.getReceiptBill().trim().length()==8;
|
|
|
+ boolean isReprint = StringUtils.isNotBlank(mzyReqrec.getReceiptBill()) && mzyReqrec.getReceiptBill().trim().length() == 8;
|
|
|
MzyReqrec newMzyReqrec = new MzyReqrec();
|
|
|
newMzyReqrec.setPatientId(mzyReqrec.getPatientId());
|
|
|
newMzyReqrec.setTimes(mzyReqrec.getTimes());
|
|
|
- Receipt receipt=null;
|
|
|
- String printer =Constants.BRZZJF_CODE.equals(mzyReqrec.getOpId())?mzyReqrec.getPrinterId():mzyReqrec.getOpId();
|
|
|
- if(!isReprint){
|
|
|
- receipt= receiptMapper.selectByUserIdCode(printer);
|
|
|
+ Receipt receipt = null;
|
|
|
+ String printer = Constants.BRZZJF_CODE.equals(mzyReqrec.getOpId()) ? mzyReqrec.getPrinterId() : mzyReqrec.getOpId();
|
|
|
+ if (!isReprint) {
|
|
|
+ receipt = receiptMapper.selectByUserIdCode(printer);
|
|
|
if (receipt == null || StringUtils.isBlank(receipt.getReceiptCurrent())) {
|
|
|
throw new MzException("用户id=" + mzyReqrec.getOpId() + "没有可用的发票,请先维护发票。");
|
|
|
}
|
|
|
@@ -360,15 +365,15 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
|
|
|
}
|
|
|
newMzyReqrec.setPrinterId(mzyReqrec.getPrinterId());
|
|
|
int num = mzyReqrecMapper.updateMzyReqrec(newMzyReqrec);
|
|
|
- if(receipt==null){
|
|
|
- return num;
|
|
|
+ if (receipt == null) {
|
|
|
+ return num;
|
|
|
}
|
|
|
//维护发票号码
|
|
|
- if(receipt.getReceiptCurrent()==receipt.getReceiptEnd()){
|
|
|
+ if (receipt.getReceiptCurrent() == receipt.getReceiptEnd()) {
|
|
|
//此时发票号已经用完,当前发票号是最后一个
|
|
|
receipt.setReceiptCurrent(null);
|
|
|
- }else {
|
|
|
- Integer temp= Integer.valueOf(receipt.getReceiptCurrent())+1;
|
|
|
+ } else {
|
|
|
+ Integer temp = Integer.valueOf(receipt.getReceiptCurrent()) + 1;
|
|
|
receipt.setReceiptCurrent(temp.toString());
|
|
|
}
|
|
|
receipt.setUpdateDate(new Date());
|
|
|
@@ -377,9 +382,9 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
|
|
|
|
|
|
@Override
|
|
|
public List<Map<String, Object>> queryMzhbCount(ThmzmxsrParamsVo thmzmxsrParamsVo) {
|
|
|
- if(YesNoEnum.YES.equals(thmzmxsrParamsVo.getHisData())){
|
|
|
+ if (YesNoEnum.YES.equals(thmzmxsrParamsVo.getHisData())) {
|
|
|
thmzmxsrParamsVo.setFirstTableName("mzy_reqrec_b");
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
thmzmxsrParamsVo.setFirstTableName("mzy_reqrec");
|
|
|
}
|
|
|
return mzyReqrecMapper.selectMzhbCount(thmzmxsrParamsVo);
|
|
|
@@ -392,6 +397,43 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
|
|
|
|
|
|
@Override
|
|
|
public MzyReqrec queryMzyReqrecByAgtordnum(String psordnum, String agtordnum) {
|
|
|
- return mzyReqrecMapper.selectMzyReqrecByAgtordnum(psordnum,agtordnum);
|
|
|
+ return mzyReqrecMapper.selectMzyReqrecByAgtordnum(psordnum, agtordnum);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean notPayGhFee(String unitCode, Date requestDayD, String ampm) {
|
|
|
+ //驾驶员体检,周末和节假日挂号费正常收费,不减免挂号费
|
|
|
+ if (Constants.JZYTZJX.equals(unitCode)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
+ cal.setTime(requestDayD);
|
|
|
+ if ((cal.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY && Constants.PM.equals(ampm)) || cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ List<Holidays> holidaysList = holidaysService.queryHolidaysByDate(requestDayD);
|
|
|
+ if (holidaysList != null && holidaysList.size() > 0) {
|
|
|
+ Holidays holidays = holidaysList.get(0);
|
|
|
+ //如果开始时间段是上午,那么应该包含下午和全天
|
|
|
+ List<String> beginAmpms = new ArrayList<>();
|
|
|
+ beginAmpms.add(holidays.getBeginAmpm());
|
|
|
+ if (Constants.AM.equals(holidays.getBeginAmpm())) {
|
|
|
+ beginAmpms.add(Constants.PM);
|
|
|
+ beginAmpms.add(Constants.DAY);
|
|
|
+ }
|
|
|
+ //如果结束时间段是下午,那么应该包含上午和全天
|
|
|
+ List<String> endAmpms = new ArrayList<>();
|
|
|
+ endAmpms.add(holidays.getEndAmpm());
|
|
|
+ if (Constants.PM.equals(holidays.getBeginAmpm())) {
|
|
|
+ endAmpms.add(Constants.AM);
|
|
|
+ endAmpms.add(Constants.DAY);
|
|
|
+ }
|
|
|
+ if ((holidays.getBeginDate().equals(requestDayD) && beginAmpms.contains(ampm))
|
|
|
+ || (holidays.getEndDate().equals(requestDayD) && endAmpms.contains(ampm))
|
|
|
+ || (requestDayD.after(holidays.getBeginDate()) && requestDayD.before(holidays.getEndDate()))) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
}
|
|
|
}
|