| | |
| | | import com.ltkj.hosp.domain.*; |
| | | import com.ltkj.hosp.service.*; |
| | | import com.ltkj.hosp.vodomain.TeamTjPeopleVo; |
| | | import com.mysql.cj.util.StringUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import jodd.util.StringUtil; |
| | | import org.aspectj.weaver.AjAttribute; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.ltkj.common.core.controller.BaseController; |
| | |
| | | import java.lang.annotation.ElementType; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.ltkj.framework.datasource.DynamicDataSourceContextHolder.log; |
| | | |
| | | /** |
| | | * 体检单位缴费主Controller |
| | |
| | | private ITjCustomerService customerService; |
| | | @Resource |
| | | private ITjDwDeptService dwDeptService; |
| | | @Resource |
| | | private ITjDwGroupingService dwGroupingService; |
| | | @Resource |
| | | private ITjOrderRemarkService remarkService; |
| | | /** |
| | | * 团体体检收费接口 |
| | | */ |
| | |
| | | wq.eq(TjCompPayInfo::getTjCompPayId,tjCompPay.getId()); |
| | | List<TjCompPayInfo> list = payInfoService.list(wq); |
| | | BigDecimal bigDecimal=new BigDecimal("0.00"); |
| | | if(null !=list && list.size()>0){ |
| | | if(null !=list && !list.isEmpty()){ |
| | | for (TjCompPayInfo payInfo : list) { |
| | | bigDecimal=bigDecimal.add(payInfo.getTransactionAmount()); |
| | | } |
| | |
| | | @GetMapping |
| | | @ApiOperation(value = "所有公司体检收费数据查询接口") |
| | | public AjaxResult list(@RequestParam(required = false) @ApiParam(value = "单位id") String compId) { |
| | | |
| | | List<TjReservation> rightList = reservationService.list(new LambdaQueryWrapper<TjReservation>().eq(TjReservation::getCompanyId, compId)); |
| | | |
| | | Map<String, List<TjReservation>> collect = rightList.stream().collect(Collectors.groupingBy(TjReservation::getPacId)); |
| | | |
| | | if (!collect.isEmpty()) { |
| | | for (Map.Entry<String, List<TjReservation>> entry : collect.entrySet()) { |
| | | BigDecimal compPay = new BigDecimal("0.00"); |
| | | for (TjReservation reservation : entry.getValue()) { |
| | | TjDwGrouping dwGrouping = dwGroupingService.getById(reservation.getGroupingId()); |
| | | compPay = compPay.add(dwGrouping.getYsPrice()); |
| | | } |
| | | LambdaQueryWrapper<TjTeamSelectRecord> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjTeamSelectRecord::getTeamNo, entry.getValue().get(0).getTeamNo()); |
| | | wq.eq(TjTeamSelectRecord::getPacId, entry.getKey()); |
| | | wq.eq(TjTeamSelectRecord::getCompId,compId); |
| | | TjTeamSelectRecord recordServiceOne = selectRecordService.getOne(wq); |
| | | if (null != recordServiceOne) { |
| | | recordServiceOne.setPacId(entry.getKey()); |
| | | recordServiceOne.setCompId(compId); |
| | | recordServiceOne.setTeamNo(entry.getValue().get(0).getTeamNo()); |
| | | recordServiceOne.setTransactionAmount(new BigDecimal("0.00")); |
| | | recordServiceOne.setCount(entry.getValue().size()); |
| | | recordServiceOne.setDifference(compPay); |
| | | selectRecordService.updateById(recordServiceOne); |
| | | } else { |
| | | TjTeamSelectRecord selectRecord = new TjTeamSelectRecord(); |
| | | selectRecord.setCompId(compId); |
| | | selectRecord.setPacId(entry.getKey()); |
| | | selectRecord.setTeamNo(entry.getValue().get(0).getTeamNo()); |
| | | selectRecord.setTransactionAmount(new BigDecimal("0.00")); |
| | | selectRecord.setCount(entry.getValue().size()); |
| | | selectRecord.setDifference(compPay); |
| | | selectRecordService.save(selectRecord); |
| | | } |
| | | } |
| | | } |
| | | |
| | | LambdaQueryWrapper<TjTeamSelectRecord>wq0=new LambdaQueryWrapper<>(); |
| | | if(null !=compId){ |
| | | wq0.eq(TjTeamSelectRecord::getCompId,compId); |
| | | } |
| | | wq0.ne(TjTeamSelectRecord::getDifference,0); |
| | | List<TjTeamSelectRecord> selectRecordList = selectRecordService.list(wq0); |
| | | if(null !=selectRecordList && selectRecordList.size()>0){ |
| | | if(null !=selectRecordList && !selectRecordList.isEmpty()){ |
| | | for(TjTeamSelectRecord selectRecord : selectRecordList){ |
| | | TjDwDept dwDept = dwDeptService.getById(selectRecord.getPacId()); |
| | | if(null !=dwDept){ |
| | | selectRecord.setPacName(dwDept.getDwDeptName()); |
| | | selectRecord.setSigningPrice(dwDept.getSigningPrice()); |
| | | TjDwGrouping dwGrouping = dwGroupingService.getById(selectRecord.getPacId()); |
| | | |
| | | if(null !=dwGrouping){ |
| | | selectRecord.setPacName(dwGrouping.getGroupingName()); |
| | | selectRecord.setSigningPrice(dwGrouping.getSigningPrice()); |
| | | } |
| | | LambdaQueryWrapper<TjCompPay>wq1=new LambdaQueryWrapper<>(); |
| | | wq1.eq(TjCompPay::getCompId,compId); |
| | |
| | | LambdaQueryWrapper<TjCompPayInfo>wq=new LambdaQueryWrapper<>(); |
| | | wq.eq(TjCompPayInfo::getTjCompPayId,compPay.getId()); |
| | | selectRecord.setPayInfoList(payInfoService.list(wq)); |
| | | selectRecord.setCopeWith(compPay.getCopeWith()); |
| | | selectRecord.setDifference(compPay.getDifference()); |
| | | selectRecord.setCopeWith(selectRecord.getDifference()); |
| | | selectRecord.setDifference(selectRecord.getDifference()); |
| | | selectRecord.setPayer(compService.getById(compPay.getCompId()).getContactPerson()); |
| | | selectRecord.setSjCount(orderService.count(new LambdaQueryWrapper<TjOrder>().eq(TjOrder::getTeamNo,compPay.getTeamNo()))); |
| | | TjCompPayInfo payInfo = new TjCompPayInfo(); |
| | |
| | | */ |
| | | @GetMapping("/getTeamTjPeopleList") |
| | | @ApiOperation(value = "根据团队体检编号团队人员体检情况查询") |
| | | public AjaxResult getTeamTjPeopleList(@RequestParam @ApiParam(value = "团队编号") String teamNo) { |
| | | public AjaxResult getTeamTjPeopleList(@RequestParam @ApiParam(value = "团队编号") String teamNo, |
| | | @RequestParam(required = false) @ApiParam(value = "单位id") String pacId) { |
| | | |
| | | List<TjReservation> reservationList = reservationService.list(new LambdaQueryWrapper<TjReservation>().eq(TjReservation::getTeamNo,teamNo)); |
| | | if (null != reservationList && reservationList.size() > 0) { |
| | | List<TeamTjPeopleVo> voList = new ArrayList<>(); |
| | | for (TjReservation reservation : reservationList) { |
| | | TeamTjPeopleVo vo = new TeamTjPeopleVo(); |
| | | vo.setName(MatchUtils.hideCusName(reservation.getName())); |
| | | TjCustomer customer = customerService.getOne(new LambdaQueryWrapper<TjCustomer>().eq(TjCustomer::getCusIdcard, reservation.getIdCard())); |
| | | if (null != customer) { |
| | | TjOrder tjOrder = orderService.getOne(new LambdaQueryWrapper<TjOrder>().eq(TjOrder::getUserId, customer.getCusId()).eq(TjOrder::getTeamNo, teamNo)); |
| | | if (null != tjOrder) { |
| | | if (null != tjOrder.getFinishTime()) { |
| | | vo.setTjStatus("已完成"); |
| | | vo.setTjTime(tjOrder.getFinishTime()); |
| | | } else { |
| | | vo.setTjStatus("未完成"); |
| | | } |
| | | } else { |
| | | vo.setTjStatus("未 检"); |
| | | try { |
| | | Map<String,Object> map=new HashMap<>(); |
| | | LambdaQueryWrapper<TjReservation> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(TjReservation::getTeamNo, teamNo); |
| | | if(StringUtil.isNotBlank(pacId))wrapper.eq(TjReservation::getPacId, pacId); |
| | | List<TjReservation> reservationList = reservationService.list(wrapper); |
| | | if (null != reservationList && !reservationList.isEmpty()) { |
| | | List<TeamTjPeopleVo> syList = new ArrayList<>(); |
| | | List<TeamTjPeopleVo> yjwjzList = new ArrayList<>(); |
| | | List<TeamTjPeopleVo> wjList = new ArrayList<>(); |
| | | for (TjReservation reservation : reservationList) { |
| | | TeamTjPeopleVo vo = new TeamTjPeopleVo(); |
| | | vo.setName(reservation.getName()); |
| | | TjCustomer customer = null; |
| | | try { |
| | | customer = customerService.getOne(new LambdaQueryWrapper<TjCustomer>().eq(TjCustomer::getCusIdcard, reservation.getIdCard())); |
| | | } catch (Exception e) { |
| | | log.error("根据团队编号查询团队预约信息异常"+reservation.getIdCard()); |
| | | throw new RuntimeException(e); |
| | | } |
| | | } else { |
| | | vo.setTjStatus("未 检"); |
| | | if (null != customer) { |
| | | TjOrder tjOrder = orderService.getOne(new LambdaQueryWrapper<TjOrder>().eq(TjOrder::getUserId, customer.getCusId()).eq(TjOrder::getTeamNo, teamNo)); |
| | | if (null != tjOrder) { |
| | | int sfwc = remarkService.panduaniswancheng(tjOrder.getTjNumber()); |
| | | if (sfwc==0) { |
| | | vo.setTjStatus("已完成"); |
| | | vo.setTjTime(tjOrder.getCreateTime()); |
| | | } else { |
| | | vo.setTjStatus("在 检"); |
| | | } |
| | | yjwjzList.add(vo); |
| | | } else { |
| | | vo.setTjStatus("未 检"); |
| | | wjList.add(vo); |
| | | } |
| | | }else { |
| | | vo.setTjStatus("未 检"); |
| | | wjList.add(vo); |
| | | } |
| | | syList.add(vo); |
| | | |
| | | } |
| | | voList.add(vo); |
| | | map.put("syList",syList); |
| | | map.put("yjwjzList",yjwjzList); |
| | | map.put("wjList",wjList); |
| | | return AjaxResult.success(map); |
| | | } |
| | | return AjaxResult.success(voList); |
| | | return AjaxResult.success(null); |
| | | } catch (Exception e) { |
| | | log.error("查询团队体检人员信息异常"); |
| | | throw new RuntimeException(e); |
| | | } |
| | | return AjaxResult.success(null); |
| | | } |
| | | } |