|
@@ -1,6 +1,10 @@
|
|
|
package thyyxxk.webserver.service.jiekou;
|
|
|
|
|
|
+import lombok.Data;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.ibatis.session.ExecutorType;
|
|
|
+import org.apache.ibatis.session.SqlSession;
|
|
|
+import org.apache.ibatis.session.SqlSessionFactory;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import thyyxxk.webserver.config.exception.BizException;
|
|
@@ -10,11 +14,15 @@ import thyyxxk.webserver.entity.ResultVo;
|
|
|
import thyyxxk.webserver.entity.datamodify.MzChargeDetail;
|
|
|
import thyyxxk.webserver.entity.login.UserInfo;
|
|
|
import thyyxxk.webserver.entity.zhuyuanyisheng.jianyanjiancha.YshYjReq;
|
|
|
+import thyyxxk.webserver.service.hospitalizationCosts.HospitalizationCostsService;
|
|
|
import thyyxxk.webserver.service.redislike.RedisLikeService;
|
|
|
+import thyyxxk.webserver.utils.ListUtil;
|
|
|
import thyyxxk.webserver.utils.ResultVoUtil;
|
|
|
import thyyxxk.webserver.utils.StringUtil;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -29,10 +37,35 @@ import java.util.Date;
|
|
|
public class MedicalTechnologyIsPaidService {
|
|
|
private final DuiWaiJieKouDao dao;
|
|
|
private final RedisLikeService redisLikeService;
|
|
|
+ private final HospitalizationCostsService hospitalizationCostsService;
|
|
|
|
|
|
- public MedicalTechnologyIsPaidService(DuiWaiJieKouDao dao, RedisLikeService redisLikeService) {
|
|
|
+ public MedicalTechnologyIsPaidService(DuiWaiJieKouDao dao, RedisLikeService redisLikeService, HospitalizationCostsService hospitalizationCostsService) {
|
|
|
this.dao = dao;
|
|
|
this.redisLikeService = redisLikeService;
|
|
|
+ this.hospitalizationCostsService = hospitalizationCostsService;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Data
|
|
|
+ public static class ConfirmList {
|
|
|
+ private List<String> reqNoAndPatNoList;
|
|
|
+ private String confirmId;
|
|
|
+ private Boolean changePrint;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Data
|
|
|
+ public static class Param {
|
|
|
+ Param(String reqStr) {
|
|
|
+ String[] temp = reqStr.split("_");
|
|
|
+ reqNo = Integer.parseInt(temp[0]);
|
|
|
+ patNo = temp[1];
|
|
|
+ times = Integer.parseInt(temp[2]);
|
|
|
+ orderNo = new BigDecimal(temp[3]);
|
|
|
+ }
|
|
|
+
|
|
|
+ private Integer reqNo;
|
|
|
+ private String patNo;
|
|
|
+ private Integer times;
|
|
|
+ private BigDecimal orderNo;
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -41,7 +74,9 @@ public class MedicalTechnologyIsPaidService {
|
|
|
if (mz == null) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.INVALID_PARAM, "未查询到原申请。");
|
|
|
}
|
|
|
+
|
|
|
UserInfo userInfo = redisLikeService.getUserInfoByCode(confirmId);
|
|
|
+
|
|
|
if (userInfo == null) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.INVALID_PARAM, "未查询到确认人数据");
|
|
|
}
|
|
@@ -61,8 +96,10 @@ public class MedicalTechnologyIsPaidService {
|
|
|
}
|
|
|
|
|
|
|
|
|
- public ResultVo<String> zyProject(Integer reqNo, String confirmId, String type) {
|
|
|
+ public ResultVo<String> zyProject(Integer reqNo, String confirmId) {
|
|
|
+
|
|
|
YshYjReq yshYjReq = dao.selectedYshJyReqOne(reqNo);
|
|
|
+
|
|
|
if (yshYjReq == null) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "未查询到申请单");
|
|
|
}
|
|
@@ -82,16 +119,21 @@ public class MedicalTechnologyIsPaidService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.INVALID_PARAM, "未查询到确认人数据");
|
|
|
}
|
|
|
|
|
|
- int yshFlag = dao.updateYshYjReqFlag(confirmId, reqNo, date, userInfo.getDeptCode());
|
|
|
+ // 1 确认 2 取消
|
|
|
+ int flag = 1;
|
|
|
+
|
|
|
+ int yshFlag = dao.updateYshYjReqFlag(confirmId, reqNo, date, userInfo.getDeptCode(), flag);
|
|
|
+
|
|
|
if (yshFlag == 0) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.INVALID_PARAM, "更新失败请联系管理员");
|
|
|
}
|
|
|
+
|
|
|
int feeCount = dao.confirmTheIntermediateTable(confirmId,
|
|
|
yshYjReq.getActOrderNo(),
|
|
|
date,
|
|
|
userInfo.getDeptCode(),
|
|
|
yshYjReq.getInpatientNo(),
|
|
|
- yshYjReq.getAdmissTimes());
|
|
|
+ yshYjReq.getAdmissTimes(), flag);
|
|
|
|
|
|
if (feeCount == 0) {
|
|
|
throw new BizException(ExceptionEnum.INVALID_PARAM, "更新失败请联系管理员");
|
|
@@ -99,4 +141,68 @@ public class MedicalTechnologyIsPaidService {
|
|
|
return ResultVoUtil.success(ExceptionEnum.SUCCESS);
|
|
|
}
|
|
|
|
|
|
+ public ResultVo<String> zyProjectCancel(Integer reqNo, String confirmId) {
|
|
|
+ UserInfo userInfo = redisLikeService.getUserInfoByCode(confirmId);
|
|
|
+ if (userInfo == null) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.INVALID_PARAM, "未查询到确认人数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ YshYjReq yshYjReq = dao.selectedYshJyReqOne(reqNo);
|
|
|
+
|
|
|
+ if (yshYjReq == null) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "未查询到申请单");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 1 确认 2 取消
|
|
|
+ int flag = 1;
|
|
|
+
|
|
|
+ Date date = new Date();
|
|
|
+ int yshFlag = dao.updateYshYjReqFlag(confirmId, reqNo, date, userInfo.getDeptCode(), flag);
|
|
|
+
|
|
|
+ if (yshFlag == 0) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.INVALID_PARAM, "更新失败请联系管理员");
|
|
|
+ }
|
|
|
+
|
|
|
+ int feeCount = dao.confirmTheIntermediateTable(confirmId,
|
|
|
+ yshYjReq.getActOrderNo(),
|
|
|
+ date,
|
|
|
+ userInfo.getDeptCode(),
|
|
|
+ yshYjReq.getInpatientNo(),
|
|
|
+ yshYjReq.getAdmissTimes(), flag);
|
|
|
+
|
|
|
+ if (feeCount == 0) {
|
|
|
+ throw new BizException(ExceptionEnum.INVALID_PARAM, "更新失败请联系管理员");
|
|
|
+ }
|
|
|
+ hospitalizationCostsService.refundsByPatientOrder(yshYjReq.getInpatientNo(), yshYjReq.getAdmissTimes(), yshYjReq.getActOrderNo());
|
|
|
+ return ResultVoUtil.success("操作成功。");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量更新数据
|
|
|
+ * reqNo_inpatient_no_admiss_times_act_order_no
|
|
|
+ *
|
|
|
+ * @param reqNoList 申请号 和 patNo , times 加 医嘱号 联合 ,下滑线连接起来
|
|
|
+ * @param confirmId 确认人的 id
|
|
|
+ * @return 返回提示
|
|
|
+ */
|
|
|
+ public ResultVo<String> medConfirmList(List<String> reqNoList, String confirmId) {
|
|
|
+ UserInfo userInfo = redisLikeService.getUserInfoByCode(confirmId);
|
|
|
+ if (userInfo == null) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.INVALID_PARAM, "未查询到确认人数据");
|
|
|
+ }
|
|
|
+ // 1 确认 2 取消
|
|
|
+ int flag = 1;
|
|
|
+ Date now = new Date();
|
|
|
+
|
|
|
+ ListUtil.batchList(reqNoList, DuiWaiJieKouDao.class, (mapper, item) -> {
|
|
|
+ // 解析出来的信息
|
|
|
+ Param p = new Param(item);
|
|
|
+ mapper.updateYshYjReqFlag(confirmId, p.getReqNo(), now, userInfo.getDeptCode(), flag);
|
|
|
+ mapper.confirmTheIntermediateTable(confirmId, p.getOrderNo(), now, userInfo.getDeptCode(), p.getPatNo(), p.getTimes(), flag);
|
|
|
+ });
|
|
|
+
|
|
|
+ return ResultVoUtil.success("确认成功。");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|