| | |
| | | import java.util.*; |
| | | import java.util.List; |
| | | import java.util.concurrent.*; |
| | | import java.util.concurrent.locks.ReentrantLock; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | import javax.annotation.Resource; |
| | |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUnit; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.IdUtil; |
| | | import cn.hutool.core.util.RandomUtil; |
| | | import cn.hutool.crypto.symmetric.DES; |
| | | import cn.hutool.extra.pinyin.PinyinUtil; |
| | |
| | | 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.AgeResult; |
| | | import com.ltkj.common.utils.DateUtils; |
| | | import com.ltkj.common.utils.PDFDocumentUtil; |
| | | import com.ltkj.common.utils.SecurityUtils; |
| | | import com.ltkj.common.utils.*; |
| | | import com.ltkj.framework.config.MatchUtils; |
| | | import com.ltkj.framework.config.ThreadPoolConfig; |
| | | import com.ltkj.framework.config.UserHoder; |
| | |
| | | import com.ltkj.hosp.hisDto.OutpinimpapplyDto; |
| | | import com.ltkj.hosp.hisDto.OutpinmedicapplyDto; |
| | | import com.ltkj.hosp.mapper.TestMapper; |
| | | import com.ltkj.hosp.mapper.TjSamplingMapper; |
| | | import com.ltkj.hosp.pacsDto.SavePacsApply; |
| | | import com.ltkj.hosp.service.*; |
| | | import com.ltkj.hosp.sqlDomain.LtkjMiddleDetail; |
| | |
| | | import com.ltkj.mall.mallOrderUtils.TjConstants; |
| | | import com.ltkj.mall.service.IMallCheckLogService; |
| | | import com.ltkj.mall.service.IMallOrderService; |
| | | import com.ltkj.system.service.ISysConfigService; |
| | | import com.ltkj.system.service.ISysDeptService; |
| | | import com.ltkj.system.service.ISysUserService; |
| | | import com.ltkj.system.domain.TjDjdDyjl; |
| | | import com.ltkj.system.service.*; |
| | | import com.ltkj.web.controller.his.*; |
| | | import com.ltkj.web.controller.lis.LisApiMethod; |
| | | import com.ltkj.web.controller.pacs.PacsApiMethodService; |
| | | import com.ltkj.web.controller.service.TjSysAsyncServiceImpl; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | |
| | | import org.springframework.http.HttpRequest; |
| | | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.transaction.annotation.Isolation; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | import org.springframework.util.DigestUtils; |
| | |
| | | private HisPDFUtil hisPDFUtil; |
| | | @Value("${path.reportServer}") |
| | | private String urlValue; |
| | | |
| | | @Autowired |
| | | private ITjSamplingService samplingService; |
| | | @Autowired |
| | | private TjSamplingMapper tjSamplingMapper; |
| | | @Autowired |
| | | private ITjGroupingProService groupingProService; |
| | | @Autowired |
| | | private ITjDjdDyjlService djdDyjlService; |
| | | @Autowired |
| | | private IdUtils idUtils; |
| | | @Autowired |
| | | private LtkjJybbzdService jybbzdService; |
| | | @Autowired |
| | | private LisJyflhbService lisJyflhbService; |
| | | @Autowired |
| | | private ISysDictDataService sysDictDataService; |
| | | //将方法返回值解析成json格式 |
| | | public JSONObject getJSONObject(String builder) { |
| | | String Response = JSONUtil.parseObj(builder).getStr("Response"); |
| | |
| | | order.setPacName(dwDeptService.getById(order.getPacId()).getDwDeptName()); |
| | | } |
| | | } |
| | | TjDjdDyjl dycs = djdDyjlService.getDjdDyCsByTjNum(order.getTjNumber()); |
| | | if(null !=dycs)order.setDycs(Math.toIntExact(dycs.getDycs())); |
| | | } |
| | | collect = list.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | } |
| | |
| | | order.setPacName(dwDeptService.getById(order.getPacId()).getDwDeptName()); |
| | | } |
| | | } |
| | | TjDjdDyjl dycs = djdDyjlService.getDjdDyCsByTjNum(order.getTjNumber()); |
| | | if(null !=dycs)order.setDycs(Math.toIntExact(dycs.getDycs())); |
| | | } |
| | | } |
| | | map.put("list", list); |
| | |
| | | /** |
| | | * 体检签到登记接口 |
| | | */ |
| | | |
| | | |
| | | ReentrantLock lock = new ReentrantLock(); |
| | | |
| | | @PostMapping |
| | | @ApiOperation(value = "体检签到登记接口") |
| | | @Transactional //(切换数据库出错,所以注释) |
| | | // @Transactional //(切换数据库出错,所以注释) |
| | | @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED) |
| | | public AjaxResult addOrderAndDetail(@RequestBody TjOrder tjOrder) throws Exception { |
| | | Long userId = Long.valueOf(SecurityUtils.getLoginUser().getUserId()); |
| | | SysUser sysUser = userService.getById(userId); |
| | |
| | | transitionService.deletedTbTransitionListByCusIdAndTjNum(tjCustomer.getCusIdcard(), tjCustomer.getCardId()); |
| | | return AjaxResult.error("不可重复登记"); |
| | | } |
| | | |
| | | TjFlowingWater tjFlowingWater = new TjFlowingWater(); |
| | | LambdaQueryWrapper<TjReservation> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.eq(TjReservation::getIdCard, tjCustomer.getCusIdcard()); |
| | |
| | | if (null != tjReservation) { |
| | | tjOrder.setReservationId(tjReservation.getId()); |
| | | mallOrder = mallOrderService.getOne(new LambdaQueryWrapper<MallOrder>().eq(MallOrder::getReservationId, tjReservation.getId())); |
| | | // if (DateUtil.endOfDay(new Date()).before(tjReservation.getReservationTime())) { |
| | | // return AjaxResult.error("未到预约时间"); |
| | | // } |
| | | // if (DateUtil.endOfDay(new Date()).before(tjReservation.getReservationTime())) { |
| | | // return AjaxResult.error("未到预约时间"); |
| | | // } |
| | | if (DateUtil.endOfDay(DateUtil.offsetDay(tjReservation.getReservationTime(), tjReservation.getYxts())).before(new Date())) { |
| | | tjReservation.setIsExpire(1); |
| | | tjReservationService.updateById(tjReservation); |
| | |
| | | tjOrder.setGroupId(tjReservation.getGroupingId()); |
| | | tjOrder.setFirmDeptId(tjReservation.getPacId()); |
| | | } |
| | | // if (null != tjReservation.getDepartmentId()) tjOrder.setFirmDeptId(tjReservation.getDepartmentId()); |
| | | // if (null != tjReservation.getDepartmentId()) tjOrder.setFirmDeptId(tjReservation.getDepartmentId()); |
| | | tjReservation.setIsExpire(1); |
| | | tjReservationService.updateById(tjReservation); |
| | | if (null != tjReservation.getTeamNo()) { |
| | | if (null != tjReservation.getTeamNo() && tjOrder.getTjType().equals("1")) { |
| | | tjOrder.setTjType("1"); |
| | | } else { |
| | | } else if (tjOrder.getTjType().equals("2")) { |
| | | tjOrder.setTjType("2"); |
| | | } |
| | | } |
| | | //生成体检号 |
| | | String tjNumber = (SecurityUtils.getUsername() + new SimpleDateFormat("yyMMddHHmmss").format(new Date())); |
| | | tjOrder.setTjNumber(tjNumber); |
| | | |
| | | if (null != tjOrder.getPhoto()) { |
| | | File file = new File(tjOrder.getPhoto()); |
| | | if (file.isFile()) { |
| | |
| | | tjOrder.setFinishTime(new Date()); |
| | | tjOrder.setCheckStatus(1); |
| | | tjOrder.setStatus(TjConstants.TJ_WAIT); |
| | | // tjFlowingWater.setPayStasus(1L); |
| | | // tjFlowingWater.setPayStasus(1L); |
| | | } |
| | | // else { |
| | | tjFlowingWater.setPayStasus(0L); |
| | | // } |
| | | if (tjOrderService.save(tjOrder)) { |
| | | |
| | | try { |
| | | boolean b = lock.tryLock(3, TimeUnit.MINUTES); |
| | | if (b) { |
| | | AjaxResult result = processOrderWithTransaction(tjOrder, tjCustomer, tjReservation, tjFlowingWater, mallOrder, sysUser); |
| | | if (!result.get("code").toString().equals("200")) |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return result; |
| | | } |
| | | } finally { |
| | | lock.unlock(); |
| | | } |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | @Transactional(propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED) |
| | | public AjaxResult processOrderWithTransaction(TjOrder tjOrder, TjCustomer tjCustomer, TjReservation tjReservation, TjFlowingWater tjFlowingWater, MallOrder mallOrder, SysUser sysUser) { |
| | | //生成体检号 |
| | | String tjNumber = (SecurityUtils.getUsername() + new SimpleDateFormat("yyMMddHHmmss").format(new Date())); |
| | | tjOrder.setTjNumber(tjNumber); |
| | | BigDecimal discount = BigDecimal.valueOf(Double.parseDouble(tjOrder.getTjFlowingWater().getDiscount())); |
| | | |
| | | tjOrder.setDiscount(discount.toString()); |
| | | if (tjOrderService.save(tjOrder)) { |
| | | //保存收货地址 |
| | | if ("2".equals(tjOrder.getGetType())) { |
| | | final TjReportGetAddress address = tjOrder.getAddAddress(); |
| | |
| | | Long cusNumber = tjCustomer.getCusNumber(); |
| | | cusNumber += 1; |
| | | tjCustomer.setCusNumber(cusNumber); |
| | | BigDecimal discount = BigDecimal.valueOf(Double.parseDouble(tjOrder.getTjFlowingWater().getDiscount())); |
| | | |
| | | if ("1".equals(tjOrder.getTjType())) { |
| | | if (null != tjReservation && tjReservation.getPayType() == 1) { |
| | |
| | | tjFlowingWater.setCopeWith(tjOrder.getTjFlowingWater().getCopeWith()); |
| | | tjFlowingWater.setPaidIn(tjOrder.getTjFlowingWater().getPaidIn()); |
| | | tjFlowingWater.setDiscount(tjOrder.getTjFlowingWater().getDiscount()); |
| | | // tjFlowingWater.setPayStasus(0L); |
| | | // tjFlowingWater.setPayStasus(0L); |
| | | } |
| | | } |
| | | if (tjFlowingWaterService.save(tjFlowingWater)) { |
| | |
| | | log.info("该登记人的his就诊号是: " + tjOrder.getCardId()); |
| | | //团体 |
| | | if ("1".equals(tjOrder.getTjType())) { |
| | | asyncService.ttextracted(tjOrder, tjCustomer, sysUser, tjReservation, tjFlowingWater); |
| | | // asyncService.ttextracted(tjOrder, tjCustomer, sysUser, tjReservation, tjFlowingWater); |
| | | ttextracted(tjOrder, tjCustomer, sysUser, tjReservation, tjFlowingWater); |
| | | } |
| | | //个人 |
| | | if ("2".equals(tjOrder.getTjType())) { |
| | |
| | | newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); |
| | | } |
| | | // 查询 对接Lis、Pacs申请如果类型包含在配置内则使用对接lis、pacs |
| | | // String useLisAndPacsRegisterDictTeam = configService.selectConfigByKey("use_lis_and_pacs_register_dict_team"); |
| | | // String[] split = useLisAndPacsRegisterDictTeam.split(","); |
| | | // List<String> list = Arrays.asList(split); |
| | | // if (list.contains(tjOrder.getTjType())) { |
| | | // List<TbTransition> detailList = tbTransitionService.getTbTransitionListByCusId(tjCustomer.getCusIdcard(),tjOrder.getCardId()); |
| | | // pacsApiMethodService.save(tjOrder,tjCustomer,detailList); |
| | | // lisApiMethod.save(tjOrder,tjCustomer,detailList); |
| | | // }else { |
| | | // hisApiMethod.tijianshenqing(tjCustomer, DateUtil.format(date1, "yyyy-MM-dd HH:mm:ss"), tjOrder.getCardId()); |
| | | // } |
| | | |
| | | hisApiMethod.tijianshenqing(tjCustomer, DateUtil.format(date1, "yyyy-MM-dd HH:mm:ss"), tjOrder.getCardId()); |
| | | |
| | | if (lisApiMethod.isUseLisAndPacsRegister(tjOrder)) { |
| | | // 这是上面个人方法引入数据 |
| | | tjFlowingWater.setPayStasus(1L); |
| | | newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); |
| | | AjaxResult ajaxResult = hisApiMethod.tijianshenqing(tjCustomer, DateUtil.format(date1, "yyyy-MM-dd HH:mm:ss"), tjOrder, sysUser, result); |
| | | if (!ajaxResult.get("code").toString().equals("200")) return ajaxResult; |
| | | tjOrderDetailService.updateTjOrderDetailsByOrderId(String.valueOf(tjOrder.getOrderId()), |
| | | sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | } else { |
| | | hisApiMethod.tijianshenqing(tjCustomer, DateUtil.format(date1, "yyyy-MM-dd HH:mm:ss"), tjOrder.getCardId()); |
| | | } |
| | | // hisApiMethod.tijianshenqing(tjCustomer, DateUtil.format(date1, "yyyy-MM-dd HH:mm:ss"), tjOrder.getCardId()); |
| | | return AjaxResult.success(tjNumber); |
| | | } else { |
| | | tjCustomer.setCardId(tjOrder.getTjNumber()); |
| | |
| | | tjOrderService.updateById(tjOrder); |
| | | } |
| | | |
| | | |
| | | //团体 |
| | | if ("1".equals(tjOrder.getTjType())) { |
| | | // asyncService.ttextracted(tjOrder, tjCustomer, sysUser, tjReservation, tjFlowingWater); |
| | | asyncService.ttextracted(tjOrder, tjCustomer, sysUser, tjReservation, tjFlowingWater); |
| | | } |
| | | //个人 |
| | | if ("2".equals(tjOrder.getTjType())) { |
| | | //asyncService.newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); |
| | | newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); |
| | | List<TjOrderDetail> detailList = tjOrderDetailService.getCaiYangDengJi(tjOrder.getOrderId()); |
| | | addCaiYangDengJi(detailList, !detailList.isEmpty(), tjOrder, sysUser,null); |
| | | } |
| | | // 查询 对接Lis、Pacs申请如果类型包含在配置内则使用对接lis、pacs |
| | | if (lisApiMethod.isUseLisAndPacsRegister(tjOrder)) { |
| | | // 这是上面个人方法引入数据 |
| | | tjFlowingWater.setPayStasus(1L); |
| | | newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); |
| | | // AjaxResult ajaxResult = hisApiMethod.tijianshenqing(tjCustomer, DateUtil.format(date1, "yyyy-MM-dd HH:mm:ss"), tjOrder, sysUser, result); |
| | | // if (!ajaxResult.get("code").toString().equals("200")) return ajaxResult; |
| | | tjOrderDetailService.updateTjOrderDetailsByOrderId(String.valueOf(tjOrder.getOrderId()), |
| | | sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | |
| | | List<TjOrderDetail> detailList = tjOrderDetailService.getCaiYangDengJi(tjOrder.getOrderId()); |
| | | addCaiYangDengJi(detailList, !detailList.isEmpty(), tjOrder, sysUser,null); |
| | | |
| | | } |
| | | |
| | | return AjaxResult.success(tjNumber); |
| | | } |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | public void addCaiYangDengJi(List<TjOrderDetail> detailList, boolean detailList1, TjOrder order, SysUser sysUser,String jxbz) { |
| | | if (null != detailList && detailList1) { |
| | | Date date = new Date(); |
| | | String format = DateUtil.format(date, "yyMMddHHmmssSSS"); |
| | | for (TjOrderDetail detail : detailList) { |
| | | TjSampling sampling = new TjSampling(); |
| | | if (null == projectService.getById(detail.getProId())) continue; |
| | | TjProject project = projectService.getById(detail.getProId()); |
| | | Long proParentId = project.getProParentId(); |
| | | String dictLabel = sysDictDataService.selectDictLabel("sys_dict_specimen", project.getSpecimenType()); |
| | | if (null != proParentId && proParentId == 0) { |
| | | sampling.setJyxh(idUtils.generateLisID()); |
| | | sampling.setSpecimenTypeCode(project.getSpecimenType()); |
| | | sampling.setSpecimenType(dictLabel); |
| | | sampling.setJyxmdm(project.getProId().toString()); |
| | | } else { |
| | | TjProject project1 = projectService.getById(proParentId); |
| | | sampling.setJyxh(idUtils.generateLisID()); |
| | | |
| | | sampling.setSpecimenTypeCode(project1.getSpecimenType()); |
| | | sampling.setSpecimenType(dictLabel); |
| | | sampling.setJyxmdm(project.getProId().toString()); |
| | | |
| | | } |
| | | sampling.setSamplingNumber(format); |
| | | sampling.setTjNum(order.getTjNumber()); |
| | | sampling.setCusId(String.valueOf(order.getUserId())); |
| | | if (tjCustomerService.getById(String.valueOf(order.getUserId())) != null) { |
| | | sampling.setCusName(tjCustomerService.getById(String.valueOf(order.getUserId())).getCusName()); |
| | | } |
| | | sampling.setApplicationTime(date); |
| | | sampling.setTjTime(order.getCreateTime()); |
| | | sampling.setProId(String.valueOf(detail.getProId())); |
| | | sampling.setProName(projectService.getById(detail.getProId()).getProName()); |
| | | sampling.setCreateBy(sysUser.getNickName()); |
| | | sampling.setCreateTime(date); |
| | | sampling.setUpdateBy(sysUser.getNickName()); |
| | | sampling.setUpdateTime(date); |
| | | sampling.setCreateId(String.valueOf(sysUser.getUserId())); |
| | | sampling.setUpdateId(String.valueOf(sysUser.getUserId())); |
| | | sampling.setJxbz(jxbz); |
| | | samplingService.save(sampling); |
| | | } |
| | | } |
| | | String config = configService.selectConfigByKey("sfkqdyhis"); |
| | | if (lisApiMethod.isUseLisAndPacsRegister(order) && (null != config && config.equals("Y"))){ |
| | | AjaxResult ajaxResult = lisApiMethod.getJyFlHb(); |
| | | if (ajaxResult.get("code").toString().equals("200")){ |
| | | String str = ajaxResult.get("data").toString(); |
| | | str = str.replace("=", ":"); |
| | | JSONArray array = JSONUtil.parseArray(str); |
| | | for (Object o : array) { |
| | | JSONObject object = (JSONObject) o; |
| | | LisJyflhb lisJyflhb = new LisJyflhb(); |
| | | lisJyflhb.setHbhxm(object.getStr("hbhxm")); |
| | | lisJyflhb.setFlmc(object.getStr("flmc")); |
| | | lisJyflhb.setMc(object.getStr("mc")); |
| | | lisJyflhb.setFlbm(object.getStr("flbm")); |
| | | LambdaQueryWrapper<LisJyflhb> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(LisJyflhb::getFlbm,lisJyflhb.getFlbm()); |
| | | LisJyflhb jyflhb = lisJyflhbService.getOne(wrapper); |
| | | if (jyflhb == null) { |
| | | lisJyflhb.setId(IdUtil.getSnowflake().nextId()); |
| | | lisJyflhbService.save(lisJyflhb); |
| | | }else { |
| | | lisJyflhb.setId(jyflhb.getId()); |
| | | lisJyflhbService.updateById(lisJyflhb); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/addPlOrderAndDetail") |
| | |
| | | SysUser sysUser = UserHoder.getLoginUser().getUser(); |
| | | List<String> cusIds = daoDto.getCusIds(); |
| | | ArrayList<String> tjNumbers = new ArrayList<>(); |
| | | if (null != cusIds && cusIds.size() > 0) { |
| | | if (null != cusIds && !cusIds.isEmpty()) { |
| | | ExecutorService threadPools = Executors.newFixedThreadPool(cusIds.size()); |
| | | for (String cusId : cusIds) { |
| | | threadPools.execute(new Runnable() { |
| | |
| | | LambdaQueryWrapper<TjCustomer> wq = new LambdaQueryWrapper<>(); |
| | | wq.in(TjCustomer::getCusIdcard, cusIds); |
| | | List<Long> list = tjCustomerService.list(wq).stream().map(TjCustomer::getCusId).collect(Collectors.toList()); |
| | | if (list.size() > 0) { |
| | | if (!list.isEmpty()) { |
| | | // ExecutorService threadPool = Executors.newFixedThreadPool(list.size()); |
| | | ThreadPoolTaskExecutor executor = threadPoolConfig.threadPoolTaskExecutor(); |
| | | for (Long aLong : list) { |
| | |
| | | if (null != tjCustomer) { |
| | | cardId = tjCustomer.getCardId(); |
| | | } |
| | | if ((null == proIds || proIds.size() == 0) && (null == packId || packId.equals(""))) { |
| | | if ((null == proIds || proIds.isEmpty()) && (null == packId || packId.equals(""))) { |
| | | transitionService.deletedTbTransitionByCusId(cusId); |
| | | if (redisCache.hasKey(cardId + cusId)) { |
| | | redisCache.deleteObject(cardId + cusId); |
| | |
| | | } |
| | | } |
| | | } |
| | | remarkService.updateRemark(tjNumber); |
| | | asyncService.tjGoutAsync(domainVos, sysUser, list); |
| | | |
| | | TjCustomer customer = tjCustomerService.selectTjCustomerByCusId(tjOrder.getUserId()); |
| | |
| | | }*/ |
| | | return AjaxResult.success("签离成功!"); |
| | | } else { |
| | | remarkService.updateRemark(tjNumber); |
| | | return getAjaxResult(tjNumber); |
| | | } |
| | | } |
| | |
| | | return AjaxResult.success().put("data", map); |
| | | } |
| | | |
| | | |
| | | 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())); |
| | | if (null != tjOrder.getTjCategory() && tjOrder.getTjCategory().equals("13")) { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | public void ttextracted(TjOrder tjOrder, TjCustomer tjCustomer, SysUser sysUser, TjReservation tjReservation, TjFlowingWater tjFlowingWater) { |
| | | |
| | | tjAskMedicalHistoryService.updateTjAskMedicalHistoryByCusId(tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjCustomer.getCusId())); |
| | | boolean b = tjOrderDetailService.saveTjOrderDetailsByCusId(tjCustomer.getCusIdcard(), String.valueOf(tjOrder.getOrderId()), sysUser.getNickName(), |
| | | String.valueOf(sysUser.getUserId()), tjOrder.getCardId()); |
| | | if (!b) { |
| | | List<TjGroupingPro> proList = groupingProService.list(new LambdaQueryWrapper<TjGroupingPro>().eq(TjGroupingPro::getGroupingId, tjOrder.getGroupId())); |
| | | if (null != proList && !proList.isEmpty()) { |
| | | for (TjGroupingPro groupingPro : proList) { |
| | | TjOrderDetail detail = new TjOrderDetail(); |
| | | TjProject tjProject = projectService.selectTjProjectByProId(Long.valueOf(groupingPro.getProId())); |
| | | detail.setIsSampling(String.valueOf(tjProject.getIsSampling())); |
| | | detail.setOrderId(tjOrder.getOrderId()); |
| | | detail.setProId(Long.valueOf(groupingPro.getProId())); |
| | | detail.setTjStatus(0L); |
| | | detail.setCreateBy(sysUser.getNickName()); |
| | | detail.setCreateTime(new Date()); |
| | | detail.setUpdateBy(sysUser.getNickName()); |
| | | detail.setUpdateTime(new Date()); |
| | | detail.setCreateId(String.valueOf(sysUser.getUserId())); |
| | | detail.setUpdateId(String.valueOf(sysUser.getUserId())); |
| | | tjOrderDetailService.save(detail); |
| | | } |
| | | List<String> list = proList.stream().map(TjGroupingPro::getProId).collect(Collectors.toList()); |
| | | List<TjProject> projectList = projectService.list(new LambdaQueryWrapper<TjProject>().in(TjProject::getProParentId, list)); |
| | | for (TjProject project : projectList) { |
| | | TjOrderDetail detail = new TjOrderDetail(); |
| | | detail.setOrderId(tjOrder.getOrderId()); |
| | | detail.setProId(project.getProId()); |
| | | detail.setTjStatus(0L); |
| | | detail.setCreateBy(sysUser.getNickName()); |
| | | detail.setCreateTime(new Date()); |
| | | detail.setUpdateBy(sysUser.getNickName()); |
| | | detail.setUpdateTime(new Date()); |
| | | detail.setCreateId(String.valueOf(sysUser.getUserId())); |
| | | detail.setUpdateId(String.valueOf(sysUser.getUserId())); |
| | | //获取该项目的默认值赋值给结果 |
| | | if (null != project.getProDefault()) { |
| | | detail.setProResult(project.getProDefault()); |
| | | } else { |
| | | detail.setProResult(null); |
| | | } |
| | | detail.setIsSampling(String.valueOf(project.getIsSampling())); |
| | | |
| | | tjOrderDetailService.save(detail); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //添加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() == 1) { |
| | | tjOrderDetailService.updateTjOrderDetailsByOrderId(String.valueOf(tjOrder.getOrderId()), |
| | | sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | } |
| | | if (tjFlowingWater.getDiscount() == null) { |
| | | transitionService.updateTbTransitionPriceByCusId(tjCustomer.getCusIdcard(), new BigDecimal(10), tjOrder.getTjNumber()); |
| | | } else { |
| | | transitionService.updateTbTransitionPriceByCusId(tjCustomer.getCusIdcard(), BigDecimal.valueOf(Long.parseLong(tjFlowingWater.getDiscount())), tjOrder.getTjNumber()); |
| | | } |
| | | |
| | | tjOrderDetailService.saveTjPureToneTesByCusId(tjCustomer.getCusIdcard(), tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), tjOrder.getCardId()); |
| | | // List<TjOrderDetail> list = tjOrderDetailService.getTjOrderDetailsByOrderId(String.valueOf(tjOrder.getOrderId())); |
| | | // if (list != null) { |
| | | // for (TjOrderDetail tjOrderDetail : list) { |
| | | // TjProject tjProject = projectService.getById(tjOrderDetail.getProId()); |
| | | // if(tjProject==null){ |
| | | // continue; |
| | | // } |
| | | // tjOrderDetail.setProject(tjProject); |
| | | // if (tjProject.getProParentId() == 0) { |
| | | // TjOrderRemark tjOrderRemark = new TjOrderRemark(); |
| | | // tjOrderRemark.setProId(tjProject.getProId()); |
| | | // tjOrderRemark.setProName(tjProject.getProName()); |
| | | // tjOrderRemark.setDeptId(tjProject.getDeptId()); |
| | | // tjOrderRemark.setTjNumber(tjOrder.getTjNumber()); |
| | | // tjOrderRemark.setCreateBy(sysUser.getNickName()); |
| | | // tjOrderRemark.setCreateTime(new Date()); |
| | | // tjOrderRemark.setUpdateBy(sysUser.getNickName()); |
| | | // tjOrderRemark.setUpdateTime(new Date()); |
| | | // tjOrderRemark.setCreateId(String.valueOf(sysUser.getUserId())); |
| | | // tjOrderRemark.setUpdateId(String.valueOf(sysUser.getUserId())); |
| | | // orderRemarkService.save(tjOrderRemark); |
| | | // } |
| | | // if ("1".equals(tjOrder.getTjType())) { |
| | | // if (null != tjReservation && tjReservation.getPayType() == 1) { |
| | | // tjOrderDetail.setFlowingWaterId(String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | // } |
| | | // } |
| | | // if(tjFlowingWater.getPayStasus()==1){ |
| | | // tjOrderDetail.setFlowingWaterId(String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | // } |
| | | // tjOrderDetailService.updateById(tjOrderDetail); |
| | | // } |
| | | // } |
| | | } |
| | | |
| | | @PostMapping("/heXiaoByIds/{orderIds}") |
| | | @ApiOperation(value = "核收报告——————总检审核通过后可以核销,核收后才能打印") |
| | |
| | | customer.setCardId("0"); |
| | | tjCustomerService.updateById(customer); |
| | | String configByKey = configService.selectConfigByKey("sfkqdyhis"); |
| | | tjSamplingMapper.deleteByTjNumAndCusId(tjNum, order.getUserId()); |
| | | if (configByKey.equals("Y")) { |
| | | |
| | | HashMap<String, Object> hisRequestParams = new HashMap<>(); |
| | |
| | | return AjaxResult.error("撤销失败,该人员已缴费,请先退费!"); |
| | | } |
| | | } |
| | | boolean zfHisApiMethods = hisApiMethod.ZfHisApiMethods(null, order); |
| | | boolean zfHisApiMethods = hisApiMethod.ZfHisApiMethods(null, order, lisApiMethod.isUseLisAndPacsRegister(order)); |
| | | if (zfHisApiMethods) { |
| | | return AjaxResult.success("撤销成功"); |
| | | } else { |
| | |
| | | } |
| | | |
| | | } |
| | | return AjaxResult.success("撤销成功!!!"); |
| | | } |
| | | return AjaxResult.success("签到记录不存在!"); |
| | | } |
| | |
| | | @Transactional |
| | | public AjaxResult revokeTjOrderByTjCardId(@RequestParam @ApiParam(value = "就诊号") String cardId) { |
| | | |
| | | TjOrder order = new TjOrder(); |
| | | LambdaQueryWrapper<TjOrder> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(TjOrder::getCardId, cardId); |
| | | TjOrder order = tjOrderService.getOne(queryWrapper); |
| | | order.setCardId(cardId); |
| | | String configByKey = configService.selectConfigByKey("sfkqdyhis"); |
| | | if (configByKey.equals("Y")) { |
| | |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error("撤销失败,门诊患者费用清单信息不为空"); |
| | | } else { |
| | | boolean zfHisApiMethods = hisApiMethod.ZfHisApiMethods(null, order); |
| | | boolean zfHisApiMethods = hisApiMethod.ZfHisApiMethods(null, order, lisApiMethod.isUseLisAndPacsRegister(order)); |
| | | if (zfHisApiMethods) { |
| | | return AjaxResult.success("撤销成功", map); |
| | | } else { |
| | |
| | | |
| | | @PostMapping("/revokeBlProByBldhAndTjh") |
| | | @ApiOperation(value = "根据补录单号和体检号删除记录") |
| | | @Transactional |
| | | // @Transactional |
| | | public AjaxResult revokeBlProByBldhAndTjh(@RequestBody TjProBlDto dto) { |
| | | |
| | | if (null == dto.getBldhs() || dto.getBldhs().size() == 0) { |
| | | log.info("请选择要撤销的补录项目"); |
| | | return AjaxResult.error("请选择要撤销的补录项目"); |
| | | } |
| | | |
| | |
| | | if (null != order) { |
| | | String configByKey = configService.selectConfigByKey("sfkqdyhis"); |
| | | if (null != configByKey && configByKey.equals("Y")) { |
| | | log.info("dto的数据是" + JSONUtil.toJsonStr(dto)); |
| | | HashMap<String, Object> hisRequestParams = new HashMap<>(); |
| | | hisRequestParams.put("patientId", order.getCardId()); |
| | | AjaxResult queryPay = hisApiGetMethodService.getHISDataNew("QueryPay", hisRequestParams); |
| | | log.info("queryPay ->{}", JSONUtil.toJsonStr(queryPay)); |
| | | if (Integer.parseInt(queryPay.get("code").toString()) == 200) { |
| | | List<Map<String, String>> data = (List<Map<String, String>>) queryPay.get("data"); |
| | | BigDecimal cateFeeAll = BigDecimal.ZERO; |
| | | List<String> advIds = new ArrayList<>(); |
| | | for (Map<String, String> datum : data) { |
| | | String advId = datum.get("Adv_Id").split("_")[1]; |
| | | BigDecimal cateFee = new BigDecimal(datum.get("CateFee")); |
| | | cateFeeAll = cateFeeAll.add(cateFee); |
| | | advIds.add(advId); |
| | | log.info("data的数据是" + JSONUtil.toJsonStr(data)); |
| | | // BigDecimal cateFeeAll = BigDecimal.ZERO; |
| | | // List<String> advIds = new ArrayList<>(); |
| | | List<LtkjJianchajianyanTree> buLuXmXinXi = tjOrderService.getBuLuXmXinXi(dto.getBldhs(), order.getCardId()); |
| | | log.info("buLuXmXinXi的值为:==========" + buLuXmXinXi); |
| | | if (null != buLuXmXinXi && !buLuXmXinXi.isEmpty()) { |
| | | for (Map<String, String> datum : data) { |
| | | for (LtkjJianchajianyanTree tree : buLuXmXinXi) { |
| | | String advId = datum.get("Adv_Id").split("_")[1]; |
| | | log.info("advid的值为:==========" + advId); |
| | | log.info("tree的值为:==========" + advId); |
| | | BigDecimal cateFee = new BigDecimal(datum.get("CateFee")); |
| | | log.info("cateFee的值为:==========" + cateFee); |
| | | log.info("tree.getFyhj()的值为:==========" + tree.getFyhj()); |
| | | if (tree.getSqdh().equals(advId) && cateFee.compareTo(new BigDecimal(tree.getFyhj())) == 0) { |
| | | log.info("该项目已缴费不可撤销"); |
| | | return AjaxResult.error("该项目已缴费不可撤销!!!"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (advIds.containsAll(dto.getBldhs()) && cateFeeAll.compareTo(BigDecimal.ZERO) != 0) { |
| | | return AjaxResult.error("改项目已缴费不可撤销!!!"); |
| | | } |
| | | |
| | | } |
| | | |
| | | boolean b = hisApiMethod.ZfBlXm(dto.getBldhs(), order); |
| | | if (!b) { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | log.info("撤销失败,调用作废出现失败"); |
| | | return AjaxResult.error("撤销失败,调用作废出现失败"); |
| | | } |
| | | } |
| | | 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 { |
| | | extracted(dto, order); |
| | | } catch (Exception e) { |
| | | log.info("撤销失败,删除表失败"); |
| | | return AjaxResult.error("撤销失败,删除表失败!"); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | // @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)); |
| | | } |
| | | tjSamplingMapper.deleteByTjNumAndCusIdAndJxbz(dto.getTjh(), order.getUserId(), dto.getBldhs()); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/addYaoPinShenQing") |
| | | @ApiOperation(value = "药品信息申请") |