| | |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.extra.pinyin.PinyinUtil; |
| | | import cn.hutool.json.JSONArray; |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ltkj.common.annotation.RepeatSubmit; |
| | | import com.ltkj.common.core.domain.entity.SysDept; |
| | | import com.ltkj.common.core.domain.entity.SysUser; |
| | | import com.ltkj.common.utils.SecurityUtils; |
| | | import com.ltkj.framework.config.MatchUtils; |
| | |
| | | import com.ltkj.hosp.vodomain.TjCollectFeesVo; |
| | | import com.ltkj.hosp.vodomain.TjRefundProInfoVo; |
| | | import com.ltkj.hosp.vodomain.TjRefundVo; |
| | | import com.ltkj.system.service.ISysConfigService; |
| | | import com.ltkj.system.service.ISysDeptService; |
| | | import com.ltkj.system.service.ISysUserService; |
| | | import com.ltkj.web.wxUtils.HttpClientUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.ltkj.common.annotation.Log; |
| | | import com.ltkj.common.core.controller.BaseController; |
| | |
| | | private IJimuOnlineReportService reportService; |
| | | @Resource |
| | | private ITjPackageProjectService tjPackageProjectService; |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | @Autowired |
| | | private ISysDeptService sysDeptService; |
| | | @Autowired |
| | | private TjFlowingWaterHisService tjFlowingWaterHisService; |
| | | |
| | | /** |
| | | * 查询该体检号对应的订单流水列表 |
| | |
| | | LambdaQueryWrapper<TjChargingStandard> wq3 = new LambdaQueryWrapper<>(); |
| | | wq3.eq(TjChargingStandard::getTjNum, TjNumber); |
| | | List<TjChargingStandard> list = chargingStandardService.list(wq3); |
| | | if (null != list && list.size() > 0) { |
| | | if (null != list && !list.isEmpty()) { |
| | | for (TjChargingStandard standard : list) { |
| | | TjProject project = projectService.getById(standard.getProId()); |
| | | if (null != project && null != project.getProCheckType()) { |
| | |
| | | @PutMapping |
| | | @ApiOperation(value = "体检点击收费按钮接口") |
| | | @Transactional |
| | | @RepeatSubmit |
| | | public AjaxResult edit(@RequestBody TjFlowingWater tjFlowingWater) { |
| | | Long userId = Long.valueOf(SecurityUtils.getLoginUser().getUserId()); |
| | | SysUser sysUser = userService.getById(userId); |
| | | |
| | | TjFlowingWater flowingWater = tjFlowingWaterService.getById(tjFlowingWater.getTjSerialNumber()); |
| | | tjFlowingWater.setTollCollectorId(String.valueOf(SecurityUtils.getLoginUser().getUserId())); |
| | | tjFlowingWater.setPayStasus(1L); |
| | | // tjFlowingWater.setTollCollectorId(String.valueOf(SecurityUtils.getLoginUser().getUserId())); |
| | | // tjFlowingWater.setPayStasus(1L); |
| | | TjOrder order = orderService.getById(tjFlowingWater.getOrderId()); |
| | | |
| | | if(order.getFinishTime() !=null){ |
| | | return AjaxResult.error("该人员已签离,不可补录项目!"); |
| | | } |
| | | |
| | | TjCustomer customer = customerService.getById(order.getUserId()); |
| | | if (null != tjFlowingWater.getTjProIds() && tjFlowingWater.getTjProIds().length > 0) { |
| | | tjFlowingWater.setWaterId(PinyinUtil.getFirstLetter(customer.getCusName(), "").toUpperCase() + DateUtil.format(new Date(), "yyMMddHHmmssSSS")); |
| | | tjFlowingWater.setWaterId(PinyinUtil.getFirstLetter(customer.getCusName(), "").toUpperCase() +SecurityUtils.getUsername() + DateUtil.format(new Date(), "yyMMddHHmmssSSS")); |
| | | tjFlowingWater.setIsAddition("Y"); |
| | | if (tjFlowingWaterService.save(tjFlowingWater)) { |
| | | |
| | | Date dates = new Date(); |
| | | String jxbz = DateUtil.format(dates, "yyyyMMddHHmmss")+order.getOrderId(); |
| | | //异步单项收费明细 |
| | | asyncService.iundividualCharges(tjFlowingWater, order, customer, sysUser); |
| | | Boolean b = asyncService.iundividualCharges(tjFlowingWater, order, customer, sysUser,jxbz); |
| | | if (!b){ |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | String s = configService.selectConfigByKey("is_request_common_his_api"); |
| | | if (null != s && s.equals("Y") && order.getTjType().equals("2")) { |
| | | String apiUrl = configService.selectConfigByKey("common_api_url"); |
| | | String hospbm = configService.selectConfigByKey("common_api_service_hospbm"); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("pationId",customer.getPationId()); |
| | | map.put("cardId",customer.getHisJzkh()); |
| | | map.put("tjNum",tjFlowingWater.getTjSerialNumber()); |
| | | map.put("kaiDanKs","7805"); |
| | | // 收费标志 1待售费 2待退费 |
| | | map.put("shouTuiStatus","1"); |
| | | |
| | | JSONArray array = JSONUtil.createArray(); |
| | | LambdaQueryWrapper<TbTransition> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(TbTransition::getTjNum,order.getTjNumber()); |
| | | wrapper.eq(TbTransition::getCusId,customer.getCusIdcard()); |
| | | wrapper.eq(TbTransition::getCardId,customer.getCardId()); |
| | | wrapper.eq(TbTransition::getJxbz,jxbz); |
| | | wrapper.isNotNull(TbTransition::getOrdPrice); |
| | | wrapper.gt(TbTransition::getOrdPrice,0); |
| | | |
| | | List<TbTransition> list = transitionService.list(wrapper); |
| | | for (TbTransition transition : list) { |
| | | LambdaQueryWrapper<TjProject> wrapper1 = new LambdaQueryWrapper<>(); |
| | | wrapper1.eq(TjProject::getProId,transition.getProId()); |
| | | TjProject project = projectService.getOne(wrapper1); |
| | | |
| | | LambdaQueryWrapper<SysDept> wrapper2 = new LambdaQueryWrapper<>(); |
| | | wrapper2.eq(SysDept::getDeptId,project.getDeptId()); |
| | | SysDept dept = sysDeptService.getOne(wrapper2); |
| | | |
| | | JSONObject obj = JSONUtil.createObj(); |
| | | BigDecimal danjia = transition.getOrdPrice(); |
| | | Integer sl = project.getSl(); |
| | | BigDecimal allPrice = danjia.multiply(new BigDecimal(sl)); |
| | | obj.putOpt("danJia",danjia); |
| | | obj.putOpt("jieSuanJe",allPrice); |
| | | obj.putOpt("shuliang",sl); |
| | | 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); |
| | | } |
| | | map.put("feiYongInfoList",array); |
| | | |
| | | String post = HttpClientUtils.sendPost(apiUrl + "/api/his/"+hospbm+"/creatCostInfo", map); |
| | | JSONObject object = JSONUtil.parseObj(post); |
| | | if (object.getInt("code") == 200) { |
| | | JSONObject data = object.getJSONObject("data"); |
| | | tjFlowingWater.setHisWaterId(data.getStr("feiYongId")); |
| | | JSONArray mxList = data.getJSONArray("mxList"); |
| | | if (mxList != null && mxList.size() > 0) { |
| | | List<TjFlowingWaterHis> his = mxList.toList(TjFlowingWaterHis.class); |
| | | tjFlowingWaterHisService.saveBatch(his); |
| | | } |
| | | tjFlowingWaterService.updateById(tjFlowingWater); |
| | | }else { |
| | | return AjaxResult.error(); |
| | | } |
| | | } |
| | | // if(!b){ |
| | | // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | // } |
| | | //extracted(tjFlowingWater, order, customer); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("waterId", tjFlowingWater.getWaterId()); |
| | |
| | | } else { |
| | | tjProjectList = detailService.selectTjOrderDetailListByFlowingWaterIdIsNotNull(OrderId); |
| | | } |
| | | String pacId = transitionService.selectPacIdByTbTransitionTjNumAndProId(order.getTjNumber()); |
| | | String pacId = transitionService.selectPacIdByTbTransitionTjNumAndProId(order.getTjNumber(),order.getCardId()); |
| | | String s = tjFlowingWaterService.getDiscount(OrderId); |
| | | if (null != tjProjectList && tjProjectList.size() > 0) { |
| | | for (TjProject project : tjProjectList) { |
| | |
| | | wq.ne(TjOrderDetail::getTjStatus, 3); |
| | | wq.isNotNull(TjOrderDetail::getFlowingWaterId); |
| | | List<TjOrderDetail> detailList = detailService.list(wq); |
| | | String pacId = transitionService.selectPacIdByTbTransitionTjNumAndProId(tjOrder.getTjNumber()); |
| | | String pacId = transitionService.selectPacIdByTbTransitionTjNumAndProId(tjOrder.getTjNumber(),tjOrder.getCardId()); |
| | | if (null != detailList && detailList.size() > 0) { |
| | | List<TjRefundProInfoVo> tjRefundProInfoVoList = new ArrayList<>(); |
| | | for (TjOrderDetail detail : detailList) { |