| | |
| | | package com.ltkj.web.controller.system; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import javax.annotation.Resource; |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import jodd.util.StringUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | * @author ltkj |
| | | * @date 2022-11-25 |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/hosp/water") |
| | | @Api(tags = "体检流水接口") |
| | |
| | | return AjaxResult.error("补录失败,所选项目可能已存在 不可补录!"); |
| | | } |
| | | |
| | | BigDecimal zongjia = new BigDecimal("0.0"); |
| | | // his直接单开体检费单项目总价编码 |
| | | String tjfhisxmbm = configService.selectConfigByKey("tjfhisxmbm"); |
| | | // 是否开启his直接单开体检费单项目 N使用明细开单 其他都为单项目开总价 |
| | | String lycdzjhmxj = configService.selectConfigByKey("lycdzjhmxj"); |
| | | // 是否使用his价格传递规则 Y开启 |
| | | String sfsyhisjgrule = configService.selectConfigByKey("sfsyhisjgrule"); |
| | | // his价格传递规则保留得位数 默认2位 |
| | | String sfsyhisjgrulebaoliuweishu = configService.selectConfigByKey("sfsyhisjgrulebaoliuweishu"); |
| | | // his价格传递规则 1四舍五入 2直接舍去 |
| | | String sfsyhisjgrulesconfig = configService.selectConfigByKey("sfsyhisjgrulesconfig"); |
| | | // 传递项目是否使用his科室 |
| | | String isUseHisKs = configService.selectConfigByKey("isCreateMenZhenFyUseHisKs"); |
| | | String createMenZhenFyZJUseHisKs = configService.selectConfigByKey("createMenZhenFyZJUseHisKs"); |
| | | |
| | | for (TbTransition transition : list) { |
| | | LambdaQueryWrapper<TjProject> wrapper1 = new LambdaQueryWrapper<>(); |
| | | wrapper1.eq(TjProject::getProId, transition.getProId()); |
| | |
| | | BigDecimal danjia = transition.getNowPrice(); |
| | | Integer sl = project.getSl(); |
| | | BigDecimal allPrice = danjia.multiply(new BigDecimal(sl)); |
| | | |
| | | if (StrUtil.isNotBlank(sfsyhisjgrule) && sfsyhisjgrule.equalsIgnoreCase("Y")){ |
| | | int baoliuweishu = 2; |
| | | if (StrUtil.isNotBlank(sfsyhisjgrulebaoliuweishu)){ |
| | | try { |
| | | baoliuweishu = Integer.parseInt(sfsyhisjgrulebaoliuweishu); |
| | | } catch (NumberFormatException e) { |
| | | log.error("his价格传递规则保留位数转换异常 配置值->{}\n{}{}",sfsyhisjgrulebaoliuweishu,e,e.getMessage()); |
| | | return AjaxResult.error(); |
| | | } |
| | | } |
| | | if (StrUtil.isNotBlank(sfsyhisjgrulesconfig) && !sfsyhisjgrulesconfig.equalsIgnoreCase("1")){ |
| | | // 其他自定义的规则计算方法 |
| | | }else { |
| | | // 四舍五入 |
| | | danjia = danjia.setScale(baoliuweishu, RoundingMode.HALF_UP); |
| | | allPrice = danjia.multiply(new BigDecimal(sl)).setScale(baoliuweishu, RoundingMode.HALF_UP); |
| | | } |
| | | } |
| | | |
| | | obj.putOpt("danJia", danjia); |
| | | obj.putOpt("jieSuanJe", allPrice); |
| | | obj.putOpt("shuliang", sl); |
| | | obj.putOpt("zhiXingKs", dept.getDeptId()); |
| | | obj.putOpt("zhiXingKsMc", dept.getDeptName()); |
| | | if (isUseHisKs.equalsIgnoreCase("Y")) { |
| | | obj.putOpt("zhiXingKs", dept.getHisksid()); |
| | | obj.putOpt("zhiXingKsMc", dept.getHisksmc()); |
| | | }else { |
| | | obj.putOpt("zhiXingKs", dept.getDeptId()); |
| | | obj.putOpt("zhiXingKsMc", dept.getDeptName()); |
| | | } |
| | | obj.putOpt("shouFeiXmId", project.getHisXmbm()); |
| | | obj.putOpt("shouFeiXmMc", project.getHisXmmc()); |
| | | |
| | | // obj.putOpt("zhiXingKs","7805"); |
| | | // obj.putOpt("zhiXingKsMc","体检科"); |
| | | // obj.putOpt("shouFeiXmId","4735346"); |
| | | // obj.putOpt("shouFeiXmMc","体检费"); |
| | | array.add(obj); |
| | | zongjia = zongjia.add(allPrice); |
| | | } |
| | | map.put("feiYongInfoList", array); |
| | | |
| | | if(StringUtil.isNotBlank(lycdzjhmxj) && lycdzjhmxj.equalsIgnoreCase("N")){ |
| | | map.put("feiYongInfoList", array); |
| | | }else { |
| | | zongjia = tjFlowingWater.getPaidIn(); |
| | | JSONArray zjarray = JSONUtil.createArray(); |
| | | JSONObject obj = JSONUtil.createObj(); |
| | | int sl = 1; |
| | | obj.putOpt("danJia", zongjia); |
| | | obj.putOpt("jieSuanJe", zongjia); |
| | | obj.putOpt("shuliang", sl); |
| | | if (isUseHisKs.equalsIgnoreCase("Y")) { |
| | | if (StrUtil.isBlank(createMenZhenFyZJUseHisKs)) return AjaxResult.error(); |
| | | obj.putOpt("zhiXingKs", createMenZhenFyZJUseHisKs); |
| | | }else { |
| | | obj.putOpt("zhiXingKs", "100"); |
| | | } |
| | | obj.putOpt("zhiXingKsMc","体检中心"); |
| | | obj.putOpt("shouFeiXmId", tjfhisxmbm); |
| | | obj.putOpt("shouFeiXmMc", "体检费"); |
| | | zjarray.add(obj); |
| | | map.put("feiYongInfoList", zjarray); |
| | | } |
| | | |
| | | log.info("补录调用His接口前 收费总价:{}", zongjia.toString()); |
| | | |
| | | String post = HttpClientUtils.sendPost(apiUrl + "/api/his/" + hospbm + "/creatCostInfo", map); |
| | | JSONObject object = JSONUtil.parseObj(post); |