| | |
| | | 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.mapper.TestMapper; |
| | | import com.ltkj.hosp.service.*; |
| | | import com.ltkj.hosp.sqlDomain.LtkjMiddleDetail; |
| | |
| | | @PostMapping("/addPlOrderAndDetail") |
| | | @ApiOperation(value = "体检批量签到登记接口") |
| | | @Transactional //(切换数据库出错,所以注释) |
| | | public AjaxResult addPlOrderAndDetail(@RequestBody List<String> cusIds){ |
| | | public AjaxResult addPlOrderAndDetail(@RequestBody QianDaoDto daoDto){ |
| | | SysUser sysUser = UserHoder.getLoginUser().getUser(); |
| | | List<String> cusIds = daoDto.getCusIds(); |
| | | if(null !=cusIds && cusIds.size()>0){ |
| | | |
| | | ExecutorService threadPools = Executors.newFixedThreadPool(cusIds.size()); |
| | | for (String cusId : cusIds) { |
| | | threadPools.execute(new Runnable() { |
| | |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | getAjaxResult(aLong,sysUser); |
| | | getAjaxResult(aLong,sysUser,daoDto.getTjCategory()); |
| | | threadPool.shutdown(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | |
| | | wq.eq(TjReservation::getIsExpire, 2); |
| | | TjReservation tjReservation = tjReservationService.getOne(wq); |
| | | if (tjReservation != null) { |
| | | if (DateUtil.endOfDay(new Date()).before(tjReservation.getReservationTime())) { |
| | | /* 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); |
| | |
| | | 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.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.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); |
| | | // return success(tjCustomer); |
| | | } |
| | | // LambdaQueryWrapper<TjCustomer> qw = new LambdaQueryWrapper<>(); |
| | | // qw.eq(TjCustomer::getCusIdcard, cusIdcard); |
| | | // TjCustomer tjCustomer = tjCustomerService.getOne(qw); |
| | | // return AjaxResult.success("暂无预约信息",tjCustomer); |
| | | } |
| | | // return error("身份证号不存在"); |
| | | |
| | | } |
| | | } |
| | | |
| | | private void extracteds(TjCustomer customer) { |
| | |
| | | DynamicDataSourceContextHolder.clearDataSourceType(); |
| | | } |
| | | |
| | | private AjaxResult getAjaxResult(Long userId,SysUser sysUser) throws IOException { |
| | | private AjaxResult getAjaxResult(Long userId,SysUser sysUser,String tjCategory) throws IOException { |
| | | |
| | | LambdaQueryWrapper<TjCustomer> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjCustomer::getCusId,userId); |
| | |
| | | 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.setIsExpire(1); |
| | | tjReservationService.updateById(tjReservation); |
| | | if (null != tjReservation.getTeamNo()) { |
| | | tjOrder.setTjType("1"); |
| | | } else { |
| | | tjOrder.setTjType("2"); |
| | | } |
| | | // if (null != tjReservation.getTeamNo()) { |
| | | // tjOrder.setTjType("1"); |
| | | // } else { |
| | | // tjOrder.setTjType("2"); |
| | | // } |
| | | } |
| | | //生成体检号 |
| | | 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 (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())) { |