| | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.OffsetTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | |
| | | import com.ltkj.system.service.ISysConfigService; |
| | | import com.ltkj.system.service.ISysDeptService; |
| | | import com.ltkj.system.service.ISysUserService; |
| | | import com.ltkj.web.controller.his.HisApiGetMethodService; |
| | | import com.ltkj.web.controller.his.HisApiMethod; |
| | | import com.ltkj.web.controller.his.HisMzJysqController; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | import org.springframework.util.DigestUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.ltkj.common.annotation.Log; |
| | |
| | | |
| | | @Autowired |
| | | private HisMzJysqController hisMzJysqController; |
| | | @Autowired |
| | | private HisApiGetMethodService hisApiGetMethodService; |
| | | |
| | | |
| | | /** |
| | |
| | | LambdaQueryWrapper<TjCustomer> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjCustomer::getCusId, tjOrder.getUserId()); |
| | | TjCustomer tjCustomer = tjCustomerService.getOne(wq); |
| | | if (tjCustomer == null) return AjaxResult.error("该客户未登记或不存在"); |
| | | 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()); |
| | | } |
| | | // 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()); |
| | | transitionService.deletedTbTransitionListByCusIdAndTjNum(tjCustomer.getCusIdcard(),tjCustomer.getCardId()); |
| | | return AjaxResult.error("不可重复登记"); |
| | | } |
| | | |
| | | |
| | | LambdaQueryWrapper<TjReservation> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.eq(TjReservation::getIdCard, tjCustomer.getCusIdcard()); |
| | | wq1.eq(TjReservation::getIsExpire, 2); |
| | |
| | | /*调用his接口*/ |
| | | String config = configService.selectConfigByKey("sfkqdyhis"); |
| | | if(null !=config && config.equals("Y")){ |
| | | hisApiMethod.HisApiMethods(tjCustomer,tjOrder.getOrderId()); |
| | | } |
| | | tjCustomer.setCardId("0"); |
| | | AjaxResult result = hisApiMethod.HisApiMethods(tjCustomer, tjOrder.getOrderId()); |
| | | if(!result.get("code").toString().equals("200")){ |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error("挂号失败!"+result.get("msg").toString()); |
| | | } |
| | | }else { |
| | | tjCustomer.setCardId(tjOrder.getTjNumber()); |
| | | tjCustomerService.updateById(tjCustomer); |
| | | |
| | | transitionService.updateCardIdByTjNumAndIdCard(tjCustomer.getCusIdcard(),tjOrder.getTjNumber(),tjOrder.getTjNumber()); |
| | | tjOrder.setCardId(tjOrder.getTjNumber()); |
| | | tjOrderService.updateById(tjOrder); |
| | | } |
| | | return AjaxResult.success(tjNumber); |
| | | } |
| | | return AjaxResult.error(); |
| | |
| | | |
| | | |
| | | if (null != tbTransitionList && tbTransitionList.size() > 0) { |
| | | 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(cardId + cusId, tbTransitionList); |
| | | redisCache.setCacheMapValue(cardId + cusId + "cusId", cardId + cusId, getMaps(cusId, cardId)); |
| | | } |
| | | // 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(cardId + cusId, tbTransitionList); |
| | | // redisCache.setCacheMapValue(cardId + cusId + "cusId", cardId + cusId, getMaps(cusId, cardId)); |
| | | // } |
| | | List<Map<String, Object>> map1 = getMap(cusId, cardId, tbTransitionList); |
| | | return AjaxResult.success(map1); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | for (TjOrder order : list) { |
| | | TjCustomer tjCustomer = tjCustomerService.getById(order.getUserId()); |
| | | if (null != tjCustomer) { |
| | | order.setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName())); |
| | | order.setTjCustomerName(tjCustomer.getCusName()); |
| | | order.setTjCustomerSex(tjCustomer.getCusSex()); |
| | | order.setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); |
| | | order.setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone())); |
| | |
| | | for (TjOrder order : list) { |
| | | TjCustomer tjCustomer = tjCustomerService.getById(order.getUserId()); |
| | | if (null != tjCustomer) { |
| | | order.setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName())); |
| | | order.setTjCustomerName(tjCustomer.getCusName()); |
| | | order.setTjCustomerSex(tjCustomer.getCusSex()); |
| | | order.setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); |
| | | order.setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone())); |
| | |
| | | */ |
| | | @PostMapping("/tjGoOut") |
| | | @ApiOperation(value = "体检签离") |
| | | @Transactional |
| | | public AjaxResult tjGoOut(@RequestBody Map<String, Object> map) { |
| | | Long userId = Long.valueOf(SecurityUtils.getLoginUser().getUserId()); |
| | | SysUser sysUser = userService.getById(userId); |
| | |
| | | String jsonString = com.alibaba.fastjson.JSON.toJSONString(domainVos1); |
| | | List<QjDomainVo> domainVos = com.alibaba.fastjson.JSON.parseArray(jsonString, QjDomainVo.class); |
| | | String tjNumber = map.get("tjNumber").toString(); |
| | | TjOrder tjOrder = tjOrderService.getOrderByTjNum(tjNumber); |
| | | if (null != domainVos && domainVos.size() > 0) { |
| | | Set<String> list = new HashSet<>(); |
| | | for (QjDomainVo domainVo : domainVos) { |
| | |
| | | if (domainVo.getType() == 3) { |
| | | list.add(String.valueOf(domainVo.getTjNumber())); |
| | | } else { |
| | | TjOrder tjOrder = tjOrderService.getOrderByTjNum(remark.getTjNumber()); |
| | | if (null != tjOrder) { |
| | | tjOrder.setFinishTime(new Date()); |
| | | tjOrder.setStatus(TjConstants.TJ_CONFIRM); |
| | |
| | | } |
| | | } |
| | | asyncService.tjGoutAsync(domainVos, sysUser, list); |
| | | |
| | | TjCustomer customer = tjCustomerService.selectTjCustomerByCusId(tjOrder.getUserId()); |
| | | customer.setCardId("0"); |
| | | tjCustomerService.updateById(customer); |
| | | |
| | | return AjaxResult.success("签离成功!"); |
| | | } else { |
| | | return getAjaxResult(tjNumber); |
| | |
| | | */ |
| | | @GetMapping("/goOut") |
| | | @ApiOperation(value = "签离") |
| | | @Transactional |
| | | public AjaxResult goOut(@RequestParam @ApiParam(value = "体检号") String tjNumber) { |
| | | return getAjaxResult(tjNumber); |
| | | } |
| | |
| | | for (Map.Entry<Long, List<TbTransition>> entry : collect.entrySet()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | Long pacId = entry.getValue().get(0).getPacId(); |
| | | map.put("proPrantId",entry.getKey().toString()); |
| | | 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()); |
| | | // } |
| | | map.put("nowPrice", transitionService.getTbTransitionDxPriceByPac(cusId, entry.getKey(), cardId, pacId)); |
| | | } 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.add(map); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | private List<Map<String, Object>> getMap(String cusId, String cardId,List<TbTransition> transitionList) { |
| | | |
| | | // List<TbTransition> transitionList = null; |
| | | // if (redisCache.hasKey(cardId + cusId)) { |
| | | // transitionList = redisCache.getCacheList(cardId + cusId); |
| | | // } else { |
| | | // 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<>(); |
| | | Long pacId = entry.getValue().get(0).getPacId(); |
| | | map.put("proPrantId",entry.getKey().toString()); |
| | | if (null != pacId) { |
| | | TjPackage aPackage = tjPackageService.getById(entry.getValue().get(0).getPacId()); |
| | | map.put("pacName", aPackage.getPacName()); |
| | |
| | | LambdaQueryWrapper<TjOrder> wq0 = new LambdaQueryWrapper<>(); |
| | | wq0.eq(TjOrder::getTjNumber, tjNumber); |
| | | TjOrder tjOrder = tjOrderService.getOne(wq0); |
| | | |
| | | if (null != tjOrder) { |
| | | TjCustomer customer = tjCustomerService.selectTjCustomerByCusId(tjOrder.getUserId()); |
| | | customer.setCardId("0"); |
| | | tjCustomerService.updateById(customer); |
| | | |
| | | LambdaQueryWrapper<TjOrderDetail> wq11 = new LambdaQueryWrapper<>(); |
| | | wq11.eq(TjOrderDetail::getOrderId, tjOrder.getOrderId()); |
| | | wq11.eq(TjOrderDetail::getTjStatus, 0); |
| | | wq11.isNotNull(TjOrderDetail::getFlowingWaterId); |
| | | List<TjOrderDetail> list = tjOrderDetailService.list(wq11); |
| | | |
| | | if (list != null) { |
| | | Long userId = Long.valueOf(SecurityUtils.getLoginUser().getUserId()); |
| | | SysUser sysUser = userService.getById(userId); |
| | |
| | | |
| | | TjOrder order = tjOrderService.getOrderByTjNum(tjNum); |
| | | if (null != order) { |
| | | String payByTjNum = tjOrderService.isPayByTjNum(String.valueOf(order.getOrderId())); |
| | | if (null != payByTjNum) { |
| | | return AjaxResult.success("该用户已收费不可撤销签到!"); |
| | | } |
| | | // String payByTjNum = tjOrderService.isPayByTjNum(String.valueOf(order.getOrderId())); |
| | | // if (null != payByTjNum) { |
| | | // return AjaxResult.error("该用户已收费不可撤销签到!"); |
| | | // } |
| | | tjOrderService.deleteTjOrderByOrderId(order.getOrderId()); |
| | | tjOrderDetailService.deleteTjOrderDetailByOrderDetailId(String.valueOf(order.getOrderId())); |
| | | remarkService.deletedOrderRemarkByTjNum(tjNum); |
| | | tjFlowingWaterService.deleteTjFlowingWaterByOrderId(String.valueOf(order.getOrderId())); |
| | | transitionService.deletedTbTransitionByTjNum(tjNum); |
| | | transitionService.updateTbTransitionByTjNum(tjNum); |
| | | TjCustomer customer = tjCustomerService.getById(order.getUserId()); |
| | | if(null !=customer){ |
| | | customer.setCardId("0"); |
| | | tjCustomerService.updateById(customer); |
| | | } |
| | | String configByKey = configService.selectConfigByKey("sfkqdyhis"); |
| | | if (configByKey.equals("Y")){ |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("cardtype","4"); |
| | | map.put("input",order.getCardId()); |
| | | LocalDate currentDate = LocalDate.now(); |
| | | LocalDateTime startOfDay = currentDate.atStartOfDay(); |
| | | LocalDateTime nineteenOClock = currentDate.atTime(LocalTime.of(19, 0)); |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | String ksrq = startOfDay.format(formatter); |
| | | String jsrq = nineteenOClock.format(formatter); |
| | | map.put("ksrq",ksrq); |
| | | map.put("jsrq",jsrq); |
| | | AjaxResult result = hisApiGetMethodService.getHISDataNew("Getoutpatientcostinfo", map); |
| | | if (Integer.parseInt(String.valueOf(result.get("code"))) == 200){ |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error("撤销失败,门诊患者费用清单信息不为空"); |
| | | }else { |
| | | boolean zfHisApiMethods = hisApiMethod.ZfHisApiMethods(null, order); |
| | | if (zfHisApiMethods) { |
| | | return AjaxResult.success("撤销成功", map); |
| | | }else { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error("撤销失败,调用作废出现失败"); |
| | | } |
| | | } |
| | | } |
| | | return AjaxResult.success("撤销成功!!!"); |
| | | } |
| | | return AjaxResult.success("签到记录不存在!"); |
| | |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @GetMapping("/delTbBycusCardIdAndProId") |
| | | @ApiOperation(value = "根据客户身份证号和项目父项id删除临时表数据") |
| | | @Transactional |
| | | public AjaxResult delTbBycusCardIdAndProId(@RequestParam @ApiParam(value = "身份证号") String cusCardId, |
| | | @RequestParam @ApiParam(value = "父项id") String proId) { |
| | | |
| | | if (transitionService.delTbBycusCardIdAndProId(cusCardId,proId)) { |
| | | return AjaxResult.success(); |
| | | } |
| | | return AjaxResult.error("记录不存在!"); |
| | | } |
| | | } |
| | | |