| | |
| | | package com.ltkj.web.controller.api; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.json.JSONArray; |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ltkj.common.core.domain.AjaxResult; |
| | | import com.ltkj.hosp.domain.TjCustomer; |
| | | import com.ltkj.hosp.domain.TjOrder; |
| | | import com.ltkj.hosp.mapper.TjCustomerMapper; |
| | | import com.ltkj.hosp.service.ITjOrderDetailService; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | |
| | | return; |
| | | } |
| | | tjReportController.preview(response,true,tjNum); |
| | | } |
| | | |
| | | @PostMapping("/viewReportUrl") |
| | | public AjaxResult viewReportUrl(@RequestBody String json){ |
| | | JSONObject entries = JSONUtil.parseObj(json); |
| | | String tjNum = entries.getStr("tjNum"); |
| | | LambdaQueryWrapper<TjOrder> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(TjOrder::getHeshouStatus,1); |
| | | wrapper.eq(TjOrder::getTjNumber,tjNum); |
| | | List<TjOrder> list = tjOrderService.list(wrapper); |
| | | if (list.isEmpty()){ |
| | | return AjaxResult.error(); |
| | | } |
| | | TjOrder tjOrder = tjOrderService.getOrderByTjNum(tjNum); |
| | | TjCustomer tjCustomer = tjCustomerMapper.selectById( tjOrder.getUserId()); |
| | | String filePath = tjCustomer.getCusId() + tjNum + tjCustomer.getCusName() + "_报告.pdf"; |
| | | return AjaxResult.success(filePath); |
| | | } |
| | | |
| | | /** |
| | |
| | | JSONObject entries = JSONUtil.parseObj(json); |
| | | String card = entries.getStr("card"); |
| | | String name = entries.getStr("name"); |
| | | if (StrUtil.isBlank(name)){ |
| | | LambdaQueryWrapper<TjCustomer> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(TjCustomer::getCusIdcard,card); |
| | | wrapper.orderByDesc(TjCustomer::getCusId); |
| | | wrapper.last("LIMIT 1"); |
| | | TjCustomer customer = tjCustomerMapper.selectOne(wrapper); |
| | | if (customer == null) return AjaxResult.error(); |
| | | name = customer.getCusName(); |
| | | } |
| | | List<Map<String ,Object>> customer = tjCustomerMapper.getCusInfoListByCardAndName(card,name); |
| | | return AjaxResult.success(customer); |
| | | } |