12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- package thyyxxk.simzfeeoprnsystm.service;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import thyyxxk.simzfeeoprnsystm.dao.MobilePayDao;
- import thyyxxk.simzfeeoprnsystm.pojo.*;
- import thyyxxk.simzfeeoprnsystm.pojo.mobilepay.*;
- import thyyxxk.simzfeeoprnsystm.utils.DateUtil;
- import thyyxxk.simzfeeoprnsystm.utils.StringUtil;
- import java.io.IOException;
- import java.util.List;
- import java.util.Objects;
- @Slf4j
- @Service
- public class MobilePayService {
- private final MobilePayDao dao;
- private final SiMzFeeService mzService;
- @Autowired
- public MobilePayService(MobilePayDao dao, SiMzFeeService mzService) throws IOException {
- this.dao = dao;
- this.mzService = mzService;
- }
- private String writeMtReceipt(String patNo, Integer times) {
- MzPatientInfo mzptnt = new MzPatientInfo();
- mzptnt.setPatNo(patNo);
- mzptnt.setTimes(times);
- return mzService.generateSiMzFees(mzptnt);
- }
- public Upload6201 getUpload6201(InsuinfoRequest request) throws Exception {
- String wrt = writeMtReceipt(request.getPatNo(), request.getTimes());
- if (!Objects.equals(wrt, "SUCCESS")) {
- return null;
- }
- Upload6201 upload6201 = dao.selectUpload6201(request.getPatNo(), request.getTimes());
- if (null == upload6201) {
- // mz_visit_table为空
- throw new Exception("患者就诊信息为空,请联系医生重开处方。");
- }
- upload6201.setMedType("11");
- upload6201.setCaty(upload6201.getDeptId());
- List<Diseinfo> diseinfoList = dao.selectMpDiseinfos(request.getPatNo(), request.getTimes());
- if (diseinfoList.isEmpty()) {
- VisitTableIcd icd = dao.selectMzVisitIcd(request.getPatNo(), request.getTimes());
- if (null == icd || StringUtil.isBlank(icd.getIcdCode())) {
- throw new Exception("医保标准诊断不能为空,请联系医生填写。");
- }
- String[] icdCodeArr = icd.getIcdCode().split(",");
- String[] icdNameArr = icd.getIcdName().split(",");
- for (int i = 0; i < icdCodeArr.length; i++) {
- Diseinfo diseinfo = new Diseinfo();
- diseinfo.setDiagType("1");
- diseinfo.setDiagSrtNo(i + 1);
- diseinfo.setDiagCode(icdCodeArr[i]);
- diseinfo.setDiagName(icdNameArr[i]);
- diseinfo.setDiagDept(upload6201.getDeptName());
- diseinfo.setDiseDorNo(icd.getDrCode());
- diseinfo.setDiseDorName(icd.getDrName());
- diseinfo.setDiagTime(DateUtil.formatDatetime(icd.getVisitDate()));
- diseinfo.setValiFlag("1");
- diseinfoList.add(diseinfo);
- }
- }
- upload6201.setDiseinfoList(diseinfoList);
- upload6201.setFeedetailList(dao.selectMpFees(request.getPatNo(), request.getTimes()));
- return upload6201;
- }
- }
|