| | |
| | | |
| | | import java.io.*; |
| | | 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 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 javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import cn.hutool.core.codec.Base64; |
| | | 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.core.util.StrUtil; |
| | | import cn.hutool.crypto.symmetric.DES; |
| | | import cn.hutool.extra.pinyin.PinyinUtil; |
| | | import cn.hutool.json.JSONArray; |
| | | import cn.hutool.json.JSONObject; |
| | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.fasterxml.jackson.databind.BeanProperty; |
| | | import com.itextpdf.text.Document; |
| | | import com.itextpdf.text.DocumentException; |
| | | import com.ltkj.common.annotation.RepeatSubmit; |
| | |
| | | import com.ltkj.hosp.dto.QianDaoDto; |
| | | import com.ltkj.hosp.dto.TjProBlDto; |
| | | import com.ltkj.hosp.dto.UpdateTransitionnewPriceDto; |
| | | import com.ltkj.hosp.hisDto.OutpinimpapplyDto; |
| | | import com.ltkj.hosp.hisDto.OutpinmedicapplyDto; |
| | | import com.ltkj.hosp.mapper.TbTransitionMapper; |
| | | 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.hosp.sqlDomain.LtkjMiddleHead; |
| | |
| | | import com.ltkj.mall.service.IMallOrderService; |
| | | import com.ltkj.system.domain.TjDjdDyjl; |
| | | import com.ltkj.system.service.*; |
| | | import com.ltkj.hosp.idutil.IdUtils; |
| | | 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 com.ltkj.web.wxUtils.HttpClientUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import jodd.util.StringUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.time.DateFormatUtils; |
| | | import org.aspectj.weaver.ast.Var; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | | 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; |
| | |
| | | wq.isNull(TjOrder::getPrintLastTime); |
| | | } |
| | | if (zt == 6) { |
| | | //已出报告 |
| | | //已打印 |
| | | wq.isNotNull(TjOrder::getPrintLastTime); |
| | | wq.eq(TjOrder::getHeshouStatus, 1); |
| | | wq.isNotNull(TjOrder::getPrintLastTime); |
| | |
| | | order.setZt("报告核收"); |
| | | } |
| | | if (zt == 6) { |
| | | order.setZt("已出报告"); |
| | | order.setZt("已打印"); |
| | | } |
| | | } else { |
| | | if (czwj == 0) { |
| | |
| | | order.setZt("报告核收"); |
| | | } |
| | | if (null != lastTime) { |
| | | //已出报告6 |
| | | order.setZt("已出报告"); |
| | | //已打印6 |
| | | order.setZt("已打印"); |
| | | } |
| | | } |
| | | } |
| | |
| | | return result; |
| | | } |
| | | }catch (Exception e){ |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | log.error(String.valueOf(e)); |
| | | } |
| | | finally { |
| | |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | @Transactional(propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED) |
| | | // @Transactional(propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED) |
| | | @Transactional(propagation = Propagation.REQUIRED) // 共享事务 |
| | | public AjaxResult processOrderWithTransaction(TjOrder tjOrder, TjCustomer tjCustomer, TjReservation tjReservation, TjFlowingWater tjFlowingWater, MallOrder mallOrder, SysUser sysUser) { |
| | | |
| | | //获取拼接前缀 |
| | | // String makeLisTmhPrefix = configService.selectConfigByKey("make_lis_tmh_prefix"); |
| | | String sfkqtjhqz = configService.selectConfigByKey("sfkqtjhqz"); |
| | | String makeLisTmhPrefix = ""; |
| | | if(sfkqtjhqz.equalsIgnoreCase("Y")){ |
| | | makeLisTmhPrefix = configService.selectConfigByKey("make_lis_tmh_prefix"); |
| | | } |
| | | |
| | | //生成体检号 |
| | | // String tjNumber = (SecurityUtils.getUsername() + new SimpleDateFormat("yyMMddHHmmss").format(new Date())); |
| | | // if(StringUtil.isNotBlank(makeLisTmhPrefix)) tjNumber=makeLisTmhPrefix+tjNumber; |
| | | // String tjNumber = (SecurityUtils.getUsername() + idUtils.getTjNumber()); |
| | | // String tjNumber = idUtils.getTjNumber(); |
| | | String tjNumber = null; |
| | | |
| | | int a =0; |
| | | while (tjNumber ==null){ |
| | | if(a>3){ |
| | | throw new RuntimeException("前方拥挤,请稍等!!!"); |
| | | } |
| | | try { |
| | | String newTjNumberRedisLockAndMysql = idUtils.getNewTjNumberRedisLockAndMysql(); |
| | | if (StringUtil.isNotBlank(makeLisTmhPrefix)){ |
| | | String tjh= makeLisTmhPrefix + newTjNumberRedisLockAndMysql; |
| | | int countByTjNum = tjOrderService.getOrderCountByTjNum(tjh); |
| | | if(countByTjNum==0){ |
| | | tjNumber=tjh; |
| | | } |
| | | }else { |
| | | int countByTjNum = tjOrderService.getOrderCountByTjNum(newTjNumberRedisLockAndMysql); |
| | | if(countByTjNum==0){ |
| | | tjNumber=newTjNumberRedisLockAndMysql; |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage()); |
| | | }finally { |
| | | a++; |
| | | } |
| | | } |
| | | |
| | | String tjNumber = (SecurityUtils.getUsername() + idUtils.getTjNumber()); |
| | | if (StringUtil.isNotBlank(makeLisTmhPrefix)) tjNumber = makeLisTmhPrefix + tjNumber; |
| | | if(StringUtil.isBlank(tjNumber)) return AjaxResult.error("登记失败 重新操作"); |
| | | |
| | | tjOrder.setTjNumber(tjNumber); |
| | | |
| | | |
| | |
| | | hisApiMethod.ZfHisApiMethod(jzh.toString()); |
| | | } |
| | | log.info("该登记人挂号失败, 就诊号为: " + tjOrder.getCardId()); |
| | | return AjaxResult.error("挂号失败!" + result.get("msg").toString()); |
| | | // return AjaxResult.error("挂号失败!" + result.get("msg").toString()); |
| | | throw new IllegalStateException("挂号失败!" + result.get("msg").toString()); |
| | | } |
| | | |
| | | log.info("该登记人的his就诊号是: " + tjOrder.getCardId()); |
| | |
| | | newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); |
| | | }*/ |
| | | // 查询 对接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())); |
| | | 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); |
| | | } else { |
| | | newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); |
| | | List<TjOrderDetail> detailList = tjOrderDetailService.getCaiYangDengJi(tjOrder.getOrderId()); |
| | | addCaiYangDengJi(detailList, !detailList.isEmpty(), tjOrder, sysUser, null); |
| | | |
| | | hisApiMethod.tijianshenqing(tjCustomer, DateUtil.format(date1, "yyyy-MM-dd HH:mm:ss"), tjOrder.getCardId()); |
| | | try { |
| | | if (lisApiMethod.isUseLisAndPacsRegister(tjOrder)) { |
| | | log.info("调用his开启 进入不收费方法 该体检人员不收费:"+tjOrder.getTjNumber()); |
| | | // 这是上面个人方法引入数据 |
| | | 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())); |
| | | 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); |
| | | log.info("调用his开启 进入不收费方法 该方法执行完毕"); |
| | | } else { |
| | | log.info("调用his开启 进入收费方法 该体检人员不收费:"+tjOrder.getTjNumber()); |
| | | newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); |
| | | List<TjOrderDetail> detailList = tjOrderDetailService.getCaiYangDengJi(tjOrder.getOrderId()); |
| | | addCaiYangDengJi(detailList, !detailList.isEmpty(), tjOrder, sysUser, null); |
| | | String isUseMx = configService.selectConfigByKey("jcxhis_is_use_mx"); |
| | | if (isUseMx.equalsIgnoreCase("Y")) |
| | | hisApiMethod.tijianshenqing(tjCustomer, DateUtil.format(date1, "yyyy-MM-dd HH:mm:ss"), tjOrder.getCardId()); |
| | | else hisApiMethod.tijianshenqingJinchuanNew(tjCustomer, DateUtil.format(date1, "yyyy-MM-dd HH:mm:ss"), tjOrder.getCardId()); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage()); |
| | | throw new IllegalStateException(); |
| | | } |
| | | return AjaxResult.success(tjNumber); |
| | | } else { |
| | |
| | | |
| | | log.info("签到登记接口该人员: "+tjOrder.getTjNumber()+" 的体检类型是:"+tjOrder.getTjType()); |
| | | if (lisApiMethod.isUseLisAndPacsRegister(tjOrder)) { |
| | | log.info(tjOrder.getTjNumber()+"签到登记进入未收费方法"); |
| | | // 这是上面个人方法引入数据 |
| | | tjFlowingWater.setPayStasus(1L); |
| | | newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); |
| | | tjOrderDetailService.updateTjOrderDetailsByOrderId(String.valueOf(tjOrder.getOrderId()), |
| | | sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | 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()); |
| | | log.info(tjOrder.getTjNumber()+"签到登记:采样数据查询个数"+detailList.size()); |
| | | addCaiYangDengJi(detailList, !detailList.isEmpty(), tjOrder, sysUser, null); |
| | | return AjaxResult.success(tjNumber); |
| | | try { |
| | | log.info(tjOrder.getTjNumber()+"签到登记进入未收费方法"); |
| | | // 这是上面个人方法引入数据 |
| | | tjFlowingWater.setPayStasus(1L); |
| | | newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); |
| | | tjOrderDetailService.updateTjOrderDetailsByOrderId(String.valueOf(tjOrder.getOrderId()), |
| | | sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | 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()); |
| | | log.info(tjOrder.getTjNumber()+"签到登记:采样数据查询个数"+detailList.size()); |
| | | addCaiYangDengJi(detailList, !detailList.isEmpty(), tjOrder, sysUser, null); |
| | | return AjaxResult.success(tjNumber); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage()); |
| | | throw new IllegalStateException(e); |
| | | } |
| | | } else { |
| | | log.info(tjOrder.getTjNumber()+"else签到登记进入收费方法"); |
| | | newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); |
| | | AjaxResult error = isRequestCommonHisApi(tjOrder, tjCustomer, tjFlowingWater); |
| | | if (error != null) return error; |
| | | try { |
| | | log.info(tjOrder.getTjNumber()+"else签到登记进入收费方法"); |
| | | 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(); |
| | | } |
| | | // if (error != null) return error; |
| | | // List<TjOrderDetail> detailList = tjOrderDetailService.getCaiYangDengJi(tjOrder.getOrderId()); |
| | | // addCaiYangDengJi(detailList, !detailList.isEmpty(), tjOrder, sysUser, null); |
| | | } |
| | |
| | | // pacsApiMethodService.OrderAdd(tjCustomer,tjOrder); |
| | | // return AjaxResult.success(tjNumber); |
| | | } |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error(); |
| | | // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | throw new RuntimeException("体检记录保存失败 强制触发回滚"); |
| | | } |
| | | |
| | | private AjaxResult isRequestCommonHisApi(TjOrder tjOrder, TjCustomer tjCustomer, TjFlowingWater tjFlowingWater) { |
| | | @Transactional(propagation = Propagation.REQUIRED) // 共享事务 |
| | | public void isRequestCommonHisApi(TjOrder tjOrder, TjCustomer tjCustomer, TjFlowingWater tjFlowingWater) { |
| | | String s = configService.selectConfigByKey("is_request_common_his_api"); |
| | | if (null != s && s.equals("Y")) { |
| | | String apiUrl = configService.selectConfigByKey("common_api_url"); |
| | |
| | | wrapper.gt(TbTransition::getNowPrice, 0); |
| | | |
| | | List<TbTransition> list = tbTransitionService.list(wrapper); |
| | | BigDecimal zongjia = new BigDecimal("0.0"); |
| | | for (TbTransition transition : list) { |
| | | LambdaQueryWrapper<TjProject> wrapper1 = new LambdaQueryWrapper<>(); |
| | | wrapper1.eq(TjProject::getProId, transition.getProId()); |
| | |
| | | SysDept dept = sysDeptService.getOne(wrapper2); |
| | | |
| | | JSONObject obj = JSONUtil.createObj(); |
| | | Integer sl = project.getSl(); |
| | | // Integer sl = project.getSl(); |
| | | int sl = 1; |
| | | BigDecimal danjia = transition.getNowPrice(); |
| | | BigDecimal allPrice = danjia.multiply(new BigDecimal(sl)); |
| | | obj.putOpt("danJia", danjia); |
| | |
| | | obj.putOpt("shouFeiXmId", project.getHisXmbm()); |
| | | obj.putOpt("shouFeiXmMc", project.getHisXmmc()); |
| | | array.add(obj); |
| | | zongjia = zongjia.add(allPrice); |
| | | } |
| | | map.put("feiYongInfoList", array); |
| | | log.info("调用His接口前 收费总价:{}", zongjia.toString()); |
| | | |
| | | String post = HttpClientUtils.sendPost(apiUrl + "/api/his/" + hospbm + "/creatCostInfo", map); |
| | | JSONObject object = JSONUtil.parseObj(post); |
| | |
| | | } |
| | | tjFlowingWaterService.updateById(tjFlowingWater); |
| | | } else { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error(); |
| | | // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | log.error("isRequestCommonHisApi 方法异常"); |
| | | throw new RuntimeException("is_request_common_his_api 强制触发回滚"); |
| | | // return AjaxResult.error(); |
| | | } |
| | | } |
| | | return null; |
| | | // return null; |
| | | } |
| | | |
| | | @Transactional(propagation = Propagation.REQUIRED) // 共享事务 |
| | | public void addCaiYangDengJi(List<TjOrderDetail> detailList, boolean detailList1, TjOrder order, SysUser sysUser, String jxbz) { |
| | | String lis_tmh_prefix = configService.selectConfigByKey("make_lis_tmh_prefix"); |
| | | String config = configService.selectConfigByKey("sfkqdyhis"); |
| | | Boolean lisAndPacsRegister = lisApiMethod.isUseLisAndPacsRegister(order); |
| | | 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(lis_tmh_prefix)); |
| | | sampling.setSpecimenTypeCode(project.getSpecimenType()); |
| | | sampling.setSpecimenType(dictLabel); |
| | | if (config.equals("Y") && lisAndPacsRegister) |
| | | sampling.setJyxmdm(project.getLisXmbm()); |
| | | else sampling.setJyxmdm(project.getProId().toString()); |
| | | } else { |
| | | TjProject project1 = projectService.getById(proParentId); |
| | | sampling.setJyxh(idUtils.generateLisID(lis_tmh_prefix)); |
| | | |
| | | sampling.setSpecimenTypeCode(project1.getSpecimenType()); |
| | | sampling.setSpecimenType(dictLabel); |
| | | if (config.equals("Y") && lisAndPacsRegister) |
| | | sampling.setJyxmdm(project1.getLisXmbm()); |
| | | else sampling.setJyxmdm(project1.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); |
| | | } |
| | | } |
| | | 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); |
| | | try { |
| | | String lis_tmh_prefix = configService.selectConfigByKey("make_lis_tmh_prefix"); |
| | | String config = configService.selectConfigByKey("sfkqdyhis"); |
| | | Boolean lisAndPacsRegister = lisApiMethod.isUseLisAndPacsRegister(order); |
| | | if (null != detailList && detailList1) { |
| | | Date date = new Date(); |
| | | String format = DateUtil.format(date, "yyMMddHHmmssSSS"); |
| | | for (TjOrderDetail detail : detailList) { |
| | | int i = samplingService.isExistProId(order.getTjNumber(), String.valueOf(detail.getProId())); |
| | | if(i>0) continue; |
| | | 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(lis_tmh_prefix)); |
| | | sampling.setSpecimenTypeCode(project.getSpecimenType()); |
| | | sampling.setSpecimenType(dictLabel); |
| | | if (config.equals("Y") && lisAndPacsRegister) |
| | | sampling.setJyxmdm(project.getLisXmbm()); |
| | | else sampling.setJyxmdm(project.getProId().toString()); |
| | | } else { |
| | | lisJyflhb.setId(jyflhb.getId()); |
| | | lisJyflhbService.updateById(lisJyflhb); |
| | | TjProject project1 = projectService.getById(proParentId); |
| | | sampling.setJyxh(idUtils.generateLisID(lis_tmh_prefix)); |
| | | |
| | | sampling.setSpecimenTypeCode(project1.getSpecimenType()); |
| | | sampling.setSpecimenType(dictLabel); |
| | | if (config.equals("Y") && lisAndPacsRegister) |
| | | sampling.setJyxmdm(project1.getLisXmbm()); |
| | | else sampling.setJyxmdm(project1.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); |
| | | } |
| | | } |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | if (StrUtil.isNotBlank(jxbz)) { |
| | | tjSamplingMapper.updateUserIdByTjNumAndJxbz(order.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), jxbz); |
| | | } else { |
| | | tjSamplingMapper.updateUserIdByTjNum(order.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId())); |
| | | } |
| | | if (StrUtil.isNotBlank(jxbz)) { |
| | | tjSamplingMapper.updateUserIdByTjNumAndJxbz(order.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), jxbz); |
| | | } else { |
| | | tjSamplingMapper.updateUserIdByTjNum(order.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId())); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | //获取拼接前缀 |
| | | String makeLisTmhPrefix = configService.selectConfigByKey("make_lis_tmh_prefix"); |
| | | String tjNumber = (sysUser.getUserName() + idUtils.getTjNumber()); |
| | | // String tjNumber = (sysUser.getUserName() + idUtils.getTjNumber()); |
| | | // String tjNumber = idUtils.getTjNumber(); |
| | | String tjNumber = idUtils.getNewTjNumberRedisLockAndMysql(); |
| | | if (StringUtil.isNotBlank(makeLisTmhPrefix)) tjNumber = makeLisTmhPrefix + tjNumber; |
| | | |
| | | |
| | |
| | | transitionService.saveRedisTransitionByPacId(cusId, cardId, pacId); |
| | | |
| | | //补差价 |
| | | List<Map<String, Object>> cjMaps = groupingProService.huoquxiangmuchajia(pacId.toString(), cusId); |
| | | List<Map<String, Object>> cjMaps = transitionService.addTbhuoquxiangmuchajia(pacId.toString(), cusId); |
| | | if (null != cjMaps && !cjMaps.isEmpty()) { |
| | | log.info("该套餐"+pacId+"中有差价:"+cjMaps.size()+"个"); |
| | | for (Map<String, Object> cjMap : cjMaps) { |
| | | log.info("添加临时表套餐数据时所选的差价为:"+ cjMap.get("cj").toString()); |
| | | transitionService.buxiangmuchajia(cusId, pacId.toString(), cjMap.get("xmid").toString(), new BigDecimal(cjMap.get("cj").toString())); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | @Transactional(propagation = Propagation.REQUIRED) // 共享事务 |
| | | 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")) { |
| | | tjOrderDetailService.saveJSYTjOrderDetailsByCusId(tjCustomer.getCusIdcard(), |
| | | String.valueOf(tjOrder.getOrderId()), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), tjOrder.getCardId(), String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | } else { |
| | | tjOrderDetailService.saveTjOrderDetailsByCusId(tjCustomer.getCusIdcard(), String.valueOf(tjOrder.getOrderId()), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), tjOrder.getCardId()); |
| | | } |
| | | try { |
| | | tjAskMedicalHistoryService.updateTjAskMedicalHistoryByCusId(tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjCustomer.getCusId())); |
| | | if (null != tjOrder.getTjCategory() && tjOrder.getTjCategory().equals("13")) { |
| | | tjOrderDetailService.saveJSYTjOrderDetailsByCusId(tjCustomer.getCusIdcard(), |
| | | String.valueOf(tjOrder.getOrderId()), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), tjOrder.getCardId(), String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | } else { |
| | | tjOrderDetailService.saveTjOrderDetailsByCusId(tjCustomer.getCusIdcard(), String.valueOf(tjOrder.getOrderId()), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), tjOrder.getCardId()); |
| | | } |
| | | |
| | | tjOrderDetailService.saveTjPureToneTesByCusId(tjCustomer.getCusIdcard(), tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), tjOrder.getCardId()); |
| | | tjOrderDetailService.saveTjPureToneTesByCusId(tjCustomer.getCusIdcard(), tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), tjOrder.getCardId()); |
| | | |
| | | //添加remark表数据 |
| | | if (null != tjOrder.getTjCategory() && tjOrder.getTjCategory().equals("13")) { |
| | | remarkService.saveJSYTjOrderRemarkByOrderId(tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjOrder.getOrderId())); |
| | | //添加remark表数据 |
| | | if (null != tjOrder.getTjCategory() && tjOrder.getTjCategory().equals("13")) { |
| | | remarkService.saveJSYTjOrderRemarkByOrderId(tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjOrder.getOrderId())); |
| | | |
| | | } else { |
| | | remarkService.saveTjOrderRemarkByOrderId(tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjOrder.getOrderId())); |
| | | } else { |
| | | 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) { |
| | | } |
| | | //判断是否交钱 |
| | | 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())); |
| | | remarkService.updateTjOrderRemarkSfbzByJxbzisnull(tjOrder.getOrderId().toString(), tjFlowingWater.getTjSerialNumber().toString()); |
| | | List<TjXdPicture> xdPictureList = xdPictureService.saveTjXdPicture(tjOrder.getTjNumber()); |
| | | xdPictureService.saveBatch(xdPictureList); |
| | | } |
| | | } |
| | | if (tjFlowingWater.getPayStasus() == 1L) { |
| | | tjOrderDetailService.updateTjOrderDetailsByOrderId(String.valueOf(tjOrder.getOrderId()), |
| | | sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | tjFlowingWater.setPaidIn(tjOrder.getTjFlowingWater().getPaidIn()); |
| | | tjFlowingWater.setCopeWith(tjOrder.getTjFlowingWater().getCopeWith()); |
| | | tjFlowingWater.setPayType(4L); |
| | | tjFlowingWaterService.updateById(tjFlowingWater); |
| | | remarkService.updateTjOrderRemarkSfbzByJxbzisnull(tjOrder.getOrderId().toString(), tjFlowingWater.getTjSerialNumber().toString()); |
| | | // asyncService.addTjChargingStandard(tjOrder, transitionService.getTbTransitionListByCusId(tjCustomer.getCusIdcard(), tjOrder.getCardId()), sysUser); |
| | | List<TjXdPicture> xdPictureList = xdPictureService.saveTjXdPicture(tjOrder.getTjNumber()); |
| | | xdPictureService.saveBatch(xdPictureList); |
| | | } |
| | | } |
| | | if (tjFlowingWater.getPayStasus() == 1L) { |
| | | tjOrderDetailService.updateTjOrderDetailsByOrderId(String.valueOf(tjOrder.getOrderId()), |
| | | sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | tjFlowingWater.setPaidIn(tjOrder.getTjFlowingWater().getPaidIn()); |
| | | tjFlowingWater.setCopeWith(tjOrder.getTjFlowingWater().getCopeWith()); |
| | | tjFlowingWater.setPayType(4L); |
| | | tjFlowingWaterService.updateById(tjFlowingWater); |
| | | remarkService.updateTjOrderRemarkSfbzByJxbzisnull(tjOrder.getOrderId().toString(), tjFlowingWater.getTjSerialNumber().toString()); |
| | | // asyncService.addTjChargingStandard(tjOrder, transitionService.getTbTransitionListByCusId(tjCustomer.getCusIdcard(), tjOrder.getCardId()), sysUser); |
| | | List<TjXdPicture> xdPictureList = xdPictureService.saveTjXdPicture(tjOrder.getTjNumber()); |
| | | xdPictureService.saveBatch(xdPictureList); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | @GetMapping("/chushenyemianyijianjiekou") |
| | | @ApiOperation(value = "初审页面弃检接口") |
| | | @Transactional |
| | | public AjaxResult chushenyemianyijianjiekou(@RequestParam String tjNUm, @RequestParam String proId) { |
| | | LambdaQueryWrapper<TjOrderRemark> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjOrderRemark::getTjNumber, tjNUm); |
| | | wq.eq(TjOrderRemark::getProId, proId); |
| | | TjOrderRemark remark = remarkService.getOne(wq); |
| | | remark.setType(1); |
| | | remarkService.updateById(remark); |
| | | return AjaxResult.success("操作成功!"); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/zongjanyemianshjianzhou") |
| | | @ApiOperation(value = "总检获取时间轴接口") |
| | | @Transactional |
| | |
| | | a = 5; |
| | | } |
| | | if (null != lastTime) { |
| | | //已出报告 |
| | | //已打印 |
| | | a = 6; |
| | | } |
| | | map.put("tjNUm", tjNUm); |
| | |
| | | public AjaxResult updateTransitionnewPrice(@RequestBody List<UpdateTransitionnewPriceDto> dtos) { |
| | | |
| | | if (null != dtos && !dtos.isEmpty()) { |
| | | int index = 0; |
| | | boolean flag = false; |
| | | for (UpdateTransitionnewPriceDto dto : dtos) { |
| | | index++; |
| | | LambdaQueryWrapper<TbTransition> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TbTransition::getCusId, dto.getCusIdCard()); |
| | | wq.eq(TbTransition::getParentProId, dto.getParentProId()); |
| | |
| | | log.info("父项目id为: " + dto.getParentProId()); |
| | | log.info("折扣为: " + new BigDecimal(dto.getDiscount())); |
| | | if (null != list && !list.isEmpty()) { |
| | | BigDecimal dxzj = transitionService.getTbTransitionPriceAndOrdPrice(dto.getCusIdCard(), dto.getParentProId()); |
| | | |
| | | for (TbTransition transition : list) { |
| | | BigDecimal ordPrice = transition.getOrdPrice(); |
| | | BigDecimal multiply = ordPrice.multiply((new BigDecimal(dto.getDiscount()).divide(BigDecimal.valueOf(10)))); |
| | | log.info("后端计算的金额: " + multiply); |
| | | log.info("后端计算的金额: " + multiply.toString()); |
| | | transition.setNowPrice(multiply); |
| | | transition.setDiscount(new BigDecimal(dto.getDiscount())); |
| | | transitionService.updateById(transition); |
| | | } |
| | | if (null != dto.getYhj() && dto.getYhj().compareTo(BigDecimal.ZERO) >= 0) { |
| | | List<TbTransition> transitionList = list.stream().filter(a -> |
| | | transitionService.getTbTransitionPriceAndOrdPrice(dto.getCusIdCard(), dto.getParentProId()).subtract(dto.getYhj()).compareTo(BigDecimal.ZERO) >= 0).collect(Collectors.toList()); |
| | | if (!transitionList.isEmpty()) { |
| | | TbTransition tbTransition = transitionList.get(0); |
| | | tbTransition.setNowPrice(dxzj); |
| | | transitionService.updateById(tbTransition); |
| | | |
| | | BigDecimal dxzj = transitionService.getTbTransitionPriceAndOrdPrice(dto.getCusIdCard(), dto.getParentProId()); |
| | | |
| | | BigDecimal yhj = dto.getYhj(); |
| | | log.info("前端传递的价格:{}",yhj.toString()); |
| | | BigDecimal cj = yhj.subtract(dxzj); |
| | | log.info("计算的差价:{}",cj.toString()); |
| | | for (TbTransition transition : list) { |
| | | BigDecimal result = transition.getNowPrice().add(cj); |
| | | log.info("补上差价前的价格为:{}",transition.getNowPrice().toString()); |
| | | if (result.compareTo(BigDecimal.ZERO)>0 && !flag && cj.compareTo(BigDecimal.ZERO) != 0){ |
| | | transition.setNowPrice(result); |
| | | transitionService.updateById(transition); |
| | | log.info("修改 补上差价后的价格为:{}",result.toString()); |
| | | flag = true; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/addBlTransition") |
| | | @ApiOperation(value = "补录添加过渡表数据") |
| | | @Transactional |
| | | public AjaxResult addBlTransition(@RequestBody Map<String, Object> map) { |
| | | Object packId = map.get("pacId"); |
| | | if (null == map.get("cusId")) return AjaxResult.error("请选择体检人"); |
| | | String cusId = map.get("cusId").toString(); |
| | | Object proIds1 = map.get("proIds"); |
| | | List<Long> proIds = null; |
| | | 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.isEmpty()) && (null == packId || packId.equals(""))) { |
| | | transitionService.deletedTbTransitionByCusId(cusId); |
| | | } |
| | | |
| | | //单项 |
| | | if (null != proIds && !proIds.isEmpty()) { |
| | | //异步保存数据库表 |
| | | for (Long proId : proIds) { |
| | | TjProject project = projectService.selectTjProjectByProId(proId); |
| | | if (null != project) { |
| | | List<TbTransition> transitionList = transitionService.getTbTransitionListByCusIdAndPacIdAndProId(cusId, String.valueOf(proId)); |
| | | if (null == transitionList || transitionList.isEmpty()) { |
| | | transitionService.saveRedisTransitionByProId(cusId, cardId, proId); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | } |
| | | |