| | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.OffsetTime; |
| | | import java.util.*; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.crypto.symmetric.DES; |
| | | import cn.hutool.extra.pinyin.PinyinUtil; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | import com.ltkj.common.core.domain.entity.SysDept; |
| | | import com.ltkj.common.core.domain.entity.SysUser; |
| | | import com.ltkj.common.core.redis.RedisCache; |
| | | import com.ltkj.common.enums.DataSourceType; |
| | | import com.ltkj.common.utils.SecurityUtils; |
| | | import com.ltkj.framework.config.MatchUtils; |
| | | import com.ltkj.framework.config.UserHoder; |
| | | import com.ltkj.framework.datasource.DynamicDataSourceContextHolder; |
| | | import com.ltkj.hosp.domain.*; |
| | | import com.ltkj.hosp.mapper.TestMapper; |
| | | import com.ltkj.hosp.service.*; |
| | | import com.ltkj.hosp.sqlDomain.LtkjMiddleDetail; |
| | | import com.ltkj.hosp.sqlDomain.LtkjMiddleHead; |
| | | import com.ltkj.hosp.vodomain.BingZhongVO; |
| | | import com.ltkj.hosp.vodomain.HistoryTjOrder; |
| | | import com.ltkj.hosp.vodomain.QjDomainVo; |
| | | import com.ltkj.mall.domain.MallCheckLog; |
| | | import com.ltkj.mall.domain.MallOrder; |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/hosp/order") |
| | | @Api(tags = "体检记录接口") |
| | | @Api(tags = "PC端 ----体检记录接口") |
| | | @Slf4j |
| | | public class TjOrderController extends BaseController { |
| | | @Resource |
| | |
| | | private String value; |
| | | @Resource |
| | | private ITjOrderRemarkService remarkService; |
| | | @Resource |
| | | private ITjTeamSelectRecordService selectRecordService; |
| | | @Resource |
| | | private TjAsyncService asyncService; |
| | | @Resource |
| | |
| | | |
| | | @Resource |
| | | private ITjRulesService rulesService; |
| | | |
| | | @Autowired |
| | | private ITjAskMedicalHistoryService tjAskMedicalHistoryService; |
| | | |
| | | @Autowired |
| | | private ITjReportGetAddressService tjReportGetAddressService; |
| | | |
| | | @Resource |
| | | private TestMapper testMapper; |
| | | |
| | | @Resource |
| | | private LtkjMiddleDetailService middleDetailService; |
| | | |
| | | @Resource |
| | | private LtkjMiddleHeadService headService; |
| | | |
| | | |
| | | /** |
| | |
| | | for (TjOrder order : list) { |
| | | TjCustomer tjCustomer = tjCustomerService.getById(order.getUserId()); |
| | | if (null != tjCustomer) { |
| | | order.setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName())); |
| | | order.setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone())); |
| | | order.setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard())); |
| | | // order.setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName())); |
| | | order.setTjCustomerName(tjCustomer.getCusName()); |
| | | // order.setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone())); |
| | | order.setTjCustomerPhone(tjCustomer.getCusPhone()); |
| | | // order.setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard())); |
| | | order.setTjCusIdCard(tjCustomer.getCusIdcard()); |
| | | order.setTjCustomerSex(tjCustomer.getCusSex()); |
| | | order.setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); |
| | | order.setCareer(tjCustomer.getCareer()); |
| | |
| | | order.setTjCustomerSex(tjCustomer.getCusSex()); |
| | | order.setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); |
| | | order.setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName())); |
| | | order.setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName())); |
| | | order.setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone())); |
| | | order.setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard())); |
| | | // order.setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard())); |
| | | order.setTjCusIdCard(tjCustomer.getCusIdcard()); |
| | | order.setCareer(tjCustomer.getCareer()); |
| | | order.setIdType(tjCustomer.getIdType()); |
| | | order.setAgeUnit(tjCustomer.getAgeUnit()); |
| | |
| | | LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>(); |
| | | wq.isNotNull(TjOrder::getReportTime); |
| | | wq.eq(TjOrder::getUserId, customer.getCusId()); |
| | | wq.eq(TjOrder::getHeshouStatus, 1); //核收状态为1才能打印 |
| | | list.addAll(tjOrderService.list(wq)); |
| | | } |
| | | List<TjOrder> collect = null; |
| | |
| | | Page<TjOrder> page1 = new Page<>(pageNum, pageSize); |
| | | LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>(); |
| | | wq.isNotNull(TjOrder::getReportTime); |
| | | wq.eq(TjOrder::getHeshouStatus, 1); //核收状态为1才能打印 |
| | | if (null != bgbeginTime && null != bgendTime) { |
| | | wq.between(TjOrder::getCreateTime, DateUtil.beginOfDay(bgbeginTime), DateUtil.endOfDay(bgendTime)); |
| | | } |
| | |
| | | order.setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); |
| | | order.setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName())); |
| | | order.setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone())); |
| | | order.setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard())); |
| | | if (tjCustomer.getCusIdcard() != null) { |
| | | order.setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard())); |
| | | } |
| | | } |
| | | String firmId = order.getFirmId(); |
| | | if (firmId != null && null != iDictCompService.getById(String.valueOf(order.getFirmId()))) { |
| | |
| | | order.setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); |
| | | order.setGrMoBanId(reportService.getGrMoBanIds()); |
| | | order.setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName())); |
| | | order.setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone())); |
| | | order.setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard())); |
| | | if (null != tjCustomer.getCusPhone()) |
| | | order.setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone())); |
| | | if (null != tjCustomer.getCusIdcard()) |
| | | order.setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard())); |
| | | } |
| | | String firmId = order.getFirmId(); |
| | | if (firmId != null && null != iDictCompService.getById(String.valueOf(order.getFirmId()))) { |
| | |
| | | order.setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); |
| | | order.setGrMoBanId(reportService.getGrMoBanIds()); |
| | | order.setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName())); |
| | | order.setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone())); |
| | | order.setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard())); |
| | | if (null != tjCustomer.getCusPhone()) |
| | | order.setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone())); |
| | | if (null != tjCustomer.getCusIdcard()) |
| | | order.setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard())); |
| | | } |
| | | String firmId = order.getFirmId(); |
| | | if (firmId != null && null != iDictCompService.getById(String.valueOf(order.getFirmId()))) { |
| | |
| | | |
| | | List<TjOrder> list = Optional.ofNullable(tjOrderService.list(wq)).get(); |
| | | if (list.size() > 0) { |
| | | List<TjOrder> list1 = new ArrayList<>(); |
| | | for (TjOrder order : list) { |
| | | TjCustomer tjCustomer = tjCustomerService.selectTjCustomerByCusId(order.getUserId()); |
| | | if (null != tjCustomer) { |
| | | order.setTjCustomerSex(tjCustomer.getCusSex()); |
| | | order.setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); |
| | | order.setGrMoBanId(reportService.getGrMoBanIds()); |
| | | order.setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName())); |
| | | order.setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone())); |
| | | order.setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard())); |
| | | asyncService.getPrintOrderList(list); |
| | | if (redisCache.hasKey("getPrintOrderList")) { |
| | | if (null != type && type == 0) { |
| | | List<TjOrder> list1 = redisCache.getCacheMapValue("getPrintOrderList", "0"); |
| | | collect = list1.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | } |
| | | String firmId = order.getFirmId(); |
| | | if (firmId != null && null != iDictCompService.selectDictCompByDrugManufacturerId(String.valueOf(order.getFirmId()))) { |
| | | order.setDictCompName(iDictCompService.selectDictCompByDrugManufacturerId(String.valueOf(order.getFirmId())).getCnName()); |
| | | if (null != type && type == 1) { |
| | | List<TjOrder> list1 = redisCache.getCacheMapValue("getPrintOrderList", "1"); |
| | | collect = list1.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | } |
| | | if (null != order.getPacId()) { |
| | | if (null != tjPackageService.getById(order.getPacId())) { |
| | | order.setPacName(tjPackageService.getById(order.getPacId()).getPacName()); |
| | | } |
| | | if (null != dwDeptService.getById(order.getPacId())) { |
| | | order.setPacName(dwDeptService.getById(order.getPacId()).getDwDeptName()); |
| | | } |
| | | } |
| | | //从打印记录查出最新打印时间 |
| | | TjPrintOrder one = printOrderService.getTjPrintOrderByTjNum(order.getTjNumber()); |
| | | if (null != type && type == 1 && one != null) { |
| | | order.setPrintTime(one.getCreateTime()); |
| | | order.setPrintName(one.getCreateBy()); |
| | | order.setType(1); |
| | | list1.add(order); |
| | | } |
| | | if (null != type && type == 0 && one == null) { |
| | | order.setType(0); |
| | | list1.add(order); |
| | | } |
| | | } else { |
| | | List<TjOrder> list1 = new ArrayList<>(); |
| | | extracted(type, list, list1); |
| | | collect = list1.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | } |
| | | collect = list1.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | } |
| | | if (null != collect) { |
| | | map.put("total", collect.size()); |
| | |
| | | } |
| | | map.put("list", collect); |
| | | return AjaxResult.success(map); |
| | | } |
| | | |
| | | private void extracted(Integer type, List<TjOrder> list, List<TjOrder> list1) { |
| | | for (TjOrder order : list) { |
| | | TjCustomer tjCustomer = tjCustomerService.selectTjCustomerByCusId(order.getUserId()); |
| | | if (null != tjCustomer) { |
| | | order.setTjCustomerSex(tjCustomer.getCusSex()); |
| | | order.setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); |
| | | order.setGrMoBanId(reportService.getGrMoBanIds()); |
| | | order.setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName())); |
| | | if (null != tjCustomer.getCusPhone()) |
| | | order.setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone())); |
| | | if (null != tjCustomer.getCusIdcard()) |
| | | order.setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard())); |
| | | } |
| | | String firmId = order.getFirmId(); |
| | | if (firmId != null && null != iDictCompService.selectDictCompByDrugManufacturerId(String.valueOf(order.getFirmId()))) { |
| | | order.setDictCompName(iDictCompService.selectDictCompByDrugManufacturerId(String.valueOf(order.getFirmId())).getCnName()); |
| | | } |
| | | if (null != order.getPacId()) { |
| | | if (null != tjPackageService.getById(order.getPacId())) { |
| | | order.setPacName(tjPackageService.getById(order.getPacId()).getPacName()); |
| | | } |
| | | if (null != dwDeptService.getById(order.getPacId())) { |
| | | order.setPacName(dwDeptService.getById(order.getPacId()).getDwDeptName()); |
| | | } |
| | | } |
| | | //从打印记录查出最新打印时间 |
| | | TjPrintOrder one = printOrderService.getTjPrintOrderByTjNum(order.getTjNumber()); |
| | | if (null != type && type == 1 && one != null) { |
| | | order.setPrintTime(one.getCreateTime()); |
| | | order.setPrintName(one.getCreateBy()); |
| | | order.setType(1); |
| | | list1.add(order); |
| | | } |
| | | if (null != type && type == 0 && one == null) { |
| | | order.setType(0); |
| | | list1.add(order); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | return success(tjOrderService.selectTjOrderByOrderId(orderId)); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/getIsRequired") |
| | | @ApiOperation(value = "根据参数配置获取是否必填项(身份证、性别、电话、照片、是否直接下单)") |
| | | public AjaxResult getIsRequired() { |
| | | Map<String, String> res = new HashMap<>(); |
| | | res.put("has_idcard", configService.selectConfigByKey("has_idcard")); |
| | | res.put("has_sex", configService.selectConfigByKey("has_sex")); |
| | | res.put("is_phone", configService.selectConfigByKey("is_phone")); |
| | | res.put("mall_hasPhoto", configService.selectConfigByKey("mall_hasPhoto")); |
| | | res.put("has_charge", configService.selectConfigByKey("has_charge")); |
| | | return AjaxResult.success(res); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 体检签到登记接口 |
| | | */ |
| | | @PostMapping |
| | | @ApiOperation(value = "体检签到登记接口") |
| | | @Transactional |
| | | @Transactional //(切换数据库出错,所以注释) |
| | | public AjaxResult addOrderAndDetail(@RequestBody TjOrder tjOrder) throws Exception { |
| | | Long userId = Long.valueOf(SecurityUtils.getLoginUser().getUserId()); |
| | | SysUser sysUser = userService.getById(userId); |
| | | |
| | | LambdaQueryWrapper<TjCustomer> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjCustomer::getCusId, tjOrder.getUserId()); |
| | | TjCustomer tjCustomer = tjCustomerService.getOne(wq); |
| | | if (tjCustomer == null) return AjaxResult.error("该客户未登记或不存在"); |
| | | |
| | | LambdaQueryWrapper<TjOrder> wqq = new LambdaQueryWrapper<>(); |
| | | wqq.eq(TjOrder::getUserId, tjOrder.getUserId()); |
| | | wqq.eq(TjOrder::getCheckStatus, 0); |
| | | wqq.isNull(TjOrder::getFinishTime); |
| | | if(!tjCustomer.getCardId().equals("0")){ |
| | | wqq.eq(TjOrder::getCardId,tjCustomer.getCardId()); |
| | | } |
| | | TjOrder order = tjOrderService.getOne(wqq); |
| | | if (null != order) { |
| | | transitionService.deletedTbTransitionListByCusIdAndTjNum(tjCustomer.getCusIdcard(),tjCustomer.getCardId()); |
| | | return AjaxResult.error("不可重复登记"); |
| | | } |
| | | LambdaQueryWrapper<TjCustomer> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjCustomer::getCusId, tjOrder.getUserId()); |
| | | TjCustomer tjCustomer = tjCustomerService.getOne(wq); |
| | | if (tjCustomer == null) return AjaxResult.error("该客户未签到或不存在"); |
| | | LambdaQueryWrapper<TjReservation> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.eq(TjReservation::getIdCard, tjCustomer.getCusIdcard()); |
| | | wq1.eq(TjReservation::getIsExpire, 2); |
| | |
| | | if (null != tjReservation.getDepartment()) tjOrder.setFirmDeptName(tjReservation.getDepartment()); |
| | | if (null != tjReservation.getJobNo()) tjOrder.setFirmWorkId(tjReservation.getJobNo()); |
| | | if (null != tjReservation.getPacId()) tjOrder.setPacId(tjReservation.getPacId()); |
| | | if (null != tjReservation.getGroupingId()) tjOrder.setGroupId(tjReservation.getGroupingId()); |
| | | if (null != tjReservation.getDepartmentId()) tjOrder.setFirmDeptId(tjReservation.getDepartmentId()); |
| | | if (null != tjReservation.getTjCategory()) tjOrder.setTjCategory(tjReservation.getTjCategory()); |
| | | if (null != tjReservation.getGroupingId()){ |
| | | tjOrder.setGroupId(tjReservation.getGroupingId()); |
| | | tjOrder.setFirmDeptId(tjReservation.getPacId()); |
| | | } |
| | | // if (null != tjReservation.getDepartmentId()) tjOrder.setFirmDeptId(tjReservation.getDepartmentId()); |
| | | tjReservation.setIsExpire(1); |
| | | tjReservationService.updateById(tjReservation); |
| | | if (null != tjReservation.getTeamNo()) { |
| | |
| | | if (null == tjOrder.getPacId() && null != transitionService.getTbTransitionPacIdByCusIdAndPac(String.valueOf(tjOrder.getUserId()))) { |
| | | tjOrder.setPacId(transitionService.getTbTransitionPacIdByCusIdAndPac(String.valueOf(tjOrder.getUserId()))); |
| | | } |
| | | |
| | | //判断小程序上预约是否付钱 |
| | | if (null != mallOrder) tjOrder.setMallOrderId(String.valueOf(mallOrder.getId())); |
| | | tjOrder.setStatus(TjConstants.TJ_BEGIN); |
| | | tjOrder.setCardId(tjCustomer.getCardId()); |
| | | if (tjOrderService.save(tjOrder)) { |
| | | //保存收货地址 |
| | | if ("2".equals(tjOrder.getGetType())){ |
| | | final TjReportGetAddress address = tjOrder.getAddAddress(); |
| | | if (address!=null){ |
| | | address.setTjNumber(tjNumber); |
| | | tjReportGetAddressService.save(address); |
| | | } |
| | | } |
| | | Long cusNumber = tjCustomer.getCusNumber(); |
| | | cusNumber += 1; |
| | | tjCustomer.setCusNumber(cusNumber); |
| | | tjCustomerService.updateById(tjCustomer); |
| | | BigDecimal discount = BigDecimal.valueOf(Double.parseDouble(tjOrder.getTjFlowingWater().getDiscount())).divide(BigDecimal.valueOf(10)); |
| | | TjFlowingWater tjFlowingWater = new TjFlowingWater(); |
| | | tjFlowingWater.setPayStasus(0L); |
| | | if ("1".equals(tjOrder.getTjType())) { |
| | | if (null != tjReservation && tjReservation.getPayType() == 1) { |
| | | tjFlowingWater.setPayStasus(3L); |
| | | } |
| | | } |
| | | |
| | | //调用SQL server拿取收费情况 |
| | | //根据配置调取存储过程 将临时表数据存入预约表2023.12.12 |
| | | final String getInfoFromSqlData = configService.selectConfigByKey("getInfoFromSqlData"); |
| | | final String isPay = configService.selectConfigByKey("isPay"); |
| | | if ("Y".equals(getInfoFromSqlData)){ |
| | | LtkjMiddleHead middleHead = headService.getMiddleHeadByPartId(tjCustomer.getCardId()); |
| | | if(null !=middleHead){ |
| | | tjFlowingWater.setPayStasus(1L); |
| | | } |
| | | } |
| | | tjFlowingWater.setOrderId(tjOrder.getOrderId()); |
| | | Date date1 = new Date(System.currentTimeMillis()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmssSSS"); |
| | | String userId1 = SecurityUtils.getUsername(); |
| | | String s1 = userId1 + sdf.format(date1); |
| | | tjFlowingWater.setWaterId(s1); |
| | | if (null != mallOrder) { |
| | | if (mallOrder.getOrderStatus().equals(201L)) { |
| | | tjFlowingWater.setCopeWith(mallOrder.getActualPrice()); |
| | | tjFlowingWater.setPaidIn(mallOrder.getActualPrice()); |
| | | tjFlowingWater.setDiscount(String.valueOf(1)); |
| | | tjFlowingWater.setPayStasus(1L); |
| | | tjFlowingWater.setPayType(3L); |
| | | MallCheckLog checkLog = new MallCheckLog(); |
| | | checkLog.setCheckBy(sysUser.getNickName()); |
| | | checkLog.setUserId(mallOrder.getUserId()); |
| | | checkLog.setConsignee(mallOrder.getConsignee()); |
| | | checkLog.setIdCard(mallOrder.getIdCard()); |
| | | checkLog.setOrderId(String.valueOf(mallOrder.getId())); |
| | | checkLog.setOrderSn(mallOrder.getOrderSn()); |
| | | checkLog.setCheckTime(new Date()); |
| | | checkLog.setShipSn("HX" + s1); |
| | | mallCheckLogService.save(checkLog); |
| | | mallOrder.setOrderStatus(301L); |
| | | mallOrderService.updateById(mallOrder); |
| | | String s1 = SecurityUtils.getUsername() + new SimpleDateFormat("yyMMddHHmmssSSS").format(date1); |
| | | tjFlowingWater.setWaterId(PinyinUtil.getFirstLetter(tjCustomer.getCusName(), "").toUpperCase() + s1); |
| | | if(isPay.equals("true")){ |
| | | if (null != mallOrder) { |
| | | if (mallOrder.getOrderStatus().equals(201L)) { |
| | | tjFlowingWater.setCopeWith(mallOrder.getActualPrice()); |
| | | tjFlowingWater.setPaidIn(mallOrder.getActualPrice()); |
| | | tjFlowingWater.setDiscount(String.valueOf(1)); |
| | | tjFlowingWater.setPayStasus(1L); |
| | | tjFlowingWater.setPayType(3L); |
| | | MallCheckLog checkLog = new MallCheckLog(); |
| | | checkLog.setCheckBy(sysUser.getNickName()); |
| | | checkLog.setUserId(mallOrder.getUserId()); |
| | | checkLog.setConsignee(mallOrder.getConsignee()); |
| | | checkLog.setIdCard(mallOrder.getIdCard()); |
| | | checkLog.setOrderId(String.valueOf(mallOrder.getId())); |
| | | checkLog.setOrderSn(mallOrder.getOrderSn()); |
| | | checkLog.setCheckTime(new Date()); |
| | | checkLog.setShipSn("HX" + s1); |
| | | mallCheckLogService.save(checkLog); |
| | | mallOrder.setOrderStatus(301L); |
| | | mallOrderService.updateById(mallOrder); |
| | | } |
| | | } else { |
| | | tjFlowingWater.setCopeWith(tjOrder.getTjFlowingWater().getCopeWith()); |
| | | tjFlowingWater.setPaidIn(tjOrder.getTjFlowingWater().getPaidIn()); |
| | | tjFlowingWater.setDiscount(tjOrder.getTjFlowingWater().getDiscount()); |
| | | // tjFlowingWater.setPayStasus(0L); |
| | | } |
| | | } else { |
| | | tjFlowingWater.setCopeWith(tjOrder.getTjFlowingWater().getCopeWith()); |
| | | tjFlowingWater.setPaidIn(tjOrder.getTjFlowingWater().getPaidIn()); |
| | | tjFlowingWater.setDiscount(tjOrder.getTjFlowingWater().getDiscount()); |
| | | tjFlowingWater.setPayStasus(0L); |
| | | } |
| | | if (tjFlowingWaterService.save(tjFlowingWater)) { |
| | | tjOrder.setTjSerialNumber(String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | |
| | | |
| | | //团体 |
| | | if ("1".equals(tjOrder.getTjType())) { |
| | | tjOrder.setFirmDeptId(tjOrder.getPacId()); |
| | | asyncService.ttextracted(tjOrder, tjCustomer, sysUser, tjReservation, tjFlowingWater); |
| | | } |
| | | |
| | | |
| | | //个人 |
| | | if ("2".equals(tjOrder.getTjType())) { |
| | | // asyncService.extracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); |
| | | |
| | | asyncService.newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); |
| | | //asyncService.newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); |
| | | newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); |
| | | } |
| | | |
| | | //调用SQL server拿取收费情况 |
| | | //根据配置调取存储过程 将临时表数据存入预约表2023.12.12 |
| | | // final String getInfoFromSqlData = configService.selectConfigByKey("getInfoFromSqlData"); |
| | | // if ("Y".equals(getInfoFromSqlData)){ |
| | | // List<LtkjMiddleHead> one = testMapper.saveMiddleHeadByPatId(tjCustomer.getCusIdcard()); |
| | | // if (one!=null){ |
| | | // for (LtkjMiddleHead ltkjMiddleHead : one) { |
| | | // DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name()); |
| | | // headService.save(ltkjMiddleHead); |
| | | // DynamicDataSourceContextHolder.clearDataSourceType(); |
| | | // List<LtkjMiddleDetail> detailList = testMapper.getMiddleDetailByHeadId(ltkjMiddleHead.getFeadId()); |
| | | // if (detailList!=null){ |
| | | // for (LtkjMiddleDetail ltkjMiddleDetail : detailList) { |
| | | // DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name()); |
| | | // middleDetailService.save(ltkjMiddleDetail); |
| | | // DynamicDataSourceContextHolder.clearDataSourceType(); |
| | | // } |
| | | // } |
| | | // } |
| | | // |
| | | // } |
| | | // } |
| | | tjCustomer.setCardId("0"); |
| | | tjCustomerService.updateById(tjCustomer); |
| | | return AjaxResult.success(tjNumber); |
| | | } |
| | | return AjaxResult.error(); |
| | |
| | | if (null != proIds1 && !proIds1.equals("")) { |
| | | proIds = JSON.parseArray(proIds1.toString(), Long.class); |
| | | } |
| | | TjCustomer tjCustomer = tjCustomerService.getTjCustomerByCusIdCard(cusId); |
| | | String cardId ="0"; |
| | | if(null !=tjCustomer){ |
| | | cardId = tjCustomer.getCardId(); |
| | | } |
| | | if ((null == proIds || proIds.size() == 0) && (null == packId || packId.equals(""))) { |
| | | transitionService.deletedTbTransitionByCusId(cusId); |
| | | if (redisCache.hasKey(cusId)) redisCache.deleteObject(cusId); |
| | | if (redisCache.hasKey(cusId + "cusId")) redisCache.deleteCacheMapValue(cusId + "cusId", cusId); |
| | | |
| | | if (redisCache.hasKey(cardId+cusId)) { |
| | | redisCache.deleteObject(cardId+cusId); |
| | | } |
| | | if (redisCache.hasKey(cardId+cusId + "cusId")){ |
| | | redisCache.deleteCacheMapValue(cardId+cusId + "cusId", cardId+cusId); |
| | | } |
| | | } |
| | | List<TbTransition> tbTransitionList = null; |
| | | if (!redisCache.hasKey(cusId)) { |
| | | if (!redisCache.hasKey(cardId+cusId)) { |
| | | tbTransitionList = new ArrayList<>(); |
| | | } else { |
| | | tbTransitionList = redisCache.getCacheList(cusId); |
| | | tbTransitionList = redisCache.getCacheList(cardId+cusId); |
| | | } |
| | | //套餐 |
| | | if (null != packId && !packId.equals("")) { |
| | | Long pacId = Long.valueOf(packId.toString()); |
| | | List<TbTransition> list = transitionService.getTbTransitionListByCusIdAndPac(cusId, String.valueOf(pacId)); |
| | | if (null == list || list.size() == 0) { |
| | | transitionService.deletedTbTransitionListByCusIdAndPac(cusId); |
| | | if (redisCache.hasKey(cusId + "cusId")) redisCache.deleteCacheMapValue(cusId + "cusId", cusId); |
| | | if (redisCache.hasKey(cusId)) { |
| | | transitionService.deletedTbTransitionListByCusIdAndPac(cusId,cardId); |
| | | if (redisCache.hasKey(cardId+cusId + "cusId")) redisCache.deleteCacheMapValue(cardId+cusId + "cusId", cardId+cusId); |
| | | if (redisCache.hasKey(cardId+cusId)) { |
| | | tbTransitionList = new ArrayList<>(); |
| | | redisCache.deleteObject(cusId); |
| | | redisCache.deleteObject(cardId+cusId); |
| | | } |
| | | List<TjPackageProject> ppList = tjPackageProjectService.getTjPackageProjectListByPacId(String.valueOf(pacId)); |
| | | if (null != ppList && ppList.size() > 0) { |
| | | //异步保存数据库 |
| | | asyncService.addRedisTransitionPac(cusId, pacId, ppList); |
| | | // asyncService.addRedisTransitionPac(cusId, pacId, ppList); |
| | | asyncService.saveRedisTransitionByPacId(cusId, pacId, null); |
| | | for (TjPackageProject tjPackageProject : ppList) { |
| | | TjProject project = projectService.getTjProjectById(String.valueOf(tjPackageProject.getProId())); |
| | | if (null != project) { |
| | | BigDecimal divide = tjPackageProject.getPriceNow().divide(project.getProPrice(), 5, RoundingMode.DOWN); |
| | | BigDecimal divide = tjPackageProject.getPriceNow().divide(project.getProPrice(), 5, RoundingMode.HALF_DOWN); |
| | | List<TjProject> tjProSonList = projectService.getTjProjectListBySoneId(String.valueOf(project.getProId())); |
| | | if (null != tjProSonList && tjProSonList.size() > 0) { |
| | | //addRedisTransitionPac(cusId, tbTransitionList, pacId, tjPackageProject, project, divide, tjProSonList); |
| | |
| | | TbTransition tbTransition = new TbTransition(); |
| | | tbTransition.setCusId(cusId); |
| | | tbTransition.setPacId(pacId); |
| | | // if (null != tjProject.getProPrice()) { |
| | | // tbTransition.setOrdPrice(tjProject.getProPrice()); |
| | | // } else { |
| | | // tbTransition.setOrdPrice(BigDecimal.valueOf(0.00)); |
| | | // } |
| | | if (null != tjPackageProject.getPriceNow() && divide.compareTo(BigDecimal.valueOf(0)) > 0) { |
| | | tbTransition.setNowPrice(tjProject.getProPrice().multiply(divide).setScale(2, RoundingMode.HALF_DOWN)); |
| | | tbTransition.setOrdPrice(tjProject.getProPrice().multiply(divide).setScale(2, RoundingMode.HALF_DOWN)); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | //单项 |
| | | if (null != proIds && proIds.size() > 0) { |
| | | asyncService.addRedisTransitionPro(cusId, proIds); |
| | | //异步保存数据库表 |
| | | asyncService.saveRedisTransitionByPacId(cusId, null, proIds); |
| | | for (Long proId : proIds) { |
| | | List<TbTransition> transitions = transitionService.getTbTransitionListByCusIdAndPacIdAndProId(cusId, String.valueOf(proId)); |
| | | if (null != transitions && transitions.size() > 0) { |
| | | continue; |
| | | } |
| | | TjProject project = projectService.getTjProjectById(String.valueOf(proId)); |
| | | if (null != project) { |
| | | List<TjProject> tjProSonList = projectService.getTjProjectListBySoneId(String.valueOf(project.getProId())); |
| | | if (null != tjProSonList && tjProSonList.size() > 0) { |
| | | //异步保存数据库表 |
| | | for (TjProject tjProject : tjProSonList) { |
| | | List<TbTransition> transitionss = transitionService.getTbTransitionListByCusIdAndPacIdAndProId(cusId, String.valueOf(tjProject.getProId())); |
| | | if (null != transitionss && transitionss.size() > 0) { |
| | | continue; |
| | | } |
| | | TbTransition tbTransition = new TbTransition(); |
| | | tbTransition.setCusId(cusId); |
| | | tbTransition.setPacId(null); |
| | | if (null != tjProject.getProPrice()) { |
| | | tbTransition.setOrdPrice(tjProject.getProPrice()); |
| | | tbTransition.setNowPrice(tjProject.getProPrice()); |
| | | } else { |
| | | tbTransition.setOrdPrice(BigDecimal.valueOf(0.00)); |
| | | tbTransition.setNowPrice(BigDecimal.valueOf(0.00)); |
| | | } |
| | | tbTransition.setParentProId(proId); |
| | | tbTransition.setParentProName(project.getProName()); |
| | | tbTransition.setProId(tjProject.getProId()); |
| | | tbTransition.setProName(tjProject.getProName()); |
| | | tbTransition.setProType(tjProject.getProType()); |
| | | tbTransition.setProCheckMethod(tjProject.getProCheckMethod()); |
| | | tbTransitionList.add(tbTransition); |
| | | TjProject tjProject = projectService.getTjProjectById(String.valueOf(proId)); |
| | | if (null != tjProject) { |
| | | // List<TjProject> tjProSonList = projectService.getTjProjectListBySoneId(String.valueOf(project.getProId())); |
| | | // if (null != tjProSonList && tjProSonList.size() > 0) { |
| | | // for (TjProject tjProject : tjProSonList) { |
| | | // List<TbTransition> transitionss = transitionService.getTbTransitionListByCusIdAndPacIdAndProId(cusId, String.valueOf(tjProject.getProId())); |
| | | // if (null != transitionss && transitionss.size() > 0) { |
| | | // continue; |
| | | // } |
| | | TbTransition tbTransition = new TbTransition(); |
| | | tbTransition.setCusId(cusId); |
| | | tbTransition.setPacId(null); |
| | | if (null != tjProject.getProPrice()) { |
| | | tbTransition.setOrdPrice(tjProject.getProPrice()); |
| | | tbTransition.setNowPrice(tjProject.getProPrice()); |
| | | } else { |
| | | tbTransition.setOrdPrice(BigDecimal.valueOf(0.00)); |
| | | tbTransition.setNowPrice(BigDecimal.valueOf(0.00)); |
| | | } |
| | | tbTransition.setParentProId(tjProject.getProParentId()); |
| | | if (tjProject.getProParentId() != null) { |
| | | TjProject byId = projectService.getById(tjProject.getProParentId()); |
| | | if(null !=byId){ |
| | | tbTransition.setParentProName(byId.getProName()); |
| | | } |
| | | } |
| | | tbTransition.setParentProName(""); |
| | | |
| | | tbTransition.setProId(tjProject.getProId()); |
| | | tbTransition.setProName(tjProject.getProName()); |
| | | tbTransition.setProType(tjProject.getProType()); |
| | | tbTransition.setProCheckMethod(tjProject.getProCheckMethod()); |
| | | tbTransitionList.add(tbTransition); |
| | | // } |
| | | // } |
| | | } |
| | | } |
| | | } |
| | | if (null != tbTransitionList && tbTransitionList.size() > 0) { |
| | | if (redisCache.hasKey(cusId)) { |
| | | redisCache.deleteObject(cusId); |
| | | redisCache.setCacheList(cusId, tbTransitionList); |
| | | redisCache.setCacheMapValue(cusId + "cusId", cusId, getMaps(cusId)); |
| | | if (redisCache.hasKey(cardId+cusId)) { |
| | | redisCache.deleteObject(cardId+cusId); |
| | | redisCache.setCacheList(cardId+cusId, tbTransitionList); |
| | | redisCache.setCacheMapValue(cardId+cusId + "cusId", cardId+cusId, getMaps(cusId,cardId)); |
| | | } else { |
| | | redisCache.setCacheList(cusId, tbTransitionList); |
| | | redisCache.setCacheMapValue(cusId + "cusId", cusId, getMaps(cusId)); |
| | | redisCache.setCacheList(cardId+cusId, tbTransitionList); |
| | | redisCache.setCacheMapValue(cardId+cusId + "cusId", cardId+cusId, getMaps(cusId,cardId)); |
| | | } |
| | | } |
| | | return AjaxResult.success(); |
| | |
| | | List<Map<String, Object>> list = redisCache.getCacheMapValue(cusId + "cusId", cusId); |
| | | return AjaxResult.success(list); |
| | | } |
| | | List<Map<String, Object>> list = getMaps(cusId); |
| | | TjCustomer tjCustomer = tjCustomerService.getTjCustomerByCusIdCard(cusId); |
| | | String cardId ="0"; |
| | | if(null !=tjCustomer){ |
| | | cardId = tjCustomer.getCardId(); |
| | | } |
| | | List<Map<String, Object>> list = getMaps(cusId,cardId); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | |
| | | for (TjOrderRemark remark : remarkList) { |
| | | TjProject project = projectService.getTjProjectById(String.valueOf(remark.getProId())); |
| | | if (null != project) { |
| | | if ("N".equals(project.getNeedReport())){ |
| | | continue; |
| | | } |
| | | remark.setProCheckType(project.getProCheckType()); |
| | | remark.setProName(project.getProName()); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | private List<Map<String, Object>> getMaps(String cusId) { |
| | | private List<Map<String, Object>> getMaps(String cusId,String cardId) { |
| | | |
| | | List<TbTransition> transitionList = null; |
| | | if (redisCache.hasKey(cusId)) { |
| | | transitionList = redisCache.getCacheList(cusId); |
| | | if (redisCache.hasKey(cardId+cusId)) { |
| | | transitionList = redisCache.getCacheList(cardId+cusId); |
| | | } else { |
| | | transitionList = transitionService.getTbTransitionListByCusId(cusId); |
| | | transitionList = transitionService.getTbTransitionListByCusId(cusId,cardId); |
| | | } |
| | | if (null == transitionList) return null; |
| | | Map<Long, List<TbTransition>> collect = transitionList.stream().collect(Collectors.groupingBy(TbTransition::getParentProId)); |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (Map.Entry<Long, List<TbTransition>> entry : collect.entrySet()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | LambdaQueryWrapper<TbTransition> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TbTransition::getCusId, cusId); |
| | | wq.eq(TbTransition::getParentProId, entry.getKey()); |
| | | Long pacId = entry.getValue().get(0).getPacId(); |
| | | if (null != pacId) { |
| | | TjPackage aPackage = tjPackageService.getById(entry.getValue().get(0).getPacId()); |
| | | map.put("pacName", aPackage.getPacName()); |
| | | TjProject tjProject = projectService.getById(entry.getKey()); |
| | | TjPackageProject project = tjPackageProjectService.getOne(new LambdaQueryWrapper<TjPackageProject>().eq(TjPackageProject::getPacId, pacId) |
| | | .eq(TjPackageProject::getProId, entry.getKey())); |
| | | map.put("ordPrice",tjProject.getProPrice()); |
| | | if(null !=project){ |
| | | map.put("nowPrice",project.getPriceNow()); |
| | | }else { |
| | | map.put("nowPrice",tjProject.getProPrice()); |
| | | } |
| | | } else { |
| | | map.put("pacName", "单项"); |
| | | List<TbTransition> tbTransitionList = entry.getValue(); |
| | | if (null != tbTransitionList && tbTransitionList.size() > 0) { |
| | | BigDecimal money1 = new BigDecimal("0.00"); |
| | | BigDecimal money2 = new BigDecimal("0.00"); |
| | | for (TbTransition tbTransition : tbTransitionList) { |
| | | money1 = money1.add(tbTransition.getOrdPrice()); |
| | | money2 = money2.add(tbTransition.getNowPrice()); |
| | | } |
| | | map.put("ordPrice", money1); |
| | | map.put("nowPrice", money2); |
| | | } |
| | | } |
| | | map.put("parentName", projectService.getById(entry.getKey()).getProName()); |
| | | map.put("list", entry.getValue()); |
| | | List<TbTransition> tbTransitionList = entry.getValue(); |
| | | if (null != tbTransitionList && tbTransitionList.size() > 0) { |
| | | BigDecimal money1 = new BigDecimal("0.00"); |
| | | BigDecimal money2 = new BigDecimal("0.00"); |
| | | for (TbTransition tbTransition : tbTransitionList) { |
| | | money1 = money1.add(tbTransition.getOrdPrice()); |
| | | money2 = money2.add(tbTransition.getNowPrice()); |
| | | if (tbTransition.getOrdPrice().compareTo(BigDecimal.valueOf(0)) == 0 || tbTransition.getNowPrice().compareTo(BigDecimal.valueOf(0)) == 0) { |
| | | tbTransition.setDiscount("0"); |
| | | } else { |
| | | tbTransition.setDiscount((tbTransition.getNowPrice()).divide(tbTransition.getOrdPrice(), BigDecimal.ROUND_CEILING).toString()); |
| | | } |
| | | if (null != tbTransition.getPacId()) { |
| | | tbTransition.setPacPrice(tjPackageService.getById(tbTransition.getPacId()).getPrice()); |
| | | } |
| | | if (null != tbTransition.getParentProId()) { |
| | | tbTransition.setPacPrice(projectService.getTjProjectById(String.valueOf(tbTransition.getParentProId())).getProPrice()); |
| | | } |
| | | } |
| | | // map.put("ordPrice", money1.setScale(Integer.parseInt(configService.selectConfigByKey("sys.price.save")), Integer.parseInt(configService.selectConfigByKey("sys.price")))); |
| | | // map.put("nowPrice", money2.setScale(Integer.parseInt(configService.selectConfigByKey("sys.price.save")), Integer.parseInt(configService.selectConfigByKey("sys.price")))); |
| | | |
| | | map.put("ordPrice", money1); |
| | | map.put("nowPrice", money2); |
| | | } |
| | | |
| | | list.add(map); |
| | | } |
| | | return list; |
| | |
| | | for (TjReservation tjReservation : list) { |
| | | |
| | | final TjDwGrouping byId = dwGroupingService.getById(tjReservation.getGroupingId()); |
| | | if (byId!=null){ |
| | | if (byId != null) { |
| | | tjReservation.setGroupingName(byId.getGroupingName()); |
| | | } |
| | | if (tjReservation.getIsExpire()==1){ |
| | | LambdaQueryWrapper<TjCustomer> wq1=new LambdaQueryWrapper<>(); |
| | | wq1.eq(TjCustomer::getCusIdcard,tjReservation.getIdCard()); |
| | | if (tjReservation.getIsExpire() == 1) { |
| | | LambdaQueryWrapper<TjCustomer> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.eq(TjCustomer::getCusIdcard, tjReservation.getIdCard()); |
| | | final TjCustomer one1 = tjCustomerService.getOne(wq1); |
| | | |
| | | LambdaQueryWrapper<TjOrder> wq2=new LambdaQueryWrapper<>(); |
| | | wq2.eq(TjOrder::getUserId,one1.getCusId()); |
| | | wq2.eq(TjOrder::getTeamNo,tjReservation.getTeamNo()); |
| | | LambdaQueryWrapper<TjOrder> wq2 = new LambdaQueryWrapper<>(); |
| | | wq2.eq(TjOrder::getUserId, one1.getCusId()); |
| | | wq2.eq(TjOrder::getTeamNo, tjReservation.getTeamNo()); |
| | | final TjOrder one = tjOrderService.getOne(wq2); |
| | | if (one!=null){ |
| | | if (one != null) { |
| | | tjReservation.setTjNumber(one.getTjNumber()); |
| | | tjReservation.setTjStatus(one.getStatus()); |
| | | if (one.getStatus() == 201) { |
| | |
| | | c += 1; |
| | | } |
| | | } |
| | | }else if (tjReservation.getIsExpire()==2){ |
| | | } else if (tjReservation.getIsExpire() == 2) { |
| | | tjReservation.setTjStatus(0); |
| | | tjReservation.setTjNumber("无"); |
| | | a+=1; |
| | | a += 1; |
| | | } |
| | | } |
| | | map.put("list",list); |
| | | map.put("all",list.size()); |
| | | map.put("weijian",a); |
| | | map.put("jianzhong",b); |
| | | map.put("yijian",c); |
| | | map.put("list", list); |
| | | map.put("all", list.size()); |
| | | map.put("weijian", a); |
| | | map.put("jianzhong", b); |
| | | map.put("yijian", c); |
| | | |
| | | return AjaxResult.success(map); |
| | | } |
| | |
| | | public AjaxResult tuanTiBingById(@ApiParam(value = "单位") @RequestParam String firmId, |
| | | @ApiParam(value = "部门") @RequestParam String firmDeptId, |
| | | @ApiParam(value = "病种") @RequestParam(required = false) String bingZhong) { |
| | | List<TjOrderDetailRules> res1=new ArrayList<>(); |
| | | List<BingZhongVO> res=new ArrayList<>(); |
| | | List<TjOrderDetailRules> res1 = new ArrayList<>(); |
| | | List<BingZhongVO> res = new ArrayList<>(); |
| | | |
| | | LambdaQueryWrapper<TjDwGrouping> wqqq=new LambdaQueryWrapper<>(); |
| | | wqqq.eq(TjDwGrouping::getDwDeptId,firmDeptId); |
| | | LambdaQueryWrapper<TjDwGrouping> wqqq = new LambdaQueryWrapper<>(); |
| | | wqqq.eq(TjDwGrouping::getDwDeptId, firmDeptId); |
| | | final List<TjDwGrouping> list2 = dwGroupingService.list(wqqq); |
| | | |
| | | |
| | | for (TjDwGrouping tjDwGrouping : list2) { |
| | | LambdaQueryWrapper<TjOrder> wq2=new LambdaQueryWrapper<>(); |
| | | wq2.eq(TjOrder::getFirmId,firmId); |
| | | wq2.eq(TjOrder::getGroupId,tjDwGrouping.getId()); |
| | | LambdaQueryWrapper<TjOrder> wq2 = new LambdaQueryWrapper<>(); |
| | | wq2.eq(TjOrder::getFirmId, firmId); |
| | | wq2.eq(TjOrder::getGroupId, tjDwGrouping.getId()); |
| | | final List<TjOrder> list = tjOrderService.list(wq2); |
| | | for (TjOrder tjOrder : list) { |
| | | LambdaQueryWrapper<TjOrderDetailRules> wq1=new LambdaQueryWrapper<>(); |
| | | wq1.eq(TjOrderDetailRules::getTjNumber,tjOrder.getTjNumber()); |
| | | if (bingZhong!=null){ |
| | | wq1.like(TjOrderDetailRules::getBingzhong,bingZhong); |
| | | LambdaQueryWrapper<TjOrderDetailRules> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.eq(TjOrderDetailRules::getTjNumber, tjOrder.getTjNumber()); |
| | | if (bingZhong != null) { |
| | | wq1.like(TjOrderDetailRules::getBingzhong, bingZhong); |
| | | } |
| | | final List<TjOrderDetailRules> list1 = orderDetailRulesService.list(wq1); |
| | | //放进集合 |
| | |
| | | // List<String> distinctIds = idStream.collect(Collectors.toList()); |
| | | |
| | | Map<String, Long> columnCountMap = res1.stream().collect(Collectors.groupingBy(TjOrderDetailRules::getAid, Collectors.counting())); |
| | | for(Map.Entry<String, Long> entry:columnCountMap.entrySet()){ |
| | | for (Map.Entry<String, Long> entry : columnCountMap.entrySet()) { |
| | | |
| | | BingZhongVO bingZhongVO=new BingZhongVO(); |
| | | BingZhongVO bingZhongVO = new BingZhongVO(); |
| | | bingZhongVO.setRules(rulesService.getById(entry.getKey())); |
| | | bingZhongVO.setNum(entry.getValue()); |
| | | |
| | | List<TjOrderDetailRules> aa=new ArrayList<>(); |
| | | List<TjOrderDetailRules> aa = new ArrayList<>(); |
| | | for (TjOrderDetailRules orderDetailRules : res1) { |
| | | if (orderDetailRules.getAid().equals(entry.getKey())){ |
| | | if (orderDetailRules.getAid().equals(entry.getKey())) { |
| | | orderDetailRules.setDwName(dwDeptService.getById(firmDeptId).getDwName()); |
| | | orderDetailRules.setDwDeptName(dwDeptService.getById(firmDeptId).getDwDeptName()); |
| | | |
| | | LambdaQueryWrapper<TjOrder> wq22=new LambdaQueryWrapper<>(); |
| | | wq22.eq(TjOrder::getFirmId,firmId); |
| | | wq22.eq(TjOrder::getTjNumber,orderDetailRules.getTjNumber()); |
| | | LambdaQueryWrapper<TjOrder> wq22 = new LambdaQueryWrapper<>(); |
| | | wq22.eq(TjOrder::getFirmId, firmId); |
| | | wq22.eq(TjOrder::getTjNumber, orderDetailRules.getTjNumber()); |
| | | final TjOrder one = tjOrderService.getOne(wq22); |
| | | orderDetailRules.setGroupName(dwGroupingService.getById(one.getGroupId()).getGroupingName()); |
| | | aa.add(orderDetailRules); |
| | |
| | | @PostMapping("/tuanTiBingChart") |
| | | @ApiOperation(value = "查询团体体检病种统计图") |
| | | public AjaxResult tuanTiBingChart(@RequestBody BingZhongVO bingZhongVO) { |
| | | List<TjOrderDetailRules> res1=new ArrayList<>(); |
| | | List<TjOrderDetailRules> res1 = new ArrayList<>(); |
| | | |
| | | LambdaQueryWrapper<TjDwGrouping> wqqq=new LambdaQueryWrapper<>(); |
| | | wqqq.eq(TjDwGrouping::getDwDeptId,bingZhongVO.getFirmDeptId()); |
| | | LambdaQueryWrapper<TjDwGrouping> wqqq = new LambdaQueryWrapper<>(); |
| | | wqqq.eq(TjDwGrouping::getDwDeptId, bingZhongVO.getFirmDeptId()); |
| | | final List<TjDwGrouping> list2 = dwGroupingService.list(wqqq); |
| | | |
| | | for (TjDwGrouping tjDwGrouping : list2) { |
| | | LambdaQueryWrapper<TjOrder> wq2=new LambdaQueryWrapper<>(); |
| | | wq2.eq(TjOrder::getFirmId,bingZhongVO.getFirmId()); |
| | | wq2.eq(TjOrder::getGroupId,tjDwGrouping.getId()); |
| | | LambdaQueryWrapper<TjOrder> wq2 = new LambdaQueryWrapper<>(); |
| | | wq2.eq(TjOrder::getFirmId, bingZhongVO.getFirmId()); |
| | | wq2.eq(TjOrder::getGroupId, tjDwGrouping.getId()); |
| | | final List<TjOrder> list = tjOrderService.list(wq2); |
| | | for (TjOrder tjOrder : list) { |
| | | LambdaQueryWrapper<TjOrderDetailRules> wq1=new LambdaQueryWrapper<>(); |
| | | wq1.eq(TjOrderDetailRules::getTjNumber,tjOrder.getTjNumber()); |
| | | wq1.in(TjOrderDetailRules::getAid,bingZhongVO.getAidList()); |
| | | LambdaQueryWrapper<TjOrderDetailRules> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.eq(TjOrderDetailRules::getTjNumber, tjOrder.getTjNumber()); |
| | | wq1.in(TjOrderDetailRules::getAid, bingZhongVO.getAidList()); |
| | | final List<TjOrderDetailRules> list1 = orderDetailRulesService.list(wq1); |
| | | //放进集合 |
| | | res1.addAll(list1); |
| | | } |
| | | } |
| | | Map<String, Long> columnCountMap = res1.stream().collect(Collectors.groupingBy(TjOrderDetailRules::getAid, Collectors.counting())); |
| | | List<Map<String, String>> aaa=new ArrayList<>(); |
| | | if (columnCountMap!=null){ |
| | | for(Map.Entry<String, Long> entry:columnCountMap.entrySet()){ |
| | | Map<String, String> resMap=new HashMap<>(); |
| | | List<Map<String, String>> aaa = new ArrayList<>(); |
| | | if (columnCountMap != null) { |
| | | for (Map.Entry<String, Long> entry : columnCountMap.entrySet()) { |
| | | Map<String, String> resMap = new HashMap<>(); |
| | | final TjRules byId = rulesService.getById(entry.getKey()); |
| | | if (byId!=null){ |
| | | if (byId != null) { |
| | | resMap.put("name", byId.getBingzhong()); |
| | | resMap.put("value", String.valueOf(entry.getValue())); |
| | | aaa.add(resMap); |
| | |
| | | @PostMapping("/deletedTbTransitionByCusId") |
| | | @ApiOperation(value = "根据身份证号删除临时表数据") |
| | | public AjaxResult deletedTbTransitionByCusId(@RequestParam @ApiParam(value = "身份证号") String cusId) { |
| | | LambdaQueryWrapper<TbTransition> wq=new LambdaQueryWrapper<>(); |
| | | wq.between(TbTransition::getCreateTime,transitionService.getTbTransitionCreateTimeByCusId(cusId),new Date()); |
| | | wq.eq(TbTransition::getCusId,cusId); |
| | | LambdaQueryWrapper<TbTransition> wq = new LambdaQueryWrapper<>(); |
| | | wq.between(TbTransition::getCreateTime, transitionService.getTbTransitionCreateTimeByCusId(cusId), new Date()); |
| | | wq.eq(TbTransition::getCusId, cusId); |
| | | return AjaxResult.success(transitionService.remove(wq)); |
| | | } |
| | | |
| | | public void newSaveextracted(TjOrder tjOrder, TjCustomer tjCustomer, BigDecimal discount, SysUser sysUser, TjReservation tjReservation, TjFlowingWater tjFlowingWater) { |
| | | tjAskMedicalHistoryService.updateTjAskMedicalHistoryByCusId(tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjCustomer.getCusId())); |
| | | tjOrderDetailService.saveTjOrderDetailsByCusId(tjCustomer.getCusIdcard(), String.valueOf(tjOrder.getOrderId()), sysUser.getNickName(), String.valueOf(sysUser.getUserId())); |
| | | tjOrderDetailService.saveTjPureToneTesByCusId(tjCustomer.getCusIdcard(),tjOrder.getTjNumber(),sysUser.getNickName(), String.valueOf(sysUser.getUserId())); |
| | | //修改每项的原价现价 //修改临时表体检号 |
| | | transitionService.updateTbTransitionPriceByCusId(tjCustomer.getCusIdcard(), discount,tjOrder.getTjNumber()); |
| | | //添加remark表数据 |
| | | remarkService.saveTjOrderRemarkByOrderId(tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjOrder.getOrderId())); |
| | | //判断是否交钱 |
| | | if ("1".equals(tjOrder.getTjType())) { |
| | | if (null != tjReservation && tjReservation.getPayType() == 1) { |
| | | tjOrderDetailService.updateTjOrderDetailsByOrderId(String.valueOf(tjOrder.getOrderId()), |
| | | sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | } |
| | | } |
| | | if (tjFlowingWater.getPayStasus() == 1L) { |
| | | tjOrderDetailService.updateTjOrderDetailsByOrderId(String.valueOf(tjOrder.getOrderId()), |
| | | sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | } |
| | | // System.out.println("这段代码时间" + (System.currentTimeMillis() - l)); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/heXiaoByIds/{orderIds}") |
| | | @ApiOperation(value = "核收报告——————总检审核通过后可以核销,核收后才能打印") |
| | | @Transactional |
| | | public AjaxResult heXiaoByIds(@PathVariable String[] orderIds) { |
| | | for (String orderId : orderIds) { |
| | | final TjOrder byId = tjOrderService.getById(orderId); |
| | | byId.setHeshouStatus(1); |
| | | byId.setHeshouDoctor(UserHoder.getLoginUser().getUserId()); |
| | | byId.setHeshouTime(new DateTime()); |
| | | final boolean b = tjOrderService.updateById(byId); |
| | | if (!b){ |
| | | return AjaxResult.error("核收失败"); |
| | | } |
| | | } |
| | | return AjaxResult.success("核收成功"); |
| | | } |
| | | |
| | | @GetMapping("/getHistryTjOrderByCusIdCard") |
| | | @ApiOperation(value = "根据身份证号查看历史体检记录") |
| | | @Transactional |
| | | public AjaxResult getHistryTjOrderByCusIdCard(@RequestParam String cusIdCard) { |
| | | TjCustomer tjCustomer = tjCustomerService.getTjCustomerByCusIdCard(cusIdCard); |
| | | List<HistoryTjOrder> list=new ArrayList<>(); |
| | | if(null !=tjCustomer){ |
| | | List<TjOrder> orderList = tjOrderService.getTjOrderListByCusId(tjCustomer.getCusId()); |
| | | for (TjOrder order : orderList) { |
| | | HistoryTjOrder historyTjOrder=new HistoryTjOrder(); |
| | | historyTjOrder.setUserName(tjCustomer.getCusName()); |
| | | historyTjOrder.setTjNum(order.getTjNumber()); |
| | | historyTjOrder.setTjTime(order.getCreateTime()); |
| | | historyTjOrder.setTjProName(tjOrderService.getHistoryTjOrderProByTjNum(order.getTjNumber())); |
| | | list.add(historyTjOrder); |
| | | } |
| | | } |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/getHistryTjOrderProByCusIdCard") |
| | | @ApiOperation(value = "根据身份证号查看历史体检项目记录") |
| | | @Transactional |
| | | public AjaxResult getHistryTjOrderProByCusIdCard(@RequestParam String cusIdCard) { |
| | | TjCustomer tjCustomer = tjCustomerService.getTjCustomerByCusIdCard(cusIdCard); |
| | | if(null !=tjCustomer){ |
| | | TjOrder order= tjOrderService.getLastTjOrderListByCusId(tjCustomer.getCusId()); |
| | | if(null !=order){ |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | if(order.getPacId().equals("o")){ |
| | | List<Long> longList = remarkService.getTjProIdsByTjNum(order.getTjNumber()); |
| | | for (Long aLong : longList) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("pacName", "单项"); |
| | | map.put("proId",aLong); |
| | | map.put("pacId",null); |
| | | map.put("parentName", projectService.getById(aLong).getProName()); |
| | | map.put("list",projectService.getTjProjectListBySoneId(String.valueOf(aLong))); |
| | | BigDecimal proPrice = projectService.getById(aLong).getProPrice(); |
| | | map.put("ordPrice", proPrice); |
| | | map.put("nowPrice", proPrice); |
| | | list.add(map); |
| | | } |
| | | } |
| | | if(!order.getPacId().equals("o")){ |
| | | List<Long> longList = remarkService.getTjProIdsByTjNumAndPacIc(order.getTjNumber(),order.getPacId()); |
| | | TjPackage aPackage = tjPackageService.getById(order.getPacId()); |
| | | for (Long aLong : longList) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("pacName",aPackage.getPacName()); |
| | | map.put("pacId",String.valueOf(aPackage.getPacId())); |
| | | map.put("parentName", projectService.getById(aLong).getProName()); |
| | | map.put("list",projectService.getTjProjectListBySoneId(String.valueOf(aLong))); |
| | | BigDecimal proPrice = projectService.getById(aLong).getProPrice(); |
| | | map.put("ordPrice", proPrice); |
| | | map.put("nowPrice",tjPackageProjectService.getPacProPriceByPacIdAndPro(aLong,order.getPacId())); |
| | | list.add(map); |
| | | } |
| | | |
| | | List<Long> longList1 = remarkService.getTjProIdsByTjNumAndPacIc(order.getTjNumber(),order.getPacId()); |
| | | for (Long aLong : longList1) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("pacName", "单项"); |
| | | map.put("proId",aLong); |
| | | map.put("pacId",null); |
| | | map.put("parentName", projectService.getById(aLong).getProName()); |
| | | map.put("list",projectService.getTjProjectListBySoneId(String.valueOf(aLong))); |
| | | BigDecimal proPrice = projectService.getById(aLong).getProPrice(); |
| | | map.put("ordPrice", proPrice); |
| | | map.put("nowPrice", proPrice); |
| | | list.add(map); |
| | | } |
| | | } |
| | | return AjaxResult.success(list); |
| | | } |
| | | } |
| | | return AjaxResult.success("暂无历史记录"); |
| | | } |
| | | |
| | | } |