| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.codec.Base64; |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUtil; |
| | |
| | | private ITbTransitionService transitionService; |
| | | @Resource |
| | | private ISysConfigService configService; |
| | | @Value("${path.filePath}") |
| | | private String value; |
| | | // @Value("${path.filePath}") |
| | | // private String value; |
| | | @Resource |
| | | private ITjOrderRemarkService remarkService; |
| | | @Resource |
| | |
| | | order.setIdType(tjCustomer.getIdType()); |
| | | order.setAgeUnit(tjCustomer.getAgeUnit()); |
| | | order.setTjCount(String.valueOf(tjCustomer.getCusNumber())); |
| | | if (null != tjCustomer.getCompName()) { |
| | | order.setDictCompName(tjCustomer.getCompName()); |
| | | } else { |
| | | String firmId = order.getFirmId(); |
| | | if (firmId != null && null != iDictCompService.getById(String.valueOf(order.getFirmId()))) { |
| | | order.setDictCompName(iDictCompService.getById(String.valueOf(order.getFirmId())).getCnName()); |
| | | } |
| | | String firmName = order.getFirmName(); |
| | | if (StringUtil.isNotBlank(firmName)) { |
| | | order.setDictCompName(firmName); |
| | | } |
| | | if (null != order.getPacId()) { |
| | | if (null != tjPackageService.getById(order.getPacId())) { |
| | |
| | | tjOrder.setFirmId("0"); |
| | | } |
| | | |
| | | if (null != tjOrder.getPhoto()) { |
| | | if (StringUtil.isNotBlank(tjOrder.getPhoto())) { |
| | | File file = new File(tjOrder.getPhoto()); |
| | | if (file.isFile()) { |
| | | FileInputStream fileInputStream = new FileInputStream(file); |
| | |
| | | tjOrder.setPhoto(encode); |
| | | } |
| | | } |
| | | String pacId = transitionService.getTbTransitionPacIdByCusIdAndPac(String.valueOf(tjCustomer.getCusIdcard())); |
| | | |
| | | |
| | | if (null == tjOrder.getPacId() && null != transitionService.getTbTransitionPacIdByCusIdAndPac(String.valueOf(tjOrder.getUserId()))) { |
| | | tjOrder.setPacId(transitionService.getTbTransitionPacIdByCusIdAndPac(String.valueOf(tjOrder.getUserId()))); |
| | | if (StringUtil.isNotBlank(tjOrder.getPacId()) && StringUtil.isNotBlank(pacId) ) { |
| | | tjOrder.setPacId(pacId); |
| | | } |
| | | //判断小程序上预约是否付钱 |
| | | if (null != mallOrder) tjOrder.setMallOrderId(String.valueOf(mallOrder.getId())); |
| | |
| | | tjOrder.setFinishTime(new Date()); |
| | | tjOrder.setCheckStatus(1); |
| | | tjOrder.setStatus(TjConstants.TJ_WAIT); |
| | | // tjFlowingWater.setPayStasus(1L); |
| | | } |
| | | tjFlowingWater.setPayStasus(0L); |
| | | |
| | |
| | | /*调用his接口*/ |
| | | String config = configService.selectConfigByKey("sfkqdyhis"); |
| | | if (null != config && config.equals("Y")) { |
| | | if(tjCustomer.getPationId().equals("0")){ |
| | | AjaxResult result = controller.Outpincreateapply(tjCustomer); |
| | | String result1 = getAjaxResult(result); |
| | | JSONObject object = getJSONObject(result1); |
| | | String code = object.getStr("ResultCode"); |
| | | if (code.equals("0")) { |
| | | JSONArray resultDatass = object.getJSONArray("ResultData"); |
| | | Map<String, Object> resultData = (Map<String, Object>) resultDatass.get(0); |
| | | if (null != resultData && !resultData.isEmpty()) { |
| | | String pationid = resultData.get("PationId").toString(); |
| | | if (null != pationid) { |
| | | tjCustomer.setPationId(pationid); |
| | | tjCustomerService.updateById(tjCustomer); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | AjaxResult result = hisApiMethod.HisApiMethods(tjCustomer, tjOrder); |
| | | if (!result.get("code").toString().equals("200")) { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | |
| | | remarkService.updateTjOrderRemarkSfbzByJxbzisnull(tjOrder.getOrderId().toString(), tjFlowingWater.getTjSerialNumber().toString()); |
| | | List<TjXdPicture> xdPictureList = xdPictureService.saveTjXdPicture(tjOrder.getTjNumber()); |
| | | xdPictureService.saveBatch(xdPictureList); |
| | | List<TjOrderDetail> detailList = tjOrderDetailService.getCaiYangDengJi(tjOrder.getOrderId()); |
| | | addCaiYangDengJi(detailList, !detailList.isEmpty(), tjOrder, sysUser, null); |
| | | // List<TjOrderDetail> detailList = tjOrderDetailService.getCaiYangDengJi(tjOrder.getOrderId()); |
| | | // addCaiYangDengJi(detailList, !detailList.isEmpty(), tjOrder, sysUser, null); |
| | | log.info("调用his开启 进入不收费方法 该方法执行完毕"); |
| | | } else { |
| | | log.info("调用his开启 进入收费方法 该体检人员收费:"+tjOrder.getTjNumber()); |
| | |
| | | else hisApiMethod.tijianshenqingJinchuanNew(tjCustomer, DateUtil.format(date1, "yyyy-MM-dd HH:mm:ss"), tjOrder.getCardId()); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage()); |
| | | log.error("发生错误 ->{}"+String.valueOf(e),e.getMessage()); |
| | | throw new IllegalStateException(); |
| | | } |
| | | return AjaxResult.success(tjNumber); |
| | |
| | | newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); |
| | | isRequestCommonHisApi(tjOrder, tjCustomer, tjFlowingWater); |
| | | } catch (Exception e) { |
| | | // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | log.error("processOrderWithTransaction 方法异常"+e.getMessage()); |
| | | throw new RuntimeException("调用公共方法失败 强制触发回滚"); |
| | | // return AjaxResult.error(); |
| | |
| | | TjReport tjReport = new TjReport(); |
| | | tjReport.setTjNumber(String.valueOf(tjNumber)); |
| | | tjReport.setPath(urlValue + outputFileName1); |
| | | String outputPath1 = value + File.separator; |
| | | // String outputPath1 = value + File.separator; |
| | | // String pdfBinary = getPDFBinary(outputPath1 + outputFileName1); |
| | | // tjReport.setReport(pdfBinary); |
| | | tjReport.setType("体检报告"); |
| | |
| | | |
| | | TjOrder order = tjOrderService.getOrderByTjNum(tjNum); |
| | | if (null != order) { |
| | | // String payByTjNum = tjOrderService.isPayByTjNum(String.valueOf(order.getOrderId())); |
| | | // if (null != payByTjNum) { |
| | | // return AjaxResult.error("该用户已收费不可撤销签到!"); |
| | | // } |
| | | if (null != order.getFinishTime()) return AjaxResult.error("该人员已签离,不可撤销!!!"); |
| | | |
| | | if (null != order.getPrintLastTime()) return AjaxResult.error("该人员报告已打印,不可撤销!!!"); |
| | | |
| | | LambdaQueryWrapper<TjCustomer> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(TjCustomer::getCusId, order.getUserId()); |
| | | TjCustomer tjCustomer = tjCustomerService.getOne(wrapper); |
| | | |
| | | Boolean useLisAndPacsRegister = lisApiMethod.isUseLisAndPacsRegister(order); |
| | | |
| | | |
| | | String s = configService.selectConfigByKey("is_request_common_his_api"); |
| | | // if (null != s && s.equals("Y") && "2".equals(order.getTjType())) { |
| | |
| | | wrapper1.eq(TjFlowingWater::getOrderId, order.getOrderId()); |
| | | wrapper1.orderByDesc(TjFlowingWater::getJxbz); |
| | | List<TjFlowingWater> list = tjFlowingWaterService.list(wrapper1); |
| | | LambdaQueryWrapper<TjCustomer> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(TjCustomer::getCusId, order.getUserId()); |
| | | TjCustomer tjCustomer = tjCustomerService.getOne(wrapper); |
| | | |
| | | for (TjFlowingWater water : list) { |
| | | if (water.getPayStasus() == 0L) { |
| | | weizhifu.add(water); |
| | | } else { |
| | | } else if (water.getPayStasus() == 1L) { |
| | | yizhifu.add(water); |
| | | } |
| | | } |
| | |
| | | |
| | | AjaxResult error1 = zuofeiYiZhifu(yizhifu, tjCustomer, order, apiUrl, hospbm, false, tjNum); |
| | | if (error1 != null && !error.get("code").toString().equals("200")) return error1; |
| | | } else { |
| | | tjOrderService.deleteTjOrderByOrderId(order.getOrderId()); |
| | | } |
| | | |
| | | /* tjOrderService.deleteTjOrderByOrderId(order.getOrderId()); |
| | | tjOrderDetailService.deleteTjOrderDetailByOrderDetailId(String.valueOf(order.getOrderId())); |
| | | remarkService.deletedOrderRemarkByTjNum(tjNum); |
| | | tjFlowingWaterService.deleteTjFlowingWaterByOrderId(String.valueOf(order.getOrderId())); |
| | | transitionService.deletedTbTransitionByTjNum(tjNum); |
| | | ycxmService.delOrderYcXmJyByTjh(tjNum); |
| | | |
| | | TjCustomer customer = tjCustomerService.getById(order.getUserId()); |
| | | customer.setCardId("0"); |
| | | tjCustomerService.updateById(customer); |
| | | xdPictureService.deleteTjXdPictureBytjNum(tjNum); |
| | | tjSamplingMapper.deleteByTjNumAndCusId(tjNum, order.getUserId()); |
| | | } |
| | | |
| | | tjSamplingMapper.deleteByTjNumAndCusId(tjNum, order.getUserId());*/ |
| | | String configByKey = configService.selectConfigByKey("sfkqdyhis"); |
| | | if (configByKey.equals("Y")) { |
| | | |
| | |
| | | } |
| | | } |
| | | boolean zfHisApiMethods = hisApiMethod.ZfHisApiMethods(null, order, lisApiMethod.isUseLisAndPacsRegister(order)); |
| | | if (zfHisApiMethods) { |
| | | return AjaxResult.success("撤销成功"); |
| | | } else { |
| | | if (!zfHisApiMethods) { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error("撤销失败,调用作废出现失败"); |
| | | } |
| | | |
| | | } |
| | | |
| | | tjCustomer.setCardId("0"); |
| | | tjCustomerService.updateById(tjCustomer); |
| | | tjOrderService.removeById(order.getOrderId()); |
| | | return AjaxResult.success("撤销成功"); |
| | | } |
| | | return AjaxResult.success("签到记录不存在!"); |
| | | return AjaxResult.error("体检记录不存在!"); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | TjOrder order = tjOrderService.getOrderByTjNum(tjNum); |
| | | if (null != order) { |
| | | // String payByTjNum = tjOrderService.isPayByTjNum(String.valueOf(order.getOrderId())); |
| | | // if (null != payByTjNum) { |
| | | // return AjaxResult.error("该用户已收费不可撤销签到!"); |
| | | // } |
| | | //这里删除的是这个人所有项目包括补录项目 |
| | | tjOrderService.deleteTjOrderByOrderId(order.getOrderId()); |
| | | tjOrderDetailService.deleteTjOrderDetailByOrderDetailId(String.valueOf(order.getOrderId())); |
| | |
| | | |
| | | TjOrder order = tjOrderService.getOrderByTjNum(dto.getTjh()); |
| | | if (null != order) { |
| | | if (null != order.getPrintLastTime()) return AjaxResult.error("该人员报告已打印,不可撤销!!!"); |
| | | |
| | | |
| | | String configByKey = configService.selectConfigByKey("sfkqdyhis"); |
| | | if (null != configByKey && configByKey.equals("Y")) { |
| | | log.info("dto的数据是" + JSONUtil.toJsonStr(dto)); |
| | |
| | | TjFlowingWater water = tjFlowingWaterService.getOne(wrapper); |
| | | if (water.getPayStasus() == 0L) { |
| | | weizhifu.add(water); |
| | | } else { |
| | | } else if (water.getPayStasus() == 1L) { |
| | | yizhifu.add(water); |
| | | } |
| | | } |
| | |
| | | |
| | | AjaxResult error1 = zuofeiYiZhifu(yizhifu, tjCustomer, order, apiUrl, hospbm, false, dto.getTjh()); |
| | | if (error1 != null && !error.get("code").toString().equals("200")) return error1; |
| | | return AjaxResult.success(); |
| | | } else { |
| | | // return AjaxResult.success(); |
| | | } |
| | | |
| | | try { |
| | | extracted(dto, order); |
| | | } catch (Exception e) { |
| | | log.info("撤销失败,删除表失败"); |
| | | return AjaxResult.error("撤销失败,删除表失败!"); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | return AjaxResult.success("撤销成功"); |
| | | } |
| | | return AjaxResult.error(); |
| | | return AjaxResult.error("未找到体检记录"); |
| | | } |
| | | |
| | | private AjaxResult zuofeiYiZhifu(ArrayList<TjFlowingWater> yizhifu, TjCustomer tjCustomer, TjOrder order, String apiUrl, String hospbm, Boolean isDelete, String tjNum) { |
| | |
| | | String tfid = jsonObject.getJSONObject("data").getStr("feiYongId"); |
| | | water.setHisTfWaterId(tfid); |
| | | tjFlowingWaterService.updateById(water); |
| | | if (isDelete) { |
| | | /* if (isDelete) { |
| | | for (TjFlowingWater water1 : yizhifu) { |
| | | String bldh1 = water1.getJxbz(); |
| | | remarkService.deleteTjOrderDetailByjxbz(bldh1); |
| | |
| | | blService.remove(new LambdaQueryWrapper<TjProBl>().eq(TjProBl::getTjh, tjNum).eq(TjProBl::getBldh, bldh1)); |
| | | tjSamplingMapper.deleteByTjNumAndCusIdAndJxbzo(tjNum, order.getUserId(), bldh1); |
| | | } |
| | | } |
| | | }*/ |
| | | } else return AjaxResult.error(); |
| | | } |
| | | } |
| | |
| | | |
| | | String post = HttpClientUtils.sendPost(apiUrl + "/api/his/" + hospbm + "/revokeCost", chexiaoMap); |
| | | if (JSONUtil.parseObj(post).getStr("code").equals("200")) { |
| | | if (isDelete) { |
| | | /*if (isDelete) { |
| | | for (TjFlowingWater water : weizhifu) { |
| | | String bldh = water.getJxbz(); |
| | | if (StrUtil.isNotBlank(bldh)) { |
| | |
| | | tjSamplingMapper.deleteByTjNumAndCusIdAndJxbzo(tjNum, order.getUserId(), bldh); |
| | | } else { |
| | | //这里删除的是这个人所有项目包括补录项目 |
| | | tjOrderService.deleteTjOrderByOrderId(order.getOrderId()); |
| | | *//* tjOrderService.deleteTjOrderByOrderId(order.getOrderId()); |
| | | tjOrderDetailService.deleteTjOrderDetailByOrderDetailId(String.valueOf(order.getOrderId())); |
| | | remarkService.deletedOrderRemarkByTjNum(tjNum); |
| | | tjFlowingWaterService.deleteTjFlowingWaterByOrderId(String.valueOf(order.getOrderId())); |
| | | transitionService.deletedTbTransitionByTjNum(tjNum); |
| | | tjSamplingMapper.deleteByTjNumAndCusId(order.getTjNumber(), order.getUserId()); |
| | | tjSamplingMapper.deleteByTjNumAndCusId(order.getTjNumber(), order.getUserId());*//* |
| | | // tjOrderService.removeById(order.getOrderId()); |
| | | } |
| | | |
| | | } |
| | | } |
| | | }*/ |
| | | } else return AjaxResult.error(); |
| | | } |
| | | return null; |
| | |
| | | |
| | | // @Transactional(propagation =Propagation.REQUIRES_NEW) |
| | | public void extracted(TjProBlDto dto, TjOrder order) { |
| | | for (String bldh : dto.getBldhs()) { |
| | | remarkService.deleteTjOrderDetailByjxbz(bldh); |
| | | tjOrderDetailService.deleteTjOrderDetailByjxbz(bldh); |
| | | tjFlowingWaterService.deleteTjOrderDetailByjxbz(bldh); |
| | | transitionService.deleteTjOrderDetailByjxbz(bldh); |
| | | blService.remove(new LambdaQueryWrapper<TjProBl>().eq(TjProBl::getTjh, dto.getTjh()).eq(TjProBl::getBldh, bldh)); |
| | | try { |
| | | for (String bldh : dto.getBldhs()) { |
| | | remarkService.deleteTjOrderDetailByjxbz(bldh); |
| | | tjOrderDetailService.deleteTjOrderDetailByjxbz(bldh); |
| | | tjFlowingWaterService.deleteTjOrderDetailByjxbz(bldh); |
| | | transitionService.deleteTjOrderDetailByjxbz(bldh); |
| | | blService.remove(new LambdaQueryWrapper<TjProBl>().eq(TjProBl::getTjh, dto.getTjh()).eq(TjProBl::getBldh, bldh)); |
| | | } |
| | | tjSamplingMapper.deleteByTjNumAndCusIdAndJxbz(dto.getTjh(), order.getUserId(), dto.getBldhs()); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | tjSamplingMapper.deleteByTjNumAndCusIdAndJxbz(dto.getTjh(), order.getUserId(), dto.getBldhs()); |
| | | } |
| | | |
| | | |