| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | 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.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | 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; |
| | |
| | | private IJimuOnlineReportService reportService; |
| | | @Resource |
| | | private ITjPackageProjectService tjPackageProjectService; |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | @Autowired |
| | | private ISysDeptService sysDeptService; |
| | | @Autowired |
| | | private TjFlowingWaterHisService tjFlowingWaterHisService; |
| | | @Autowired |
| | | private ITjSamplingService tjSamplingService; |
| | | |
| | | /** |
| | | * 查询该体检号对应的订单流水列表 |
| | |
| | | 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.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() +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(); |
| | | // } |
| | |
| | | return AjaxResult.success("该订单已付款 无须再付"); |
| | | } |
| | | if (tjFlowingWaterService.updateById(tjFlowingWater)) { |
| | | LambdaQueryWrapper<TjOrderDetail> wq2 = new LambdaQueryWrapper<>(); |
| | | wq2.eq(TjOrderDetail::getOrderId, tjFlowingWater.getOrderId()); |
| | | wq2.isNull(TjOrderDetail::getFlowingWaterId); |
| | | // LambdaQueryWrapper<TjOrderDetail> wq2 = new LambdaQueryWrapper<>(); |
| | | // wq2.eq(TjOrderDetail::getOrderId, tjFlowingWater.getOrderId()); |
| | | // wq2.isNull(TjOrderDetail::getFlowingWaterId); |
| | | List<TjConsumables> list2 = new ArrayList<>(); |
| | | for (TjOrderDetail tjOrderDetail : detailService.list(wq2)) { |
| | | tjOrderDetail.setFlowingWaterId(String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | detailService.updateById(tjOrderDetail); |
| | | } |
| | | // for (TjOrderDetail tjOrderDetail : detailService.list(wq2)) { |
| | | // tjOrderDetail.setFlowingWaterId(String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | // detailService.updateById(tjOrderDetail); |
| | | // } |
| | | detailService.updateTjOrderDetailsFlowingWaterIdByJxbzisnull(String.valueOf(order.getOrderId()),String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | remarkService.updateTjOrderRemarkSfbzByJxbzisnull(order.getOrderId().toString(),tjFlowingWater.getTjSerialNumber().toString()); |
| | | LambdaQueryWrapper<TjOrderDetail> wq3 = new LambdaQueryWrapper<>(); |
| | | wq3.eq(TjOrderDetail::getOrderId, tjFlowingWater.getOrderId()); |
| | | wq3.isNotNull(TjOrderDetail::getFlowingWaterId); |
| | | List<TjOrderDetail> detailList = detailService.list(wq3); |
| | | if (null != detailList && detailList.size() > 0) { |
| | | if (null != detailList && !detailList.isEmpty()) { |
| | | LambdaQueryWrapper<TbTransition> wqq = new LambdaQueryWrapper<>(); |
| | | wqq.eq(TbTransition::getCusId, customer.getCusIdcard()); |
| | | wqq.in(TbTransition::getProId, detailList.stream().map(TjOrderDetail::getProId).collect(Collectors.toList())); |
| | | List<TbTransition> tbTransitionList = transitionService.list(wqq); |
| | | if (null != tbTransitionList && tbTransitionList.size() > 0) { |
| | | if (null != tbTransitionList && !tbTransitionList.isEmpty()) { |
| | | // extracted(order, list2, tbTransitionList); |
| | | //异步添加收费明细 |
| | | asyncService.collectFees(order, list2, tbTransitionList, sysUser, tjFlowingWater.getDiscount()); |
| | |
| | | return AjaxResult.success("该用户已收费不可重复收费"); |
| | | } |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | @PutMapping("supper") |
| | | @ApiOperation(value = "体检点击强制收费按钮接口") |
| | | @Transactional |
| | | @RepeatSubmit |
| | | public AjaxResult supperEdit(@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); |
| | | 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() +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(); |
| | | //异步单项收费明细 |
| | | Boolean b = asyncService.iundividualCharges(tjFlowingWater, order, customer, sysUser,jxbz); |
| | | if (!b){ |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error(); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("waterId", tjFlowingWater.getWaterId()); |
| | | map.put("mobanId", reportService.getMoBanIds()); |
| | | return AjaxResult.success("收费成功", map); |
| | | } |
| | | } |
| | | |
| | | if (flowingWater.getPayStasus() == 1) { |
| | | return AjaxResult.success("该订单已付款 无须再付"); |
| | | } |
| | | String s = configService.selectConfigByKey("is_request_common_his_api"); |
| | | if (null != s && s.equals("Y") && order.getTjType().equals("2") && StrUtil.isNotBlank(tjFlowingWater.getHisWaterId())) { |
| | | tjFlowingWater.setPayStasus(1L); |
| | | } |
| | | if (tjFlowingWaterService.updateById(tjFlowingWater)) { |
| | | // LambdaQueryWrapper<TjOrderDetail> wq2 = new LambdaQueryWrapper<>(); |
| | | // wq2.eq(TjOrderDetail::getOrderId, tjFlowingWater.getOrderId()); |
| | | // wq2.isNull(TjOrderDetail::getFlowingWaterId); |
| | | List<TjConsumables> list2 = new ArrayList<>(); |
| | | // for (TjOrderDetail tjOrderDetail : detailService.list(wq2)) { |
| | | // tjOrderDetail.setFlowingWaterId(String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | // detailService.updateById(tjOrderDetail); |
| | | // } |
| | | if (StrUtil.isBlank(flowingWater.getJxbz())){ |
| | | detailService.updateTjOrderDetailsFlowingWaterIdByJxbzisnull(String.valueOf(order.getOrderId()),String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | remarkService.updateTjOrderRemarkSfbzByJxbzisnull(order.getOrderId().toString(),tjFlowingWater.getTjSerialNumber().toString()); |
| | | }else { |
| | | detailService.updateTjOrderDetailsFlowingWaterIdByJxbz(String.valueOf(order.getOrderId()), flowingWater.getJxbz(), String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | remarkService.updateTjOrderRemarkSfbzByJxbz(order.getOrderId().toString(), flowingWater.getJxbz(), tjFlowingWater.getTjSerialNumber().toString()); |
| | | } |
| | | |
| | | LambdaQueryWrapper<TjOrderDetail> wq3 = new LambdaQueryWrapper<>(); |
| | | wq3.eq(TjOrderDetail::getOrderId, tjFlowingWater.getOrderId()); |
| | | wq3.isNotNull(TjOrderDetail::getFlowingWaterId); |
| | | List<TjOrderDetail> detailList = detailService.list(wq3); |
| | | if (null != detailList && !detailList.isEmpty()) { |
| | | LambdaQueryWrapper<TbTransition> wqq = new LambdaQueryWrapper<>(); |
| | | wqq.eq(TbTransition::getCusId, customer.getCusIdcard()); |
| | | wqq.in(TbTransition::getProId, detailList.stream().map(TjOrderDetail::getProId).collect(Collectors.toList())); |
| | | List<TbTransition> tbTransitionList = transitionService.list(wqq); |
| | | if (null != tbTransitionList && !tbTransitionList.isEmpty()) { |
| | | // extracted(order, list2, tbTransitionList); |
| | | //异步添加收费明细 |
| | | asyncService.collectFees(order, list2, tbTransitionList, sysUser, tjFlowingWater.getDiscount()); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("waterId", tjFlowingWater.getWaterId()); |
| | | map.put("mobanId", reportService.getMoBanIds()); |
| | | return AjaxResult.success("收费成功", map); |
| | | } |
| | | } |
| | | return AjaxResult.success("该用户已收费不可重复收费"); |
| | | } |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | @PutMapping("refund") |
| | | @ApiOperation(value = "体检点击强制退费按钮接口") |
| | | @Transactional |
| | | @RepeatSubmit |
| | | public AjaxResult refundEdit(@RequestBody String json){ |
| | | JSONObject parseObj = JSONUtil.parseObj(json); |
| | | String tjSerialNumber = parseObj.getStr("tjSerialNumber"); |
| | | TjFlowingWater tjFlowingWater = tjFlowingWaterService.getById(tjSerialNumber); |
| | | Long orderId = tjFlowingWater.getOrderId(); |
| | | LambdaQueryWrapper<TjOrderRemark> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(TjOrderRemark::getSfbz,tjSerialNumber); |
| | | List<TjOrderRemark> list = remarkService.list(wrapper); |
| | | if (list.isEmpty()){ |
| | | return AjaxResult.error("该人员没有已收费项目"); |
| | | } |
| | | String tjNumber = list.get(0).getTjNumber(); |
| | | List<Long> proIds = list.stream().map(TjOrderRemark::getProId).collect(Collectors.toList()); |
| | | LambdaQueryWrapper<TjSampling> wrapper1 = new LambdaQueryWrapper<>(); |
| | | wrapper1.eq(TjSampling::getTjNum,tjNumber); |
| | | wrapper1.in(TjSampling::getProId,proIds); |
| | | wrapper1.eq(TjSampling::getIsSignFor,"0"); |
| | | List<TjSampling> samplings = tjSamplingService.list(wrapper1); |
| | | if (!samplings.isEmpty()) |
| | | return AjaxResult.error("该人员此单中存在已做的化验项目,不可退费"); |
| | | |
| | | if (StrUtil.isBlank(tjFlowingWater.getJxbz())){ |
| | | |
| | | LambdaUpdateWrapper<TjOrderDetail> wrapper2 = new LambdaUpdateWrapper<>(); |
| | | wrapper2.set(TjOrderDetail::getFlowingWaterId,null) |
| | | .set(TjOrderDetail::getUpdateTime,new Date()) |
| | | .eq(TjOrderDetail::getOrderId,orderId) |
| | | .isNull(TjOrderDetail::getJxbz); |
| | | detailService.update(wrapper2); |
| | | |
| | | LambdaUpdateWrapper<TjOrderRemark> wrapper3 = new LambdaUpdateWrapper<>(); |
| | | // wrapper3 |
| | | }else { |
| | | // detailService.updateTjOrderDetailsFlowingWaterIdByJxbz(String.valueOf(order.getOrderId()), flowingWater.getJxbz(), String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | // remarkService.updateTjOrderRemarkSfbzByJxbz(order.getOrderId().toString(), flowingWater.getJxbz(), tjFlowingWater.getTjSerialNumber().toString()); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | |
| | | .or() |
| | | .like(TjCustomer::getCusPhone, tjPhone); |
| | | List<TjCustomer> customerList = customerService.list(wq0); |
| | | if (null != customerList && customerList.size() > 0) { |
| | | if (null != customerList && !customerList.isEmpty()) { |
| | | for (TjCustomer customer : customerList) { |
| | | LambdaQueryWrapper<TjOrder> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.eq(TjOrder::getUserId, customer.getCusId()); |
| | | wq1.eq(TjOrder::getCheckStatus, 0); |
| | | wq1.orderByDesc(TjOrder::getCreateTime); |
| | | List<TjOrder> tjOrders = orderService.list(wq1); |
| | | if (null != tjOrders && tjOrders.size() > 0) { |
| | | if (null != tjOrders && !tjOrders.isEmpty()) { |
| | | for (TjOrder order : tjOrders) { |
| | | LambdaQueryWrapper<TjOrderDetail> wq2 = new LambdaQueryWrapper<>(); |
| | | wq2.eq(TjOrderDetail::getOrderId, order.getOrderId()); |
| | | List<TjOrderDetail> detailList = detailService.list(wq2); |
| | | if (null != detailList && detailList.size() > 0) { |
| | | if (null != detailList && !detailList.isEmpty()) { |
| | | TjCollectFeesVo tjRefundVo = new TjCollectFeesVo(); |
| | | tjRefundVo.setTjCusId(String.valueOf(customer.getCusId())); |
| | | tjRefundVo.setTjName(customer.getCusName()); |
| | |
| | | } |
| | | } |
| | | } |
| | | // TjOrder order = null; |
| | | // if (null != tjOrders && tjOrders.size() > 0) { |
| | | // order = tjOrders.get(0); |
| | | // } |
| | | // if (null == order) { |
| | | // continue; |
| | | // } |
| | | // LambdaQueryWrapper<TjOrderDetail> wq2 = new LambdaQueryWrapper<>(); |
| | | // wq2.eq(TjOrderDetail::getOrderId, order.getOrderId()); |
| | | // List<TjOrderDetail> detailList = detailService.list(wq2); |
| | | // if (null != detailList && detailList.size() > 0) { |
| | | // TjCollectFeesVo tjRefundVo = new TjCollectFeesVo(); |
| | | // tjRefundVo.setTjCusId(String.valueOf(customer.getCusId())); |
| | | // tjRefundVo.setTjName(customer.getCusName()); |
| | | // tjRefundVo.setTjPhone(customer.getCusPhone()); |
| | | // tjRefundVo.setSex(String.valueOf(customer.getCusSex())); |
| | | // tjRefundVo.setIdCard(customer.getCusIdcard()); |
| | | // if (null != order.getDictCompName()) |
| | | // tjRefundVo.setTjComp(compService.getById(order.getFirmId()) != null ? compService.getById(order.getFirmId()).getCnName() : null); |
| | | // if (null != order.getTjType()) tjRefundVo.setTjType(order.getTjType()); |
| | | // LambdaQueryWrapper<TjFlowingWater> wq = new LambdaQueryWrapper<>(); |
| | | // wq.eq(TjFlowingWater::getOrderId, order.getOrderId()); |
| | | // wq.eq(TjFlowingWater::getIsAddition, "N"); |
| | | // wq.eq(TjFlowingWater::getPayStasus, 0); |
| | | // TjFlowingWater one = tjFlowingWaterService.getOne(wq); |
| | | //// if (null == one) { |
| | | //// return AjaxResult.success("不可重复收费"); |
| | | //// } |
| | | // tjRefundVo.setTjFlowingWater(one); |
| | | // tjRefundVo.setTjNumber(order.getTjNumber()); |
| | | // tjRefundVo.setTjOrderId(String.valueOf(order.getOrderId())); |
| | | // tjCollectFeesVoList.add(tjRefundVo); |
| | | // } |
| | | } |
| | | return AjaxResult.success(tjCollectFeesVoList); |
| | | } |
| | |
| | | wq1.likeLeft(TjOrder::getTjNumber, tjNum); |
| | | // wq1.eq(TjOrder::getCheckStatus, 0); |
| | | List<TjOrder> orderList = orderService.list(wq1); |
| | | if (null != orderList && orderList.size() > 0) { |
| | | if (null != orderList && !orderList.isEmpty()) { |
| | | for (TjOrder order : orderList) { |
| | | LambdaQueryWrapper<TjOrderDetail> wq2 = new LambdaQueryWrapper<>(); |
| | | wq2.eq(TjOrderDetail::getOrderId, order.getOrderId()); |
| | | //wq2.isNull(TjOrderDetail::getFlowingWaterId); |
| | | List<TjOrderDetail> detailList = detailService.list(wq2); |
| | | if (null != detailList && detailList.size() > 0) { |
| | | if (null != detailList && !detailList.isEmpty()) { |
| | | TjCustomer customer = customerService.getById(order.getUserId()); |
| | | if (null != customer) { |
| | | TjCollectFeesVo tjRefundVo = new TjCollectFeesVo(); |
| | | tjRefundVo.setTjCusId(String.valueOf(customer.getCusId())); |
| | | tjRefundVo.setTjName(customer.getCusName()); |
| | | tjRefundVo.setTjPhone(customer.getCusPhone()); |
| | | tjRefundVo.setSex(String.valueOf(customer.getCusSex())); |
| | | tjRefundVo.setIdCard(customer.getCusIdcard()); |
| | | if (null != order.getFirmId()) { |
| | | DictComp byId = compService.getById(order.getFirmId()); |
| | | if (null != byId) { |
| | | tjRefundVo.setTjComp(byId.getCnName()); |
| | | } |
| | | } |
| | | if (null != order.getTjType()) tjRefundVo.setTjType(order.getTjType()); |
| | | TjFlowingWater one = tjFlowingWaterService.getOne(new LambdaQueryWrapper<TjFlowingWater>() |
| | | .eq(TjFlowingWater::getOrderId, order.getOrderId()) |
| | | .eq(TjFlowingWater::getIsAddition, "N") |
| | | .ne(TjFlowingWater::getPayStasus, 2)); |
| | | tjRefundVo.setTjFlowingWater(one); |
| | | tjRefundVo.setTjNumber(order.getTjNumber()); |
| | | tjRefundVo.setTjOrderId(String.valueOf(order.getOrderId())); |
| | | tjCollectFeesVoList.add(tjRefundVo); |
| | | } |
| | | } |
| | | } |
| | | return AjaxResult.success(tjCollectFeesVoList); |
| | | } |
| | | return AjaxResult.success("该用户不存在或已体检完成"); |
| | | } |
| | | return AjaxResult.error("请输入要查询条件"); |
| | | } |
| | | |
| | | /** |
| | | * 体检(收费)页面查询接口 |
| | | */ |
| | | @GetMapping("/findTjCollectFeesByNameAndTjNumAndPhoneN") |
| | | @ApiOperation(value = "体检(收费)页面查询接口") |
| | | public AjaxResult findTjCollectFeesByNameAndTjNumAndPhoneNew(@RequestParam(required = false) @ApiParam(value = "体检号") String tjNum, |
| | | @RequestParam(required = false) @ApiParam(value = "体检人姓名") String tjName, |
| | | @RequestParam(required = false) @ApiParam(value = "体检人手机号") String tjPhone) { |
| | | List<TjCollectFeesVo> tjCollectFeesVoList = new ArrayList<>(); |
| | | if (null != tjName || null != tjPhone) { |
| | | LambdaQueryWrapper<TjCustomer> wq0 = new LambdaQueryWrapper<>(); |
| | | wq0.like(TjCustomer::getCusName, tjName) |
| | | .or() |
| | | .like(TjCustomer::getCusPhone, tjPhone); |
| | | List<TjCustomer> customerList = customerService.list(wq0); |
| | | if (null != customerList && !customerList.isEmpty()) { |
| | | LambdaQueryWrapper<TjOrder> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.in(TjOrder::getUserId,customerList.stream().map(TjCustomer::getCusId).collect(Collectors.toList())); |
| | | wq1.eq(TjOrder::getCheckStatus, 0); |
| | | // wq1.isNotNull(TjOrder::getReportTime); |
| | | wq1.orderByDesc(TjOrder::getCreateTime); |
| | | List<TjOrder> tjOrders = orderService.list(wq1); |
| | | if (null != tjOrders && !tjOrders.isEmpty()) { |
| | | for (TjOrder order : tjOrders) { |
| | | TjCustomer customer = customerService.getById(order.getUserId()); |
| | | LambdaQueryWrapper<TjOrderDetail> wq2 = new LambdaQueryWrapper<>(); |
| | | wq2.eq(TjOrderDetail::getOrderId, order.getOrderId()); |
| | | List<TjOrderDetail> detailList = detailService.list(wq2); |
| | | if (null != detailList && !detailList.isEmpty()) { |
| | | TjCollectFeesVo tjRefundVo = new TjCollectFeesVo(); |
| | | tjRefundVo.setTjCusId(String.valueOf(customer.getCusId())); |
| | | tjRefundVo.setTjName(customer.getCusName()); |
| | | tjRefundVo.setTjPhone(customer.getCusPhone()); |
| | | tjRefundVo.setSex(String.valueOf(customer.getCusSex())); |
| | | if (null != customer.getCusIdcard()) tjRefundVo.setIdCard(customer.getCusIdcard()); |
| | | DictComp dictComp = compService.getById(order.getFirmId()); |
| | | if (null != dictComp) { |
| | | tjRefundVo.setTjComp(dictComp.getCnName()); |
| | | } else { |
| | | tjRefundVo.setTjComp("无"); |
| | | } |
| | | if (null != order.getTjType()) tjRefundVo.setTjType(order.getTjType()); |
| | | LambdaQueryWrapper<TjFlowingWater> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjFlowingWater::getOrderId, order.getOrderId()); |
| | | // wq.eq(TjFlowingWater::getIsAddition, "N"); |
| | | wq.ne(TjFlowingWater::getPayStasus, 2); |
| | | |
| | | List<TjFlowingWater> list = tjFlowingWaterService.list(wq); |
| | | for (TjFlowingWater water : list) { |
| | | tjRefundVo.setTjFlowingWater(water); |
| | | tjRefundVo.setTjNumber(order.getTjNumber()); |
| | | tjRefundVo.setTjOrderId(String.valueOf(order.getOrderId())); |
| | | TjCollectFeesVo vo = BeanUtil.copyProperties(tjRefundVo, TjCollectFeesVo.class); |
| | | tjCollectFeesVoList.add(vo); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return AjaxResult.success(tjCollectFeesVoList); |
| | | } |
| | | return AjaxResult.error("该用户不存在"); |
| | | } |
| | | |
| | | if (null != tjNum) { |
| | | LambdaQueryWrapper<TjOrder> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.likeLeft(TjOrder::getTjNumber, tjNum); |
| | | // wq1.eq(TjOrder::getCheckStatus, 0); |
| | | List<TjOrder> orderList = orderService.list(wq1); |
| | | if (null != orderList && !orderList.isEmpty()) { |
| | | for (TjOrder order : orderList) { |
| | | LambdaQueryWrapper<TjOrderDetail> wq2 = new LambdaQueryWrapper<>(); |
| | | wq2.eq(TjOrderDetail::getOrderId, order.getOrderId()); |
| | | //wq2.isNull(TjOrderDetail::getFlowingWaterId); |
| | | List<TjOrderDetail> detailList = detailService.list(wq2); |
| | | if (null != detailList && !detailList.isEmpty()) { |
| | | TjCustomer customer = customerService.getById(order.getUserId()); |
| | | if (null != customer) { |
| | | TjCollectFeesVo tjRefundVo = new TjCollectFeesVo(); |
| | |
| | | } |
| | | String pacId = transitionService.selectPacIdByTbTransitionTjNumAndProId(order.getTjNumber(),order.getCardId()); |
| | | String s = tjFlowingWaterService.getDiscount(OrderId); |
| | | if (null != tjProjectList && tjProjectList.size() > 0) { |
| | | if (null != tjProjectList && !tjProjectList.isEmpty()) { |
| | | for (TjProject project : tjProjectList) { |
| | | if (project.getProParentId() == 0) { |
| | | /* //LambdaQueryWrapper<TbTransition> wqq1 = new LambdaQueryWrapper<>(); |
| | | // wqq1.eq(TbTransition::getCusId, customerService.getById(order.getUserId()).getCusIdcard()); |
| | | // wqq1.eq(TbTransition::getParentProId, project.getProId()); |
| | | // List<TbTransition> tbTransitionList = transitionService.list(wqq1); |
| | | // BigDecimal bigDecimal = new BigDecimal("0.00"); |
| | | // BigDecimal bigDecimal1 = new BigDecimal("0.00"); |
| | | // for (TbTransition transition : tbTransitionList) { |
| | | // bigDecimal = bigDecimal.add(transition.getNowPrice()); |
| | | // bigDecimal1=bigDecimal1.add(transition.getOrdPrice()); |
| | | // } |
| | | // project.setProPrice(bigDecimal.setScale(0,BigDecimal.ROUND_UP)); |
| | | // project.setProOrdPrice(bigDecimal1); |
| | | BigDecimal decimal = transitionService.getTbTransitionPriceAndOrdPrice(customerService.getById(order.getUserId()).getCusIdcard(), |
| | | project.getProId()); |
| | | String s = tjFlowingWaterService.getDiscount(OrderId); |
| | | if(null !=decimal){ |
| | | // project.setProPrice(decimal.setScale(2)); |
| | | project.setProPrice(decimal); |
| | | // project.setProOrdPrice(decimal.multiply(new BigDecimal(s)).setScale(2)); |
| | | project.setProOrdPrice(decimal); |
| | | }else { |
| | | BigDecimal decimal1 = transitionService.getTbTransitionDxPriceAndOrdPrice(String.valueOf(order.getUserId()),project.getProId()); |
| | | if(null !=decimal1){ |
| | | project.setProPrice(decimal1.setScale(2)); |
| | | project.setProOrdPrice(decimal1.multiply(new BigDecimal(s)).setScale(2)); |
| | | }else { |
| | | project.setProPrice(new BigDecimal("0.00").setScale(2)); |
| | | project.setProOrdPrice(new BigDecimal("0.00").setScale(2)); |
| | | } |
| | | }*/ |
| | | if (null != pacId) { |
| | | TjPackageProject pp = tjPackageProjectService.getOne(new LambdaQueryWrapper<TjPackageProject>().eq(TjPackageProject::getPacId, pacId) |
| | | .eq(TjPackageProject::getProId, String.valueOf(project.getProId()))); |
| | |
| | | List<TjFlowingWater> list = tjFlowingWaterService.list(new LambdaQueryWrapper<TjFlowingWater>() |
| | | .eq(TjFlowingWater::getOrderId, order) |
| | | .eq(TjFlowingWater::getPayStasus, 2)); |
| | | if (null != list && list.size() > 0) { |
| | | if (null != list && !list.isEmpty()) { |
| | | List<TjProject> projectList = projectService.getTjProListByPacIdAndDeptId(pacId); |
| | | if(null !=projectList && projectList.size()>0){ |
| | | if(null !=projectList && !projectList.isEmpty()){ |
| | | for (TjProject project : projectList) { |
| | | project.setProOrdPrice(tjPackageProjectService.getPacProPriceByPacIdAndPro(project.getProId(),pacId) |
| | | .multiply(new BigDecimal(s)).setScale(2)); |
| | | tjProjectList.add(project); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | return AjaxResult.success(tjProjectList); |
| | | } |
| | | } |
| | | return AjaxResult.error("暂时没有数据"); |
| | | } |
| | | |
| | | /** |
| | | * 体检已收费未收费信息查询接口 |
| | | */ |
| | | @GetMapping("/findTjChargedButNotChargedByTjNumN") |
| | | @ApiOperation(value = "体检已收费未收费信息查询接口") |
| | | public AjaxResult findTjChargedButNotChargedByTjNumN(@RequestParam @ApiParam(value = "0未缴费1已缴费") Integer type, |
| | | @RequestParam @ApiParam(value = "体检号") String OrderId, |
| | | @RequestParam String tjSerialNumber) { |
| | | if (null != OrderId) { |
| | | TjOrder order = orderService.getById(OrderId); |
| | | if (null != order) { |
| | | List<TjProject> tjProjectList = null; |
| | | TjFlowingWater water = tjFlowingWaterService.getById(tjSerialNumber); |
| | | if (type == 0) { |
| | | if (StrUtil.isBlank(water.getJxbz())) |
| | | tjProjectList = detailService.selectTjOrderDetailListByFlowingWaterIdIsNullAndJxbzIsNull(OrderId); |
| | | else tjProjectList = detailService.selectTjOrderDetailListByFlowingWaterIdIsNullN(OrderId,water.getJxbz()); |
| | | } else { |
| | | if (StrUtil.isBlank(water.getJxbz())) |
| | | tjProjectList = detailService.selectTjOrderDetailListByFlowingWaterIdIsNotNullAndJxbzIsNull(OrderId); |
| | | else tjProjectList = detailService.selectTjOrderDetailListByFlowingWaterIdIsNotNullN(OrderId,water.getJxbz()); |
| | | } |
| | | String pacId = transitionService.selectPacIdByTbTransitionTjNumAndProId(order.getTjNumber(),order.getCardId()); |
| | | String s = tjFlowingWaterService.getDiscount(OrderId); |
| | | if (null != tjProjectList && !tjProjectList.isEmpty()) { |
| | | for (TjProject project : tjProjectList) { |
| | | if (project.getProParentId() == 0) { |
| | | if (null != pacId) { |
| | | TjPackageProject pp = tjPackageProjectService.getOne(new LambdaQueryWrapper<TjPackageProject>().eq(TjPackageProject::getPacId, pacId) |
| | | .eq(TjPackageProject::getProId, String.valueOf(project.getProId()))); |
| | | if (null != pp) { |
| | | project.setProPrice(pp.getPriceNow()); |
| | | project.setProOrdPrice(pp.getPriceNow().multiply(new BigDecimal(s))); |
| | | } else { |
| | | project.setProPrice(project.getProPrice().setScale(2)); |
| | | project.setProOrdPrice(project.getProPrice().multiply(new BigDecimal(s)).setScale(2)); |
| | | } |
| | | } else { |
| | | project.setProPrice(project.getProPrice().setScale(2)); |
| | | project.setProOrdPrice(project.getProPrice().multiply(new BigDecimal(s)).setScale(2)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | List<TjFlowingWater> list = tjFlowingWaterService.list(new LambdaQueryWrapper<TjFlowingWater>() |
| | | .eq(TjFlowingWater::getOrderId, order) |
| | | .eq(TjFlowingWater::getPayStasus, 2)); |
| | | if (null != list && !list.isEmpty()) { |
| | | List<TjProject> projectList = projectService.getTjProListByPacIdAndDeptId(pacId); |
| | | if(null !=projectList && !projectList.isEmpty()){ |
| | | for (TjProject project : projectList) { |
| | | project.setProOrdPrice(tjPackageProjectService.getPacProPriceByPacIdAndPro(project.getProId(),pacId) |
| | | .multiply(new BigDecimal(s)).setScale(2)); |