|
@@ -4,11 +4,13 @@ import cn.hnthyy.thmz.common.Constants;
|
|
|
import cn.hnthyy.thmz.entity.MzException;
|
|
|
import cn.hnthyy.thmz.entity.his.*;
|
|
|
import cn.hnthyy.thmz.entity.thmz.Receipt;
|
|
|
+import cn.hnthyy.thmz.entity.thmz.ReqrecRequestRelation;
|
|
|
import cn.hnthyy.thmz.entity.thmz.User;
|
|
|
import cn.hnthyy.thmz.entity.thmz.Windows;
|
|
|
import cn.hnthyy.thmz.enums.YesNoEnum;
|
|
|
import cn.hnthyy.thmz.mapper.his.*;
|
|
|
import cn.hnthyy.thmz.mapper.thmz.ReceiptMapper;
|
|
|
+import cn.hnthyy.thmz.mapper.thmz.ReqrecRequestRelationMapper;
|
|
|
import cn.hnthyy.thmz.mapper.thmz.WindowsMapper;
|
|
|
import cn.hnthyy.thmz.service.his.MzSerialNoService;
|
|
|
import cn.hnthyy.thmz.service.his.MzfzConfigService;
|
|
@@ -55,12 +57,16 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
|
|
|
@SuppressWarnings("all")
|
|
|
@Autowired
|
|
|
private MzReceiptSerialMapper mzReceiptSerialMapper;
|
|
|
+ @SuppressWarnings("all")
|
|
|
+ @Autowired
|
|
|
+ private ReqrecRequestRelationMapper reqrecRequestRelationMapper;
|
|
|
@Autowired
|
|
|
private MzyRequestService mzyRequestService;
|
|
|
@Autowired
|
|
|
private MzSerialNoService mzSerialNoService;
|
|
|
@Autowired
|
|
|
private MzfzConfigService mzfzConfigService;
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT,timeout=36000,rollbackFor=Exception.class)
|
|
|
public int saveMzyReqrec(MzyReqrecPageDto mzyReqrecPageDto) throws MzException {
|
|
@@ -88,10 +94,11 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
|
|
|
}
|
|
|
times++;
|
|
|
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(mzyReqrecPageDto, mzyReqrec, mzPatientMi, windows, mzyZdChargeType, times, serialNo, now);
|
|
|
+ fomartReqrec(mzyReqrec, mzPatientMi, windows, mzyZdChargeType, times, serialNo, now, mzyRequest);
|
|
|
mzyReqrecMapper.insertMzyReqrec(mzyReqrec);
|
|
|
MzfzPatientOrder mzfzPatientOrder = getMzfzPatientOrder(mzyReqrec, mzPatientMi, times, serialNo, now);
|
|
|
mzfzPatientOrderMapper.insertMzfzPatientOrder(mzfzPatientOrder);
|
|
@@ -100,6 +107,8 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
|
|
|
updateMzPatientMi.setTimes(times);
|
|
|
updateMzPatientMi.setLvDate(now);
|
|
|
mzPatientMiMapper.updateMzPatientMi(updateMzPatientMi);
|
|
|
+ ReqrecRequestRelation reqrecRequestRelation = new ReqrecRequestRelation(mzyRequest.getId(),serialNo);
|
|
|
+ reqrecRequestRelationMapper.insertReqrecRequestRelation(reqrecRequestRelation);
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
@@ -120,11 +129,10 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
|
|
|
return mzfzPatientOrder;
|
|
|
}
|
|
|
|
|
|
- private void fomartReqrec(MzyReqrecPageDto mzyReqrecPageDto, MzyReqrec mzyReqrec, MzPatientMi mzPatientMi, Windows windows, MzyZdChargeType mzyZdChargeType, int times, int serialNo, Date now) 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());
|
|
|
mzyReqrec.setRequestDay(now);
|
|
|
- MzyRequest mzyRequest=mzyRequestMapper.selectMzyRequestById(mzyReqrecPageDto.getMzyRequestId());
|
|
|
Integer reqOrder= mzyRequestService.getReqOrder(mzyRequest);
|
|
|
mzyReqrec.setReqOrder(reqOrder);
|
|
|
mzyReqrec.setReqFee(mzyZdChargeType.getReqFee());
|
|
@@ -195,6 +203,10 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
|
|
|
mzVisitTableMapper.updateMzVisitTable(mzVisitTable);
|
|
|
//将原记录查出,并设置相关字段为负数,新增该记录,用于费用统计
|
|
|
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());
|
|
|
dbMzyReqrec.setReqFee(BigDecimal.ZERO.subtract(dbMzyReqrec.getReqFee()));
|
|
|
dbMzyReqrec.setClinicFee(BigDecimal.ZERO.subtract(dbMzyReqrec.getClinicFee()));
|
|
@@ -207,7 +219,7 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
|
|
|
dbMzyReqrec.setClosingDate(null);
|
|
|
dbMzyReqrec.setChargeType(Constants.CASH);
|
|
|
mzyReqrecMapper.insertMzyReqrec(dbMzyReqrec);
|
|
|
-
|
|
|
+ reqrecRequestRelationMapper.selectReqrecRequestRelation(dbMzyReqrec.getSerialNo());
|
|
|
}
|
|
|
return mzyReqrecMapper.updateMzyReqrec(mzyReqrec);
|
|
|
}
|