package com.lyms.talkonlineweb.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lyms.talkonlineweb.annotation.TokenRequired;
import com.lyms.talkonlineweb.domain.LymsInspectionReport;
import com.lyms.talkonlineweb.domain.LymsPatient;
import com.lyms.talkonlineweb.result.BaseResponse;
import com.lyms.talkonlineweb.service.LymsInspectionReportService;
import com.lyms.talkonlineweb.service.LymsPatientService;
import com.lyms.talkonlineweb.util.StringUtil;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.DigestUtils;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 检查报告
*/
@RestController
@RequestMapping("insr")
@Log4j2
public class LymsInspectionReportController {
@Autowired
private LymsInspectionReportService lymsInspectionReportService;//检查报告
/**
* PC 检查报告 新增/修改
*
* @param inspectionReport
* @return
*/
@PostMapping("addOrUpdateInspectionReport")
@TokenRequired
public BaseResponse addOrUpdateInspectionReport(@RequestBody LymsInspectionReport inspectionReport) {
BaseResponse baseResponse = new BaseResponse();
try {
boolean b = lymsInspectionReportService.saveOrUpdate(inspectionReport);
baseResponse.setErrorcode(b?0:1);
baseResponse.setErrormsg(b?(null==inspectionReport.getId()?"注册成功!":"修改成功"):(null==inspectionReport.getId()?"注册失败!":"修改失败"));
} catch (Exception e) {
baseResponse.setErrorcode(1);
baseResponse.setErrormsg("系统异常");
e.printStackTrace();
}
return baseResponse;
}
/**
* PC 检查报告 查询病例下的检查报告
*
* @param pcid
* @return
*/
@GetMapping("queryInspectionReport")
@TokenRequired
public BaseResponse queryInspectionReport(Integer pcid) {
BaseResponse baseResponse = new BaseResponse();
try {
QueryWrapper<LymsInspectionReport> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(LymsInspectionReport::getPcid, pcid);
List<LymsInspectionReport> list = lymsInspectionReportService.list(queryWrapper.orderByDesc("checkdate"));
baseResponse.setErrorcode(0);
baseResponse.setErrormsg("成功");
baseResponse.setObject(list);
} catch (Exception e) {
baseResponse.setErrorcode(1);
baseResponse.setErrormsg("系统异常");
e.printStackTrace();
}
return baseResponse;
}
}