| | |
| | | |
| | | 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.bean.BeanUtil; |
| | | 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.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; |
| | |
| | | private ITbTransitionService transitionService; |
| | | @Resource |
| | | private ISysConfigService configService; |
| | | @Value("${path.filePath}") |
| | | private String value; |
| | | // @Value("${path.filePath}") |
| | | // private String value; |
| | | @Resource |
| | | private ITjOrderRemarkService remarkService; |
| | | @Resource |
| | |
| | | private TjFlowingWaterHisService tjFlowingWaterHisService; |
| | | @Resource |
| | | private ITjXdPictureService xdPictureService; |
| | | @Autowired |
| | | private TjOrderYcxmService ycxmService; |
| | | @Autowired |
| | | private TbTransitionMapper tbTransitionMapper; |
| | | |
| | | private static final String TJH = "tjhs:tjh"; |
| | | |
| | | //将方法返回值解析成json格式 |
| | | public JSONObject getJSONObject(String builder) { |
| | |
| | | wqq.like(TjCustomer::getCusName, name); |
| | | List<TjCustomer> customerList = tjCustomerService.list(wqq); |
| | | List<TjOrder> list2 = new ArrayList<>(); |
| | | 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<>(); |
| | |
| | | list.addAll(tjOrderService.list(wq)); |
| | | } |
| | | List<TjOrder> collect = null; |
| | | if (list.size() > 0) { |
| | | if (!list.isEmpty()) { |
| | | for (TjOrder order : list) { |
| | | //筛选有调查问卷的 |
| | | LambdaQueryWrapper<TjSurveyRecord> wqq1 = new LambdaQueryWrapper<>(); |
| | | wqq1.eq(TjSurveyRecord::getTjnumber, order.getTjNumber()); |
| | | List<TjSurveyRecord> one = surveyRecordService.list(wqq1); |
| | | if (one.size() == 0) { |
| | | if (one.isEmpty()) { |
| | | TjCustomer tjCustomer = tjCustomerService.getById(order.getUserId()); |
| | | if (null != tjCustomer) { |
| | | order.setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName())); |
| | |
| | | LambdaQueryWrapper<TjSurveyRecord> wqq = new LambdaQueryWrapper<>(); |
| | | wqq.eq(TjSurveyRecord::getTjnumber, order.getTjNumber()); |
| | | List<TjSurveyRecord> one = surveyRecordService.list(wqq); |
| | | if (one.size() == 0) { |
| | | if (one.isEmpty()) { |
| | | TjCustomer tjCustomer = tjCustomerService.getById(order.getUserId()); |
| | | if (null != tjCustomer) { |
| | | order.setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName())); |
| | |
| | | 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("已打印"); |
| | | } |
| | | } |
| | | } |
| | |
| | | @ApiParam(value = "单位") @RequestParam(required = false) String dw, |
| | | @ApiParam(value = "报告开始时间") @RequestParam(required = false) String djbeginTime, |
| | | @ApiParam(value = "报告结束时间") @RequestParam(required = false) String djendTime) { |
| | | /* Map<String, Object> map = new HashMap<>(); |
| | | List<Long> cusIds = null; |
| | | if (StringUtil.isNotBlank(name)) { |
| | | LambdaQueryWrapper<TjCustomer> wqq = new LambdaQueryWrapper<>(); |
| | | wqq.like(TjCustomer::getCusName, name); |
| | | cusIds = tjCustomerService.list(wqq).stream().map(TjCustomer::getCusId).collect(Collectors.toList()); |
| | | } |
| | | Page<TjOrder> page1 = new Page<>(pageNum, pageSize); |
| | | LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>(); |
| | | if (dyzt == 0) { |
| | | wq.isNull(TjOrder::getPrintLastTime); |
| | | wq.eq(TjOrder::getHeshouStatus, 1); //核收状态为1才能打印 |
| | | } else { |
| | | wq.isNotNull(TjOrder::getPrintLastTime); |
| | | } |
| | | |
| | | if (null != djbeginTime && null != djendTime) { |
| | | wq.between(TjOrder::getCreateTime, DateUtil.beginOfDay(DateUtil.parseDate(djbeginTime)), DateUtil.endOfDay(DateUtil.parseDate(djendTime))); |
| | | } |
| | | if (null != tjNum) { |
| | | wq.like(TjOrder::getTjNumber, tjNum); |
| | | } |
| | | if (StringUtil.isNotBlank(dw)) { |
| | | wq.like(TjOrder::getFirmName, dw); |
| | | } |
| | | if (null != cusIds && !cusIds.isEmpty()) { |
| | | wq.in(TjOrder::getUserId, cusIds); |
| | | } |
| | | wq.orderByDesc(TjOrder::getCreateTime); |
| | | Page<TjOrder> page2 = tjOrderService.page(page1, wq); |
| | | List<TjOrder> list = page2.getRecords(); |
| | | if (list != null) { |
| | | for (int i = 0; i < list.size(); i++) { |
| | | TjCustomer tjCustomer = tjCustomerService.getById(list.get(i).getUserId()); |
| | | if (null == tjCustomer) { |
| | | list.remove(list.get(i)); |
| | | continue; |
| | | } |
| | | list.get(i).setTjCustomerSex(tjCustomer.getCusSex()); |
| | | list.get(i).setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); |
| | | list.get(i).setTjCustomerName(tjCustomer.getCusName()); |
| | | list.get(i).setTjCustomerPhone(tjCustomer.getCusPhone()); |
| | | if (tjCustomer.getCusIdcard() != null) { |
| | | list.get(i).setTjCusIdCard(tjCustomer.getCusIdcard()); |
| | | } |
| | | |
| | | if (null != tjCustomer.getCompName()) { |
| | | list.get(i).setDictCompName(tjCustomer.getCompName()); |
| | | } else { |
| | | String firmId = list.get(i).getFirmId(); |
| | | if (firmId != null && null != iDictCompService.getById(String.valueOf(list.get(i).getFirmId()))) { |
| | | list.get(i).setDictCompName(iDictCompService.getById(String.valueOf(list.get(i).getFirmId())).getCnName()); |
| | | } |
| | | } |
| | | if (null != list.get(i).getPacId()) { |
| | | if (null != tjPackageService.getById(list.get(i).getPacId())) { |
| | | list.get(i).setPacName(tjPackageService.getById(list.get(i).getPacId()).getPacName()); |
| | | } |
| | | if (null != dwDeptService.getById(list.get(i).getPacId())) { |
| | | list.get(i).setPacName(dwDeptService.getById(list.get(i).getPacId()).getDwDeptName()); |
| | | } |
| | | } |
| | | //从打印记录查出最新打印时间 |
| | | // LambdaQueryWrapper<TjReportPrint> wqqq = new LambdaQueryWrapper<>(); |
| | | // wqqq.eq(TjReportPrint::getTjNumber, list.get(i).getTjNumber()); |
| | | // wqqq.orderByDesc(TjReportPrint::getPrintTime); |
| | | // wqqq.last("limit 1"); |
| | | // TjReportPrint one = tjReportPrintService.getOne(wqqq); |
| | | // if (one != null) { |
| | | // list.get(i).setPrintLastTime(one.getPrintTime()); |
| | | // } |
| | | } |
| | | } |
| | | map.put("list", list); |
| | | map.put("total", page2.getTotal());*/ |
| | | |
| | | if (djbeginTime == null) djbeginTime = ""; |
| | | if (djendTime == null) djendTime = ""; |
| | | Map<String, Object> map = tjOrderService.getTjBgdyList(pageNum, pageSize, dyzt, tjNum, name, dw, djbeginTime, djendTime); |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导出体检记录列表 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('hosp:order:export')") |
| | | @Log(title = "体检记录", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | |
| | | |
| | | @PostMapping("/exportOrderList") |
| | | @ApiOperation(value = "导出体检记录列表") |
| | | public void export(HttpServletResponse response, TjOrder tjOrder) { |
| | | //List<TjOrder> list = tjOrderService.selectTjOrderList(tjOrder); |
| | | List<TjOrder> list = tjOrderService.selectExportOrderList(tjOrder); |
| | | public void exportOrderList(@ApiParam(value = "页码数(默认1)") @RequestParam(defaultValue = "1") Integer pageNum, |
| | | @ApiParam(value = "显示条数(默认10)") @RequestParam(defaultValue = "10") Integer pageSize, |
| | | @ApiParam(value = "状态") @RequestParam(required = false) Integer zt, |
| | | @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, |
| | | @ApiParam(value = "报告结束时间") @RequestParam(required = false) Date bgendTime, |
| | | @ApiParam(value = "单位") @RequestParam(required = false) String dw, |
| | | @ApiParam(value = "当前页或全部数据") @RequestParam(required = false) String dqyorqbsj, |
| | | HttpServletResponse response) { |
| | | List<Long> cusIds = null; |
| | | if (null != name) { |
| | | LambdaQueryWrapper<TjCustomer> wqq = new LambdaQueryWrapper<>(); |
| | | wqq.like(TjCustomer::getCusName, name); |
| | | cusIds = tjCustomerService.list(wqq).stream().map(TjCustomer::getCusId).collect(Collectors.toList()); |
| | | } |
| | | |
| | | Page<TjOrder> page1 = new Page<>(pageNum, pageSize); |
| | | LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>(); |
| | | if (null != djbeginTime && null != djendTime) { |
| | | wq.between(TjOrder::getCreateTime, DateUtil.beginOfDay(djbeginTime), DateUtil.endOfDay(djendTime)); |
| | | } |
| | | if (null != bgbeginTime && null != bgendTime) { |
| | | wq.between(TjOrder::getCreateTime, DateUtil.beginOfDay(bgbeginTime), DateUtil.endOfDay(bgendTime)); |
| | | } |
| | | if (null != tjNum) { |
| | | wq.eq(TjOrder::getTjNumber, tjNum); |
| | | } |
| | | |
| | | |
| | | if (null != xmmc) { |
| | | wq.in(TjOrder::getTjNumber, projectService.getTjNumLIstByXmmx(xmmc)); |
| | | } |
| | | |
| | | if (StrUtil.isNotBlank(dw)) { |
| | | wq.like(TjOrder::getFirmName, dw); |
| | | } |
| | | |
| | | if (null != cusIds && !cusIds.isEmpty()) { |
| | | wq.in(TjOrder::getUserId, cusIds); |
| | | } |
| | | |
| | | if (null != zt && (zt == 0 || zt == 1 || zt == 2)) { |
| | | List<TjOrder> orders = new ArrayList<>(); |
| | | List<TjOrder> tjOrders = null; |
| | | List<TjOrder> orderList = tjOrderService.list(wq); |
| | | if (null != orderList && !orderList.isEmpty()) { |
| | | for (TjOrder order : orderList) { |
| | | int czwj = remarkService.panduaniscunzaiweijian(order.getTjNumber()); |
| | | int sfwc = remarkService.panduaniswancheng(order.getTjNumber()); |
| | | if (zt == 0 && czwj == 0) { |
| | | //未检0 |
| | | order.setZt("未检"); |
| | | orders.add(order); |
| | | } |
| | | if (zt == 1 && czwj > 0) { |
| | | //在检1 |
| | | order.setZt("在检"); |
| | | orders.add(order); |
| | | } |
| | | if (zt == 2 && sfwc == 0 && order.getCheckStatus() == 0 && order.getCheckTime() == null && order.getHeshouStatus() == 0 && order.getPrintLastTime() == null) { |
| | | //已完成2 |
| | | order.setZt("已完成"); |
| | | orders.add(order); |
| | | } |
| | | } |
| | | if (!orders.isEmpty()) { |
| | | tjOrders = orders.stream().sorted(Comparator.comparing(TjOrder::getCreateTime).reversed()) |
| | | .skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | for (TjOrder order : tjOrders) { |
| | | TjCustomer tjCustomer = tjCustomerService.getById(order.getUserId()); |
| | | if (null != tjCustomer) { |
| | | order.setTjCustomerSex(tjCustomer.getCusSex()); |
| | | order.setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); |
| | | order.setTjCustomerName(tjCustomer.getCusName()); |
| | | order.setTjCustomerPhone(tjCustomer.getCusPhone()); |
| | | order.setTjCusIdCard(tjCustomer.getCusIdcard()); |
| | | order.setCareer(tjCustomer.getCareer()); |
| | | order.setIdType(tjCustomer.getIdType()); |
| | | order.setAgeUnit(tjCustomer.getAgeUnit()); |
| | | order.setTjCount(String.valueOf(tjCustomer.getCusNumber())); |
| | | String firmName = order.getFirmName(); |
| | | if (StringUtil.isNotBlank(firmName)) { |
| | | order.setDictCompName(firmName); |
| | | } |
| | | if (null != order.getPacId()) { |
| | | if (null != tjPackageService.getById(order.getPacId())) { |
| | | order.setPacName(tjPackageService.getById(order.getPacId()).getPacName()); |
| | | } else if (null != dwDeptService.getById(order.getPacId())) { |
| | | order.setPacName(dwDeptService.getById(order.getPacId()).getDwDeptName()); |
| | | } |
| | | } |
| | | TjDjdDyjl dycs = djdDyjlService.getDjdDyCsByTjNum(order.getTjNumber()); |
| | | if (null != dycs) order.setDycs(Math.toIntExact(dycs.getDycs())); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ExcelUtil<TjOrder> util = new ExcelUtil<TjOrder>(TjOrder.class); |
| | | util.exportExcel(response, tjOrders, "体检记录数据"); |
| | | } |
| | | |
| | | if (null != zt) { |
| | | if (zt == 3) { |
| | | //已审核 |
| | | wq.isNotNull(TjOrder::getCheckTime); |
| | | wq.eq(TjOrder::getCheckStatus, 1); |
| | | wq.isNull(TjOrder::getHeshouTime); |
| | | wq.isNull(TjOrder::getPrintLastTime); |
| | | wq.eq(TjOrder::getHeshouStatus, 0); |
| | | } |
| | | if (zt == 4) { |
| | | //生成报告 |
| | | wq.isNotNull(TjOrder::getReportTime); |
| | | wq.isNull(TjOrder::getHeshouTime); |
| | | wq.isNull(TjOrder::getPrintLastTime); |
| | | wq.eq(TjOrder::getHeshouStatus, 0); |
| | | } |
| | | if (zt == 5) { |
| | | //报告核收 |
| | | wq.eq(TjOrder::getHeshouStatus, 1); |
| | | wq.isNull(TjOrder::getPrintLastTime); |
| | | } |
| | | if (zt == 6) { |
| | | //已打印 |
| | | wq.isNotNull(TjOrder::getPrintLastTime); |
| | | wq.eq(TjOrder::getHeshouStatus, 1); |
| | | wq.isNotNull(TjOrder::getPrintLastTime); |
| | | } |
| | | } |
| | | |
| | | wq.orderByDesc(TjOrder::getCreateTime); |
| | | |
| | | List<TjOrder> list =null; |
| | | if(StringUtil.isNotBlank(dqyorqbsj) && dqyorqbsj.equals("1")){ |
| | | list = tjOrderService.list(wq); |
| | | }else { |
| | | Page<TjOrder> page2 = tjOrderService.page(page1, wq); |
| | | list = page2.getRecords(); |
| | | } |
| | | if (!list.isEmpty()) { |
| | | for (TjOrder order : list) { |
| | | TjCustomer tjCustomer = tjCustomerService.getById(order.getUserId()); |
| | | if (null != tjCustomer) { |
| | | order.setTjCustomerSex(tjCustomer.getCusSex()); |
| | | order.setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); |
| | | order.setTjCustomerName(tjCustomer.getCusName()); |
| | | order.setTjCustomerPhone(tjCustomer.getCusPhone()); |
| | | order.setTjCusIdCard(tjCustomer.getCusIdcard()); |
| | | order.setCareer(tjCustomer.getCareer()); |
| | | order.setIdType(tjCustomer.getIdType()); |
| | | order.setAgeUnit(tjCustomer.getAgeUnit()); |
| | | order.setTjCount(String.valueOf(tjCustomer.getCusNumber())); |
| | | if (null != tjCustomer.getCompName()) { |
| | | order.setDictCompName(tjCustomer.getCompName()); |
| | | } else { |
| | | String firmId = order.getFirmId(); |
| | | if (firmId != null && null != iDictCompService.getById(String.valueOf(order.getFirmId()))) { |
| | | order.setDictCompName(iDictCompService.getById(String.valueOf(order.getFirmId())).getCnName()); |
| | | } |
| | | } |
| | | if (null != order.getPacId()) { |
| | | if (null != tjPackageService.getById(order.getPacId())) { |
| | | order.setPacName(tjPackageService.getById(order.getPacId()).getPacName()); |
| | | } else if (null != dwDeptService.getById(order.getPacId())) { |
| | | order.setPacName(dwDeptService.getById(order.getPacId()).getDwDeptName()); |
| | | } |
| | | } |
| | | TjDjdDyjl dycs = djdDyjlService.getDjdDyCsByTjNum(order.getTjNumber()); |
| | | if (null != dycs) order.setDycs(Math.toIntExact(dycs.getDycs())); |
| | | } |
| | | int czwj = remarkService.panduaniscunzaiweijian(order.getTjNumber()); |
| | | int sfwc = remarkService.panduaniswancheng(order.getTjNumber()); |
| | | Date checkTime = order.getCheckTime(); |
| | | Date reportTime = order.getReportTime(); |
| | | Integer heshouStatus = order.getHeshouStatus(); |
| | | Date lastTime = order.getPrintLastTime(); |
| | | |
| | | if (null != zt) { |
| | | if (zt == 3) { |
| | | order.setZt("已审核"); |
| | | } |
| | | if (zt == 4) { |
| | | order.setZt("生成报告"); |
| | | } |
| | | if (zt == 5) { |
| | | order.setZt("报告核收"); |
| | | } |
| | | if (zt == 6) { |
| | | order.setZt("已打印"); |
| | | } |
| | | } else { |
| | | if (czwj == 0) { |
| | | //未检0 |
| | | order.setZt("未检"); |
| | | } |
| | | if (czwj > 0) { |
| | | //在检1 |
| | | order.setZt("在检"); |
| | | } |
| | | if (sfwc == 0) { |
| | | //已完成2 |
| | | order.setZt("已完成"); |
| | | } |
| | | if (null != checkTime) { |
| | | //已审核3 |
| | | order.setZt("已审核"); |
| | | } |
| | | if (null != reportTime) { |
| | | //生成报告4 |
| | | order.setZt("生成报告"); |
| | | } |
| | | if (1 == heshouStatus) { |
| | | //报告核收5 |
| | | order.setZt("报告核收"); |
| | | } |
| | | if (null != lastTime) { |
| | | //已打印6 |
| | | order.setZt("已打印"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ExcelUtil<TjOrder> util = new ExcelUtil<TjOrder>(TjOrder.class); |
| | | util.exportExcel(response, list, "体检记录数据"); |
| | | } |
| | |
| | | TjCustomer tjCustomer = tjCustomerService.getOne(wq); |
| | | if (tjCustomer == null) return AjaxResult.error("该客户未登记"); |
| | | |
| | | LambdaQueryWrapper<TjOrder> wqq = new LambdaQueryWrapper<>(); |
| | | wqq.eq(TjOrder::getUserId, tjOrder.getUserId()); |
| | | wqq.eq(TjOrder::getCheckStatus, 0); |
| | | wqq.isNull(TjOrder::getFinishTime); |
| | | // if (!tjCustomer.getCardId().equals("0")) { |
| | | wqq.eq(TjOrder::getCardId, tjCustomer.getCardId()); |
| | | // LambdaQueryWrapper<TjOrder> wqq = new LambdaQueryWrapper<>(); |
| | | // wqq.eq(TjOrder::getUserId, tjOrder.getUserId()); |
| | | // wqq.eq(TjOrder::getCheckStatus, 0); |
| | | // wqq.isNull(TjOrder::getFinishTime); |
| | | //// if (!tjCustomer.getCardId().equals("0")) { |
| | | // wqq.eq(TjOrder::getCardId, tjCustomer.getCardId()); |
| | | //// } |
| | | // TjOrder order = tjOrderService.getOne(wqq); |
| | | // if (null != order) { |
| | | // transitionService.deletedTbTransitionListByCusIdAndTjNum(tjCustomer.getCusIdcard(), tjCustomer.getCardId()); |
| | | // return AjaxResult.error("不可重复登记"); |
| | | // } |
| | | TjOrder order = tjOrderService.getOne(wqq); |
| | | if (null != order) { |
| | | transitionService.deletedTbTransitionListByCusIdAndTjNum(tjCustomer.getCusIdcard(), tjCustomer.getCardId()); |
| | | return AjaxResult.error("不可重复登记"); |
| | | } |
| | | TjFlowingWater tjFlowingWater = new TjFlowingWater(); |
| | | LambdaQueryWrapper<TjReservation> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.eq(TjReservation::getIdCard, tjCustomer.getCusIdcard()); |
| | |
| | | return AjaxResult.error("对不起您的预约已超时请重新预约"); |
| | | } |
| | | if (null != tjReservation.getTeamNo()) tjOrder.setTeamNo(tjReservation.getTeamNo()); |
| | | // if (null != tjReservation.getCompanyId()) tjOrder.setFirmId(tjReservation.getCompanyId()); |
| | | // if (null != tjReservation.getCompany()) tjOrder.setFirmName(tjReservation.getCompany()); |
| | | if (null != tjReservation.getCompanyId()) tjOrder.setFirmId(tjReservation.getCompanyId()); |
| | | if (null != tjReservation.getCompany()) tjOrder.setFirmName(tjReservation.getCompany()); |
| | | if (null != tjReservation.getDepartment()) tjOrder.setFirmDeptName(tjReservation.getDepartment()); |
| | | if (null != tjReservation.getJobNo()) tjOrder.setFirmWorkId(tjReservation.getJobNo()); |
| | | if (null != tjReservation.getPacId()) tjOrder.setPacId(tjReservation.getPacId()); |
| | | if (null != tjReservation.getTjCategory()) tjOrder.setTjCategory(tjReservation.getTjCategory()); |
| | | if (null != tjReservation.getGroupingId()) { |
| | | TjDwGrouping dwGrouping = dwGroupingService.getById(tjReservation.getGroupingId()); |
| | | tjOrder.setGroupId(tjReservation.getGroupingId()); |
| | | tjOrder.setFirmDeptId(tjReservation.getPacId()); |
| | | tjOrder.setFirmDeptId(dwGrouping.getDwDeptId()); |
| | | } |
| | | tjReservation.setIsExpire(1); |
| | | tjReservationService.updateById(tjReservation); |
| | | if (null != tjReservation.getTeamNo() && tjOrder.getTjType().equals("1")) { |
| | | if (null != tjReservation.getTeamNo()) { |
| | | tjOrder.setTjType("1"); |
| | | } else if (tjOrder.getTjType().equals("2")) { |
| | | tjOrder.setTjType("2"); |
| | | } |
| | | } |
| | | if(StringUtil.isBlank(tjOrder.getFirmId())){ |
| | | if (StringUtil.isBlank(tjOrder.getFirmId())) { |
| | | tjOrder.setFirmId("0"); |
| | | } |
| | | |
| | |
| | | tjOrderService.tjQiandaodengji(tjOrder.getTjNumber()); |
| | | return result; |
| | | } |
| | | } finally { |
| | | }catch (Exception e){ |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | log.error(String.valueOf(e)); |
| | | } |
| | | finally { |
| | | lock.unlock(); |
| | | } |
| | | 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); |
| | | |
| | | |
| | |
| | | tjFlowingWater.setDiscount(discount.toString()); |
| | | |
| | | BigDecimal subtract = paidIn.subtract(copeWith.multiply(discount.divide(BigDecimal.valueOf(10)))); |
| | | log.info("签到登记体检人: "+tjOrder.getTjNumber()+" 应付: "+copeWith); |
| | | log.info("签到登记体检人: "+tjOrder.getTjNumber()+" 折扣: "+discount); |
| | | log.info("签到登记体检人: "+tjOrder.getTjNumber()+" 实付: "+paidIn); |
| | | log.info("签到登记体检人: "+tjOrder.getTjNumber()+" 相差: "+subtract); |
| | | log.info("签到登记体检人: " + tjOrder.getTjNumber() + " 应付: " + copeWith); |
| | | log.info("签到登记体检人: " + tjOrder.getTjNumber() + " 折扣: " + discount); |
| | | log.info("签到登记体检人: " + tjOrder.getTjNumber() + " 实付: " + paidIn); |
| | | log.info("签到登记体检人: " + tjOrder.getTjNumber() + " 相差: " + subtract); |
| | | |
| | | if (isPay.equals("true")) { |
| | | if (null != mallOrder) { |
| | |
| | | //修改每项的原价现价 |
| | | // transitionService.updateTbTransitionPriceByCusId(tjCustomer.getCusIdcard(), discount, tjOrder.getTjNumber()); |
| | | //修改临时表体检号 |
| | | transitionService.updateTbTransitionTjNumByCusId(tjCustomer.getCusIdcard(),tjOrder.getTjNumber()); |
| | | transitionService.updateTbTransitionTjNumByCusId(tjCustomer.getCusIdcard(), tjOrder.getTjNumber()); |
| | | //补差价 |
| | | /* if(subtract.compareTo(BigDecimal.ZERO)>0){ |
| | | tjFlowingWater.setPaidIn(paidIn.add(subtract)); |
| | |
| | | /*调用his接口*/ |
| | | String config = configService.selectConfigByKey("sfkqdyhis"); |
| | | if (null != config && config.equals("Y")) { |
| | | if(tjCustomer.getPationId().equals("0")){ |
| | | AjaxResult result = controller.Outpincreateapply(tjCustomer); |
| | | String result1 = getAjaxResult(result); |
| | | JSONObject object = getJSONObject(result1); |
| | | String code = object.getStr("ResultCode"); |
| | | if (code.equals("0")) { |
| | | JSONArray resultDatass = object.getJSONArray("ResultData"); |
| | | Map<String, Object> resultData = (Map<String, Object>) resultDatass.get(0); |
| | | if (null != resultData && !resultData.isEmpty()) { |
| | | String pationid = resultData.get("PationId").toString(); |
| | | if (null != pationid) { |
| | | tjCustomer.setPationId(pationid); |
| | | tjCustomerService.updateById(tjCustomer); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | AjaxResult result = hisApiMethod.HisApiMethods(tjCustomer, tjOrder); |
| | | if (!result.get("code").toString().equals("200")) { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | |
| | | hisApiMethod.ZfHisApiMethod(jzh.toString()); |
| | | } |
| | | log.info("该登记人挂号失败, 就诊号为: " + tjOrder.getCardId()); |
| | | return AjaxResult.error("挂号失败!" + result.get("msg").toString()); |
| | | throw new IllegalStateException("挂号失败!" + result.get("msg").toString()); |
| | | } |
| | | |
| | | log.info("该登记人的his就诊号是: " + tjOrder.getCardId()); |
| | | //团体 |
| | | /* if ("1".equals(tjOrder.getTjType())) { |
| | | // asyncService.ttextracted(tjOrder, tjCustomer, sysUser, tjReservation, tjFlowingWater); |
| | | 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、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(String.valueOf(e),e.getMessage()); |
| | | throw new IllegalStateException(); |
| | | } |
| | | return AjaxResult.success(tjNumber); |
| | | } else { |
| | |
| | | |
| | | // 查询 对接Lis、Pacs申请如果类型包含在配置内则使用对接lis、pacs |
| | | |
| | | log.info("签到登记接口该人员: "+tjOrder.getTjNumber()+" 的体检类型是:"+tjOrder.getTjType()); |
| | | if (lisApiMethod.isUseLisAndPacsRegister(tjOrder)) { |
| | | // 这是上面个人方法引入数据 |
| | | 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()); |
| | | addCaiYangDengJi(detailList, !detailList.isEmpty(), tjOrder, sysUser, null); |
| | | return AjaxResult.success(tjNumber); |
| | | }else { |
| | | newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); |
| | | AjaxResult error = isRequestCommonHisApi(tjOrder, tjCustomer, tjFlowingWater); |
| | | if (error != null) return error; |
| | | 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 { |
| | | try { |
| | | log.info(tjOrder.getTjNumber()+"else签到登记进入收费方法"); |
| | | newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); |
| | | isRequestCommonHisApi(tjOrder, tjCustomer, tjFlowingWater); |
| | | } catch (Exception e) { |
| | | 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.eq(TbTransition::getTjNum, tjOrder.getTjNumber()); |
| | | wrapper.eq(TbTransition::getCusId, tjCustomer.getCusIdcard()); |
| | | wrapper.eq(TbTransition::getCardId, tjCustomer.getCardId()); |
| | | wrapper.isNotNull(TbTransition::getOrdPrice); |
| | | wrapper.gt(TbTransition::getOrdPrice, 0); |
| | | wrapper.isNotNull(TbTransition::getNowPrice); |
| | | 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(); |
| | | BigDecimal danjia = transition.getOrdPrice(); |
| | | // Integer sl = project.getSl(); |
| | | int sl = 1; |
| | | BigDecimal danjia = transition.getNowPrice(); |
| | | BigDecimal allPrice = danjia.multiply(new BigDecimal(sl)); |
| | | obj.putOpt("danJia", danjia); |
| | | obj.putOpt("jieSuanJe", allPrice); |
| | |
| | | obj.putOpt("zhiXingKsMc", dept.getDeptName()); |
| | | obj.putOpt("shouFeiXmId", project.getHisXmbm()); |
| | | obj.putOpt("shouFeiXmMc", project.getHisXmmc()); |
| | | |
| | | // obj.putOpt("zhiXingKs","7805"); |
| | | // obj.putOpt("zhiXingKsMc","体检科"); |
| | | // obj.putOpt("shouFeiXmId","4735346"); |
| | | // obj.putOpt("shouFeiXmMc","体检费"); |
| | | 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"); |
| | | 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); |
| | | 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); |
| | | sampling.setJyxmdm(project.getProId().toString()); |
| | | |
| | | } |
| | | sampling.setSamplingNumber(format); |
| | | sampling.setTjNum(order.getTjNumber()); |
| | | sampling.setCusId(String.valueOf(order.getUserId())); |
| | | if (tjCustomerService.getById(String.valueOf(order.getUserId())) != null) { |
| | | sampling.setCusName(tjCustomerService.getById(String.valueOf(order.getUserId())).getCusName()); |
| | | } |
| | | sampling.setApplicationTime(date); |
| | | sampling.setTjTime(order.getCreateTime()); |
| | | sampling.setProId(String.valueOf(detail.getProId())); |
| | | sampling.setProName(projectService.getById(detail.getProId()).getProName()); |
| | | sampling.setCreateBy(sysUser.getNickName()); |
| | | sampling.setCreateTime(date); |
| | | sampling.setUpdateBy(sysUser.getNickName()); |
| | | sampling.setUpdateTime(date); |
| | | sampling.setCreateId(String.valueOf(sysUser.getUserId())); |
| | | sampling.setUpdateId(String.valueOf(sysUser.getUserId())); |
| | | sampling.setJxbz(jxbz); |
| | | samplingService.save(sampling); |
| | | } |
| | | } |
| | | String config = configService.selectConfigByKey("sfkqdyhis"); |
| | | if (lisApiMethod.isUseLisAndPacsRegister(order) && (null != config && config.equals("Y"))) { |
| | | AjaxResult ajaxResult = lisApiMethod.getJyFlHb(); |
| | | if (ajaxResult.get("code").toString().equals("200")) { |
| | | String str = ajaxResult.get("data").toString(); |
| | | str = str.replace("=", ":"); |
| | | JSONArray array = JSONUtil.parseArray(str); |
| | | for (Object o : array) { |
| | | JSONObject object = (JSONObject) o; |
| | | LisJyflhb lisJyflhb = new LisJyflhb(); |
| | | lisJyflhb.setHbhxm(object.getStr("hbhxm")); |
| | | lisJyflhb.setFlmc(object.getStr("flmc")); |
| | | lisJyflhb.setMc(object.getStr("mc")); |
| | | lisJyflhb.setFlbm(object.getStr("flbm")); |
| | | LambdaQueryWrapper<LisJyflhb> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(LisJyflhb::getFlbm, lisJyflhb.getFlbm()); |
| | | LisJyflhb jyflhb = lisJyflhbService.getOne(wrapper); |
| | | if (jyflhb == null) { |
| | | lisJyflhb.setId(IdUtil.getSnowflake().nextId()); |
| | | lisJyflhbService.save(lisJyflhb); |
| | | 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())); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage()); |
| | | } |
| | | 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())); |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/addCaiYangDengJi") |
| | | @ApiOperation(value = "手动添加采样记录接口") |
| | | public AjaxResult addCaiYangDengJi(@RequestParam("tjNum") String tjNum){ |
| | | |
| | | try { |
| | | TjOrder order = tjOrderService.getOrderByTjNum(tjNum); |
| | | if(null !=order){ |
| | | Long userId = Long.valueOf(SecurityUtils.getLoginUser().getUserId()); |
| | | SysUser sysUser = userService.getById(userId); |
| | | List<TjOrderDetail> detailList = tjOrderDetailService.getCaiYangDengJi(order.getOrderId()); |
| | | log.info("签到登记:采样数据查询个数"+detailList.size()); |
| | | addCaiYangDengJi(detailList, !detailList.isEmpty(), order, sysUser, null); |
| | | } |
| | | } catch (NumberFormatException e) { |
| | | log.error(String.valueOf(e)); |
| | | } |
| | | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/addPlOrderAndDetail") |
| | | @ApiOperation(value = "体检批量签到登记接口") |
| | | @Transactional //(切换数据库出错,所以注释) |
| | | // @Transactional //(切换数据库出错,所以注释) |
| | | public AjaxResult addPlOrderAndDetail(@RequestBody QianDaoDto daoDto, HttpServletResponse response) { |
| | | SysUser sysUser = UserHoder.getLoginUser().getUser(); |
| | | List<String> cusIds = daoDto.getCusIds(); |
| | | ArrayList<String> tjNumbers = new ArrayList<>(); |
| | | ArrayList<String> errTjh = new ArrayList<>(); |
| | | if (null != cusIds && !cusIds.isEmpty()) { |
| | | ExecutorService threadPools = Executors.newFixedThreadPool(cusIds.size()); |
| | | for (String cusId : cusIds) { |
| | | threadPools.execute(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | getAjaxResults(cusId); |
| | | } |
| | | }); |
| | | |
| | | // threadPools.execute(new Runnable() { |
| | | // @Override |
| | | // public void run() { |
| | | try { |
| | | getAjaxResults(cusId); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | // } |
| | | // }); |
| | | } |
| | | LambdaQueryWrapper<TjCustomer> wq = new LambdaQueryWrapper<>(); |
| | | wq.in(TjCustomer::getCusIdcard, cusIds); |
| | |
| | | // } |
| | | // } |
| | | // }); |
| | | |
| | | Future<AjaxResult> future = executor.submit(new Callable<AjaxResult>() { |
| | | @Override |
| | | public AjaxResult call() throws Exception { |
| | |
| | | }); |
| | | try { |
| | | AjaxResult result = future.get(); |
| | | String tjNumber = result.get("tjNumber").toString(); |
| | | tjNumbers.add(tjNumber); |
| | | String code = result.get("code").toString(); |
| | | if (code.equals("200")) { |
| | | String tjNumber = result.get("tjNumber").toString(); |
| | | tjNumbers.add(tjNumber); |
| | | }else { |
| | | String userId = result.get("userId").toString(); |
| | | errTjh.add(userId); |
| | | } |
| | | } catch (InterruptedException | ExecutionException e) { |
| | | // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | threadPools.shutdown(); |
| | | } |
| | | } |
| | | // TODO 因为有体检号会查出空数据 先使用死数据 |
| | | tjNumbers = new ArrayList<>(); |
| | | tjNumbers.add("02095240229171627"); |
| | | tjNumbers.add("02095240229173104"); |
| | | tjNumbers.add("10001240524172002"); |
| | | tjNumbers.add("10001240304124410"); |
| | | tjNumbers.add("00325240304160123"); |
| | | tjNumbers.add("02095240304162044"); |
| | | tjNumbers.add("02095240304162152"); |
| | | tjNumbers.add("10001240304163505"); |
| | | Map<String, Object> map = null; |
| | | try { |
| | | map = PDFDocumentUtil.getDocument(); |
| | | Document document = (Document) map.get("document"); |
| | | for (int i = 0; i < tjNumbers.size(); i++) { |
| | | try { |
| | | List<Map<String, String>> djdInfos = tjOrderService.selectDjdInfo(tjNumbers.get(i)); |
| | | Map<String, Object> userInfo = tjOrderService.selectDjdUserInfo(tjNumbers.get(i)); |
| | | LocalDateTime tjsj = (LocalDateTime) userInfo.get("tjsj"); |
| | | DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); |
| | | String time = null; |
| | | if (tjsj != null) { |
| | | time = dateFormat.format(tjsj); |
| | | } |
| | | PDFDocumentUtil.makeUserInfoTable(document, (String) userInfo.get("tjname"), (String) userInfo.get("sex") |
| | | , (String) userInfo.get("tjh"), (String) userInfo.get("lxdh"), (String) userInfo.get("tjname"), time); |
| | | PDFDocumentUtil.makeTjInfo(document, djdInfos); |
| | | // 多条则换页 |
| | | if (i + 1 < tjNumbers.size()) { |
| | | document.newPage(); |
| | | } |
| | | } catch (DocumentException | IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | // TODO 因为有体检号会查出空数据 先使用死数据 打印导诊单 |
| | | Map<String,Object> map=new HashMap<>(); |
| | | if (!tjNumbers.isEmpty()) { |
| | | map.put("tjh",tjNumbers); |
| | | } |
| | | document.close(); |
| | | ByteArrayOutputStream outputStream = (ByteArrayOutputStream) map.get("stream"); |
| | | String encodeToString = java.util.Base64.getEncoder().encodeToString(outputStream.toByteArray()); |
| | | return AjaxResult.success().put("file", encodeToString); |
| | | } catch (IOException | DocumentException e) { |
| | | e.printStackTrace(); |
| | | map.put("errtjh",errTjh); |
| | | return AjaxResult.success("操作成功",map); |
| | | } |
| | | return AjaxResult.success("操作成功"); |
| | | // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | private void getAjaxResults(String cusIdcard) { |
| | | @GetMapping("/signOrderInfo") |
| | | public AjaxResult signOrderInfo(@RequestParam("tjNum") String tjNum){ |
| | | List<Map<String, Object>> djdInfos = tjOrderService.selectDjdInfo(tjNum); |
| | | Map<String, Object> userInfo = tjOrderService.selectDjdUserInfo(tjNum); |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("djd",djdInfos); |
| | | hashMap.put("user",userInfo); |
| | | return AjaxResult.success(hashMap); |
| | | } |
| | | |
| | | @Transactional |
| | | public void getAjaxResults(String cusIdcard) { |
| | | if (!"".equals(cusIdcard) && cusIdcard != null) { |
| | | //根据配置调取存储过程 将临时表数据存入预约表2023.12.12 |
| | | final String getInfoFromSqlData = configService.selectConfigByKey("getInfoFromSqlData"); |
| | |
| | | tjReservationService.updateById(tjReservation); |
| | | // return AjaxResult.error("对不起您的预约已超时请重新预约"); |
| | | }*/ |
| | | LambdaQueryWrapper<TjCustomer> qw = new LambdaQueryWrapper<>(); |
| | | qw.eq(TjCustomer::getCusIdcard, cusIdcard); |
| | | TjCustomer tjCustomer1 = tjCustomerService.getOne(qw); |
| | | if (tjCustomer1 != null) { |
| | | tjCustomer1.setTjType(tjReservation.getTjType()); |
| | | tjCustomer1.setCusName(tjReservation.getName()); |
| | | tjCustomer1.setCusSex(Long.valueOf(tjReservation.getSex())); |
| | | tjCustomer1.setCusBrithday(tjReservation.getBirthday()); |
| | | tjCustomer1.setCusPhone(tjReservation.getPhoe()); |
| | | tjCustomer1.setCusEmail(tjReservation.getEmail()); |
| | | tjCustomer1.setCusAddr(tjReservation.getAddress()); |
| | | tjCustomer1.setCusMarryStatus(String.valueOf(tjReservation.getMarriage())); |
| | | tjCustomer1.setCusNational(String.valueOf(tjReservation.getNation())); |
| | | tjCustomer1.setIdType(tjReservation.getIdType()); |
| | | tjCustomer1.setAge(tjReservation.getAge()); |
| | | tjCustomer1.setAgeUnit(tjReservation.getAgeUnit()); |
| | | tjCustomer1.setCareer(tjReservation.getCareer()); |
| | | tjCustomerService.updateById(tjCustomer1); |
| | | } else { |
| | | TjCustomer tjCustomer = new TjCustomer(); |
| | | tjCustomer.setCusIdcard(tjReservation.getIdCard()); |
| | | tjCustomer.setCusName(tjReservation.getName()); |
| | | tjCustomer.setCusSex(Long.valueOf(tjReservation.getSex())); |
| | | tjCustomer.setCusBrithday(tjReservation.getBirthday()); |
| | | tjCustomer.setCusPhone(tjReservation.getPhoe()); |
| | | tjCustomer.setCusEmail(tjReservation.getEmail()); |
| | | tjCustomer.setCusAddr(tjReservation.getAddress()); |
| | | tjCustomer.setCusMarryStatus(String.valueOf(tjReservation.getMarriage())); |
| | | tjCustomer.setCusNational(String.valueOf(tjReservation.getNation())); |
| | | tjCustomer.setIdType(tjReservation.getIdType()); |
| | | tjCustomer.setAge(tjReservation.getAge()); |
| | | tjCustomer.setAgeUnit(tjReservation.getAgeUnit()); |
| | | tjCustomer.setCareer(tjReservation.getCareer()); |
| | | tjCustomer.setDwPhone(tjReservation.getDwPhone()); |
| | | tjCustomer.setCardId(tjReservation.getCardId()); |
| | | tjCustomer.setIndexCard(tjReservation.getIndexCard()); |
| | | //截取密码自动生成set进去 |
| | | String substring = cusIdcard.substring(cusIdcard.length() - 6); |
| | | substring = DigestUtils.md5DigestAsHex(substring.getBytes()); |
| | | tjCustomer.setCusPassword(substring); |
| | | tjCustomer.setTjType(tjReservation.getTjType()); |
| | | tjCustomerService.save(tjCustomer); |
| | | try { |
| | | LambdaQueryWrapper<TjCustomer> qw = new LambdaQueryWrapper<>(); |
| | | qw.eq(TjCustomer::getCusIdcard, cusIdcard); |
| | | TjCustomer tjCustomer1 = tjCustomerService.getOne(qw); |
| | | if (tjCustomer1 != null) { |
| | | tjCustomer1.setTjType(tjReservation.getTjType()); |
| | | tjCustomer1.setCusName(tjReservation.getName()); |
| | | tjCustomer1.setCusSex(Long.valueOf(tjReservation.getSex())); |
| | | tjCustomer1.setCusBrithday(tjReservation.getBirthday()); |
| | | tjCustomer1.setCusPhone(tjReservation.getPhoe()); |
| | | tjCustomer1.setCusEmail(tjReservation.getEmail()); |
| | | tjCustomer1.setCusAddr(tjReservation.getAddress()); |
| | | tjCustomer1.setCusMarryStatus(String.valueOf(tjReservation.getMarriage())); |
| | | tjCustomer1.setCusNational(String.valueOf(tjReservation.getNation())); |
| | | tjCustomer1.setIdType(tjReservation.getIdType()); |
| | | tjCustomer1.setAge(tjReservation.getAge()); |
| | | tjCustomer1.setAgeUnit(tjReservation.getAgeUnit()); |
| | | tjCustomer1.setCareer(tjReservation.getCareer()); |
| | | tjCustomerService.updateById(tjCustomer1); |
| | | } else { |
| | | TjCustomer tjCustomer = new TjCustomer(); |
| | | tjCustomer.setCusIdcard(tjReservation.getIdCard()); |
| | | tjCustomer.setCusName(tjReservation.getName()); |
| | | tjCustomer.setCusSex(Long.valueOf(tjReservation.getSex())); |
| | | tjCustomer.setCusBrithday(tjReservation.getBirthday()); |
| | | tjCustomer.setCusPhone(tjReservation.getPhoe()); |
| | | tjCustomer.setCusEmail(tjReservation.getEmail()); |
| | | tjCustomer.setCusAddr(tjReservation.getAddress()); |
| | | tjCustomer.setCusMarryStatus(String.valueOf(tjReservation.getMarriage())); |
| | | tjCustomer.setCusNational(String.valueOf(tjReservation.getNation())); |
| | | tjCustomer.setIdType(tjReservation.getIdType()); |
| | | tjCustomer.setAge(tjReservation.getAge()); |
| | | tjCustomer.setAgeUnit(tjReservation.getAgeUnit()); |
| | | tjCustomer.setCareer(tjReservation.getCareer()); |
| | | tjCustomer.setDwPhone(tjReservation.getDwPhone()); |
| | | tjCustomer.setCardId(tjReservation.getCardId()); |
| | | tjCustomer.setIndexCard(tjReservation.getIndexCard()); |
| | | //截取密码自动生成set进去 |
| | | String substring = cusIdcard.substring(cusIdcard.length() - 6); |
| | | substring = DigestUtils.md5DigestAsHex(substring.getBytes()); |
| | | tjCustomer.setCusPassword(substring); |
| | | tjCustomer.setTjType(tjReservation.getTjType()); |
| | | tjCustomerService.save(tjCustomer); |
| | | } |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | }else { |
| | | throw new RuntimeException(); |
| | | } |
| | | |
| | | }else { |
| | | throw new RuntimeException(); |
| | | } |
| | | } |
| | | |
| | |
| | | DynamicDataSourceContextHolder.clearDataSourceType(); |
| | | } |
| | | |
| | | private AjaxResult getAjaxResult(Long userId, SysUser sysUser, String tjCategory) throws IOException { |
| | | @Transactional |
| | | public AjaxResult getAjaxResult(Long userId, SysUser sysUser, String tjCategory) throws IOException { |
| | | |
| | | LambdaQueryWrapper<TjCustomer> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjCustomer::getCusId, userId); |
| | | TjCustomer tjCustomer = tjCustomerService.getOne(wq); |
| | | if (tjCustomer == null) return AjaxResult.error("该客户未登记或不存在"); |
| | | |
| | | LambdaQueryWrapper<TjOrder> wqq = new LambdaQueryWrapper<>(); |
| | | wqq.eq(TjOrder::getUserId, userId); |
| | | wqq.eq(TjOrder::getCheckStatus, 0); |
| | | wqq.isNull(TjOrder::getFinishTime); |
| | | if (!tjCustomer.getCardId().equals("0")) { |
| | | wqq.eq(TjOrder::getCardId, tjCustomer.getCardId()); |
| | | } |
| | | TjOrder order = tjOrderService.getOne(wqq); |
| | | if (null != order) { |
| | | transitionService.deletedTbTransitionListByCusIdAndTjNum(tjCustomer.getCusIdcard(), tjCustomer.getCardId()); |
| | | return AjaxResult.error("不可重复登记"); |
| | | } |
| | | TjOrder tjOrder = new TjOrder(); |
| | | Date date = new Date(); |
| | | tjOrder.setCreateTime(date); |
| | |
| | | if (tjReservation != null) { |
| | | 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())) { |
| | | tjReservation.setIsExpire(1); |
| | | tjReservationService.updateById(tjReservation); |
| | | return AjaxResult.error("对不起您的预约已超时请重新预约"); |
| | | } |
| | | // if (DateUtil.endOfDay(new Date()).before(tjReservation.getReservationTime())) { |
| | | // return AjaxResult.error("未到预约时间"); |
| | | // } |
| | | // if (DateUtil.endOfDay(tjReservation.getReservationTime()).before(new Date())) { |
| | | // tjReservation.setIsExpire(1); |
| | | // tjReservationService.updateById(tjReservation); |
| | | // return AjaxResult.error("对不起您的预约已超时请重新预约"); |
| | | // } |
| | | if (null != tjReservation.getTeamNo()) tjOrder.setTeamNo(tjReservation.getTeamNo()); |
| | | if (null != tjReservation.getCompanyId()) tjOrder.setFirmId(tjReservation.getCompanyId()); |
| | | if (null != tjReservation.getCompany()) tjOrder.setFirmName(tjReservation.getCompany()); |
| | | if (null != tjReservation.getDepartment()) tjOrder.setFirmDeptName(tjReservation.getDepartment()); |
| | | if (null != tjReservation.getJobNo()) tjOrder.setFirmWorkId(tjReservation.getJobNo()); |
| | | if (null != tjReservation.getPacId()) tjOrder.setPacId(tjReservation.getPacId()); |
| | |
| | | } |
| | | tjReservation.setIsExpire(1); |
| | | tjReservationService.updateById(tjReservation); |
| | | if (null != tjReservation.getTeamNo()) { |
| | | tjOrder.setTjType("1"); |
| | | } else{ |
| | | tjOrder.setTjType("2"); |
| | | } |
| | | |
| | | if (StringUtil.isBlank(tjOrder.getFirmId())) { |
| | | tjOrder.setFirmId("0"); |
| | | } |
| | | // |
| | | // tjReservation.setIsExpire(1); |
| | | // tjReservationService.updateById(tjReservation); |
| | | |
| | | //生成体检号 |
| | | String tjNumber = (sysUser.getUserName() + new SimpleDateFormat("yyMMddHHmmss").format(new Date())); |
| | | // String tjNumber = (sysUser.getUserName() + new SimpleDateFormat("yyMMddHHmmss").format(new Date())); |
| | | // tjNumber = tjNumber.replaceAll(".{6}$", userId.toString().substring(userId.toString().length() - 6)); |
| | | |
| | | tjNumber = tjNumber.replaceAll(".{4}$", userId.toString().substring(userId.toString().length() - 4)); |
| | | |
| | | //获取拼接前缀 |
| | | String makeLisTmhPrefix = configService.selectConfigByKey("make_lis_tmh_prefix"); |
| | | // String tjNumber = (sysUser.getUserName() + idUtils.getTjNumber()); |
| | | // String tjNumber = idUtils.getTjNumber(); |
| | | String tjNumber = idUtils.getNewTjNumberRedisLockAndMysql(); |
| | | if (StringUtil.isNotBlank(makeLisTmhPrefix)) tjNumber = makeLisTmhPrefix + tjNumber; |
| | | |
| | | |
| | | // if (redisCache.hasKey(TJH)) { |
| | | // while (true){ |
| | | // List<String> tjh = redisCache.getCacheList(TJH); |
| | | // if(tjh.contains(tjNumber)){ |
| | | // tjNumber =(sysUser.getUserName() + IdUtils.getTjNumber()); |
| | | // if (StringUtil.isNotBlank(makeLisTmhPrefix)) tjNumber = makeLisTmhPrefix + tjNumber; |
| | | // }else { |
| | | // tjh.add(tjNumber); |
| | | // } |
| | | // } |
| | | // }else { |
| | | // List<String> stringList = tjOrderService. |
| | | // list(new LambdaQueryWrapper<TjOrder>().select(TjOrder::getTjNumber)).stream().map(TjOrder::getTjNumber).collect(Collectors.toList()); |
| | | // stringList.add(tjNumber); |
| | | // redisCache.setCacheList(TJH,stringList); |
| | | // } |
| | | tjOrder.setTjNumber(tjNumber); |
| | | if (null != tjOrder.getPhoto()) { |
| | | File file = new File(tjOrder.getPhoto()); |
| | |
| | | tjCustomer.setCusNumber(cusNumber); |
| | | // BigDecimal discount = BigDecimal.valueOf(Double.parseDouble(tjOrder.getTjFlowingWater().getDiscount())).divide(BigDecimal.valueOf(10)); |
| | | TjFlowingWater tjFlowingWater = new TjFlowingWater(); |
| | | tjFlowingWater.setCreateTime(date); |
| | | tjFlowingWater.setCreateTime(date); |
| | | tjFlowingWater.setUpdateTime(date); |
| | | tjFlowingWater.setCreateBy(sysUser.getNickName()); |
| | | tjFlowingWater.setUpdateBy(sysUser.getNickName()); |
| | | // BigDecimal bigDecimal = tbTransitionMapper.sumTbTransitionOrdPriceByTjNum(tjOrder.getTjNumber()); |
| | | BigDecimal bigDecimal = tbTransitionMapper.sumTbTransitionOrdPriceByTjNumIsNull(tjCustomer.getCusIdcard()); |
| | | tjFlowingWater.setCopeWith(bigDecimal); |
| | | // BigDecimal bigDecimal1 = tbTransitionMapper.sumTbTransitionNowPriceByTjNum(tjOrder.getTjNumber()); |
| | | BigDecimal bigDecimal1 = tbTransitionMapper.sumTbTransitionNowPriceByTjNumIsNull(tjCustomer.getCusIdcard()); |
| | | tjFlowingWater.setPaidIn(bigDecimal1); |
| | | tjFlowingWater.setDiscount(String.valueOf(10)); |
| | | tjFlowingWater.setPayStasus(1L); |
| | | tjFlowingWater.setPayType(3L); |
| | | |
| | | tjFlowingWater.setPayStasus(0L); |
| | | if ("1".equals(tjOrder.getTjType())) { |
| | | if (tjReservation.getPayType() == 1) { |
| | |
| | | if (tjFlowingWaterService.save(tjFlowingWater)) { |
| | | tjOrder.setTjSerialNumber(String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | tjOrderService.updateById(tjOrder); |
| | | |
| | | |
| | | } |
| | | asyncService.ttextracted(tjOrder, tjCustomer, sysUser, tjReservation, tjFlowingWater); |
| | | transitionService.updateTbTransitionTjNumByCusId(tjCustomer.getCusIdcard(), tjOrder.getTjNumber()); |
| | | tjCustomer.setCardId(tjOrder.getTjNumber()); |
| | | tjCustomerService.updateById(tjCustomer); |
| | | transitionService.updateCardIdByTjNumAndIdCard(tjCustomer.getCusIdcard(), tjOrder.getTjNumber(), tjOrder.getTjNumber()); |
| | | tjOrder.setCardId(tjOrder.getTjNumber()); |
| | | tjOrderService.updateById(tjOrder); |
| | | |
| | | // asyncService.ttextracted(tjOrder, tjCustomer, sysUser, tjReservation, tjFlowingWater); |
| | | |
| | | if (lisApiMethod.isUseLisAndPacsRegister(tjOrder)) { |
| | | // 这是上面个人方法引入数据 |
| | | tjFlowingWater.setPayStasus(1L); |
| | | tjOrder.setTjFlowingWater(tjFlowingWater); |
| | | newSaveextracted(tjOrder, tjCustomer, BigDecimal.valueOf(10), 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()); |
| | | addCaiYangDengJi(detailList, !detailList.isEmpty(), tjOrder, sysUser, null); |
| | | } |
| | | |
| | | tjCustomer.setCardId("0"); |
| | | tjCustomerService.updateById(tjCustomer); |
| | | return AjaxResult.success().put("tjNumber", tjNumber); |
| | | } |
| | | } |
| | | return AjaxResult.error(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error().put("userId",userId); |
| | | } |
| | | |
| | | |
| | |
| | | return AjaxResult.error("操作失败! 以下项目已存在: " + string); |
| | | } |
| | | transitionService.saveRedisTransitionByPacId(cusId, cardId, pacId); |
| | | |
| | | //补差价 |
| | | 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); |
| | | } |
| | | } |
| | | |
| | |
| | | TjReport tjReport = new TjReport(); |
| | | tjReport.setTjNumber(String.valueOf(tjNumber)); |
| | | tjReport.setPath(urlValue + outputFileName1); |
| | | String outputPath1 = value + File.separator; |
| | | String pdfBinary = getPDFBinary(outputPath1 + outputFileName1); |
| | | tjReport.setReport(pdfBinary); |
| | | // String outputPath1 = value + File.separator; |
| | | // String pdfBinary = getPDFBinary(outputPath1 + outputFileName1); |
| | | // tjReport.setReport(pdfBinary); |
| | | tjReport.setType("体检报告"); |
| | | tjReport.setPrint("pdf"); |
| | | tjReportService.save(tjReport); |
| | |
| | | remarkService.deletedOrderRemarkByTjNum(tjNum); |
| | | tjFlowingWaterService.deleteTjFlowingWaterByOrderId(String.valueOf(order.getOrderId())); |
| | | transitionService.deletedTbTransitionByTjNum(tjNum); |
| | | ycxmService.delOrderYcXmJyByTjh(tjNum); |
| | | |
| | | TjCustomer customer = tjCustomerService.getById(order.getUserId()); |
| | | customer.setCardId("0"); |
| | |
| | | for (int i = 0; i < tjNumbers.size(); i++) { |
| | | String tjNumber = tjNumbers.get(i).getTjNumber(); |
| | | try { |
| | | List<Map<String, String>> djdInfos = tjOrderService.selectDjdInfo(tjNumber); |
| | | List<Map<String, Object>> djdInfos = tjOrderService.selectDjdInfo(tjNumber); |
| | | Map<String, Object> userInfo = tjOrderService.selectDjdUserInfo(tjNumber); |
| | | LocalDateTime tjsj = (LocalDateTime) userInfo.get("tjsj"); |
| | | DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); |
| | |
| | | log.info("退费申请 入参 -> {}", JSONUtil.toJsonStr(map)); |
| | | String post = HttpClientUtils.sendPost(apiUrl + "/api/his/" + hospbm + "/creatCostInfo", map); |
| | | log.info("退费申请 返回 -> {}", JSONUtil.toJsonStr(post)); |
| | | if(null !=post){ |
| | | if (null != post) { |
| | | JSONObject jsonObject = JSONUtil.parseObj(post); |
| | | if (jsonObject.getStr("code").equals("200")) { |
| | | // hisTfWaterId |
| | |
| | | } |
| | | |
| | | |
| | | @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); |
| | |
| | | } |
| | | } |
| | | } |
| | | int i = tjReportService.deleteTjReportByReIds(list.toArray(new Long[]{})); |
| | | if (i == 0) { |
| | | return AjaxResult.error("撤回失败!"); |
| | | if (!list.isEmpty()) { |
| | | int i = tjReportService.deleteTjReportByReIds(list.toArray(new Long[]{})); |
| | | if (i == 0) { |
| | | return AjaxResult.error("撤回失败!"); |
| | | } |
| | | } |
| | | return AjaxResult.success("操作成功"); |
| | | } |
| | |
| | | return AjaxResult.error("操作失败! 以下项目已存在: " + string); |
| | | } |
| | | transitionService.ttsaveTemoTransitionByGroupingId(cusId, cardId, pacId.toString()); |
| | | //补差价 |
| | | List<Map<String, Object>> cjMaps = groupingProService.huoquxiangmuchajia(pacId.toString(), cusId); |
| | | if (null != cjMaps && !cjMaps.isEmpty()) { |
| | | for (Map<String, Object> cjMap : cjMaps) { |
| | | transitionService.buxiangmuchajia(cusId, pacId.toString(), cjMap.get("xmid").toString(), new BigDecimal(cjMap.get("cj").toString())); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | @GetMapping(value = "newgetTransitionList") |
| | | @ApiOperation(value = "最新查询过渡表数据") |
| | | public AjaxResult newgetTransitionList(@RequestParam @ApiParam(value = "客户id") String cusId) { |
| | | List<TbTransition> list= transitionService.newgetTransitionList(cusId); |
| | | List<TbTransition> list = transitionService.newgetTransitionList(cusId); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | |
| | | @Transactional |
| | | public AjaxResult updateTransitionnewPrice(@RequestBody List<UpdateTransitionnewPriceDto> dtos) { |
| | | |
| | | if(null !=dtos && !dtos.isEmpty()){ |
| | | if (null != dtos && !dtos.isEmpty()) { |
| | | int index = 0; |
| | | boolean flag = false; |
| | | for (UpdateTransitionnewPriceDto dto : dtos) { |
| | | LambdaQueryWrapper<TbTransition> wq=new LambdaQueryWrapper<>(); |
| | | wq.eq(TbTransition::getCusId,dto.getCusIdCard()); |
| | | wq.eq(TbTransition::getParentProId,dto.getParentProId()); |
| | | index++; |
| | | LambdaQueryWrapper<TbTransition> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TbTransition::getCusId, dto.getCusIdCard()); |
| | | wq.eq(TbTransition::getParentProId, dto.getParentProId()); |
| | | wq.isNull(TbTransition::getTjNum); |
| | | List<TbTransition> list = transitionService.list(wq); |
| | | log.info("修改的客户身份证号为: "+dto.getCusIdCard()); |
| | | log.info("父项目id为: "+dto.getParentProId()); |
| | | log.info("折扣为: "+new BigDecimal(dto.getDiscount())); |
| | | if(null !=list && !list.isEmpty()){ |
| | | log.info("修改的客户身份证号为: " + dto.getCusIdCard()); |
| | | log.info("父项目id为: " + dto.getParentProId()); |
| | | log.info("折扣为: " + new BigDecimal(dto.getDiscount())); |
| | | if (null != list && !list.isEmpty()) { |
| | | |
| | | 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); |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/huifuyuyuejilu") |
| | | @ApiOperation(value = "体检记录页面恢复预约记录接口") |
| | | @Transactional |
| | | public AjaxResult huifuyuyuejilu(@RequestBody List<String> tjNUms) { |
| | | |
| | | if (null != tjNUms && !tjNUms.isEmpty()) { |
| | | for (String tjNUm : tjNUms) { |
| | | TjOrder order = tjOrderService.getOrderByTjNum(tjNUm); |
| | | if(null !=order && StringUtil.isNotBlank(order.getReservationId())){ |
| | | //这里删除的是这个人所有项目包括补录项目 |
| | | tjOrderService.deleteTjOrderByOrderId(order.getOrderId()); |
| | | tjOrderDetailService.deleteTjOrderDetailByOrderDetailId(String.valueOf(order.getOrderId())); |
| | | remarkService.deletedOrderRemarkByTjNum(tjNUm); |
| | | tjFlowingWaterService.deleteTjFlowingWaterByOrderId(String.valueOf(order.getOrderId())); |
| | | // transitionService.deletedTbTransitionByTjNum(tjNum); |
| | | tjSamplingMapper.deleteByTjNumAndCusId(order.getTjNumber(), order.getUserId()); |
| | | |
| | | TjReservation reservation = tjReservationService.getById(order.getReservationId()); |
| | | if(null !=reservation){ |
| | | reservation.setIsExpire(2); |
| | | tjReservationService.updateById(reservation); |
| | | transitionService.updateTbTransitionByTjNum(tjNUm); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | return AjaxResult.success(); |
| | | } |
| | | 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(); |
| | | } |
| | | } |
| | | |