| | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.OffsetTime; |
| | | import java.util.*; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | |
| | | import com.ltkj.common.core.redis.RedisCache; |
| | | import com.ltkj.common.utils.SecurityUtils; |
| | | import com.ltkj.framework.config.MatchUtils; |
| | | import com.ltkj.framework.config.UserHoder; |
| | | import com.ltkj.hosp.domain.*; |
| | | import com.ltkj.hosp.service.*; |
| | | import com.ltkj.hosp.vodomain.BingZhongVO; |
| | | import com.ltkj.hosp.vodomain.HistoryTjOrder; |
| | | import com.ltkj.hosp.vodomain.QjDomainVo; |
| | | import com.ltkj.mall.domain.MallCheckLog; |
| | | import com.ltkj.mall.domain.MallOrder; |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/hosp/order") |
| | | @Api(tags = "体检记录接口") |
| | | @Api(tags = "PC端 ----体检记录接口") |
| | | @Slf4j |
| | | public class TjOrderController extends BaseController { |
| | | @Resource |
| | |
| | | private String value; |
| | | @Resource |
| | | private ITjOrderRemarkService remarkService; |
| | | @Resource |
| | | private ITjTeamSelectRecordService selectRecordService; |
| | | @Resource |
| | | private TjAsyncService asyncService; |
| | | @Resource |
| | |
| | | |
| | | @Autowired |
| | | private ITjAskMedicalHistoryService tjAskMedicalHistoryService; |
| | | |
| | | @Autowired |
| | | private ITjReportGetAddressService tjReportGetAddressService; |
| | | |
| | | |
| | | /** |
| | |
| | | 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; |
| | |
| | | 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 (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); |
| | | 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); |
| | |
| | | System.out.println("这段代码时间" + (System.currentTimeMillis() - l)); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/heXiaoByIds/{orderIds}") |
| | | @ApiOperation(value = "核收报告——————总检审核通过后可以核销,核收后才能打印") |
| | | @Transactional |
| | | public AjaxResult heXiaoByIds(@PathVariable String[] orderIds) { |
| | | 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("核收失败"); |
| | | } |
| | | } |
| | | return AjaxResult.success("核收成功"); |
| | | } |
| | | |
| | | @GetMapping("/getHistryTjOrderByCusIdCard") |
| | | @ApiOperation(value = "根据身份证号查看历史体检记录") |
| | | @Transactional |
| | | public AjaxResult getHistryTjOrderByCusIdCard(@RequestParam String cusIdCard) { |
| | | TjCustomer tjCustomer = tjCustomerService.getTjCustomerByCusIdCard(cusIdCard); |
| | | List<HistoryTjOrder> list=new ArrayList<>(); |
| | | if(null !=tjCustomer){ |
| | | List<TjOrder> orderList = tjOrderService.getTjOrderListByCusId(tjCustomer.getCusId()); |
| | | for (TjOrder order : orderList) { |
| | | HistoryTjOrder historyTjOrder=new HistoryTjOrder(); |
| | | historyTjOrder.setUserName(tjCustomer.getCusName()); |
| | | historyTjOrder.setTjNum(order.getTjNumber()); |
| | | historyTjOrder.setTjTime(order.getCreateTime()); |
| | | historyTjOrder.setTjProName(tjOrderService.getHistoryTjOrderProByTjNum(order.getTjNumber())); |
| | | list.add(historyTjOrder); |
| | | } |
| | | } |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/getHistryTjOrderProByCusIdCard") |
| | | @ApiOperation(value = "根据身份证号查看历史体检项目记录") |
| | | @Transactional |
| | | public AjaxResult getHistryTjOrderProByCusIdCard(@RequestParam String cusIdCard) { |
| | | TjCustomer tjCustomer = tjCustomerService.getTjCustomerByCusIdCard(cusIdCard); |
| | | if(null !=tjCustomer){ |
| | | TjOrder order= tjOrderService.getLastTjOrderListByCusId(tjCustomer.getCusId()); |
| | | if(null !=order){ |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | if(order.getPacId().equals("o")){ |
| | | List<Long> longList = remarkService.getTjProIdsByTjNum(order.getTjNumber()); |
| | | for (Long aLong : longList) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("pacName", "单项"); |
| | | map.put("proId",aLong); |
| | | map.put("pacId",null); |
| | | map.put("parentName", projectService.getById(aLong).getProName()); |
| | | map.put("list",projectService.getTjProjectListBySoneId(String.valueOf(aLong))); |
| | | BigDecimal proPrice = projectService.getById(aLong).getProPrice(); |
| | | map.put("ordPrice", proPrice); |
| | | map.put("nowPrice", proPrice); |
| | | list.add(map); |
| | | } |
| | | } |
| | | if(!order.getPacId().equals("o")){ |
| | | List<Long> longList = remarkService.getTjProIdsByTjNumAndPacIc(order.getTjNumber(),order.getPacId()); |
| | | TjPackage aPackage = tjPackageService.getById(order.getPacId()); |
| | | for (Long aLong : longList) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("pacName",aPackage.getPacName()); |
| | | map.put("pacId",String.valueOf(aPackage.getPacId())); |
| | | map.put("parentName", projectService.getById(aLong).getProName()); |
| | | map.put("list",projectService.getTjProjectListBySoneId(String.valueOf(aLong))); |
| | | BigDecimal proPrice = projectService.getById(aLong).getProPrice(); |
| | | map.put("ordPrice", proPrice); |
| | | map.put("nowPrice",tjPackageProjectService.getPacProPriceByPacIdAndPro(aLong,order.getPacId())); |
| | | list.add(map); |
| | | } |
| | | |
| | | List<Long> longList1 = remarkService.getTjProIdsByTjNumAndPacIc(order.getTjNumber(),order.getPacId()); |
| | | for (Long aLong : longList1) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("pacName", "单项"); |
| | | map.put("proId",aLong); |
| | | map.put("pacId",null); |
| | | map.put("parentName", projectService.getById(aLong).getProName()); |
| | | map.put("list",projectService.getTjProjectListBySoneId(String.valueOf(aLong))); |
| | | BigDecimal proPrice = projectService.getById(aLong).getProPrice(); |
| | | map.put("ordPrice", proPrice); |
| | | map.put("nowPrice", proPrice); |
| | | list.add(map); |
| | | } |
| | | } |
| | | return AjaxResult.success(list); |
| | | } |
| | | } |
| | | return AjaxResult.success("暂无历史记录"); |
| | | } |
| | | |
| | | } |