| | |
| | | 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 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 cn.hutool.json.JSONUtil; |
| | | 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.SecurityUtils; |
| | | import com.ltkj.common.utils.*; |
| | | import com.ltkj.framework.config.MatchUtils; |
| | | import com.ltkj.framework.config.ThreadPoolConfig; |
| | | import com.ltkj.framework.config.UserHoder; |
| | | import com.ltkj.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.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.hosp.sqlDomain.LtkjTjPat; |
| | | import com.ltkj.hosp.vodomain.BingZhongVO; |
| | | import com.ltkj.hosp.vodomain.HistoryTjOrder; |
| | | import com.ltkj.hosp.vodomain.QjDomainVo; |
| | |
| | | import com.ltkj.mall.mallOrderUtils.TjConstants; |
| | | import com.ltkj.mall.service.IMallCheckLogService; |
| | | import com.ltkj.mall.service.IMallOrderService; |
| | | import com.ltkj.system.service.ISysConfigService; |
| | | import com.ltkj.system.service.ISysDeptService; |
| | | import com.ltkj.system.service.ISysUserService; |
| | | import com.ltkj.system.domain.TjDjdDyjl; |
| | | import com.ltkj.system.service.*; |
| | | import com.ltkj.web.controller.his.*; |
| | | import com.ltkj.web.controller.lis.LisApiMethod; |
| | | import com.ltkj.web.controller.pacs.PacsApiMethodService; |
| | | import com.ltkj.web.controller.service.TjSysAsyncServiceImpl; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import 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; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | import org.springframework.util.DigestUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.ltkj.common.annotation.Log; |
| | | import com.ltkj.common.core.controller.BaseController; |
| | |
| | | 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 |
| | |
| | | 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 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; |
| | | @Autowired |
| | | private ITjSamplingService samplingService; |
| | | @Autowired |
| | | private TjSamplingMapper tjSamplingMapper; |
| | | @Autowired |
| | | private ITjGroupingProService groupingProService; |
| | | @Autowired |
| | | private ITjDjdDyjlService djdDyjlService; |
| | | @Autowired |
| | | private IdUtils idUtils; |
| | | @Autowired |
| | | private LtkjJybbzdService jybbzdService; |
| | | @Autowired |
| | | private LisJyflhbService lisJyflhbService; |
| | | @Autowired |
| | | private ISysDictDataService sysDictDataService; |
| | | |
| | | //将方法返回值解析成json格式 |
| | | public JSONObject getJSONObject(String builder) { |
| | | String Response = JSONUtil.parseObj(builder).getStr("Response"); |
| | | return JSONUtil.parseObj(Response); |
| | | } |
| | | |
| | | //获取方法返回值信息 |
| | | public String getAjaxResult(AjaxResult result) { |
| | | return result.get("data").toString(); |
| | | } |
| | | |
| | | /** |
| | | * 查询体检记录列表 |
| | |
| | | @ApiOperation(value = "查询体检记录列表") |
| | | public AjaxResult getOrderList(@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) Date bgendTime, |
| | | @ApiParam(value = "单位") @RequestParam(required = false) String dw) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | List<Long> cusIds = null; |
| | | 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) { |
| | | List<TjOrder> list = new ArrayList<>(); |
| | | for (TjCustomer customer : customerList) { |
| | | LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>(); |
| | | if (null != djbeginTime && null != djendTime) { |
| | | wq.between(TjOrder::getCreateTime, DateUtil.beginOfDay(djbeginTime), DateUtil.endOfDay(djendTime)); |
| | | } |
| | | wq.eq(TjOrder::getUserId, customer.getCusId()); |
| | | list.addAll(tjOrderService.list(wq)); |
| | | } |
| | | List<TjOrder> collect = null; |
| | | if (list.size() > 0) { |
| | | for (TjOrder order : list) { |
| | | TjCustomer tjCustomer = tjCustomerService.getById(order.getUserId()); |
| | | if (null != tjCustomer) { |
| | | // order.setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName())); |
| | | order.setTjCustomerName(tjCustomer.getCusName()); |
| | | // order.setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone())); |
| | | order.setTjCustomerPhone(tjCustomer.getCusPhone()); |
| | | // order.setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard())); |
| | | order.setTjCusIdCard(tjCustomer.getCusIdcard()); |
| | | order.setTjCustomerSex(tjCustomer.getCusSex()); |
| | | order.setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); |
| | | order.setCareer(tjCustomer.getCareer()); |
| | | order.setIdType(tjCustomer.getIdType()); |
| | | order.setAgeUnit(tjCustomer.getAgeUnit()); |
| | | order.setTjCount(String.valueOf(tjCustomer.getCusNumber())); |
| | | } |
| | | 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()); |
| | | } |
| | | if (null != dwDeptService.getById(order.getPacId())) { |
| | | order.setPacName(dwDeptService.getById(order.getPacId()).getDwDeptName()); |
| | | } |
| | | } |
| | | } |
| | | collect = list.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | } |
| | | if (null != collect) { |
| | | map.put("total", collect.size()); |
| | | } else { |
| | | map.put("total", 0); |
| | | } |
| | | map.put("list", collect); |
| | | return AjaxResult.success(map); |
| | | } |
| | | |
| | | 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) { |
| | |
| | | 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) { |
| | | //已完成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())); |
| | | 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())); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | map.put("list", tjOrders); |
| | | map.put("total", orders.size()); |
| | | return AjaxResult.success(map); |
| | | } |
| | | |
| | | if(null !=zt){ |
| | | if(zt==3){ |
| | | wq.isNotNull(TjOrder::getCheckTime); |
| | | } |
| | | if(zt==4){ |
| | | wq.isNotNull(TjOrder::getReportTime); |
| | | } |
| | | if(zt==5){ |
| | | wq.eq(TjOrder::getHeshouStatus,1); |
| | | } |
| | | if(zt==6){ |
| | | wq.isNotNull(TjOrder::getPrintLastTime); |
| | | } |
| | | } |
| | | |
| | | wq.orderByDesc(TjOrder::getCreateTime); |
| | | Page<TjOrder> page2 = tjOrderService.page(page1, wq); |
| | | List<TjOrder> list = page2.getRecords(); |
| | |
| | | if (null != tjCustomer) { |
| | | order.setTjCustomerSex(tjCustomer.getCusSex()); |
| | | order.setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); |
| | | order.setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName())); |
| | | order.setTjCustomerName(tjCustomer.getCusName()); |
| | | order.setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone())); |
| | | // order.setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard())); |
| | | 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 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()); |
| | | 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 != dwDeptService.getById(order.getPacId())) { |
| | | order.setPacName(dwDeptService.getById(order.getPacId()).getDwDeptName()); |
| | | 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("已出报告"); |
| | | } |
| | | } |
| | | } |
| | |
| | | @ApiOperation(value = "体检报告页面——体检记录列表") |
| | | public AjaxResult getOrderListOO(@ApiParam(value = "页码数(默认1)") @RequestParam(defaultValue = "1") Integer pageNum, |
| | | @ApiParam(value = "显示条数(默认10)") @RequestParam(defaultValue = "10") Integer pageSize, |
| | | @ApiParam(value = "打印未打印状态 0未打印 1已打印") @RequestParam(defaultValue = "0") Integer dyzt, |
| | | @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 dw, |
| | | @ApiParam(value = "报告开始时间") @RequestParam(required = false) String djbeginTime, |
| | | @ApiParam(value = "报告结束时间") @RequestParam(required = false) String djendTime) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | if (null != name) { |
| | | List<Long> cusIds = null; |
| | | if (StringUtil.isNotBlank(name)) { |
| | | LambdaQueryWrapper<TjCustomer> wqq = new LambdaQueryWrapper<>(); |
| | | wqq.like(TjCustomer::getCusName, name); |
| | | List<TjCustomer> customerList = tjCustomerService.list(wqq); |
| | | if (null != customerList && customerList.size() > 0) { |
| | | List<TjOrder> list = new ArrayList<>(); |
| | | for (TjCustomer customer : customerList) { |
| | | LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>(); |
| | | wq.isNotNull(TjOrder::getReportTime); |
| | | wq.eq(TjOrder::getUserId, customer.getCusId()); |
| | | wq.eq(TjOrder::getHeshouStatus, 1); //核收状态为1才能打印 |
| | | list.addAll(tjOrderService.list(wq)); |
| | | } |
| | | List<TjOrder> collect = null; |
| | | if (list.size() > 0) { |
| | | |
| | | 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(MatchUtils.hideCusName(tjCustomer.getCusName())); |
| | | list.get(i).setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone())); |
| | | list.get(i).setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard())); |
| | | |
| | | 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()); |
| | | } |
| | | |
| | | } |
| | | collect = list.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | } |
| | | if (null != collect) { |
| | | map.put("total", collect.size()); |
| | | } else { |
| | | map.put("total", 0); |
| | | } |
| | | map.put("list", collect); |
| | | return AjaxResult.success(map); |
| | | } |
| | | cusIds = tjCustomerService.list(wqq).stream().map(TjCustomer::getCusId).collect(Collectors.toList()); |
| | | // if (null != customerList && !customerList.isEmpty()) { |
| | | // List<TjOrder> list = new ArrayList<>(); |
| | | // for (TjCustomer customer : customerList) { |
| | | // LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>(); |
| | | // wq.eq(TjOrder::getUserId, customer.getCusId()); |
| | | // if (dyzt == 0) { |
| | | // wq.isNull(TjOrder::getPrintLastTime); |
| | | // wq.eq(TjOrder::getHeshouStatus, 1); |
| | | // } else { |
| | | // wq.isNotNull(TjOrder::getPrintLastTime); |
| | | // } |
| | | // list.addAll(tjOrderService.list(wq)); |
| | | // } |
| | | // List<TjOrder> collect = null; |
| | | // if (!list.isEmpty()) { |
| | | // |
| | | // 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()); |
| | | // 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()); |
| | | // } |
| | | // } |
| | | // } |
| | | // collect = list.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | // } |
| | | // if (null != collect) { |
| | | // map.put("total", collect.size()); |
| | | // } else { |
| | | // map.put("total", 0); |
| | | // } |
| | | // if (collect == null) collect = new ArrayList<>(); |
| | | // map.put("list", collect); |
| | | // return AjaxResult.success(map); |
| | | // } |
| | | |
| | | } |
| | | // if (StringUtil.isNotBlank(dw)) { |
| | | // LambdaQueryWrapper<TjCustomer> wqq = new LambdaQueryWrapper<>(); |
| | | // wqq.like(TjCustomer::getCompName, dw); |
| | | // List<TjCustomer> customerList = tjCustomerService.list(wqq); |
| | | // List<TjOrder> list = new ArrayList<>(); |
| | | // if (null != customerList && !customerList.isEmpty()) { |
| | | // for (TjCustomer customer : customerList) { |
| | | // LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>(); |
| | | // wq.eq(TjOrder::getUserId, customer.getCusId()); |
| | | // if (dyzt == 0) { |
| | | // wq.isNull(TjOrder::getPrintLastTime); |
| | | // wq.eq(TjOrder::getHeshouStatus, 1); |
| | | // } else { |
| | | // wq.isNotNull(TjOrder::getPrintLastTime); |
| | | // } |
| | | // list.addAll(tjOrderService.list(wq)); |
| | | // } |
| | | // } |
| | | // List<String> dwIds = iDictCompService.getdwIdByDwName(dw); |
| | | // |
| | | // LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>(); |
| | | // wq.in(TjOrder::getFirmId, dwIds); |
| | | // list.addAll(tjOrderService.list(wq)); |
| | | // List<TjOrder> collect = null; |
| | | // if (!list.isEmpty()) { |
| | | // List<TjOrder> orders = list.stream().distinct().collect(Collectors.toList()); |
| | | // for (int i = 0; i < orders.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()); |
| | | // 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()); |
| | | // } |
| | | // } |
| | | // } |
| | | // collect = list.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); |
| | | // } |
| | | // if (null != collect) { |
| | | // map.put("total", collect.size()); |
| | | // } else { |
| | | // map.put("total", 0); |
| | | // } |
| | | // map.put("list", collect); |
| | | // return AjaxResult.success(map); |
| | | // |
| | | // |
| | | // } |
| | | |
| | | |
| | | Page<TjOrder> page1 = new Page<>(pageNum, pageSize); |
| | | 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 (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.eq(TjOrder::getTjNumber, tjNum); |
| | | wq.like(TjOrder::getTjNumber, tjNum); |
| | | } |
| | | wq.orderByDesc(TjOrder::getReportTime); |
| | | 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) { |
| | |
| | | } |
| | | 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).setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone())); |
| | | list.get(i).setTjCustomerName(tjCustomer.getCusName()); |
| | | list.get(i).setTjCustomerPhone(tjCustomer.getCusPhone()); |
| | | if (tjCustomer.getCusIdcard() != null) { |
| | | list.get(i).setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard())); |
| | | list.get(i).setTjCusIdCard(tjCustomer.getCusIdcard()); |
| | | } |
| | | |
| | | 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 != 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())) { |
| | |
| | | } |
| | | } |
| | | //从打印记录查出最新打印时间 |
| | | 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()); |
| | | } |
| | | // 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); |
| | |
| | | /** |
| | | * 体检签到登记接口 |
| | | */ |
| | | |
| | | |
| | | 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); |
| | |
| | | LambdaQueryWrapper<TjCustomer> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjCustomer::getCusId, tjOrder.getUserId()); |
| | | TjCustomer tjCustomer = tjCustomerService.getOne(wq); |
| | | if (tjCustomer == null) return AjaxResult.error("该客户未登记或不存在"); |
| | | 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()); |
| | | } |
| | | // 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("不可重复登记"); |
| | | } |
| | | TjFlowingWater tjFlowingWater = new TjFlowingWater(); |
| | | LambdaQueryWrapper<TjReservation> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.eq(TjReservation::getIdCard, tjCustomer.getCusIdcard()); |
| | | wq1.eq(TjReservation::getIsExpire, 2); |
| | | TjReservation tjReservation = tjReservationService.getOne(wq1); |
| | | MallOrder mallOrder = null; |
| | | if (tjReservation != null) { |
| | | 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("对不起您的预约已超时请重新预约"); |
| | | } |
| | | if (null != tjReservation.getTeamNo()) tjOrder.setTeamNo(tjReservation.getTeamNo()); |
| | | if (null != tjReservation.getCompanyId()) tjOrder.setFirmId(tjReservation.getCompanyId()); |
| | | // 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()); |
| | |
| | | tjOrder.setGroupId(tjReservation.getGroupingId()); |
| | | tjOrder.setFirmDeptId(tjReservation.getPacId()); |
| | | } |
| | | // if (null != tjReservation.getDepartmentId()) tjOrder.setFirmDeptId(tjReservation.getDepartmentId()); |
| | | tjReservation.setIsExpire(1); |
| | | tjReservationService.updateById(tjReservation); |
| | | if (null != tjReservation.getTeamNo()) { |
| | | if (null != tjReservation.getTeamNo() && tjOrder.getTjType().equals("1")) { |
| | | tjOrder.setTjType("1"); |
| | | } else { |
| | | } else if (tjOrder.getTjType().equals("2")) { |
| | | tjOrder.setTjType("2"); |
| | | } |
| | | } |
| | | //生成体检号 |
| | | String tjNumber = (SecurityUtils.getUsername() + new SimpleDateFormat("yyMMddHHmmss").format(new Date())); |
| | | tjOrder.setTjNumber(tjNumber); |
| | | |
| | | if (null != tjCustomer.getCompName()) { |
| | | tjOrder.setFirmName(tjCustomer.getCompName()); |
| | | } |
| | | if (null != tjCustomer.getDictCompId()) { |
| | | tjOrder.setFirmId(String.valueOf(tjCustomer.getDictCompId())); |
| | | } else { |
| | | tjOrder.setFirmId("0"); |
| | | } |
| | | |
| | | |
| | | if (null != tjOrder.getPhoto()) { |
| | | File file = new File(tjOrder.getPhoto()); |
| | | if (file.isFile()) { |
| | |
| | | tjOrder.setPhoto(encode); |
| | | } |
| | | } |
| | | if (tjOrder.getFirmId() == null) { |
| | | tjOrder.setFirmId("0"); |
| | | } |
| | | |
| | | |
| | | if (null == tjOrder.getPacId() && null != transitionService.getTbTransitionPacIdByCusIdAndPac(String.valueOf(tjOrder.getUserId()))) { |
| | | tjOrder.setPacId(transitionService.getTbTransitionPacIdByCusIdAndPac(String.valueOf(tjOrder.getUserId()))); |
| | | } |
| | |
| | | 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")) { |
| | | tjOrder.setFinishTime(new Date()); |
| | | tjOrder.setCheckStatus(1); |
| | | tjOrder.setStatus(TjConstants.TJ_WAIT); |
| | | // tjFlowingWater.setPayStasus(1L); |
| | | } |
| | | tjFlowingWater.setPayStasus(0L); |
| | | |
| | | try { |
| | | boolean b = lock.tryLock(3, TimeUnit.MINUTES); |
| | | if (b) { |
| | | AjaxResult result = processOrderWithTransaction(tjOrder, tjCustomer, tjReservation, tjFlowingWater, mallOrder, sysUser); |
| | | if (!result.get("code").toString().equals("200")) |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | tjOrderService.tjQiandaodengji(tjOrder.getTjNumber()); |
| | | return result; |
| | | } |
| | | } finally { |
| | | lock.unlock(); |
| | | } |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | @Transactional(propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED) |
| | | public AjaxResult processOrderWithTransaction(TjOrder tjOrder, TjCustomer tjCustomer, TjReservation tjReservation, TjFlowingWater tjFlowingWater, MallOrder mallOrder, SysUser sysUser) { |
| | | //生成体检号 |
| | | String tjNumber = (SecurityUtils.getUsername() + new SimpleDateFormat("yyMMddHHmmss").format(new Date())); |
| | | tjOrder.setTjNumber(tjNumber); |
| | | BigDecimal discount = BigDecimal.valueOf(Double.parseDouble(tjOrder.getTjFlowingWater().getDiscount())); |
| | | |
| | | tjOrder.setDiscount(discount.toString()); |
| | | if (tjOrderService.save(tjOrder)) { |
| | | //保存收货地址 |
| | | if ("2".equals(tjOrder.getGetType())) { |
| | |
| | | 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); |
| | |
| | | mallOrder.setOrderStatus(301L); |
| | | mallOrderService.updateById(mallOrder); |
| | | } |
| | | } |
| | | else { |
| | | } else { |
| | | tjFlowingWater.setCopeWith(tjOrder.getTjFlowingWater().getCopeWith()); |
| | | tjFlowingWater.setPaidIn(tjOrder.getTjFlowingWater().getPaidIn()); |
| | | tjFlowingWater.setDiscount(tjOrder.getTjFlowingWater().getDiscount()); |
| | | // tjFlowingWater.setPayStasus(0L); |
| | | // tjFlowingWater.setPayStasus(0L); |
| | | } |
| | | } |
| | | if (tjFlowingWaterService.save(tjFlowingWater)) { |
| | | tjOrder.setTjSerialNumber(String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | tjOrderService.updateById(tjOrder); |
| | | } |
| | | |
| | | //修改每项的原价现价 //修改临时表体检号 |
| | | transitionService.updateTbTransitionPriceByCusId(tjCustomer.getCusIdcard(), discount, tjOrder.getTjNumber()); |
| | | |
| | | /*调用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()); |
| | | } |
| | | |
| | | 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())); |
| | | } 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); |
| | | } |
| | | |
| | | //团体 |
| | | if ("1".equals(tjOrder.getTjType())) { |
| | | // asyncService.ttextracted(tjOrder, tjCustomer, sysUser, tjReservation, tjFlowingWater); |
| | | asyncService.ttextracted(tjOrder, tjCustomer, sysUser, tjReservation, tjFlowingWater); |
| | | } |
| | | //个人 |
| | | if ("2".equals(tjOrder.getTjType())) { |
| | | //asyncService.newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); |
| | | newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); |
| | | List<TjOrderDetail> detailList = tjOrderDetailService.getCaiYangDengJi(tjOrder.getOrderId()); |
| | | addCaiYangDengJi(detailList, !detailList.isEmpty(), tjOrder, sysUser, null); |
| | | } |
| | | // 查询 对接Lis、Pacs申请如果类型包含在配置内则使用对接lis、pacs |
| | | if (lisApiMethod.isUseLisAndPacsRegister(tjOrder)) { |
| | | // 这是上面个人方法引入数据 |
| | | tjFlowingWater.setPayStasus(1L); |
| | | newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater); |
| | | // AjaxResult ajaxResult = hisApiMethod.tijianshenqing(tjCustomer, DateUtil.format(date1, "yyyy-MM-dd HH:mm:ss"), tjOrder, sysUser, result); |
| | | // if (!ajaxResult.get("code").toString().equals("200")) return ajaxResult; |
| | | tjOrderDetailService.updateTjOrderDetailsByOrderId(String.valueOf(tjOrder.getOrderId()), |
| | | sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | |
| | | List<TjOrderDetail> detailList = tjOrderDetailService.getCaiYangDengJi(tjOrder.getOrderId()); |
| | | addCaiYangDengJi(detailList, !detailList.isEmpty(), tjOrder, sysUser, null); |
| | | |
| | | } |
| | | // pacsApiMethodService.OrderAdd(tjCustomer,tjOrder); |
| | | return AjaxResult.success(tjNumber); |
| | | } |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | public void addCaiYangDengJi(List<TjOrderDetail> detailList, boolean detailList1, TjOrder order, SysUser sysUser, String jxbz) { |
| | | if (null != detailList && detailList1) { |
| | | Date date = new Date(); |
| | | String format = DateUtil.format(date, "yyMMddHHmmssSSS"); |
| | | for (TjOrderDetail detail : detailList) { |
| | | TjSampling sampling = new TjSampling(); |
| | | if (null == projectService.getById(detail.getProId())) continue; |
| | | TjProject project = projectService.getById(detail.getProId()); |
| | | Long proParentId = project.getProParentId(); |
| | | String dictLabel = sysDictDataService.selectDictLabel("sys_dict_specimen", project.getSpecimenType()); |
| | | if (null != proParentId && proParentId == 0) { |
| | | sampling.setJyxh(idUtils.generateLisID()); |
| | | sampling.setSpecimenTypeCode(project.getSpecimenType()); |
| | | sampling.setSpecimenType(dictLabel); |
| | | sampling.setJyxmdm(project.getProId().toString()); |
| | | } else { |
| | | TjProject project1 = projectService.getById(proParentId); |
| | | sampling.setJyxh(idUtils.generateLisID()); |
| | | |
| | | sampling.setSpecimenTypeCode(project1.getSpecimenType()); |
| | | sampling.setSpecimenType(dictLabel); |
| | | sampling.setJyxmdm(project.getProId().toString()); |
| | | |
| | | } |
| | | sampling.setSamplingNumber(format); |
| | | sampling.setTjNum(order.getTjNumber()); |
| | | sampling.setCusId(String.valueOf(order.getUserId())); |
| | | if (tjCustomerService.getById(String.valueOf(order.getUserId())) != null) { |
| | | sampling.setCusName(tjCustomerService.getById(String.valueOf(order.getUserId())).getCusName()); |
| | | } |
| | | sampling.setApplicationTime(date); |
| | | sampling.setTjTime(order.getCreateTime()); |
| | | sampling.setProId(String.valueOf(detail.getProId())); |
| | | sampling.setProName(projectService.getById(detail.getProId()).getProName()); |
| | | sampling.setCreateBy(sysUser.getNickName()); |
| | | sampling.setCreateTime(date); |
| | | sampling.setUpdateBy(sysUser.getNickName()); |
| | | sampling.setUpdateTime(date); |
| | | sampling.setCreateId(String.valueOf(sysUser.getUserId())); |
| | | sampling.setUpdateId(String.valueOf(sysUser.getUserId())); |
| | | sampling.setJxbz(jxbz); |
| | | samplingService.save(sampling); |
| | | } |
| | | } |
| | | String config = configService.selectConfigByKey("sfkqdyhis"); |
| | | if (lisApiMethod.isUseLisAndPacsRegister(order) && (null != config && config.equals("Y"))) { |
| | | AjaxResult ajaxResult = lisApiMethod.getJyFlHb(); |
| | | if (ajaxResult.get("code").toString().equals("200")) { |
| | | String str = ajaxResult.get("data").toString(); |
| | | str = str.replace("=", ":"); |
| | | JSONArray array = JSONUtil.parseArray(str); |
| | | for (Object o : array) { |
| | | JSONObject object = (JSONObject) o; |
| | | LisJyflhb lisJyflhb = new LisJyflhb(); |
| | | lisJyflhb.setHbhxm(object.getStr("hbhxm")); |
| | | lisJyflhb.setFlmc(object.getStr("flmc")); |
| | | lisJyflhb.setMc(object.getStr("mc")); |
| | | lisJyflhb.setFlbm(object.getStr("flbm")); |
| | | LambdaQueryWrapper<LisJyflhb> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(LisJyflhb::getFlbm, lisJyflhb.getFlbm()); |
| | | LisJyflhb jyflhb = lisJyflhbService.getOne(wrapper); |
| | | if (jyflhb == null) { |
| | | lisJyflhb.setId(IdUtil.getSnowflake().nextId()); |
| | | lisJyflhbService.save(lisJyflhb); |
| | | } else { |
| | | lisJyflhb.setId(jyflhb.getId()); |
| | | lisJyflhbService.updateById(lisJyflhb); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //调用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(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @PostMapping("/addPlOrderAndDetail") |
| | | @ApiOperation(value = "体检批量签到登记接口") |
| | | @Transactional //(切换数据库出错,所以注释) |
| | | public AjaxResult addPlOrderAndDetail(@RequestBody QianDaoDto daoDto, HttpServletResponse response) { |
| | | SysUser sysUser = UserHoder.getLoginUser().getUser(); |
| | | List<String> cusIds = daoDto.getCusIds(); |
| | | ArrayList<String> tjNumbers = 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); |
| | | } |
| | | }); |
| | | } |
| | | 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.isEmpty()) { |
| | | // ExecutorService threadPool = Executors.newFixedThreadPool(list.size()); |
| | | ThreadPoolTaskExecutor executor = threadPoolConfig.threadPoolTaskExecutor(); |
| | | for (Long aLong : list) { |
| | | // threadPool.execute(new Runnable() { |
| | | // @Override |
| | | // public void run() { |
| | | // try { |
| | | // AjaxResult result = getAjaxResult(aLong, sysUser, daoDto.getTjCategory()); |
| | | // threadPool.shutdown(); |
| | | // } catch (IOException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | // } |
| | | // |
| | | // } |
| | | // } |
| | | tjCustomer.setCardId("0"); |
| | | tjCustomerService.updateById(tjCustomer); |
| | | return AjaxResult.success(tjNumber); |
| | | // }); |
| | | Future<AjaxResult> future = executor.submit(new Callable<AjaxResult>() { |
| | | @Override |
| | | public AjaxResult call() throws Exception { |
| | | return getAjaxResult(aLong, sysUser, daoDto.getTjCategory()); |
| | | } |
| | | }); |
| | | try { |
| | | AjaxResult result = future.get(); |
| | | String tjNumber = result.get("tjNumber").toString(); |
| | | tjNumbers.add(tjNumber); |
| | | } catch (InterruptedException | ExecutionException e) { |
| | | 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(); |
| | | } |
| | | } |
| | | 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(); |
| | | } |
| | | return AjaxResult.success("操作成功"); |
| | | } |
| | | |
| | | private void getAjaxResults(String cusIdcard) { |
| | | if (!"".equals(cusIdcard) && cusIdcard != null) { |
| | | //根据配置调取存储过程 将临时表数据存入预约表2023.12.12 |
| | | final String getInfoFromSqlData = configService.selectConfigByKey("getInfoFromSqlData"); |
| | | if ("Y".equals(getInfoFromSqlData)) { |
| | | //根据身份证号从his查信息 |
| | | LtkjTjPat tjPatByIdCard = testMapper.getTjPatByIdCard(cusIdcard); |
| | | if (null != tjPatByIdCard) { |
| | | String fcardNo = tjPatByIdCard.getFcardNo(); |
| | | if (null != fcardNo && !fcardNo.equals("")) { |
| | | fcardNo = fcardNo.trim(); |
| | | tjPatByIdCard.setFcardNo(fcardNo); |
| | | } else { |
| | | fcardNo = cusIdcard.trim(); |
| | | tjPatByIdCard.setFcardNo(fcardNo); |
| | | } |
| | | //根据身份证号从数据库拿信息 没有的话保存 |
| | | LtkjTjPat ltkjTjPat = tjvLtkjvtjpatService.getLtkjTjPatByCusIdCard(cusIdcard); |
| | | if (null == ltkjTjPat) { |
| | | tjvLtkjvtjpatService.save(tjPatByIdCard); |
| | | } |
| | | DynamicDataSourceContextHolder.clearDataSourceType(); |
| | | //再根据身份证号写customer表 |
| | | TjCustomer tjCustomer = tjCustomerService.getTjCustomerByCusIdCard(tjPatByIdCard.getFcardNo()); |
| | | if (null == tjCustomer) { |
| | | //为空的话掉存储过程保存到客户表 |
| | | testMapper.getTjPatByCusId(cusIdcard); |
| | | LambdaQueryWrapper<TjCustomer> qw = new LambdaQueryWrapper<>(); |
| | | qw.eq(TjCustomer::getCusIdcard, tjPatByIdCard.getFcardNo()); |
| | | TjCustomer customer = tjCustomerService.getOne(qw); |
| | | customer.setReservationId(customer.getCardId()); |
| | | extracteds(customer); |
| | | } else { |
| | | String cardId = tjPatByIdCard.getFcardId(); |
| | | if (null != cardId && !cardId.equals("0")) { |
| | | int i = tjOrderService.selectTjOrderByCardId(cardId); |
| | | if (i > 0) { |
| | | // return AjaxResult.error("不可重复签到"); |
| | | } |
| | | } |
| | | tjCustomer.setReservationId(tjCustomer.getCardId()); |
| | | tjCustomer.setCardId(tjPatByIdCard.getFcardId()); |
| | | tjCustomerService.updateById(tjCustomer); |
| | | extracteds(tjCustomer); |
| | | } |
| | | |
| | | } |
| | | } |
| | | //end====2023.12.12 |
| | | LambdaQueryWrapper<TjReservation> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjReservation::getIdCard, cusIdcard); |
| | | wq.eq(TjReservation::getIsExpire, 2); |
| | | TjReservation tjReservation = tjReservationService.getOne(wq); |
| | | if (tjReservation != null) { |
| | | /* if (DateUtil.endOfDay(new Date()).before(tjReservation.getReservationTime())) { |
| | | // return AjaxResult.error("未到预约时间"); |
| | | } |
| | | if (null != tjReservation.getReservationTime() && DateUtil.endOfDay(tjReservation.getReservationTime()).before(new Date())) { |
| | | tjReservation.setIsExpire(1); |
| | | 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); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | private void extracteds(TjCustomer customer) { |
| | | //从his表抓数据 |
| | | LtkjMiddleHead pat = testMapper.getMiddleHeadByPartId(customer.getCardId()); |
| | | if (null != pat) { |
| | | LambdaQueryWrapper<LtkjMiddleHead> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.eq(LtkjMiddleHead::getFeadId, customer.getCardId()); |
| | | headService.remove(wq1); |
| | | LambdaQueryWrapper<LtkjMiddleDetail> wq0 = new LambdaQueryWrapper<>(); |
| | | wq0.eq(LtkjMiddleDetail::getFheadId, pat.getFeadId()); |
| | | middleDetailService.remove(wq0); |
| | | List<LtkjMiddleDetail> list = testMapper.getMiddleDetailByFeadId(pat.getFeadId()); |
| | | DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name()); |
| | | LtkjMiddleHead o = headService.getMiddleHeadByPartId(customer.getCardId()); |
| | | if (o == null) { |
| | | headService.save(pat); |
| | | for (LtkjMiddleDetail ltkjMiddleDetail : list) { |
| | | middleDetailService.save(ltkjMiddleDetail); |
| | | } |
| | | } |
| | | testMapper.saveTjProByCusId(customer.getCardId(), customer.getCusIdcard()); |
| | | } |
| | | DynamicDataSourceContextHolder.clearDataSourceType(); |
| | | } |
| | | |
| | | private 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); |
| | | tjOrder.setUpdateTime(date); |
| | | tjOrder.setCreateBy(sysUser.getNickName()); |
| | | tjOrder.setUpdateBy(sysUser.getNickName()); |
| | | tjOrder.setUserId(userId); |
| | | tjOrder.setTjCategory(tjCategory); |
| | | LambdaQueryWrapper<TjReservation> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.eq(TjReservation::getIdCard, tjCustomer.getCusIdcard()); |
| | | wq1.eq(TjReservation::getIsExpire, 2); |
| | | TjReservation tjReservation = tjReservationService.getOne(wq1); |
| | | MallOrder mallOrder = null; |
| | | 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 (null != tjReservation.getTeamNo()) tjOrder.setTeamNo(tjReservation.getTeamNo()); |
| | | if (null != tjReservation.getCompanyId()) tjOrder.setFirmId(tjReservation.getCompanyId()); |
| | | 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()) { |
| | | tjOrder.setGroupId(tjReservation.getGroupingId()); |
| | | tjOrder.setFirmDeptId(tjReservation.getPacId()); |
| | | } |
| | | tjReservation.setIsExpire(1); |
| | | tjReservationService.updateById(tjReservation); |
| | | |
| | | //生成体检号 |
| | | String tjNumber = (sysUser.getUserName() + new SimpleDateFormat("yyMMddHHmmss").format(new Date())); |
| | | |
| | | tjNumber = tjNumber.replaceAll(".{4}$", userId.toString().substring(userId.toString().length() - 4)); |
| | | |
| | | tjOrder.setTjNumber(tjNumber); |
| | | if (null != tjOrder.getPhoto()) { |
| | | File file = new File(tjOrder.getPhoto()); |
| | | if (file.isFile()) { |
| | | FileInputStream fileInputStream = new FileInputStream(file); |
| | | byte[] bytes = new byte[fileInputStream.available()]; |
| | | fileInputStream.read(bytes); // 读取到 byte 里面 |
| | | fileInputStream.close(); |
| | | // 得到文件 之后转成beye 然后使用base64转码 |
| | | String encode = Base64.encode(bytes); |
| | | tjOrder.setPhoto(encode); |
| | | } |
| | | } |
| | | if (tjOrder.getFirmId() == null) { |
| | | tjOrder.setFirmId("0"); |
| | | } |
| | | if (null == tjOrder.getPacId() && null != transitionService.getTbTransitionPacIdByCusIdAndPac(String.valueOf(tjOrder.getUserId()))) { |
| | | tjOrder.setPacId(transitionService.getTbTransitionPacIdByCusIdAndPac(String.valueOf(tjOrder.getUserId()))); |
| | | } |
| | | //判断小程序上预约是否付钱 |
| | | if (null != mallOrder) tjOrder.setMallOrderId(String.valueOf(mallOrder.getId())); |
| | | tjOrder.setStatus(TjConstants.TJ_BEGIN); |
| | | tjOrder.setCardId(tjCustomer.getCardId()); |
| | | tjOrder.setTjType("1"); |
| | | |
| | | if (tjOrderService.save(tjOrder)) { |
| | | |
| | | //保存收货地址 |
| | | 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 (tjReservation.getPayType() == 1) { |
| | | tjFlowingWater.setPayStasus(3L); |
| | | } |
| | | } |
| | | |
| | | //调用SQL server拿取收费情况 |
| | | //根据配置调取存储过程 将临时表数据存入预约表2023.12.12 |
| | | String getInfoFromSqlData = configService.selectConfigByKey("getInfoFromSqlData"); |
| | | 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 = sysUser.getUserName() + new SimpleDateFormat("yyMMddHHmmssSSS").format(date1); |
| | | tjFlowingWater.setWaterId(PinyinUtil.getFirstLetter(tjCustomer.getCusName(), "").toUpperCase() + s1); |
| | | |
| | | 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 (tjFlowingWaterService.save(tjFlowingWater)) { |
| | | tjOrder.setTjSerialNumber(String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | tjOrderService.updateById(tjOrder); |
| | | |
| | | |
| | | } |
| | | asyncService.ttextracted(tjOrder, tjCustomer, sysUser, tjReservation, tjFlowingWater); |
| | | |
| | | |
| | | tjCustomer.setCardId("0"); |
| | | tjCustomerService.updateById(tjCustomer); |
| | | return AjaxResult.success().put("tjNumber", tjNumber); |
| | | } |
| | | } |
| | | return AjaxResult.error(); |
| | | } |
| | |
| | | if (null != tjCustomer) { |
| | | cardId = tjCustomer.getCardId(); |
| | | } |
| | | if ((null == proIds || proIds.size() == 0) && (null == packId || packId.equals(""))) { |
| | | if ((null == proIds || proIds.isEmpty()) && (null == packId || packId.equals(""))) { |
| | | transitionService.deletedTbTransitionByCusId(cusId); |
| | | if (redisCache.hasKey(cardId + cusId)) { |
| | | redisCache.deleteObject(cardId + cusId); |
| | |
| | | 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) { |
| | | //异步保存数据库 |
| | | // asyncService.addRedisTransitionPac(cusId, pacId, ppList); |
| | | asyncService.saveRedisTransitionByPacId(cusId, 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()) { |
| | | String string = transitionService.panduantaocanshifouchongfu(cusId, pacId); |
| | | if (!StringUtils.isBlank(string)) { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error("操作失败! 以下项目已存在: " + string); |
| | | } |
| | | transitionService.saveRedisTransitionByPacId(cusId, cardId, pacId); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //单项 |
| | | if (null != proIds && proIds.size() > 0) { |
| | | if (null != proIds && !proIds.isEmpty()) { |
| | | //异步保存数据库表 |
| | | asyncService.saveRedisTransitionByPacId(cusId, null, proIds); |
| | | 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)); |
| | | 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); |
| | | } |
| | | 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)); |
| | | } |
| | | } |
| | | return AjaxResult.success(); |
| | |
| | | for (TjOrder order : list) { |
| | | TjCustomer tjCustomer = tjCustomerService.getById(order.getUserId()); |
| | | if (null != tjCustomer) { |
| | | order.setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName())); |
| | | order.setTjCustomerName(tjCustomer.getCusName()); |
| | | order.setTjCustomerSex(tjCustomer.getCusSex()); |
| | | order.setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); |
| | | order.setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone())); |
| | |
| | | for (TjOrder order : list) { |
| | | TjCustomer tjCustomer = tjCustomerService.getById(order.getUserId()); |
| | | if (null != tjCustomer) { |
| | | order.setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName())); |
| | | order.setTjCustomerName(tjCustomer.getCusName()); |
| | | order.setTjCustomerSex(tjCustomer.getCusSex()); |
| | | order.setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday())); |
| | | order.setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone())); |
| | |
| | | */ |
| | | @PostMapping("/tjGoOut") |
| | | @ApiOperation(value = "体检签离") |
| | | @Transactional |
| | | public AjaxResult tjGoOut(@RequestBody Map<String, Object> map) { |
| | | Long userId = Long.valueOf(SecurityUtils.getLoginUser().getUserId()); |
| | | SysUser sysUser = userService.getById(userId); |
| | |
| | | String jsonString = com.alibaba.fastjson.JSON.toJSONString(domainVos1); |
| | | List<QjDomainVo> domainVos = com.alibaba.fastjson.JSON.parseArray(jsonString, QjDomainVo.class); |
| | | String tjNumber = map.get("tjNumber").toString(); |
| | | TjOrder tjOrder = tjOrderService.getOrderByTjNum(tjNumber); |
| | | if (null != domainVos && domainVos.size() > 0) { |
| | | Set<String> list = new HashSet<>(); |
| | | for (QjDomainVo domainVo : domainVos) { |
| | |
| | | if (domainVo.getType() == 3) { |
| | | list.add(String.valueOf(domainVo.getTjNumber())); |
| | | } else { |
| | | TjOrder tjOrder = tjOrderService.getOrderByTjNum(remark.getTjNumber()); |
| | | if (null != tjOrder) { |
| | | tjOrder.setFinishTime(new Date()); |
| | | tjOrder.setStatus(TjConstants.TJ_CONFIRM); |
| | |
| | | } |
| | | } |
| | | } |
| | | remarkService.updateRemark(tjNumber); |
| | | asyncService.tjGoutAsync(domainVos, sysUser, list); |
| | | |
| | | TjCustomer customer = tjCustomerService.selectTjCustomerByCusId(tjOrder.getUserId()); |
| | | customer.setCardId("0"); |
| | | tjCustomerService.updateById(customer); |
| | | /* 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(); |
| | | dto.setHisRegistrationId(tjOrder.getCardId()); |
| | | dto.setMzzdid(1); |
| | | dto.setSqysbm("00029"); |
| | | dto.setMzksbm("0101"); |
| | | dto.setFbrq(date); |
| | | dto.setZdrq(date); |
| | | dto.setCzybm("00029"); |
| | | dto.setCzyksbm("0101"); |
| | | dto.setZs("健康查体"); |
| | | dto.setBs("不详"); |
| | | dto.setClyz(""); |
| | | dto.setJws(""); |
| | | dto.setTgjc(""); |
| | | dto.setGms(""); |
| | | dto.setJbbm("Z00.001"); |
| | | dto.setJbbm1(""); |
| | | dto.setJbbm2(""); |
| | | dto.setFzbz("1"); |
| | | dto.setHzqx("6"); |
| | | dto.setSfqc("0"); |
| | | dto.setQchs(""); |
| | | dto.setSfqj("0"); |
| | | dto.setJzqk(9); |
| | | controller.Outpinimpapply(dto); |
| | | }*/ |
| | | return AjaxResult.success("签离成功!"); |
| | | } else { |
| | | remarkService.updateRemark(tjNumber); |
| | | return getAjaxResult(tjNumber); |
| | | } |
| | | } |
| | |
| | | */ |
| | | @GetMapping("/goOut") |
| | | @ApiOperation(value = "签离") |
| | | @Transactional |
| | | public AjaxResult goOut(@RequestParam @ApiParam(value = "体检号") String tjNumber) { |
| | | return getAjaxResult(tjNumber); |
| | | } |
| | |
| | | if (!handleOption.isCanship()) { |
| | | return AjaxResult.error("订单不能核销"); |
| | | } |
| | | Date date = new Date(); |
| | | order.setOrderStatus(OrderUtil.STATUS_SHIP.longValue()); |
| | | order.setShipTime(new Date()); |
| | | order.setConfirmTime(new Date()); |
| | | order.setShipTime(date); |
| | | order.setConfirmTime(date); |
| | | |
| | | MallCheckLog checkLog = new MallCheckLog(); |
| | | String s1 = SecurityUtils.getUsername() + new SimpleDateFormat("yyMMddHHmmssSSS").format(new Date()); |
| | | String s1 = SecurityUtils.getUsername() + new SimpleDateFormat("yyMMddHHmmssSSS").format(date); |
| | | checkLog.setCheckBy(String.valueOf(SecurityUtils.getUserId())); |
| | | checkLog.setUserId(order.getUserId()); |
| | | checkLog.setConsignee(order.getConsignee()); |
| | | checkLog.setIdCard(order.getIdCard()); |
| | | checkLog.setOrderId(String.valueOf(order.getId())); |
| | | checkLog.setOrderSn(order.getOrderSn()); |
| | | checkLog.setCheckTime(new Date()); |
| | | checkLog.setCheckTime(date); |
| | | checkLog.setShipSn("HX" + s1); |
| | | mallCheckLogService.save(checkLog); |
| | | mallOrderService.updateById(order); |
| | |
| | | // if (redisCache.hasKey(cardId + cusId)) { |
| | | // transitionList = redisCache.getCacheList(cardId + cusId); |
| | | // } else { |
| | | transitionList = transitionService.getTbTransitionListByCusId(cusId, cardId); |
| | | transitionList = transitionService.getTbTransitionListByCusId(cusId, cardId); |
| | | // } |
| | | if (null == transitionList) return null; |
| | | Map<Long, List<TbTransition>> collect = transitionList.stream().collect(Collectors.groupingBy(TbTransition::getParentProId)); |
| | |
| | | for (Map.Entry<Long, List<TbTransition>> entry : collect.entrySet()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | Long pacId = entry.getValue().get(0).getPacId(); |
| | | 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("pacName", aPackage.getPacName()); |
| | | TjProject tjProject = projectService.getById(entry.getKey()); |
| | | TjPackageProject project = tjPackageProjectService.getOne(new LambdaQueryWrapper<TjPackageProject>().eq(TjPackageProject::getPacId, pacId) |
| | | .eq(TjPackageProject::getProId, entry.getKey())); |
| | | // TjPackageProject project = tjPackageProjectService.getOne(new LambdaQueryWrapper<TjPackageProject>().eq(TjPackageProject::getPacId, pacId) |
| | | // .eq(TjPackageProject::getProId, entry.getKey())); |
| | | map.put("ordPrice", tjProject.getProPrice()); |
| | | if (null != project) { |
| | | map.put("nowPrice", project.getPriceNow()); |
| | | } else { |
| | | map.put("nowPrice", tjProject.getProPrice()); |
| | | } |
| | | // if (null != project) { |
| | | // map.put("nowPrice", project.getPriceNow()); |
| | | // } else { |
| | | // map.put("nowPrice", tjProject.getProPrice()); |
| | | // } |
| | | map.put("nowPrice", transitionService.getTbTransitionDxPriceByPac(cusId, entry.getKey(), cardId, pacId)); |
| | | } else { |
| | | map.put("tjCategory", null); |
| | | map.put("pacName", "单项"); |
| | | List<TbTransition> tbTransitionList = entry.getValue(); |
| | | if (null != tbTransitionList && tbTransitionList.size() > 0) { |
| | |
| | | } |
| | | map.put("parentName", projectService.getById(entry.getKey()).getProName()); |
| | | map.put("list", entry.getValue()); |
| | | list.add(map); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | private List<Map<String, Object>> getMap(String cusId, String cardId, List<TbTransition> transitionList) { |
| | | |
| | | // List<TbTransition> transitionList = null; |
| | | // if (redisCache.hasKey(cardId + cusId)) { |
| | | // transitionList = redisCache.getCacheList(cardId + cusId); |
| | | // } else { |
| | | // transitionList = transitionService.getTbTransitionListByCusId(cusId, cardId); |
| | | // } |
| | | if (null == transitionList) return null; |
| | | Map<Long, List<TbTransition>> collect = transitionList.stream().collect(Collectors.groupingBy(TbTransition::getParentProId)); |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (Map.Entry<Long, List<TbTransition>> entry : collect.entrySet()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | Long pacId = entry.getValue().get(0).getPacId(); |
| | | 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("pacName", aPackage.getPacName()); |
| | | TjProject tjProject = projectService.getById(entry.getKey()); |
| | | // TjPackageProject project = tjPackageProjectService.getOne(new LambdaQueryWrapper<TjPackageProject>().eq(TjPackageProject::getPacId, pacId) |
| | | // .eq(TjPackageProject::getProId, entry.getKey())); |
| | | map.put("ordPrice", tjProject.getProPrice()); |
| | | // if (null != project) { |
| | | // map.put("nowPrice", project.getPriceNow()); |
| | | // } else { |
| | | // map.put("nowPrice", tjProject.getProPrice()); |
| | | // } |
| | | map.put("nowPrice", tjProject.getProPrice()); |
| | | } else { |
| | | map.put("tjCategory", null); |
| | | map.put("pacName", "单项"); |
| | | List<TbTransition> tbTransitionList = entry.getValue(); |
| | | if (null != tbTransitionList && tbTransitionList.size() > 0) { |
| | | BigDecimal money1 = new BigDecimal("0.00"); |
| | | BigDecimal money2 = new BigDecimal("0.00"); |
| | | for (TbTransition tbTransition : tbTransitionList) { |
| | | money1 = money1.add(tbTransition.getOrdPrice()); |
| | | money2 = money2.add(tbTransition.getNowPrice()); |
| | | } |
| | | map.put("ordPrice", money1); |
| | | map.put("nowPrice", money2); |
| | | } |
| | | } |
| | | map.put("parentName", projectService.getById(entry.getKey()).getProName()); |
| | | map.put("list", entry.getValue()); |
| | | list.add(map); |
| | | } |
| | | return list; |
| | |
| | | LambdaQueryWrapper<TjOrder> wq0 = new LambdaQueryWrapper<>(); |
| | | wq0.eq(TjOrder::getTjNumber, tjNumber); |
| | | TjOrder tjOrder = tjOrderService.getOne(wq0); |
| | | |
| | | if (null != tjOrder) { |
| | | TjCustomer customer = tjCustomerService.selectTjCustomerByCusId(tjOrder.getUserId()); |
| | | customer.setCardId("0"); |
| | | tjCustomerService.updateById(customer); |
| | | |
| | | LambdaQueryWrapper<TjOrderDetail> wq11 = new LambdaQueryWrapper<>(); |
| | | wq11.eq(TjOrderDetail::getOrderId, tjOrder.getOrderId()); |
| | | wq11.eq(TjOrderDetail::getTjStatus, 0); |
| | | wq11.isNotNull(TjOrderDetail::getFlowingWaterId); |
| | | List<TjOrderDetail> list = tjOrderDetailService.list(wq11); |
| | | |
| | | if (list != null) { |
| | | Long userId = Long.valueOf(SecurityUtils.getLoginUser().getUserId()); |
| | | SysUser sysUser = userService.getById(userId); |
| | |
| | | return AjaxResult.success(transitionService.remove(wq)); |
| | | } |
| | | |
| | | @GetMapping("/getTransitionInfo") |
| | | @ApiOperation(value = "根据体检号获取汇总和明细的数据") |
| | | 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) |
| | | .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); |
| | | 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()); |
| | | SysDept dept = sysDeptService.getOne(queryWrapper); |
| | | for (TbTransition tbTransition : list) { |
| | | 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()); |
| | | huiZong.add(obj); |
| | | } |
| | | } |
| | | } |
| | | wrapper = new QueryWrapper<>(); |
| | | 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()); |
| | | BigDecimal ordPrice = tbTransition.getOrdPrice(); |
| | | obj.putOpt("zongjia", ordPrice); |
| | | QueryWrapper<TjProject> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("pro_id", tbTransition.getProId()); |
| | | TjProject tjProject = projectService.getOne(queryWrapper); |
| | | Integer num = tjProject.getSl(); |
| | | obj.putOpt("num", num); |
| | | BigDecimal price = ordPrice.divide(new BigDecimal(num)); |
| | | obj.putOpt("danjia", price); |
| | | Date createTime = tbTransition.getCreateTime(); |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | 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); |
| | | } |
| | | |
| | | |
| | | 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())); |
| | | tjOrderDetailService.saveTjOrderDetailsByCusId(tjCustomer.getCusIdcard(), String.valueOf(tjOrder.getOrderId()), sysUser.getNickName(), String.valueOf(sysUser.getUserId())); |
| | | tjOrderDetailService.saveTjPureToneTesByCusId(tjCustomer.getCusIdcard(), tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId())); |
| | | //修改每项的原价现价 //修改临时表体检号 |
| | | // transitionService.updateTbTransitionPriceByCusId(tjCustomer.getCusIdcard(), discount, tjOrder.getTjNumber()); |
| | | 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()); |
| | | |
| | | //添加remark表数据 |
| | | remarkService.saveTjOrderRemarkByOrderId(tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjOrder.getOrderId())); |
| | | 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())); |
| | | |
| | | } |
| | | //判断是否交钱 |
| | | if ("1".equals(tjOrder.getTjType())) { |
| | | if (null != tjReservation && tjReservation.getPayType() == 1) { |
| | |
| | | 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("这段代码时间" + (System.currentTimeMillis() - l)); |
| | | } |
| | | |
| | | |
| | | public void ttextracted(TjOrder tjOrder, TjCustomer tjCustomer, SysUser sysUser, TjReservation tjReservation, TjFlowingWater tjFlowingWater) { |
| | | |
| | | tjAskMedicalHistoryService.updateTjAskMedicalHistoryByCusId(tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjCustomer.getCusId())); |
| | | boolean b = tjOrderDetailService.saveTjOrderDetailsByCusId(tjCustomer.getCusIdcard(), String.valueOf(tjOrder.getOrderId()), sysUser.getNickName(), |
| | | String.valueOf(sysUser.getUserId()), tjOrder.getCardId()); |
| | | if (!b) { |
| | | List<TjGroupingPro> proList = groupingProService.list(new LambdaQueryWrapper<TjGroupingPro>().eq(TjGroupingPro::getGroupingId, tjOrder.getGroupId())); |
| | | if (null != proList && !proList.isEmpty()) { |
| | | for (TjGroupingPro groupingPro : proList) { |
| | | TjOrderDetail detail = new TjOrderDetail(); |
| | | TjProject tjProject = projectService.selectTjProjectByProId(Long.valueOf(groupingPro.getProId())); |
| | | detail.setIsSampling(String.valueOf(tjProject.getIsSampling())); |
| | | detail.setOrderId(tjOrder.getOrderId()); |
| | | detail.setProId(Long.valueOf(groupingPro.getProId())); |
| | | detail.setTjStatus(0L); |
| | | detail.setCreateBy(sysUser.getNickName()); |
| | | detail.setCreateTime(new Date()); |
| | | detail.setUpdateBy(sysUser.getNickName()); |
| | | detail.setUpdateTime(new Date()); |
| | | detail.setCreateId(String.valueOf(sysUser.getUserId())); |
| | | detail.setUpdateId(String.valueOf(sysUser.getUserId())); |
| | | tjOrderDetailService.save(detail); |
| | | } |
| | | List<String> list = proList.stream().map(TjGroupingPro::getProId).collect(Collectors.toList()); |
| | | List<TjProject> projectList = projectService.list(new LambdaQueryWrapper<TjProject>().in(TjProject::getProParentId, list)); |
| | | for (TjProject project : projectList) { |
| | | TjOrderDetail detail = new TjOrderDetail(); |
| | | detail.setOrderId(tjOrder.getOrderId()); |
| | | detail.setProId(project.getProId()); |
| | | detail.setTjStatus(0L); |
| | | detail.setCreateBy(sysUser.getNickName()); |
| | | detail.setCreateTime(new Date()); |
| | | detail.setUpdateBy(sysUser.getNickName()); |
| | | detail.setUpdateTime(new Date()); |
| | | detail.setCreateId(String.valueOf(sysUser.getUserId())); |
| | | detail.setUpdateId(String.valueOf(sysUser.getUserId())); |
| | | //获取该项目的默认值赋值给结果 |
| | | if (null != project.getProDefault()) { |
| | | detail.setProResult(project.getProDefault()); |
| | | } else { |
| | | detail.setProResult(null); |
| | | } |
| | | detail.setIsSampling(String.valueOf(project.getIsSampling())); |
| | | |
| | | tjOrderDetailService.save(detail); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //添加remark表数据 |
| | | remarkService.saveTjOrderRemarkByOrderId(tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjOrder.getOrderId())); |
| | | |
| | | //判断是否交钱 |
| | | if ("1".equals(tjOrder.getTjType())) { |
| | | if (null != tjReservation && tjReservation.getPayType() == 1) { |
| | | tjOrderDetailService.updateTjOrderDetailsByOrderId(String.valueOf(tjOrder.getOrderId()), |
| | | sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | } |
| | | } |
| | | if (tjFlowingWater.getPayStasus() == 1) { |
| | | tjOrderDetailService.updateTjOrderDetailsByOrderId(String.valueOf(tjOrder.getOrderId()), |
| | | sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | } |
| | | if (tjFlowingWater.getDiscount() == null) { |
| | | transitionService.updateTbTransitionPriceByCusId(tjCustomer.getCusIdcard(), new BigDecimal(10), tjOrder.getTjNumber()); |
| | | } else { |
| | | transitionService.updateTbTransitionPriceByCusId(tjCustomer.getCusIdcard(), BigDecimal.valueOf(Long.parseLong(tjFlowingWater.getDiscount())), tjOrder.getTjNumber()); |
| | | } |
| | | |
| | | tjOrderDetailService.saveTjPureToneTesByCusId(tjCustomer.getCusIdcard(), tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), tjOrder.getCardId()); |
| | | // List<TjOrderDetail> list = tjOrderDetailService.getTjOrderDetailsByOrderId(String.valueOf(tjOrder.getOrderId())); |
| | | // if (list != null) { |
| | | // for (TjOrderDetail tjOrderDetail : list) { |
| | | // TjProject tjProject = projectService.getById(tjOrderDetail.getProId()); |
| | | // if(tjProject==null){ |
| | | // continue; |
| | | // } |
| | | // tjOrderDetail.setProject(tjProject); |
| | | // if (tjProject.getProParentId() == 0) { |
| | | // TjOrderRemark tjOrderRemark = new TjOrderRemark(); |
| | | // tjOrderRemark.setProId(tjProject.getProId()); |
| | | // tjOrderRemark.setProName(tjProject.getProName()); |
| | | // tjOrderRemark.setDeptId(tjProject.getDeptId()); |
| | | // tjOrderRemark.setTjNumber(tjOrder.getTjNumber()); |
| | | // tjOrderRemark.setCreateBy(sysUser.getNickName()); |
| | | // tjOrderRemark.setCreateTime(new Date()); |
| | | // tjOrderRemark.setUpdateBy(sysUser.getNickName()); |
| | | // tjOrderRemark.setUpdateTime(new Date()); |
| | | // tjOrderRemark.setCreateId(String.valueOf(sysUser.getUserId())); |
| | | // tjOrderRemark.setUpdateId(String.valueOf(sysUser.getUserId())); |
| | | // orderRemarkService.save(tjOrderRemark); |
| | | // } |
| | | // if ("1".equals(tjOrder.getTjType())) { |
| | | // if (null != tjReservation && tjReservation.getPayType() == 1) { |
| | | // tjOrderDetail.setFlowingWaterId(String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | // } |
| | | // } |
| | | // if(tjFlowingWater.getPayStasus()==1){ |
| | | // tjOrderDetail.setFlowingWaterId(String.valueOf(tjFlowingWater.getTjSerialNumber())); |
| | | // } |
| | | // tjOrderDetailService.updateById(tjOrderDetail); |
| | | // } |
| | | // } |
| | | } |
| | | |
| | | @PostMapping("/heXiaoByIds/{orderIds}") |
| | | @ApiOperation(value = "核收报告——————总检审核通过后可以核销,核收后才能打印") |
| | | @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); |
| | | LambdaQueryWrapper<TjReportTemplate> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(TjReportTemplate::getFlag, "4"); |
| | | wrapper.eq(TjReportTemplate::getOpen, "1"); |
| | | TjReportTemplate zongJianYiShiQianMing = reportTemplateService.getOne(wrapper); |
| | | try { |
| | | shengchengbgmoban(byId.getTjNumber(), byId, tjCustomer, reportTemplate, zongJianYiShiQianMing); |
| | | 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, TjReportTemplate zongJianYiShiQianMing) throws Exception { |
| | | // AjaxResult ajaxResult = hisPDFUtil.hisPDF(tjOrder, tjCustomer, reportTemplate); |
| | | // AjaxResult ajaxResult = hisPDFUtil.hisPDFNew(tjOrder, tjCustomer, reportTemplate); |
| | | AjaxResult ajaxResult = hisPDFUtil.hisPDFNew2(tjOrder, tjCustomer, reportTemplate, zongJianYiShiQianMing); |
| | | 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 + File.separator; |
| | | 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") |
| | |
| | | final List<TjFlowingWater> list1 = tjFlowingWaterService.list(wqq); |
| | | if (list1 != null) { |
| | | for (TjFlowingWater tjFlowingWater : list1) { |
| | | if (tjFlowingWater!=null && tjFlowingWater.getPaidIn()!=null){ |
| | | if (tjFlowingWater != null && tjFlowingWater.getPaidIn() != null) { |
| | | res.add(tjFlowingWater.getPaidIn()); |
| | | } |
| | | } |
| | |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/revokeTjOrderByTjNum") |
| | | @ApiOperation(value = "根据客户体检号撤销体检记录") |
| | | @Transactional |
| | | public AjaxResult revokeTjOrderByTjNum(@RequestParam @ApiParam(value = "体检号") String tjNum) { |
| | | |
| | | TjOrder order = tjOrderService.getOrderByTjNum(tjNum); |
| | | if (null != order) { |
| | | // String payByTjNum = tjOrderService.isPayByTjNum(String.valueOf(order.getOrderId())); |
| | | // if (null != payByTjNum) { |
| | | // return AjaxResult.error("该用户已收费不可撤销签到!"); |
| | | // } |
| | | if (null != order.getFinishTime()) return AjaxResult.error("该人员已签离,不可撤销!!!"); |
| | | tjOrderService.deleteTjOrderByOrderId(order.getOrderId()); |
| | | tjOrderDetailService.deleteTjOrderDetailByOrderDetailId(String.valueOf(order.getOrderId())); |
| | | remarkService.deletedOrderRemarkByTjNum(tjNum); |
| | | tjFlowingWaterService.deleteTjFlowingWaterByOrderId(String.valueOf(order.getOrderId())); |
| | | transitionService.deletedTbTransitionByTjNum(tjNum); |
| | | |
| | | TjCustomer customer = tjCustomerService.getById(order.getUserId()); |
| | | customer.setCardId("0"); |
| | | tjCustomerService.updateById(customer); |
| | | String configByKey = configService.selectConfigByKey("sfkqdyhis"); |
| | | tjSamplingMapper.deleteByTjNumAndCusId(tjNum, order.getUserId()); |
| | | if (configByKey.equals("Y")) { |
| | | |
| | | HashMap<String, Object> hisRequestParams = new HashMap<>(); |
| | | 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("撤销失败,该人员已缴费,请先退费!"); |
| | | } |
| | | } |
| | | boolean zfHisApiMethods = hisApiMethod.ZfHisApiMethods(null, order, lisApiMethod.isUseLisAndPacsRegister(order)); |
| | | if (zfHisApiMethods) { |
| | | return AjaxResult.success("撤销成功"); |
| | | } else { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error("撤销失败,调用作废出现失败"); |
| | | } |
| | | |
| | | } |
| | | } |
| | | return AjaxResult.success("签到记录不存在!"); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/getCusTomterListByCompId") |
| | | @ApiOperation(value = "获取单位id体检人信息接口") |
| | | public AjaxResult getCusTomterListByCompId(@RequestParam(required = false) @ApiParam(value = "单位id") String compId, |
| | | @RequestParam(required = false) @ApiParam(value = "名字") String name, |
| | | @RequestParam(required = false) @ApiParam(value = "部门id") String deptId, |
| | | @RequestParam(required = false) @ApiParam(value = "预约时间") Date reservationTime, |
| | | @RequestParam(defaultValue = "1") Integer page, |
| | | @RequestParam(defaultValue = "10") Integer pageSize) { |
| | | Page<TjReservation> pages = new Page<>(page, pageSize); |
| | | LambdaQueryWrapper<TjReservation> wq = new LambdaQueryWrapper<>(); |
| | | if (null != compId) wq.eq(TjReservation::getCompanyId, compId); |
| | | if (null != name) wq.eq(TjReservation::getName, name); |
| | | if (null != deptId) wq.eq(TjReservation::getDepartment, deptId); |
| | | if (null != reservationTime) |
| | | wq.between(TjReservation::getReservationTime, DateUtil.beginOfDay(reservationTime), DateUtil.endOfDay(reservationTime)); |
| | | List<TjReservation> reservationList = tjReservationService.list(wq); |
| | | if (null != reservationList && reservationList.size() > 0) { |
| | | LambdaQueryWrapper<TjOrder> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.in(TjOrder::getReservationId, reservationList.stream().map(TjReservation::getId).collect(Collectors.toList())); |
| | | List<TjOrder> orderList = tjOrderService.list(wq1); |
| | | if (null != orderList && orderList.size() > 0) { |
| | | LambdaQueryWrapper<TjReservation> wq3 = new LambdaQueryWrapper<>(); |
| | | wq3.in(TjReservation::getId, orderList.stream().map(TjOrder::getReservationId).collect(Collectors.toList())); |
| | | // wq3.eq(TjReservation::getTeamNo,reservationList.get(0).getTeamNo()); |
| | | Page<TjReservation> page1 = tjReservationService.page(pages, wq3); |
| | | return AjaxResult.success(page1); |
| | | |
| | | } |
| | | } |
| | | return AjaxResult.success("暂无信息"); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/plRevokeTjOrderByTjNum") |
| | | @ApiOperation(value = "根据客户体检号批量撤销体检记录") |
| | | @Transactional |
| | | public AjaxResult plRevokeTjOrderByTjNum(@RequestBody @ApiParam(value = "预约主键id集合") List<String> reservationIds) { |
| | | if (null != reservationIds && reservationIds.size() > 0) { |
| | | LambdaQueryWrapper<TjOrder> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.in(TjOrder::getReservationId, reservationIds); |
| | | List<TjOrder> orderList = tjOrderService.list(wq1); |
| | | if (null != orderList && orderList.size() > 0) { |
| | | for (TjOrder order : orderList) { |
| | | // TjOrder order = tjOrderService.getOrderByTjNum(tjNum); |
| | | if (null != order) { |
| | | // String payByTjNum = tjOrderService.isPayByTjNum(String.valueOf(order.getOrderId())); |
| | | // if (null != payByTjNum) { |
| | | // return AjaxResult.success("该用户已收费不可撤销签到!"); |
| | | // } |
| | | tjOrderService.deleteTjOrderByOrderId(order.getOrderId()); |
| | | tjOrderDetailService.deleteTjOrderDetailByOrderDetailId(String.valueOf(order.getOrderId())); |
| | | remarkService.deletedOrderRemarkByTjNum(order.getTjNumber()); |
| | | tjFlowingWaterService.deleteTjFlowingWaterByOrderId(String.valueOf(order.getOrderId())); |
| | | transitionService.deletedTbTransitionByTjNum(order.getTjNumber()); |
| | | transitionService.updateTbTransitionByTjNum(order.getTjNumber()); |
| | | } |
| | | } |
| | | for (String id : reservationIds) { |
| | | TjReservation reservation = tjReservationService.getById(id); |
| | | if (null != reservation) { |
| | | reservation.setIsExpire(2); |
| | | tjReservationService.updateById(reservation); |
| | | } |
| | | } |
| | | } |
| | | return AjaxResult.success("撤销成功!!!"); |
| | | } |
| | | return AjaxResult.error("请选择要撤销的人员!"); |
| | | } |
| | | |
| | | @PostMapping("makeTjPDF") |
| | | @ApiOperation(value = "批量生成PDF") |
| | | public AjaxResult makeTjPDF(@RequestBody List<String> reservations) { |
| | | QueryWrapper<TjOrder> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.in("reservation_id", reservations); |
| | | List<TjOrder> tjNumbers = tjOrderService.list(queryWrapper); |
| | | Map<String, Object> map = null; |
| | | try { |
| | | map = PDFDocumentUtil.getDocument(); |
| | | Document document = (Document) map.get("document"); |
| | | for (int i = 0; i < tjNumbers.size(); i++) { |
| | | String tjNumber = tjNumbers.get(i).getTjNumber(); |
| | | try { |
| | | List<Map<String, String>> 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"); |
| | | 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(); |
| | | } |
| | | } |
| | | 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(); |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @GetMapping("/delTbBycusCardIdAndProId") |
| | | @ApiOperation(value = "根据客户身份证号和项目父项id删除临时表数据") |
| | | @Transactional |
| | | public AjaxResult delTbBycusCardIdAndProId(@RequestParam @ApiParam(value = "身份证号") String cusCardId, |
| | | @RequestParam @ApiParam(value = "父项id") String proId) { |
| | | |
| | | if (transitionService.delTbBycusCardIdAndProId(cusCardId, proId)) { |
| | | return AjaxResult.success(); |
| | | } |
| | | return AjaxResult.error("记录不存在!"); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/revokeTjOrderByTjCardId") |
| | | @ApiOperation(value = "根据就诊号撤销申请记录") |
| | | @Transactional |
| | | public AjaxResult revokeTjOrderByTjCardId(@RequestParam @ApiParam(value = "就诊号") String cardId) { |
| | | |
| | | 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")) { |
| | | 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("撤销失败,门诊患者费用清单信息不为空"); |
| | | } else { |
| | | boolean zfHisApiMethods = hisApiMethod.ZfHisApiMethods(null, order, lisApiMethod.isUseLisAndPacsRegister(order)); |
| | | if (zfHisApiMethods) { |
| | | return AjaxResult.success("撤销成功", map); |
| | | } else { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error("撤销失败,调用作废出现失败"); |
| | | } |
| | | } |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/revokeTjOrderByTjh") |
| | | @ApiOperation(value = "根据就体检号删除记录") |
| | | @Transactional |
| | | public AjaxResult revokeTjOrderByTjh(@RequestParam @ApiParam(value = "体检号") String tjNum) { |
| | | |
| | | TjOrder order = tjOrderService.getOrderByTjNum(tjNum); |
| | | if (null != order) { |
| | | // String payByTjNum = tjOrderService.isPayByTjNum(String.valueOf(order.getOrderId())); |
| | | // if (null != payByTjNum) { |
| | | // return AjaxResult.error("该用户已收费不可撤销签到!"); |
| | | // } |
| | | tjOrderService.deleteTjOrderByOrderId(order.getOrderId()); |
| | | tjOrderDetailService.deleteTjOrderDetailByOrderDetailId(String.valueOf(order.getOrderId())); |
| | | remarkService.deletedOrderRemarkByTjNum(tjNum); |
| | | tjFlowingWaterService.deleteTjFlowingWaterByOrderId(String.valueOf(order.getOrderId())); |
| | | transitionService.deletedTbTransitionByTjNum(tjNum); |
| | | } |
| | | 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); |
| | | log.info("queryPay ->{}", JSONUtil.toJsonStr(queryPay)); |
| | | if (Integer.parseInt(queryPay.get("code").toString()) == 200) { |
| | | List<Map<String, String>> data = (List<Map<String, String>>) queryPay.get("data"); |
| | | 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, order); |
| | | } catch (Exception e) { |
| | | log.info("撤销失败,删除表失败"); |
| | | return AjaxResult.error("撤销失败,删除表失败!"); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | // @Transactional(propagation =Propagation.REQUIRES_NEW) |
| | | public void extracted(TjProBlDto dto, TjOrder order) { |
| | | for (String bldh : dto.getBldhs()) { |
| | | remarkService.deleteTjOrderDetailByjxbz(bldh); |
| | | tjOrderDetailService.deleteTjOrderDetailByjxbz(bldh); |
| | | tjFlowingWaterService.deleteTjOrderDetailByjxbz(bldh); |
| | | transitionService.deleteTjOrderDetailByjxbz(bldh); |
| | | blService.remove(new LambdaQueryWrapper<TjProBl>().eq(TjProBl::getTjh, dto.getTjh()).eq(TjProBl::getBldh, bldh)); |
| | | } |
| | | tjSamplingMapper.deleteByTjNumAndCusIdAndJxbz(dto.getTjh(), order.getUserId(), dto.getBldhs()); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/addYaoPinShenQing") |
| | | @ApiOperation(value = "药品信息申请") |
| | | @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(); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/chushenyemianqijianjiekou") |
| | | @ApiOperation(value = "初审页面弃检接口") |
| | | @Transactional |
| | | public AjaxResult chushenyemianqijianjiekou(@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("操作成功!"); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/zongjanyemianshjianzhou") |
| | | @ApiOperation(value = "总检获取时间轴接口") |
| | | @Transactional |
| | | public AjaxResult zongjanyemianshjianzhou(@RequestParam String tjNUm) { |
| | | TjOrder order = tjOrderService.getOrderByTjNum(tjNUm); |
| | | if (null != order) { |
| | | int czwj = remarkService.panduaniscunzaiweijian(tjNUm); |
| | | int sfwc = remarkService.panduaniswancheng(tjNUm); |
| | | Date checkTime = order.getCheckTime(); |
| | | Date reportTime = order.getReportTime(); |
| | | Integer heshouStatus = order.getHeshouStatus(); |
| | | Date lastTime = order.getPrintLastTime(); |
| | | int a=0; |
| | | if (czwj == 0) { |
| | | //未检 |
| | | a=0; |
| | | } else if (czwj > 0) { |
| | | //在检 |
| | | a=1; |
| | | } else if (sfwc == 0) { |
| | | //已完成 |
| | | a=2; |
| | | } else if (null != checkTime) { |
| | | //已审核 |
| | | a=3; |
| | | } else if (null != reportTime) { |
| | | //生成报告 |
| | | a=4; |
| | | } else if (null != heshouStatus) { |
| | | //报告核收 |
| | | a=5; |
| | | } else if (null != lastTime) { |
| | | //已出报告 |
| | | a=6; |
| | | } |
| | | return AjaxResult.success(a); |
| | | } |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |