From ef998cdc3655a6640df84c36b5da332ff901e54d Mon Sep 17 00:00:00 2001 From: zhaowenxuan <chacca165@163.com> Date: 星期三, 16 十月 2024 15:30:40 +0800 Subject: [PATCH] 2024-10-16 --- ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java | 861 +++++++++++++++++++++++++++++++++----------------------- 1 files changed, 505 insertions(+), 356 deletions(-) diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java index 3b21af4..cb85d44 100644 --- a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java +++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java @@ -12,6 +12,7 @@ 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; @@ -20,7 +21,9 @@ 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.RandomUtil; import cn.hutool.crypto.symmetric.DES; import cn.hutool.extra.pinyin.PinyinUtil; import cn.hutool.json.JSONArray; @@ -29,15 +32,19 @@ 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.common.core.domain.entity.SysDept; import com.ltkj.common.core.domain.entity.SysUser; import com.ltkj.common.core.redis.RedisCache; import com.ltkj.common.enums.DataSourceType; +import com.ltkj.common.utils.AgeResult; +import com.ltkj.common.utils.DateUtils; import com.ltkj.common.utils.PDFDocumentUtil; import com.ltkj.common.utils.SecurityUtils; import com.ltkj.framework.config.MatchUtils; @@ -46,8 +53,11 @@ import com.ltkj.framework.datasource.DynamicDataSourceContextHolder; import com.ltkj.hosp.domain.*; import com.ltkj.hosp.dto.QianDaoDto; +import com.ltkj.hosp.dto.TjProBlDto; import com.ltkj.hosp.hisDto.OutpinimpapplyDto; +import com.ltkj.hosp.hisDto.OutpinmedicapplyDto; import com.ltkj.hosp.mapper.TestMapper; +import com.ltkj.hosp.pacsDto.SavePacsApply; import com.ltkj.hosp.service.*; import com.ltkj.hosp.sqlDomain.LtkjMiddleDetail; import com.ltkj.hosp.sqlDomain.LtkjMiddleHead; @@ -65,20 +75,23 @@ 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.HisApiMethodService; -import com.ltkj.web.controller.his.HisMzJysqController; +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 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.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; @@ -89,6 +102,8 @@ import com.ltkj.common.enums.BusinessType; import com.ltkj.common.utils.poi.ExcelUtil; import com.ltkj.common.core.page.TableDataInfo; + +import static com.ltkj.web.config.pdfutils.PDFBinaryUtil.getPDFBinary; /** * 浣撴璁板綍Controller @@ -131,67 +146,83 @@ private TjAsyncService asyncService; @Resource private ISysUserService userService; - @Resource private RedisCache redisCache; @Autowired private ITjReportPrintService tjReportPrintService; - @Resource private ITjPrintOrderService printOrderService; - @Resource private IJimuOnlineReportService reportService; - @Resource private ITjSurveyRecordService surveyRecordService; - @Autowired private IMallOrderService mallOrderService; @Autowired private IMallCheckLogService mallCheckLogService; @Resource private ITjDwDeptService dwDeptService; - @Resource private ITjDwGroupingService dwGroupingService; - @Resource private ITjOrderDetailRulesService orderDetailRulesService; - @Resource private ITjRulesService rulesService; - @Autowired private ITjAskMedicalHistoryService tjAskMedicalHistoryService; - @Autowired private ITjReportGetAddressService tjReportGetAddressService; - @Resource private TestMapper testMapper; - @Resource private LtkjMiddleDetailService middleDetailService; - @Resource private LtkjMiddleHeadService headService; @Resource private TjvLtkjvtjpatService tjvLtkjvtjpatService; @Autowired private ThreadPoolConfig threadPoolConfig; - @Autowired private HisApiMethod hisApiMethod; - - @Autowired - private HisMzJysqController hisMzJysqController; @Autowired private HisApiGetMethodService hisApiGetMethodService; @Autowired private ISysDeptService sysDeptService; @Autowired private HisApiMethodService controller; + @Autowired + private TjProBlService blService; + @Resource + private ITjReportTemplateService reportTemplateService; + @Autowired + private LtkjJianchajianyanTreeService ltkjJianchajianyanTreeService; + @Autowired + private PacsApiMethodService pacsApiMethodService; + @Autowired + private ITbTransitionService tbTransitionService; + @Autowired + private LisApiMethod lisApiMethod; + @Autowired + private TjCfService cfService; + @Autowired + private TjReportController reportController; + @Resource + private ITjReportService tjReportService; + @Autowired + private HisPDFUtil hisPDFUtil; + @Value("${path.reportServer}") + private String urlValue; + + //灏嗘柟娉曡繑鍥炲�艰В鏋愭垚json鏍煎紡 + public JSONObject getJSONObject(String builder) { + String Response = JSONUtil.parseObj(builder).getStr("Response"); + return JSONUtil.parseObj(Response); + } + + //鑾峰彇鏂规硶杩斿洖鍊间俊鎭� + public String getAjaxResult(AjaxResult result) { + return result.get("data").toString(); + } /** * 鏌ヨ浣撴璁板綍鍒楄〃 @@ -366,6 +397,7 @@ @ApiParam(value = "鏄剧ず鏉℃暟(榛樿10)") @RequestParam(defaultValue = "10") Integer pageSize, @ApiParam(value = "浣撴鍙�)") @RequestParam(required = false) String tjNum, @ApiParam(value = "濮撳悕)") @RequestParam(required = false) String name, + @ApiParam(value = "椤圭洰鍚�)") @RequestParam(required = false) String xmmc, @ApiParam(value = "鐧昏寮�濮嬫椂闂�") @RequestParam(required = false) Date djbeginTime, @ApiParam(value = "鐧昏缁撴潫鏃堕棿") @RequestParam(required = false) Date djendTime, @ApiParam(value = "鎶ュ憡寮�濮嬫椂闂�") @RequestParam(required = false) Date bgbeginTime, @@ -439,6 +471,12 @@ if (null != tjNum) { wq.eq(TjOrder::getTjNumber, tjNum); } + + + if (null != xmmc) { + wq.in(TjOrder::getTjNumber, projectService.getTjNumLIstByXmmx(xmmc)); + } + wq.orderByDesc(TjOrder::getCreateTime); Page<TjOrder> page2 = tjOrderService.page(page1, wq); List<TjOrder> list = page2.getRecords(); @@ -450,7 +488,6 @@ order.setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); order.setTjCustomerName(tjCustomer.getCusName()); order.setTjCustomerPhone(tjCustomer.getCusPhone()); -// order.setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard())); order.setTjCusIdCard(tjCustomer.getCusIdcard()); order.setCareer(tjCustomer.getCareer()); order.setIdType(tjCustomer.getIdType()); @@ -464,8 +501,7 @@ if (null != order.getPacId()) { if (null != tjPackageService.getById(order.getPacId())) { order.setPacName(tjPackageService.getById(order.getPacId()).getPacName()); - } - if (null != dwDeptService.getById(order.getPacId())) { + } else if (null != dwDeptService.getById(order.getPacId())) { order.setPacName(dwDeptService.getById(order.getPacId()).getDwDeptName()); } } @@ -483,14 +519,14 @@ @ApiParam(value = "鏄剧ず鏉℃暟(榛樿10)") @RequestParam(defaultValue = "10") Integer pageSize, @ApiParam(value = "浣撴鍙�)") @RequestParam(required = false) String tjNum, @ApiParam(value = "濮撳悕)") @RequestParam(required = false) String name, - @ApiParam(value = "鎶ュ憡寮�濮嬫椂闂�") @RequestParam(required = false) Date bgbeginTime, - @ApiParam(value = "鎶ュ憡缁撴潫鏃堕棿") @RequestParam(required = false) Date bgendTime) { + @ApiParam(value = "鎶ュ憡寮�濮嬫椂闂�") @RequestParam(required = false) String djbeginTime, + @ApiParam(value = "鎶ュ憡缁撴潫鏃堕棿") @RequestParam(required = false) String djendTime) { Map<String, Object> map = new HashMap<>(); if (null != name) { LambdaQueryWrapper<TjCustomer> wqq = new LambdaQueryWrapper<>(); wqq.like(TjCustomer::getCusName, name); List<TjCustomer> customerList = tjCustomerService.list(wqq); - if (null != customerList && customerList.size() > 0) { + if (null != customerList && !customerList.isEmpty()) { List<TjOrder> list = new ArrayList<>(); for (TjCustomer customer : customerList) { LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>(); @@ -500,7 +536,7 @@ list.addAll(tjOrderService.list(wq)); } List<TjOrder> collect = null; - if (list.size() > 0) { + if (!list.isEmpty()) { for (int i = 0; i < list.size(); i++) { TjCustomer tjCustomer = tjCustomerService.getById(list.get(i).getUserId()); @@ -510,7 +546,7 @@ } list.get(i).setTjCustomerSex(tjCustomer.getCusSex()); list.get(i).setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); - list.get(i).setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName())); + list.get(i).setTjCustomerName(tjCustomer.getCusName()); list.get(i).setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone())); list.get(i).setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard())); @@ -553,13 +589,13 @@ LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>(); wq.isNotNull(TjOrder::getReportTime); wq.eq(TjOrder::getHeshouStatus, 1); //鏍告敹鐘舵�佷负1鎵嶈兘鎵撳嵃 - if (null != bgbeginTime && null != bgendTime) { - wq.between(TjOrder::getCreateTime, DateUtil.beginOfDay(bgbeginTime), DateUtil.endOfDay(bgendTime)); + if (null != djbeginTime && null != djendTime) { + wq.between(TjOrder::getCreateTime, DateUtil.beginOfDay(DateUtil.parseDate(djbeginTime)), DateUtil.endOfDay(DateUtil.parseDate(djendTime))); } if (null != tjNum) { wq.eq(TjOrder::getTjNumber, tjNum); } - wq.orderByDesc(TjOrder::getReportTime); + wq.orderByDesc(TjOrder::getCreateTime); Page<TjOrder> page2 = tjOrderService.page(page1, wq); List<TjOrder> list = page2.getRecords(); if (list != null) { @@ -571,7 +607,7 @@ } list.get(i).setTjCustomerSex(tjCustomer.getCusSex()); list.get(i).setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); - list.get(i).setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName())); + list.get(i).setTjCustomerName(tjCustomer.getCusName()); list.get(i).setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone())); if (tjCustomer.getCusIdcard() != null) { list.get(i).setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard())); @@ -842,9 +878,14 @@ /** * 浣撴绛惧埌鐧昏鎺ュ彛 */ + + + 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); @@ -866,8 +907,7 @@ transitionService.deletedTbTransitionListByCusIdAndTjNum(tjCustomer.getCusIdcard(), tjCustomer.getCardId()); return AjaxResult.error("涓嶅彲閲嶅鐧昏"); } - - + TjFlowingWater tjFlowingWater = new TjFlowingWater(); LambdaQueryWrapper<TjReservation> wq1 = new LambdaQueryWrapper<>(); wq1.eq(TjReservation::getIdCard, tjCustomer.getCusIdcard()); wq1.eq(TjReservation::getIsExpire, 2); @@ -876,10 +916,10 @@ 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(tjReservation.getReservationTime()).before(new Date())) { + // 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); return AjaxResult.error("瀵逛笉璧锋偍鐨勯绾﹀凡瓒呮椂璇烽噸鏂伴绾�"); @@ -894,7 +934,7 @@ 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()) { @@ -903,9 +943,7 @@ 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()) { @@ -928,138 +966,156 @@ if (null != mallOrder) tjOrder.setMallOrderId(String.valueOf(mallOrder.getId())); tjOrder.setStatus(TjConstants.TJ_BEGIN); tjOrder.setCardId(tjCustomer.getCardId()); - if(null !=tjOrder.getTjCategory() && tjOrder.getTjCategory().equals("13")){ + if (null != tjOrder.getTjCategory() && tjOrder.getTjCategory().equals("13")) { tjOrder.setFinishTime(new Date()); tjOrder.setCheckStatus(1); tjOrder.setStatus(TjConstants.TJ_WAIT); + // tjFlowingWater.setPayStasus(1L); } - if (tjOrderService.save(tjOrder)) { + tjFlowingWater.setPayStasus(0L); - //淇濆瓨鏀惰揣鍦板潃 - if ("2".equals(tjOrder.getGetType())) { - final TjReportGetAddress address = tjOrder.getAddAddress(); - if (address != null) { - address.setTjNumber(tjNumber); - tjReportGetAddressService.save(address); - } - } - Long cusNumber = tjCustomer.getCusNumber(); - cusNumber += 1; - tjCustomer.setCusNumber(cusNumber); - BigDecimal discount = BigDecimal.valueOf(Double.parseDouble(tjOrder.getTjFlowingWater().getDiscount())).divide(BigDecimal.valueOf(10)); - TjFlowingWater tjFlowingWater = new TjFlowingWater(); - tjFlowingWater.setPayStasus(0L); - if ("1".equals(tjOrder.getTjType())) { - if (null != tjReservation && tjReservation.getPayType() == 1) { - tjFlowingWater.setPayStasus(3L); - } - } + try { + boolean b = lock.tryLock(3, TimeUnit.MINUTES); + if (b) { + //鐢熸垚浣撴鍙� + String tjNumber = (SecurityUtils.getUsername() + new SimpleDateFormat("yyMMddHHmmss").format(new Date())); + tjOrder.setTjNumber(tjNumber); - //璋冪敤SQL server鎷垮彇鏀惰垂鎯呭喌 - //鏍规嵁閰嶇疆璋冨彇瀛樺偍杩囩▼ 灏嗕复鏃惰〃鏁版嵁瀛樺叆棰勭害琛�2023.12.12 - final String getInfoFromSqlData = configService.selectConfigByKey("getInfoFromSqlData"); - final String isPay = configService.selectConfigByKey("isPay"); - if ("Y".equals(getInfoFromSqlData)) { - LtkjMiddleHead middleHead = headService.getMiddleHeadByPartId(tjCustomer.getCardId()); - if (null != middleHead) { - tjFlowingWater.setPayStasus(1L); - } - } - tjFlowingWater.setOrderId(tjOrder.getOrderId()); - Date date1 = new Date(System.currentTimeMillis()); - String s1 = SecurityUtils.getUsername() + new SimpleDateFormat("yyMMddHHmmssSSS").format(date1); - tjFlowingWater.setWaterId(PinyinUtil.getFirstLetter(tjCustomer.getCusName(), "").toUpperCase() + s1); - - - tjFlowingWater.setCopeWith(tjOrder.getTjFlowingWater().getCopeWith()); - tjFlowingWater.setPaidIn(tjOrder.getTjFlowingWater().getPaidIn()); - tjFlowingWater.setDiscount(tjOrder.getTjFlowingWater().getDiscount()); - - if (isPay.equals("true")) { - if (null != mallOrder) { - if (mallOrder.getOrderStatus().equals(201L)) { - tjFlowingWater.setCopeWith(mallOrder.getActualPrice()); - tjFlowingWater.setPaidIn(mallOrder.getActualPrice()); - tjFlowingWater.setDiscount(String.valueOf(1)); - tjFlowingWater.setPayStasus(1L); - tjFlowingWater.setPayType(3L); - MallCheckLog checkLog = new MallCheckLog(); - checkLog.setCheckBy(sysUser.getNickName()); - checkLog.setUserId(mallOrder.getUserId()); - checkLog.setConsignee(mallOrder.getConsignee()); - checkLog.setIdCard(mallOrder.getIdCard()); - checkLog.setOrderId(String.valueOf(mallOrder.getId())); - checkLog.setOrderSn(mallOrder.getOrderSn()); - checkLog.setCheckTime(new Date()); - checkLog.setShipSn("HX" + s1); - mallCheckLogService.save(checkLog); - mallOrder.setOrderStatus(301L); - mallOrderService.updateById(mallOrder); + if (tjOrderService.save(tjOrder)) { + //淇濆瓨鏀惰揣鍦板潃 + if ("2".equals(tjOrder.getGetType())) { + final TjReportGetAddress address = tjOrder.getAddAddress(); + if (address != null) { + address.setTjNumber(tjNumber); + tjReportGetAddressService.save(address); + } } - } else { + 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.setPayStasus(3L); + } + } + + //璋冪敤SQL server鎷垮彇鏀惰垂鎯呭喌 + //鏍规嵁閰嶇疆璋冨彇瀛樺偍杩囩▼ 灏嗕复鏃惰〃鏁版嵁瀛樺叆棰勭害琛�2023.12.12 + final String getInfoFromSqlData = configService.selectConfigByKey("getInfoFromSqlData"); + final String isPay = configService.selectConfigByKey("isPay"); + if ("Y".equals(getInfoFromSqlData)) { + LtkjMiddleHead middleHead = headService.getMiddleHeadByPartId(tjCustomer.getCardId()); + if (null != middleHead) { + tjFlowingWater.setPayStasus(1L); + } + } + tjFlowingWater.setOrderId(tjOrder.getOrderId()); + Date date1 = new Date(System.currentTimeMillis()); + String s1 = SecurityUtils.getUsername() + new SimpleDateFormat("yyMMddHHmmssSSS").format(date1); + tjFlowingWater.setWaterId(PinyinUtil.getFirstLetter(tjCustomer.getCusName(), "").toUpperCase() + s1); + + tjFlowingWater.setCopeWith(tjOrder.getTjFlowingWater().getCopeWith()); tjFlowingWater.setPaidIn(tjOrder.getTjFlowingWater().getPaidIn()); tjFlowingWater.setDiscount(tjOrder.getTjFlowingWater().getDiscount()); -// tjFlowingWater.setPayStasus(0L); - } - } - if (tjFlowingWaterService.save(tjFlowingWater)) { - tjOrder.setTjSerialNumber(String.valueOf(tjFlowingWater.getTjSerialNumber())); - tjOrderService.updateById(tjOrder); + if (isPay.equals("true")) { + if (null != mallOrder) { + if (mallOrder.getOrderStatus().equals(201L)) { + tjFlowingWater.setCopeWith(mallOrder.getActualPrice()); + tjFlowingWater.setPaidIn(mallOrder.getActualPrice()); + tjFlowingWater.setDiscount(String.valueOf(1)); + tjFlowingWater.setPayStasus(1L); + tjFlowingWater.setPayType(3L); + MallCheckLog checkLog = new MallCheckLog(); + checkLog.setCheckBy(sysUser.getNickName()); + checkLog.setUserId(mallOrder.getUserId()); + checkLog.setConsignee(mallOrder.getConsignee()); + checkLog.setIdCard(mallOrder.getIdCard()); + checkLog.setOrderId(String.valueOf(mallOrder.getId())); + checkLog.setOrderSn(mallOrder.getOrderSn()); + checkLog.setCheckTime(new Date()); + checkLog.setShipSn("HX" + s1); + mallCheckLogService.save(checkLog); + mallOrder.setOrderStatus(301L); + mallOrderService.updateById(mallOrder); + } + } else { + tjFlowingWater.setCopeWith(tjOrder.getTjFlowingWater().getCopeWith()); + tjFlowingWater.setPaidIn(tjOrder.getTjFlowingWater().getPaidIn()); + tjFlowingWater.setDiscount(tjOrder.getTjFlowingWater().getDiscount()); + // tjFlowingWater.setPayStasus(0L); + } + } + if (tjFlowingWaterService.save(tjFlowingWater)) { + tjOrder.setTjSerialNumber(String.valueOf(tjFlowingWater.getTjSerialNumber())); + tjOrderService.updateById(tjOrder); + } - } + //淇敼姣忛」鐨勫師浠风幇浠� //淇敼涓存椂琛ㄤ綋妫�鍙� + transitionService.updateTbTransitionPriceByCusId(tjCustomer.getCusIdcard(), discount, tjOrder.getTjNumber()); - //鍥綋 - if ("1".equals(tjOrder.getTjType())) { - 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); - } + /*璋冪敤his鎺ュ彛*/ + String config = configService.selectConfigByKey("sfkqdyhis"); + if (null != config && config.equals("Y")) { + AjaxResult result = hisApiMethod.HisApiMethods(tjCustomer, tjOrder); + if (!result.get("code").toString().equals("200")) { + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + Object jzh = result.get("jzh"); + if (null != jzh && null != jzh.toString()) { + hisApiMethod.ZfHisApiMethod(jzh.toString()); + } + log.info("璇ョ櫥璁颁汉鎸傚彿澶辫触, 灏辫瘖鍙蜂负: " + tjOrder.getCardId()); + return AjaxResult.error("鎸傚彿澶辫触!" + result.get("msg").toString()); + } - //璋冪敤SQL server鎷垮彇鏀惰垂鎯呭喌 - //鏍规嵁閰嶇疆璋冨彇瀛樺偍杩囩▼ 灏嗕复鏃惰〃鏁版嵁瀛樺叆棰勭害琛�2023.12.12 -// final String getInfoFromSqlData = configService.selectConfigByKey("getInfoFromSqlData"); -// if ("Y".equals(getInfoFromSqlData)){ -// List<LtkjMiddleHead> one = testMapper.saveMiddleHeadByPatId(tjCustomer.getCusIdcard()); -// if (one!=null){ -// for (LtkjMiddleHead ltkjMiddleHead : one) { -// DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name()); -// headService.save(ltkjMiddleHead); -// DynamicDataSourceContextHolder.clearDataSourceType(); -// List<LtkjMiddleDetail> detailList = testMapper.getMiddleDetailByHeadId(ltkjMiddleHead.getFeadId()); -// if (detailList!=null){ -// for (LtkjMiddleDetail ltkjMiddleDetail : detailList) { -// DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name()); -// middleDetailService.save(ltkjMiddleDetail); -// DynamicDataSourceContextHolder.clearDataSourceType(); -// } + log.info("璇ョ櫥璁颁汉鐨刪is灏辫瘖鍙锋槸: " + tjOrder.getCardId()); + //鍥綋 + if ("1".equals(tjOrder.getTjType())) { + 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); + } + // 鏌ヨ 瀵规帴Lis銆丳acs鐢宠濡傛灉绫诲瀷鍖呭惈鍦ㄩ厤缃唴鍒欎娇鐢ㄥ鎺is銆乸acs +// if (lisApiMethod.isUseLisAndPacsRegister(tjOrder)) { + // 杩欐槸涓婇潰涓汉鏂规硶寮曞叆鏁版嵁 +// 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; +// }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()); + tjCustomerService.updateById(tjCustomer); + transitionService.updateCardIdByTjNumAndIdCard(tjCustomer.getCusIdcard(), tjOrder.getTjNumber(), tjOrder.getTjNumber()); + tjOrder.setCardId(tjOrder.getTjNumber()); + tjOrderService.updateById(tjOrder); + } - - /*璋冪敤his鎺ュ彛*/ - String config = configService.selectConfigByKey("sfkqdyhis"); - if (null != config && config.equals("Y")) { - AjaxResult result = hisApiMethod.HisApiMethods(tjCustomer, tjOrder.getOrderId()); - if (!result.get("code").toString().equals("200")) { - TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); - return AjaxResult.error("鎸傚彿澶辫触!" + result.get("msg").toString()); + //鍥綋 + if ("1".equals(tjOrder.getTjType())) { + 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); + } + return AjaxResult.success(tjNumber); } - } 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.error(); } - return AjaxResult.success(tjNumber); + } finally { + lock.unlock(); } return AjaxResult.error(); } @@ -1072,7 +1128,7 @@ 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() { @@ -1085,7 +1141,7 @@ 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) { @@ -1530,143 +1586,32 @@ redisCache.deleteCacheMapValue(cardId + cusId + "cusId", cardId + cusId); } } -// List<TbTransition> tbTransitionList = null; -// if (!redisCache.hasKey(cardId + cusId)) { -// tbTransitionList = new ArrayList<>(); -// } else { -// tbTransitionList = redisCache.getCacheList(cardId + cusId); -// } - //濂楅 /*濂楅*/ if (null != packId && !packId.equals("")) { Long pacId = Long.valueOf(packId.toString()); List<TbTransition> list = transitionService.getTbTransitionListByCusIdAndPac(cusId, String.valueOf(pacId)); - if (null == list || list.size() == 0) { + if (null == list || list.isEmpty()) { transitionService.deletedTbTransitionListByCusIdAndPac(cusId, cardId); -// if (redisCache.hasKey(cardId + cusId + "cusId")) -// redisCache.deleteCacheMapValue(cardId + cusId + "cusId", cardId + cusId); -// if (redisCache.hasKey(cardId + cusId)) { -// tbTransitionList = new ArrayList<>(); -// redisCache.deleteObject(cardId + cusId); -// } List<TjPackageProject> ppList = tjPackageProjectService.getTjPackageProjectListByPacId(String.valueOf(pacId)); - if (null != ppList && ppList.size() > 0) { - transitionService.saveRedisTransitionByPacId(cusId,cardId ,pacId); - //寮傛淇濆瓨鏁版嵁搴� -// asyncService.addRedisTransitionPac(cusId, pacId, ppList); -// asyncService.saveRedisTransitionByPacId(cusId, cardId, pacId, null); -// for (TjPackageProject tjPackageProject : ppList) { -// TjProject project = projectService.getTjProjectById(String.valueOf(tjPackageProject.getProId())); -// if (null != project) { -// -// BigDecimal divide = BigDecimal.valueOf(0); -// if (tjPackageProject.getPriceNow().compareTo(BigDecimal.valueOf(0)) == 0 || project.getProPrice().compareTo(BigDecimal.valueOf(0)) == 0) { -// divide = BigDecimal.valueOf(0); -// } else { -// divide = tjPackageProject.getPriceNow().divide(project.getProPrice(), 5, RoundingMode.HALF_DOWN); -// } -// List<TjProject> tjProSonList = projectService.getTjProjectListBySoneId(String.valueOf(project.getProId())); -// if (null != tjProSonList && tjProSonList.size() > 0) { -// //addRedisTransitionPac(cusId, tbTransitionList, pacId, tjPackageProject, project, divide, tjProSonList); -// for (TjProject tjProject : tjProSonList) { -// TbTransition tbTransition = new TbTransition(); -// tbTransition.setCusId(cusId); -// tbTransition.setPacId(pacId); -// if (null != tjPackageProject.getPriceNow() && divide.compareTo(BigDecimal.valueOf(0)) > 0) { -// tbTransition.setNowPrice(tjProject.getProPrice().multiply(divide).setScale(2, RoundingMode.HALF_DOWN)); -// tbTransition.setOrdPrice(tjProject.getProPrice().multiply(divide).setScale(2, RoundingMode.HALF_DOWN)); -// } else { -// tbTransition.setNowPrice(BigDecimal.valueOf(0.00)); -// tbTransition.setOrdPrice(BigDecimal.valueOf(0.00)); -// } -// tbTransition.setParentProId(project.getProId()); -// tbTransition.setParentProName(project.getProName()); -// tbTransition.setProId(tjProject.getProId()); -// tbTransition.setProName(tjProject.getProName()); -// tbTransition.setPacName(tjPackageService.getById(tbTransition.getPacId()).getPacName()); -// tbTransition.setProType(tjProject.getProType()); -// tbTransition.setProCheckMethod(tjProject.getProCheckMethod()); -// tbTransitionList.add(tbTransition); -// } -// -// } -// } -// } + if (null != ppList && !ppList.isEmpty()) { + transitionService.saveRedisTransitionByPacId(cusId, cardId, pacId); } } } //鍗曢」 - if (null != proIds && proIds.size() > 0) { + if (null != proIds && !proIds.isEmpty()) { //寮傛淇濆瓨鏁版嵁搴撹〃 -// asyncService.saveRedisTransitionByPacId(cusId, cardId, null, proIds); for (Long proId : proIds) { TjProject project = projectService.selectTjProjectByProId(proId); - if(null !=project){ //&& (!project.getProName().contains("闈欒剦閲囪")|| !project.getProName().contains("璐�")) + if (null != project) { List<TbTransition> transitionList = transitionService.getTbTransitionListByCusIdAndPacIdAndProId(cusId, String.valueOf(proId)); - if (null == transitionList || transitionList.size() == 0) { - transitionService.saveRedisTransitionByProId(cusId,cardId, proId); + if (null == transitionList || transitionList.isEmpty()) { + transitionService.saveRedisTransitionByProId(cusId, cardId, proId); } } -// if(null !=project) transitionService.saveRedisTransitionByProId(cusId,cardId, proId); } -// for (Long proId : proIds) { -// List<TbTransition> transitions = transitionService.getTbTransitionListByCusIdAndPacIdAndProId(cusId, String.valueOf(proId)); -// if (null != transitions && transitions.size() > 0) { -// continue; -// } -// TjProject tjProject = projectService.getTjProjectById(String.valueOf(proId)); -// if (null != tjProject) { -//// List<TjProject> tjProSonList = projectService.getTjProjectListBySoneId(String.valueOf(project.getProId())); -//// if (null != tjProSonList && tjProSonList.size() > 0) { -//// for (TjProject tjProject : tjProSonList) { -//// List<TbTransition> transitionss = transitionService.getTbTransitionListByCusIdAndPacIdAndProId(cusId, String.valueOf(tjProject.getProId())); -//// if (null != transitionss && transitionss.size() > 0) { -//// continue; -//// } -// TbTransition tbTransition = new TbTransition(); -// tbTransition.setCusId(cusId); -// tbTransition.setPacId(null); -// if (null != tjProject.getProPrice()) { -// tbTransition.setOrdPrice(tjProject.getProPrice()); -// tbTransition.setNowPrice(tjProject.getProPrice()); -// } else { -// tbTransition.setOrdPrice(BigDecimal.valueOf(0.00)); -// tbTransition.setNowPrice(BigDecimal.valueOf(0.00)); -// } -// tbTransition.setParentProId(tjProject.getProParentId()); -// if (tjProject.getProParentId() != null) { -// TjProject byId = projectService.getById(tjProject.getProParentId()); -// if (null != byId) { -// tbTransition.setParentProName(byId.getProName()); -// } -// } -// tbTransition.setParentProName(""); -// -// tbTransition.setProId(tjProject.getProId()); -// tbTransition.setProName(tjProject.getProName()); -// tbTransition.setProType(tjProject.getProType()); -// tbTransition.setProCheckMethod(tjProject.getProCheckMethod()); -// tbTransitionList.add(tbTransition); -//// } -//// } -// } -// } } - - -// if (null != tbTransitionList && tbTransitionList.size() > 0) { -// if (redisCache.hasKey(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(); -// } return AjaxResult.success(); } @@ -1870,7 +1815,7 @@ TjCustomer customer = tjCustomerService.selectTjCustomerByCusId(tjOrder.getUserId()); customer.setCardId("0"); tjCustomerService.updateById(customer); - String config = configService.selectConfigByKey("sfkqdyhis"); + /* String config = configService.selectConfigByKey("sfkqdyhis"); if(null !=config && config.equals("Y")){ final String date = DateUtil.format(tjOrder.getCreateTime(), "yyyy-MM-dd HH:mm:ss"); OutpinimpapplyDto dto=new OutpinimpapplyDto(); @@ -1898,8 +1843,7 @@ dto.setSfqj("0"); dto.setJzqk(9); controller.Outpinimpapply(dto); - } - + }*/ return AjaxResult.success("绛剧鎴愬姛锛�"); } else { return getAjaxResult(tjNumber); @@ -1974,7 +1918,7 @@ map.put("proPrantId", entry.getKey().toString()); if (null != pacId) { TjPackage aPackage = tjPackageService.getById(entry.getValue().get(0).getPacId()); - map.put("tjCategory",aPackage.getTjCategory()); + map.put("tjCategory", aPackage.getTjCategory()); map.put("pacName", aPackage.getPacName()); TjProject tjProject = projectService.getById(entry.getKey()); // TjPackageProject project = tjPackageProjectService.getOne(new LambdaQueryWrapper<TjPackageProject>().eq(TjPackageProject::getPacId, pacId) @@ -1987,7 +1931,7 @@ // } map.put("nowPrice", transitionService.getTbTransitionDxPriceByPac(cusId, entry.getKey(), cardId, pacId)); } else { - map.put("tjCategory",null); + map.put("tjCategory", null); map.put("pacName", "鍗曢」"); List<TbTransition> tbTransitionList = entry.getValue(); if (null != tbTransitionList && tbTransitionList.size() > 0) { @@ -2026,7 +1970,7 @@ map.put("proPrantId", entry.getKey().toString()); if (null != pacId) { TjPackage aPackage = tjPackageService.getById(entry.getValue().get(0).getPacId()); - map.put("tjCategory",aPackage.getTjCategory()); + map.put("tjCategory", aPackage.getTjCategory()); map.put("pacName", aPackage.getPacName()); TjProject tjProject = projectService.getById(entry.getKey()); // TjPackageProject project = tjPackageProjectService.getOne(new LambdaQueryWrapper<TjPackageProject>().eq(TjPackageProject::getPacId, pacId) @@ -2037,9 +1981,9 @@ // } else { // map.put("nowPrice", tjProject.getProPrice()); // } - map.put("nowPrice",tjProject.getProPrice()); + map.put("nowPrice", tjProject.getProPrice()); } else { - map.put("tjCategory",null); + map.put("tjCategory", null); map.put("pacName", "鍗曢」"); List<TbTransition> tbTransitionList = entry.getValue(); if (null != tbTransitionList && tbTransitionList.size() > 0) { @@ -2277,79 +2221,79 @@ @GetMapping("/getTransitionInfo") @ApiOperation(value = "鏍规嵁浣撴鍙疯幏鍙栨眹鎬诲拰鏄庣粏鐨勬暟鎹�") - public AjaxResult getTransitionInfo(@RequestParam("tjNumber")String tjNumber){ + public AjaxResult getTransitionInfo(@RequestParam("tjNumber") String tjNumber) { QueryWrapper<TbTransition> wrapper = new QueryWrapper<>(); - wrapper.select("parent_pro_id","parent_pro_name","sum(ord_price) as ord_price") - .eq("tj_num",tjNumber) + wrapper.select("parent_pro_id", "parent_pro_name", "sum(ord_price) as ord_price") + .eq("tj_num", tjNumber) .groupBy("parent_pro_name"); List<TbTransition> list = transitionService.list(wrapper); List<Long> parentProIds = list.stream().map(item -> item.getParentProId()).collect(Collectors.toList()); LambdaQueryWrapper<TjProject> projectQueryWrapper = new LambdaQueryWrapper<>(); - projectQueryWrapper.in(TjProject::getProId,parentProIds); + projectQueryWrapper.in(TjProject::getProId, parentProIds); List<TjProject> projects = projectService.list(projectQueryWrapper); JSONArray huiZong = JSONUtil.createArray(); int index = 1; for (TjProject project : projects) { LambdaQueryWrapper<SysDept> queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(SysDept::getDeptId,project.getDeptId()); + queryWrapper.eq(SysDept::getDeptId, project.getDeptId()); SysDept dept = sysDeptService.getOne(queryWrapper); for (TbTransition tbTransition : list) { - if (tbTransition.getParentProId().toString().equals(project.getProId().toString())){ + if (tbTransition.getParentProId().toString().equals(project.getProId().toString())) { JSONObject obj = JSONUtil.createObj(); - obj.putOpt("index",index++); - obj.putOpt("parent_pro_name",tbTransition.getParentProName()); - obj.putOpt("price",tbTransition.getOrdPrice()); - obj.putOpt("ks",dept.getDeptName()); + obj.putOpt("index", index++); + obj.putOpt("parent_pro_name", tbTransition.getParentProName()); + obj.putOpt("price", tbTransition.getOrdPrice()); + obj.putOpt("ks", dept.getDeptName()); huiZong.add(obj); } } } wrapper = new QueryWrapper<>(); - wrapper.eq("tj_num",tjNumber); + wrapper.eq("tj_num", tjNumber); list = transitionService.list(wrapper); JSONArray info = JSONUtil.createArray(); index = 1; for (TbTransition tbTransition : list) { JSONObject obj = JSONUtil.createObj(); - obj.putOpt("index",index++); - obj.putOpt("parent_pro_name",tbTransition.getParentProName()); - obj.putOpt("pro_name",tbTransition.getProName()); + obj.putOpt("index", index++); + obj.putOpt("parent_pro_name", tbTransition.getParentProName()); + obj.putOpt("pro_name", tbTransition.getProName()); BigDecimal ordPrice = tbTransition.getOrdPrice(); - obj.putOpt("zongjia",ordPrice); + obj.putOpt("zongjia", ordPrice); QueryWrapper<TjProject> queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("pro_id",tbTransition.getProId()); + queryWrapper.eq("pro_id", tbTransition.getProId()); TjProject tjProject = projectService.getOne(queryWrapper); Integer num = tjProject.getSl(); - obj.putOpt("num",num); + obj.putOpt("num", num); BigDecimal price = ordPrice.divide(new BigDecimal(num)); - obj.putOpt("danjia",price); + obj.putOpt("danjia", price); Date createTime = tbTransition.getCreateTime(); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - obj.putOpt("time",dateFormat.format(createTime)); + obj.putOpt("time", dateFormat.format(createTime)); info.put(obj); } HashMap<String, Object> map = new HashMap<>(); - map.put("huizong",huiZong); - map.put("info",info); - return AjaxResult.success().put("data",map); + map.put("huizong", huiZong); + map.put("info", info); + 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")){ - tjOrderDetailService.saveJSYTjOrderDetailsByCusId(tjCustomer.getCusIdcard(), String.valueOf(tjOrder.getOrderId()), sysUser.getNickName(), String.valueOf(sysUser.getUserId())); - }else { - tjOrderDetailService.saveTjOrderDetailsByCusId(tjCustomer.getCusIdcard(), String.valueOf(tjOrder.getOrderId()), sysUser.getNickName(), String.valueOf(sysUser.getUserId())); - } + 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())); - //淇敼姣忛」鐨勫師浠风幇浠� //淇敼涓存椂琛ㄤ綋妫�鍙� - transitionService.updateTbTransitionPriceByCusId(tjCustomer.getCusIdcard(), discount, tjOrder.getTjNumber()); + tjOrderDetailService.saveTjPureToneTesByCusId(tjCustomer.getCusIdcard(), tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), tjOrder.getCardId()); + //娣诲姞remark琛ㄦ暟鎹� - if(null !=tjOrder.getTjCategory() && tjOrder.getTjCategory().equals("13")){ + if (null != tjOrder.getTjCategory() && tjOrder.getTjCategory().equals("13")) { remarkService.saveJSYTjOrderRemarkByOrderId(tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjOrder.getOrderId())); - }else { + } else { remarkService.saveTjOrderRemarkByOrderId(tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjOrder.getOrderId())); } @@ -2367,27 +2311,109 @@ tjFlowingWater.setCopeWith(tjOrder.getTjFlowingWater().getCopeWith()); tjFlowingWater.setPayType(4L); tjFlowingWaterService.updateById(tjFlowingWater); - asyncService.addTjChargingStandard(tjOrder, transitionService.getTbTransitionListByCusId(tjCustomer.getCusIdcard(), tjOrder.getCardId()), sysUser); +// asyncService.addTjChargingStandard(tjOrder, transitionService.getTbTransitionListByCusId(tjCustomer.getCusIdcard(), tjOrder.getCardId()), sysUser); } -// System.out.println("杩欐浠g爜鏃堕棿" + (System.currentTimeMillis() - l)); } @PostMapping("/heXiaoByIds/{orderIds}") @ApiOperation(value = "鏍告敹鎶ュ憡鈥斺�斺�斺�斺�斺�旀�绘瀹℃牳閫氳繃鍚庡彲浠ユ牳閿�锛屾牳鏀跺悗鎵嶈兘鎵撳嵃") @Transactional + @RepeatSubmit public AjaxResult heXiaoByIds(@PathVariable String[] orderIds) { + Date date = new Date(); for (String orderId : orderIds) { - final TjOrder byId = tjOrderService.getById(orderId); - byId.setHeshouStatus(1); - byId.setHeshouDoctor(UserHoder.getLoginUser().getUserId()); - byId.setHeshouTime(new DateTime()); - final boolean b = tjOrderService.updateById(byId); - if (!b) { - return AjaxResult.error("鏍告敹澶辫触"); + TjOrder byId = tjOrderService.getById(orderId); + if (null != byId) { + if (byId.getReportTime() == null) { + LambdaQueryWrapper<TjReportTemplate> tjReportTemplateLambdaQueryWrapper = new LambdaQueryWrapper<>(); + tjReportTemplateLambdaQueryWrapper.eq(TjReportTemplate::getFlag, 1); + tjReportTemplateLambdaQueryWrapper.eq(TjReportTemplate::getOpen, 0); + TjReportTemplate reportTemplate = reportTemplateService.getOne(tjReportTemplateLambdaQueryWrapper); + if ("鎶ヨ〃".equals(reportTemplate.getPrint())) { + TjReport tjReport = new TjReport(); + tjReport.setTjNumber(String.valueOf(byId.getTjNumber())); + tjReport.setPath(reportTemplate.getUrl() + "?tjNum=" + byId.getTjNumber()); + tjReport.setType("浣撴鎶ュ憡"); + tjReport.setPrint("鎶ヨ〃"); + tjReportService.save(tjReport); + //淇敼order琛ㄤ腑鐨勬墦鍗版姤鍛婃椂闂翠负褰撳墠鏃堕棿 + LambdaUpdateWrapper<TjOrder> updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.eq(TjOrder::getTjNumber, byId.getTjNumber()); + updateWrapper.set(TjOrder::getReportTime, new Date()); + updateWrapper.set(TjOrder::getPrintLastTime, new Date()); + updateWrapper.set(TjOrder::getDownloadLastTime, new Date()); + updateWrapper.set(TjOrder::getStatus, TjConstants.TJ_END); + tjOrderService.update(updateWrapper); + } + String hisRegistrationId = byId.getCardId(); + Date createTime = byId.getCreateTime(); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String ksrq = dateFormat.format(createTime); + String jsrq = dateFormat.format(date); + HashMap<String, Object> params = new HashMap<>(); + params.put("his_registration_id", hisRegistrationId); + params.put("ksbm", ""); + params.put("pationid", ""); + params.put("ksrq", ksrq); + params.put("jsrq", jsrq); + params.put("pagecount", 100); + params.put("page", 1); + LambdaQueryWrapper<TjCustomer> wq1 = new LambdaQueryWrapper<>(); + wq1.eq(TjCustomer::getCusId, byId.getUserId()); + TjCustomer tjCustomer = tjCustomerService.getOne(wq1); + try { + shengchengbgmoban(byId.getTjNumber(), byId, tjCustomer, reportTemplate); + byId.setStatus(TjConstants.TJ_END); + byId.setReportTime(date); + byId.setPrintLastTime(date); + byId.setDownloadLastTime(date); + } catch (Exception e) { + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + e.printStackTrace(); + // 璋冪敤鎾ら攢 + logger.error("鐢熸垚鎶ュ憡寮傚父"); + return AjaxResult.error("鐢熸垚鎶ュ憡寮傚父,鏍告敹澶辫触"); + } + } + + byId.setHeshouStatus(1); + byId.setHeshouDoctor(UserHoder.getLoginUser().getUserId()); + byId.setHeshouTime(date); + final boolean b = tjOrderService.updateById(byId); + if (!b) { + return AjaxResult.error("鏍告敹澶辫触"); + } } } return AjaxResult.success("鏍告敹鎴愬姛"); + } + + + public AjaxResult shengchengbgmoban(String tjNumber, TjOrder tjOrder, TjCustomer tjCustomer, TjReportTemplate reportTemplate) throws Exception { + AjaxResult ajaxResult = hisPDFUtil.hisPDF(tjOrder, tjCustomer, reportTemplate); + if (!ajaxResult.get("code").toString().equals("200")) { + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + } else { + Long userId = tjCustomer.getCusId(); + String outputFileName1 = userId + tjNumber + tjCustomer.getCusName() + "_鎶ュ憡.pdf"; + TjReport tjReport = new TjReport(); + tjReport.setTjNumber(String.valueOf(tjNumber)); + tjReport.setPath(urlValue + outputFileName1); + String outputPath1 = value + "\\"; + String pdfBinary = getPDFBinary(outputPath1 + outputFileName1); + tjReport.setReport(pdfBinary); + tjReport.setType("浣撴鎶ュ憡"); + tjReport.setPrint("pdf"); + tjReportService.save(tjReport); +// Date date = new Date(); +// tjOrder.setStatus(TjConstants.TJ_END); +// tjOrder.setReportTime(date); +// tjOrder.setPrintLastTime(date); +// tjOrder.setDownloadLastTime(date); +// tjOrderService.updateById(tjOrder); + } + return ajaxResult; } @GetMapping("/getHistryTjOrderByCusIdCard") @@ -2524,39 +2550,36 @@ transitionService.deletedTbTransitionByTjNum(tjNum); TjCustomer customer = tjCustomerService.getById(order.getUserId()); - if (null != customer) { - customer.setCardId("0"); - tjCustomerService.updateById(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("鎾ら攢澶辫触,闂ㄨ瘖鎮h�呰垂鐢ㄦ竻鍗曚俊鎭笉涓虹┖"); - } else { - boolean zfHisApiMethods = hisApiMethod.ZfHisApiMethods(null, order); - if (zfHisApiMethods) { - return AjaxResult.success("鎾ら攢鎴愬姛", map); - } else { + + HashMap<String, Object> hisRequestParams = new HashMap<>(); + hisRequestParams.put("patientId", order.getCardId()); + AjaxResult queryPay = hisApiGetMethodService.getHISDataNew("QueryPay", hisRequestParams); + if (Integer.parseInt(queryPay.get("code").toString()) == 200) { + List<Map<String, String>> data = (List<Map<String, String>>) queryPay.get("data"); + + BigDecimal cateFeeAll = BigDecimal.ZERO; + for (Map<String, String> datum : data) { + BigDecimal cateFee = new BigDecimal(datum.get("CateFee")); + cateFeeAll = cateFeeAll.add(cateFee); + } + if (cateFeeAll.compareTo(BigDecimal.ZERO) != 0) { TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); - return AjaxResult.error("鎾ら攢澶辫触,璋冪敤浣滃簾鍑虹幇澶辫触"); + return AjaxResult.error("鎾ら攢澶辫触,璇ヤ汉鍛樺凡缂磋垂,璇峰厛閫�璐�!"); } } - } + boolean zfHisApiMethods = hisApiMethod.ZfHisApiMethods(null, order, lisApiMethod.isUseLisAndPacsRegister(order)); + if (zfHisApiMethods) { + return AjaxResult.success("鎾ら攢鎴愬姛"); + } else { + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return AjaxResult.error("鎾ら攢澶辫触,璋冪敤浣滃簾鍑虹幇澶辫触"); + } -// transitionService.updateTbTransitionByTjNum(tjNum); + } return AjaxResult.success("鎾ら攢鎴愬姛!!!"); } return AjaxResult.success("绛惧埌璁板綍涓嶅瓨鍦�!"); @@ -2694,7 +2717,9 @@ @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")) { @@ -2714,7 +2739,7 @@ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); return AjaxResult.error("鎾ら攢澶辫触,闂ㄨ瘖鎮h�呰垂鐢ㄦ竻鍗曚俊鎭笉涓虹┖"); } else { - boolean zfHisApiMethods = hisApiMethod.ZfHisApiMethods(null, order); + boolean zfHisApiMethods = hisApiMethod.ZfHisApiMethods(null, order, lisApiMethod.isUseLisAndPacsRegister(order)); if (zfHisApiMethods) { return AjaxResult.success("鎾ら攢鎴愬姛", map); } else { @@ -2746,5 +2771,129 @@ } return AjaxResult.success(); } + + + @GetMapping("/getBlproByTjh") + @ApiOperation(value = "鏍规嵁浣撴鍙疯幏鍙栬ˉ褰曢」鐩褰�") + @Transactional + public AjaxResult getBlproByTjh(@RequestParam @ApiParam(value = "浣撴鍙�") String tjNum) { + + TjOrder order = tjOrderService.getOrderByTjNum(tjNum); + if (null != order) { + LambdaQueryWrapper<TjProBl> wq = new LambdaQueryWrapper<>(); + wq.eq(TjProBl::getTjh, tjNum); + List<TjProBl> blList = blService.list(wq); + if (null != blList && blList.size() > 0) { + for (TjProBl bl : blList) { + LambdaQueryWrapper<TjOrderRemark> wqr = new LambdaQueryWrapper<>(); + wqr.eq(TjOrderRemark::getJxbz, bl.getBldh()); + List<TjOrderRemark> remarkList = remarkService.list(wqr); + if (null != remarkList && remarkList.size() > 0) { + List<Long> collect = remarkList.stream().map(TjOrderRemark::getProId).collect(Collectors.toList()); + LambdaQueryWrapper<TjProject> wqp = new LambdaQueryWrapper<>(); + wqp.in(TjProject::getProId, collect); + List<TjProject> projectList = projectService.list(wqp); + for (TjProject project : projectList) { + project.setChildren(projectService.getTjProjectListBySoneId(String.valueOf(project.getProId()))); + } + bl.setProjectList(projectList); + } + } + return AjaxResult.success(blList); + } + return AjaxResult.success(null); + } + return AjaxResult.error("鏆傛棤浣撴璁板綍"); + } + + + @PostMapping("/revokeBlProByBldhAndTjh") + @ApiOperation(value = "鏍规嵁琛ュ綍鍗曞彿鍜屼綋妫�鍙峰垹闄よ褰�") +// @Transactional + public AjaxResult revokeBlProByBldhAndTjh(@RequestBody TjProBlDto dto) { + + if (null == dto.getBldhs() || dto.getBldhs().size() == 0) { + log.info("璇烽�夋嫨瑕佹挙閿�鐨勮ˉ褰曢」鐩�"); + return AjaxResult.error("璇烽�夋嫨瑕佹挙閿�鐨勮ˉ褰曢」鐩�"); + } + + TjOrder order = tjOrderService.getOrderByTjNum(dto.getTjh()); + 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); + if (Integer.parseInt(queryPay.get("code").toString()) == 200) { + List<Map<String, String>> data = (List<Map<String, String>>) queryPay.get("data"); + 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("璇ラ」鐩凡缂磋垂涓嶅彲鎾ら攢!!!"); + } + } + } + } + } + + boolean b = hisApiMethod.ZfBlXm(dto.getBldhs(), order); + if (!b) { + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + log.info("鎾ら攢澶辫触,璋冪敤浣滃簾鍑虹幇澶辫触"); + return AjaxResult.error("鎾ら攢澶辫触,璋冪敤浣滃簾鍑虹幇澶辫触"); + } + } + try { + extracted(dto); + } catch (Exception e) { + log.info("鎾ら攢澶辫触,鍒犻櫎琛ㄥけ璐�"); + return AjaxResult.error("鎾ら攢澶辫触,鍒犻櫎琛ㄥけ璐�!"); + } + return AjaxResult.success(); + } + return AjaxResult.error(); + } + + // @Transactional(propagation =Propagation.REQUIRES_NEW) + public void extracted(TjProBlDto dto) { + 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)); + } + } + + + @PostMapping("/addYaoPinShenQing") + @ApiOperation(value = "鑽搧淇℃伅鐢宠") + @Transactional + public AjaxResult addYaoPinShenQing(@RequestBody OutpinmedicapplyDto dto) { + AjaxResult result = controller.Outpinmedicapply(dto); + String result1 = getAjaxResult(result); + JSONObject object = getJSONObject(result1); + String code = object.getStr("ResultCode"); + if (null != code && code.equals("0")) { + + } + return AjaxResult.success(); + } + + } -- Gitblit v1.8.0