lige
2023-12-07 eabf890be5718f5e22d03e3ce2b530da0568a8d0
ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java
@@ -4,6 +4,7 @@
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;
@@ -29,6 +30,7 @@
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;
@@ -64,7 +66,7 @@
 */
@RestController
@RequestMapping("/hosp/order")
@Api(tags = "体检记录接口")
@Api(tags = "PC端 ----体检记录接口")
@Slf4j
public class TjOrderController extends BaseController {
    @Resource
@@ -1643,4 +1645,85 @@
        }
        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",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("暂无历史记录");
    }
}