新增获取样本码信息接口
This commit is contained in:
parent
c1d49642f1
commit
261cdbdacb
@ -207,7 +207,7 @@ public class InspectPatientController {
|
|||||||
String datePart = currentDate.format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
String datePart = currentDate.format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||||
// 生成一个6位的序列号
|
// 生成一个6位的序列号
|
||||||
int sequenceNumber = counter.incrementAndGet() % 1000000; // 确保序列号是6位数
|
int sequenceNumber = counter.incrementAndGet() % 1000000; // 确保序列号是6位数
|
||||||
String MedicalSn = datePart+String.format("%06d", sequenceNumber);
|
String MedicalSn = datePart + String.format("%06d", sequenceNumber);
|
||||||
//患者信息
|
//患者信息
|
||||||
InspectPatientSaveReqVO rowData = new InspectPatientSaveReqVO();
|
InspectPatientSaveReqVO rowData = new InspectPatientSaveReqVO();
|
||||||
|
|
||||||
@ -268,7 +268,7 @@ public class InspectPatientController {
|
|||||||
// 分批插入患者信息
|
// 分批插入患者信息
|
||||||
batchInsertPatients(dataList);
|
batchInsertPatients(dataList);
|
||||||
// 分批插入患者项目信息
|
// 分批插入患者项目信息
|
||||||
// batchInsertPatientItems(dataList2);
|
// batchInsertPatientItems(dataList2);
|
||||||
|
|
||||||
return success("上传成功");
|
return success("上传成功");
|
||||||
|
|
||||||
@ -323,26 +323,25 @@ public class InspectPatientController {
|
|||||||
patientitemsService.createPatientListitems(batch);
|
patientitemsService.createPatientListitems(batch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/insertPatinetInfo")
|
@PostMapping("/insertPatinetInfo")
|
||||||
@Operation(summary = "根据表单创建患者信息和项目信息")
|
@Operation(summary = "根据表单创建患者信息和项目信息")
|
||||||
public CommonResult<Boolean> insertPatinetInfo(@Valid @RequestBody InspectPatientSaveReqVO inspectPatientSaveReqVO)
|
public CommonResult<Boolean> insertPatinetInfo(@Valid @RequestBody InspectPatientSaveReqVO inspectPatientSaveReqVO) {
|
||||||
{
|
|
||||||
//验证身份证
|
//验证身份证
|
||||||
if( patientService.validateIdCardExists(inspectPatientSaveReqVO.getCardId()))
|
if (patientService.validateIdCardExists(inspectPatientSaveReqVO.getCardId())) {
|
||||||
{
|
return success(false, "身份证号已存在");
|
||||||
return success(false,"身份证号已存在");
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//检查项目
|
//检查项目
|
||||||
// List<InspectPatientitemsSaveReqVO> dataList2 = new ArrayList<>();
|
// List<InspectPatientitemsSaveReqVO> dataList2 = new ArrayList<>();
|
||||||
//检查套餐信息
|
//检查套餐信息
|
||||||
// List<InspectitemsDO> doList = exammoduleService.selectItemsByExamModuleID(1001);
|
// List<InspectitemsDO> doList = exammoduleService.selectItemsByExamModuleID(1001);
|
||||||
// 获取当前日期并格式化为 yyyyMMdd 格式
|
// 获取当前日期并格式化为 yyyyMMdd 格式
|
||||||
LocalDate currentDate = LocalDate.now();
|
LocalDate currentDate = LocalDate.now();
|
||||||
String datePart = currentDate.format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
String datePart = currentDate.format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||||
// 生成一个6位的序列号
|
// 生成一个6位的序列号
|
||||||
int sequenceNumber = counter.incrementAndGet() % 1000000; // 确保序列号是6位数
|
int sequenceNumber = counter.incrementAndGet() % 1000000; // 确保序列号是6位数
|
||||||
String sequencePart = datePart+String.format("%06d", sequenceNumber);
|
String sequencePart = datePart + String.format("%06d", sequenceNumber);
|
||||||
//患者信息
|
//患者信息
|
||||||
InspectPatientSaveReqVO rowData = new InspectPatientSaveReqVO();
|
InspectPatientSaveReqVO rowData = new InspectPatientSaveReqVO();
|
||||||
rowData.setMedicalSn(sequencePart);
|
rowData.setMedicalSn(sequencePart);
|
||||||
@ -378,14 +377,13 @@ public class InspectPatientController {
|
|||||||
// batchInsertPatientItems(dataList2);
|
// batchInsertPatientItems(dataList2);
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/createPatientitem")
|
@GetMapping("/createPatientitem")
|
||||||
@Operation(summary = "通过体检编号绑定检查项目信息")
|
@Operation(summary = "通过体检编号绑定检查项目信息")
|
||||||
public CommonResult<Boolean> createPatientitem(@RequestParam("medicalSn") String medicalSn)
|
public CommonResult<Boolean> createPatientitem(@RequestParam("medicalSn") String medicalSn) {
|
||||||
{
|
|
||||||
//如果这个患者存在患者项目数据则不进行插入
|
//如果这个患者存在患者项目数据则不进行插入
|
||||||
boolean exists = patientitemsService.existsByMedicalSn(medicalSn);
|
boolean exists = patientitemsService.existsByMedicalSn(medicalSn);
|
||||||
if(exists)
|
if (exists) {
|
||||||
{
|
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
//检查项目
|
//检查项目
|
||||||
@ -414,14 +412,14 @@ public class InspectPatientController {
|
|||||||
rowData2.setMealfrontorafter(inspectitemsDO.getMealfrontorafter());
|
rowData2.setMealfrontorafter(inspectitemsDO.getMealfrontorafter());
|
||||||
dataList2.add(rowData2);
|
dataList2.add(rowData2);
|
||||||
}
|
}
|
||||||
if(dataList2.size()>0)
|
if (dataList2.size() > 0) {
|
||||||
{
|
|
||||||
// 分批插入患者项目信息
|
// 分批插入患者项目信息
|
||||||
batchInsertPatientItems(dataList2);
|
batchInsertPatientItems(dataList2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/syncinspectApplyTj")
|
@GetMapping("/syncinspectApplyTj")
|
||||||
@Operation(summary = "发送检验申请单")
|
@Operation(summary = "发送检验申请单")
|
||||||
public CommonResult<Boolean> syncinspectApplyTj(@RequestParam("medicalSn") String medicalSn) throws JsonProcessingException {
|
public CommonResult<Boolean> syncinspectApplyTj(@RequestParam("medicalSn") String medicalSn) throws JsonProcessingException {
|
||||||
@ -491,7 +489,7 @@ public class InspectPatientController {
|
|||||||
|
|
||||||
// 将 Java 对象转换为 JSON 字符串
|
// 将 Java 对象转换为 JSON 字符串
|
||||||
String jsonRequestBody = objectMapper.writeValueAsString(patient);
|
String jsonRequestBody = objectMapper.writeValueAsString(patient);
|
||||||
|
|
||||||
// 保存日志
|
// 保存日志
|
||||||
InspectApplylogSaveReqVO logVO = new InspectApplylogSaveReqVO();
|
InspectApplylogSaveReqVO logVO = new InspectApplylogSaveReqVO();
|
||||||
logVO.setTime(LocalDateTime.now());
|
logVO.setTime(LocalDateTime.now());
|
||||||
@ -499,14 +497,14 @@ public class InspectPatientController {
|
|||||||
logVO.setIdcard(patientDO.getCardId());
|
logVO.setIdcard(patientDO.getCardId());
|
||||||
logVO.setJson(jsonRequestBody);
|
logVO.setJson(jsonRequestBody);
|
||||||
applylogService.createApplylog(logVO);
|
applylogService.createApplylog(logVO);
|
||||||
|
|
||||||
//获取配置项地址
|
//获取配置项地址
|
||||||
ConfigDO config = configService.getConfigByKey("url.applytj");
|
ConfigDO config = configService.getConfigByKey("url.applytj");
|
||||||
// 发送 POST 请求
|
// 发送 POST 请求
|
||||||
String url = config.getValue();
|
String url = config.getValue();
|
||||||
|
|
||||||
String response = HttpUtils.postJson(url, jsonRequestBody);
|
String response = HttpUtils.postJson(url, jsonRequestBody);
|
||||||
|
|
||||||
// 记录接口返回值
|
// 记录接口返回值
|
||||||
InspectApplylogSaveReqVO responseLogVO = new InspectApplylogSaveReqVO();
|
InspectApplylogSaveReqVO responseLogVO = new InspectApplylogSaveReqVO();
|
||||||
responseLogVO.setTime(LocalDateTime.now());
|
responseLogVO.setTime(LocalDateTime.now());
|
||||||
@ -514,7 +512,7 @@ public class InspectPatientController {
|
|||||||
responseLogVO.setIdcard(patientDO.getCardId());
|
responseLogVO.setIdcard(patientDO.getCardId());
|
||||||
responseLogVO.setJson(response);
|
responseLogVO.setJson(response);
|
||||||
applylogService.createApplylog(responseLogVO);
|
applylogService.createApplylog(responseLogVO);
|
||||||
|
|
||||||
InspectPatientSaveReqVO updateReqVO = new InspectPatientSaveReqVO();
|
InspectPatientSaveReqVO updateReqVO = new InspectPatientSaveReqVO();
|
||||||
updateReqVO.setMedicalSn(patientDO.getMedicalSn());
|
updateReqVO.setMedicalSn(patientDO.getMedicalSn());
|
||||||
updateReqVO.setHospitalNo("121526004609160793");//乌兰察布第四医院 暂时写死
|
updateReqVO.setHospitalNo("121526004609160793");//乌兰察布第四医院 暂时写死
|
||||||
@ -540,22 +538,19 @@ public class InspectPatientController {
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case "XCG":
|
case "XCG":
|
||||||
model = "cbc";
|
model = "cbc";
|
||||||
if(patientDO.getXcgcode()!=null)
|
if (patientDO.getXcgcode() != null) {
|
||||||
{
|
|
||||||
barCode = patientDO.getXcgcode();
|
barCode = patientDO.getXcgcode();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "NCG":
|
case "NCG":
|
||||||
model = "rt";
|
model = "rt";
|
||||||
if(patientDO.getNcgcode()!=null)
|
if (patientDO.getNcgcode() != null) {
|
||||||
{
|
|
||||||
barCode = patientDO.getNcgcode();
|
barCode = patientDO.getNcgcode();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "SHQX":
|
case "SHQX":
|
||||||
model = "bt";
|
model = "bt";
|
||||||
if(patientDO.getShqx()!=null)
|
if (patientDO.getShqx() != null) {
|
||||||
{
|
|
||||||
barCode = patientDO.getShqx();
|
barCode = patientDO.getShqx();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -563,81 +558,72 @@ public class InspectPatientController {
|
|||||||
ConfigDO config = configService.getConfigByKey("url.reporttj");
|
ConfigDO config = configService.getConfigByKey("url.reporttj");
|
||||||
String url = config.getValue();
|
String url = config.getValue();
|
||||||
//查询是否已经存在记录 存在则不进行同步操作
|
//查询是否已经存在记录 存在则不进行同步操作
|
||||||
if(pacsDataService.IspacsDataExist(medicalSn, model))
|
if (pacsDataService.IspacsDataExist(medicalSn, model)) {
|
||||||
{
|
if (!pacsDataService.IspacsDataitemExist(medicalSn, model)) {
|
||||||
if(!pacsDataService.IspacsDataitemExist(medicalSn, model))
|
|
||||||
{
|
|
||||||
//没有对应的item值 更新
|
//没有对应的item值 更新
|
||||||
String response = HttpUtils.get(url + "?" + "barCode=" + barCode + "&" + "hospitalCode=" + patientDO.getHospitalNo());
|
String response = HttpUtils.get(url + "?" + "barCode=" + barCode + "&" + "hospitalCode=" + patientDO.getHospitalNo());
|
||||||
if (response != null)
|
if (response != null) {
|
||||||
{
|
// 解析 JSON 响应
|
||||||
// 解析 JSON 响应
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
try {
|
||||||
try {
|
ReportResponse reportResponse = objectMapper.readValue(response, ReportResponse.class);
|
||||||
ReportResponse reportResponse = objectMapper.readValue(response, ReportResponse.class);
|
if ("操作成功".equals(reportResponse.getMsg()) && reportResponse.getCode() == 200) {
|
||||||
if ("操作成功".equals(reportResponse.getMsg()) && reportResponse.getCode() == 200)
|
ReportData reportData = reportResponse.getData();
|
||||||
{
|
// 获取 reportPath
|
||||||
ReportData reportData = reportResponse.getData();
|
String reportPath = reportData.getReportPath();
|
||||||
// 获取 reportPath
|
if (!reportPath.contains("报告暂未出")) {
|
||||||
String reportPath = reportData.getReportPath();
|
StringBuilder sb = new StringBuilder();
|
||||||
if(!reportPath.contains("报告暂未出"))
|
InspectPacsDataSaveReqVO inspectPacs = new InspectPacsDataSaveReqVO();
|
||||||
{
|
inspectPacs.setCode(patientDO.getMedicalSn());
|
||||||
StringBuilder sb = new StringBuilder();
|
inspectPacs.setType(model);
|
||||||
InspectPacsDataSaveReqVO inspectPacs = new InspectPacsDataSaveReqVO();
|
if (reportData.getResults() != null && reportData.getResults().size() > 0) {
|
||||||
inspectPacs.setCode(patientDO.getMedicalSn());
|
// 获取 results 数组并遍历
|
||||||
inspectPacs.setType(model);
|
List<ResultItem> results = reportData.getResults();
|
||||||
if(reportData.getResults()!=null&&reportData.getResults().size()>0)
|
for (ResultItem result : results) {
|
||||||
{
|
// 判断 Item Tips 并输出相应的结果
|
||||||
// 获取 results 数组并遍历
|
String itemTips = result.getItemTips();
|
||||||
List<ResultItem> results = reportData.getResults();
|
String tipsDescription = "";
|
||||||
for (ResultItem result : results) {
|
if ("1".equals(itemTips)) {
|
||||||
// 判断 Item Tips 并输出相应的结果
|
tipsDescription = "偏低";
|
||||||
String itemTips = result.getItemTips();
|
} else if ("4".equals(itemTips)) {
|
||||||
String tipsDescription = "";
|
tipsDescription = "偏高";
|
||||||
if ("1".equals(itemTips)) {
|
}
|
||||||
tipsDescription = "偏低";
|
|
||||||
} else if ("4".equals(itemTips)) {
|
|
||||||
tipsDescription = "偏高";
|
|
||||||
}
|
|
||||||
|
|
||||||
sb.append("【"+result.getItemName() +":"+tipsDescription+" ,结果:" + result.getItemValue() + result.getItemUnit() +","+"参考值("+result.getReferenceRange()+ ")】"+"\n");
|
sb.append("【" + result.getItemName() + ":" + tipsDescription + " ,结果:" + result.getItemValue() + result.getItemUnit() + "," + "参考值(" + result.getReferenceRange() + ")】" + "\n");
|
||||||
}
|
}
|
||||||
inspectPacs.setItem(sb.toString());
|
inspectPacs.setItem(sb.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
pacsDataService.updatePacsDataitem(inspectPacs);
|
pacsDataService.updatePacsDataitem(inspectPacs);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
String response = HttpUtils.get(url + "?" + "barCode=" + barCode + "&" + "hospitalCode=" + patientDO.getHospitalNo());
|
String response = HttpUtils.get(url + "?" + "barCode=" + barCode + "&" + "hospitalCode=" + patientDO.getHospitalNo());
|
||||||
if (response != null) {
|
if (response != null) {
|
||||||
// 解析 JSON 响应
|
// 解析 JSON 响应
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
try {
|
try {
|
||||||
ReportResponse reportResponse = objectMapper.readValue(response, ReportResponse.class);
|
ReportResponse reportResponse = objectMapper.readValue(response, ReportResponse.class);
|
||||||
if ("操作成功".equals(reportResponse.getMsg()) && reportResponse.getCode() == 200)
|
if ("操作成功".equals(reportResponse.getMsg()) && reportResponse.getCode() == 200) {
|
||||||
{
|
|
||||||
ReportData reportData = reportResponse.getData();
|
ReportData reportData = reportResponse.getData();
|
||||||
// 获取 reportPath
|
// 获取 reportPath
|
||||||
String reportPath = reportData.getReportPath();
|
String reportPath = reportData.getReportPath();
|
||||||
if(!reportPath.contains("报告暂未出"))
|
if (!reportPath.contains("报告暂未出")) {
|
||||||
{
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
InspectPacsDataSaveReqVO inspectPacs = new InspectPacsDataSaveReqVO();
|
InspectPacsDataSaveReqVO inspectPacs = new InspectPacsDataSaveReqVO();
|
||||||
inspectPacs.setCode(patientDO.getMedicalSn());
|
inspectPacs.setCode(patientDO.getMedicalSn());
|
||||||
inspectPacs.setData(reportPath);
|
inspectPacs.setData(reportPath);
|
||||||
inspectPacs.setType(model);
|
inspectPacs.setType(model);
|
||||||
inspectPacs.setPersonName(patientDO.getPName());
|
inspectPacs.setPersonName(patientDO.getPName());
|
||||||
if(reportData.getResults()!=null&&reportData.getResults().size()>0)
|
if (reportData.getResults() != null && reportData.getResults().size() > 0) {
|
||||||
{
|
|
||||||
// 获取 results 数组并遍历
|
// 获取 results 数组并遍历
|
||||||
List<ResultItem> results = reportData.getResults();
|
List<ResultItem> results = reportData.getResults();
|
||||||
for (ResultItem result : results) {
|
for (ResultItem result : results) {
|
||||||
@ -650,7 +636,7 @@ public class InspectPatientController {
|
|||||||
tipsDescription = "偏高";
|
tipsDescription = "偏高";
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append("【"+result.getItemName() +":"+tipsDescription+" ,结果:" + result.getItemValue() + result.getItemUnit() +","+"参考值("+result.getReferenceRange()+ ")】"+"\n");
|
sb.append("【" + result.getItemName() + ":" + tipsDescription + " ,结果:" + result.getItemValue() + result.getItemUnit() + "," + "参考值(" + result.getReferenceRange() + ")】" + "\n");
|
||||||
}
|
}
|
||||||
inspectPacs.setItem(sb.toString());
|
inspectPacs.setItem(sb.toString());
|
||||||
}
|
}
|
||||||
@ -718,6 +704,7 @@ public class InspectPatientController {
|
|||||||
patientService.medicalSnupdate(updateReqVO);
|
patientService.medicalSnupdate(updateReqVO);
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/updatedoctorid")
|
@PutMapping("/updatedoctorid")
|
||||||
@Operation(summary = "更新患者总检医生ID")
|
@Operation(summary = "更新患者总检医生ID")
|
||||||
public CommonResult<Boolean> updatedoctorid(@Valid @RequestBody InspectPatientSaveReqVO updateReqVO) {
|
public CommonResult<Boolean> updatedoctorid(@Valid @RequestBody InspectPatientSaveReqVO updateReqVO) {
|
||||||
@ -730,19 +717,17 @@ public class InspectPatientController {
|
|||||||
public CommonResult<InspectPatientReportVO> getReport(@RequestParam("medicalSn") String medicalSn) {
|
public CommonResult<InspectPatientReportVO> getReport(@RequestParam("medicalSn") String medicalSn) {
|
||||||
// 获取患者基本信息
|
// 获取患者基本信息
|
||||||
InspectPatientDO patientDO = patientService.getPatientInfo(medicalSn);
|
InspectPatientDO patientDO = patientService.getPatientInfo(medicalSn);
|
||||||
|
|
||||||
// 创建报告VO对象
|
// 创建报告VO对象
|
||||||
InspectPatientReportVO inspectPatientReportVO = new InspectPatientReportVO();
|
InspectPatientReportVO inspectPatientReportVO = new InspectPatientReportVO();
|
||||||
|
|
||||||
if (patientDO != null) {
|
if (patientDO != null) {
|
||||||
// 设置基本信息
|
// 设置基本信息
|
||||||
BeanUtils.copyProperties(patientDO, inspectPatientReportVO);
|
BeanUtils.copyProperties(patientDO, inspectPatientReportVO);
|
||||||
// 先拿到ID 在查询签名
|
// 先拿到ID 在查询签名
|
||||||
if(patientDO.getChiefinspectorid()!=null)
|
if (patientDO.getChiefinspectorid() != null) {
|
||||||
{
|
InspectDoctorDO doctorDO = doctorService.getDoctorid(patientDO.getChiefinspectorid());
|
||||||
InspectDoctorDO doctorDO= doctorService.getDoctorid( patientDO.getChiefinspectorid());
|
if (doctorDO != null && doctorDO.getDoctorsign() != null) {
|
||||||
if(doctorDO!=null&&doctorDO.getDoctorsign()!=null)
|
|
||||||
{
|
|
||||||
inspectPatientReportVO.setSign(doctorDO.getDoctorsign());
|
inspectPatientReportVO.setSign(doctorDO.getDoctorsign());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -750,14 +735,14 @@ public class InspectPatientController {
|
|||||||
List<InspectPatientitemsDO> allItems = patientitemsService.GetPatientItemList(medicalSn);
|
List<InspectPatientitemsDO> allItems = patientitemsService.GetPatientItemList(medicalSn);
|
||||||
// 获取PACS数据
|
// 获取PACS数据
|
||||||
List<InspectPacsDataDO> pacsDataList = pacsDataService.GetpacsData(medicalSn);
|
List<InspectPacsDataDO> pacsDataList = pacsDataService.GetpacsData(medicalSn);
|
||||||
|
|
||||||
List<InspectPatientReportDataVO> dataList = new ArrayList<>();
|
List<InspectPatientReportDataVO> dataList = new ArrayList<>();
|
||||||
|
|
||||||
// 1. 首先处理所有基础检查项目
|
// 1. 首先处理所有基础检查项目
|
||||||
if (allItems != null) {
|
if (allItems != null) {
|
||||||
for (InspectPatientitemsDO item : allItems) {
|
for (InspectPatientitemsDO item : allItems) {
|
||||||
InspectPatientReportDataVO itemData = new InspectPatientReportDataVO();
|
InspectPatientReportDataVO itemData = new InspectPatientReportDataVO();
|
||||||
|
|
||||||
// 设置基本项目信息
|
// 设置基本项目信息
|
||||||
itemData.setItemCode(item.getItemCode());
|
itemData.setItemCode(item.getItemCode());
|
||||||
itemData.setItemName(item.getItemName());
|
itemData.setItemName(item.getItemName());
|
||||||
@ -768,7 +753,7 @@ public class InspectPatientController {
|
|||||||
itemData.setInspecttime(item.getInspecttime());
|
itemData.setInspecttime(item.getInspecttime());
|
||||||
itemData.setType(item.getItemName());
|
itemData.setType(item.getItemName());
|
||||||
itemData.setItemStatus(item.getItemStatus());
|
itemData.setItemStatus(item.getItemStatus());
|
||||||
|
|
||||||
// 尝试转换数值结果
|
// 尝试转换数值结果
|
||||||
if (item.getItemResult() != null) {
|
if (item.getItemResult() != null) {
|
||||||
try {
|
try {
|
||||||
@ -777,7 +762,7 @@ public class InspectPatientController {
|
|||||||
// 如果不是数值,保持为null
|
// 如果不是数值,保持为null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 查找并关联PACS数据
|
// 2. 查找并关联PACS数据
|
||||||
if (pacsDataList != null) {
|
if (pacsDataList != null) {
|
||||||
for (InspectPacsDataDO pacsData : pacsDataList) {
|
for (InspectPacsDataDO pacsData : pacsDataList) {
|
||||||
@ -788,24 +773,24 @@ public class InspectPatientController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dataList.add(itemData);
|
dataList.add(itemData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 处理可能存在的独立PACS数据
|
// 3. 处理可能存在的独立PACS数据
|
||||||
if (pacsDataList != null) {
|
if (pacsDataList != null) {
|
||||||
for (InspectPacsDataDO pacsData : pacsDataList) {
|
for (InspectPacsDataDO pacsData : pacsDataList) {
|
||||||
// 检查该PACS数据是否已经被关联
|
// 检查该PACS数据是否已经被关联
|
||||||
boolean alreadyLinked = false;
|
boolean alreadyLinked = false;
|
||||||
for (InspectPatientReportDataVO existingData : dataList) {
|
for (InspectPatientReportDataVO existingData : dataList) {
|
||||||
if (existingData.getPacsDataType() != null &&
|
if (existingData.getPacsDataType() != null &&
|
||||||
existingData.getPacsDataType().equals(pacsData.getType())) {
|
existingData.getPacsDataType().equals(pacsData.getType())) {
|
||||||
alreadyLinked = true;
|
alreadyLinked = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果未被关联,创建新的数据项
|
// 如果未被关联,创建新的数据项
|
||||||
if (!alreadyLinked) {
|
if (!alreadyLinked) {
|
||||||
InspectPatientReportDataVO pacsOnlyData = new InspectPatientReportDataVO();
|
InspectPatientReportDataVO pacsOnlyData = new InspectPatientReportDataVO();
|
||||||
@ -817,11 +802,11 @@ public class InspectPatientController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置排序后的数据列表
|
// 设置排序后的数据列表
|
||||||
inspectPatientReportVO.setData(sortReportData(dataList));
|
inspectPatientReportVO.setData(sortReportData(dataList));
|
||||||
}
|
}
|
||||||
|
|
||||||
return success(inspectPatientReportVO);
|
return success(inspectPatientReportVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -839,18 +824,18 @@ public class InspectPatientController {
|
|||||||
orderMap.put("TZ", 6); // 体重
|
orderMap.put("TZ", 6); // 体重
|
||||||
orderMap.put("YW", 7); // 腰围
|
orderMap.put("YW", 7); // 腰围
|
||||||
orderMap.put("BMI", 8); // BMI
|
orderMap.put("BMI", 8); // BMI
|
||||||
|
|
||||||
dataList.sort((a, b) -> {
|
dataList.sort((a, b) -> {
|
||||||
String codeA = a.getItemCode();
|
String codeA = a.getItemCode();
|
||||||
String codeB = b.getItemCode();
|
String codeB = b.getItemCode();
|
||||||
|
|
||||||
// 获取排序值,默认为100(放在基础检查项目后面)
|
// 获取排序值,默认为100(放在基础检查项目后面)
|
||||||
int orderA = getOrderValue(codeA, orderMap);
|
int orderA = getOrderValue(codeA, orderMap);
|
||||||
int orderB = getOrderValue(codeB, orderMap);
|
int orderB = getOrderValue(codeB, orderMap);
|
||||||
|
|
||||||
return Integer.compare(orderA, orderB);
|
return Integer.compare(orderA, orderB);
|
||||||
});
|
});
|
||||||
|
|
||||||
return dataList;
|
return dataList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -859,13 +844,13 @@ public class InspectPatientController {
|
|||||||
*/
|
*/
|
||||||
private int getOrderValue(String itemCode, Map<String, Integer> orderMap) {
|
private int getOrderValue(String itemCode, Map<String, Integer> orderMap) {
|
||||||
if (itemCode == null) return 100;
|
if (itemCode == null) return 100;
|
||||||
|
|
||||||
for (Map.Entry<String, Integer> entry : orderMap.entrySet()) {
|
for (Map.Entry<String, Integer> entry : orderMap.entrySet()) {
|
||||||
if (itemCode.startsWith(entry.getKey())) {
|
if (itemCode.startsWith(entry.getKey())) {
|
||||||
return entry.getValue();
|
return entry.getValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 100;
|
return 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -876,9 +861,9 @@ public class InspectPatientController {
|
|||||||
if (pacsType == null || (itemCode == null && itemName == null)) {
|
if (pacsType == null || (itemCode == null && itemName == null)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pacsType = pacsType.toUpperCase();
|
pacsType = pacsType.toUpperCase();
|
||||||
|
|
||||||
// 根据项目代码匹配
|
// 根据项目代码匹配
|
||||||
if (itemCode != null) {
|
if (itemCode != null) {
|
||||||
String upperItemCode = itemCode.toUpperCase();
|
String upperItemCode = itemCode.toUpperCase();
|
||||||
@ -887,13 +872,13 @@ public class InspectPatientController {
|
|||||||
if (pacsType.equals("NC") && upperItemCode.contains("NCG")) return true;
|
if (pacsType.equals("NC") && upperItemCode.contains("NCG")) return true;
|
||||||
if ((pacsType.equals("EC") || pacsType.equals("ECG")) && upperItemCode.contains("ECG")) return true;
|
if ((pacsType.equals("EC") || pacsType.equals("ECG")) && upperItemCode.contains("ECG")) return true;
|
||||||
if (pacsType.equals("US") && upperItemCode.contains("US")) return true;
|
if (pacsType.equals("US") && upperItemCode.contains("US")) return true;
|
||||||
|
|
||||||
// 添加新的匹配逻辑
|
// 添加新的匹配逻辑
|
||||||
if (pacsType.equals("CBC") && upperItemCode.contains("XCG")) return true;
|
if (pacsType.equals("CBC") && upperItemCode.contains("XCG")) return true;
|
||||||
if (pacsType.equals("RT") && upperItemCode.contains("NCG")) return true;
|
if (pacsType.equals("RT") && upperItemCode.contains("NCG")) return true;
|
||||||
if (pacsType.equals("BT") && upperItemCode.contains("SHQX")) return true;
|
if (pacsType.equals("BT") && upperItemCode.contains("SHQX")) return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据项目名称匹配
|
// 根据项目名称匹配
|
||||||
if (itemName != null) {
|
if (itemName != null) {
|
||||||
String upperItemName = itemName.toUpperCase();
|
String upperItemName = itemName.toUpperCase();
|
||||||
@ -902,13 +887,14 @@ public class InspectPatientController {
|
|||||||
if (pacsType.equals("NC") && upperItemName.contains("尿常规")) return true;
|
if (pacsType.equals("NC") && upperItemName.contains("尿常规")) return true;
|
||||||
if ((pacsType.equals("EC") || pacsType.equals("ECG")) && upperItemName.contains("心电图")) return true;
|
if ((pacsType.equals("EC") || pacsType.equals("ECG")) && upperItemName.contains("心电图")) return true;
|
||||||
if (pacsType.equals("US") && upperItemName.contains("超声")) return true;
|
if (pacsType.equals("US") && upperItemName.contains("超声")) return true;
|
||||||
|
|
||||||
// 添加新的匹配逻辑
|
// 添加新的匹配逻辑
|
||||||
if (pacsType.equals("CBC") && upperItemName.contains("血常规")) return true;
|
if (pacsType.equals("CBC") && upperItemName.contains("血常规")) return true;
|
||||||
if (pacsType.equals("RT") && upperItemName.contains("尿常规")) return true;
|
if (pacsType.equals("RT") && upperItemName.contains("尿常规")) return true;
|
||||||
if (pacsType.equals("BT") && (upperItemName.contains("生化") || upperItemName.contains("SHQX"))) return true;
|
if (pacsType.equals("BT") && (upperItemName.contains("生化") || upperItemName.contains("SHQX")))
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -917,16 +903,24 @@ public class InspectPatientController {
|
|||||||
*/
|
*/
|
||||||
private String getPacsItemName(String pacsType) {
|
private String getPacsItemName(String pacsType) {
|
||||||
if (pacsType == null) return "未知检查";
|
if (pacsType == null) return "未知检查";
|
||||||
|
|
||||||
switch (pacsType.toUpperCase()) {
|
switch (pacsType.toUpperCase()) {
|
||||||
case "XCG": return "血常规";
|
case "XCG":
|
||||||
case "NCG": return "尿常规";
|
return "血常规";
|
||||||
case "ECG": return "心电图";
|
case "NCG":
|
||||||
case "US": return "超声检查";
|
return "尿常规";
|
||||||
case "BT": return "生化";
|
case "ECG":
|
||||||
case "RT": return "尿常规";
|
return "心电图";
|
||||||
case "CBC": return "血常规";
|
case "US":
|
||||||
default: return pacsType;
|
return "超声检查";
|
||||||
|
case "BT":
|
||||||
|
return "生化";
|
||||||
|
case "RT":
|
||||||
|
return "尿常规";
|
||||||
|
case "CBC":
|
||||||
|
return "血常规";
|
||||||
|
default:
|
||||||
|
return pacsType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1054,13 +1048,11 @@ public class InspectPatientController {
|
|||||||
}
|
}
|
||||||
list.add(inspectPatientitemsSaveReqVO);
|
list.add(inspectPatientitemsSaveReqVO);
|
||||||
patientitemsService.updatePatientitemInfo(list);
|
patientitemsService.updatePatientitemInfo(list);
|
||||||
if(dataMap.get("personimg")!=null)
|
if (dataMap.get("personimg") != null) {
|
||||||
{
|
|
||||||
|
|
||||||
String headurl = dataMap.get("personimg").toString();
|
String headurl = dataMap.get("personimg").toString();
|
||||||
String base64 = HttpUtils.getImageAsBase64(headurl);
|
String base64 = HttpUtils.getImageAsBase64(headurl);
|
||||||
if(base64!=null|| base64!="")
|
if (base64 != null || base64 != "") {
|
||||||
{
|
|
||||||
InspectPatientSaveReqVO updateReqVO = new InspectPatientSaveReqVO();
|
InspectPatientSaveReqVO updateReqVO = new InspectPatientSaveReqVO();
|
||||||
updateReqVO.setMedicalSn(medicalSn);
|
updateReqVO.setMedicalSn(medicalSn);
|
||||||
updateReqVO.setHeadPicUrl(base64);
|
updateReqVO.setHeadPicUrl(base64);
|
||||||
@ -1099,11 +1091,13 @@ public class InspectPatientController {
|
|||||||
public CommonResult<InspectPatientDO> getPatientInfo(@RequestParam("medicalSn") String medicalSn) {
|
public CommonResult<InspectPatientDO> getPatientInfo(@RequestParam("medicalSn") String medicalSn) {
|
||||||
return success(patientService.getPatientInfo(medicalSn));
|
return success(patientService.getPatientInfo(medicalSn));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/PatientBySearchKey")
|
@GetMapping("/PatientBySearchKey")
|
||||||
@Operation(summary = "根据姓名、身份证号、体检编号获得患者信息")
|
@Operation(summary = "根据姓名、身份证号、体检编号获得患者信息")
|
||||||
public CommonResult<List<InspectPatientDO>> getPatientBySearchKey(@RequestParam("searchKey") String searchKey) {
|
public CommonResult<List<InspectPatientDO>> getPatientBySearchKey(@RequestParam("searchKey") String searchKey) {
|
||||||
return success(patientService.getPatientBySearchKey(searchKey));
|
return success(patientService.getPatientBySearchKey(searchKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/getecgTj")
|
@GetMapping("/getecgTj")
|
||||||
@Operation(summary = "获取体检ecg数据")
|
@Operation(summary = "获取体检ecg数据")
|
||||||
public CommonResult<Boolean> GetApiEcgInfo(@RequestParam("medicalSn") String medicalSn) {
|
public CommonResult<Boolean> GetApiEcgInfo(@RequestParam("medicalSn") String medicalSn) {
|
||||||
@ -1116,23 +1110,21 @@ public class InspectPatientController {
|
|||||||
pacsDataService.createPacsData(inspectPacs);
|
pacsDataService.createPacsData(inspectPacs);
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/GetApiPatientInfo")
|
@GetMapping("/GetApiPatientInfo")
|
||||||
@Operation(summary = "获取公卫患者信息")
|
@Operation(summary = "获取公卫患者信息")
|
||||||
public CommonResult<InspectApiInfoVO> GetApiPatientInfo(@RequestParam("idCard") String idCard) throws JsonProcessingException {
|
public CommonResult<InspectApiInfoVO> GetApiPatientInfo(@RequestParam("idCard") String idCard) throws JsonProcessingException {
|
||||||
ConfigDO config = configService.getConfigByKey("url.patientinfo");
|
ConfigDO config = configService.getConfigByKey("url.patientinfo");
|
||||||
String url = config.getValue();
|
String url = config.getValue();
|
||||||
InspectApiInfoVO inspectApiInfoVO =new InspectApiInfoVO();
|
InspectApiInfoVO inspectApiInfoVO = new InspectApiInfoVO();
|
||||||
if(url!=null)
|
if (url != null) {
|
||||||
{
|
|
||||||
String response = HttpUtils.post(url + "?" + "idCard=" + idCard);
|
String response = HttpUtils.post(url + "?" + "idCard=" + idCard);
|
||||||
if(response!=null)
|
if (response != null) {
|
||||||
{
|
|
||||||
// 解析 JSON 响应
|
// 解析 JSON 响应
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
Map<String, Object> responseMap = objectMapper.readValue(response, Map.class);
|
Map<String, Object> responseMap = objectMapper.readValue(response, Map.class);
|
||||||
Map<String, Object> dataMap = (Map<String, Object>) responseMap.get("data");
|
Map<String, Object> dataMap = (Map<String, Object>) responseMap.get("data");
|
||||||
if (dataMap != null)
|
if (dataMap != null) {
|
||||||
{
|
|
||||||
if (dataMap.get("idCard") != null) {
|
if (dataMap.get("idCard") != null) {
|
||||||
inspectApiInfoVO.setIdCard(dataMap.get("idCard").toString());
|
inspectApiInfoVO.setIdCard(dataMap.get("idCard").toString());
|
||||||
}
|
}
|
||||||
@ -1157,9 +1149,7 @@ public class InspectPatientController {
|
|||||||
if (dataMap.get("telephone") != null) {
|
if (dataMap.get("telephone") != null) {
|
||||||
inspectApiInfoVO.setTelephone(dataMap.get("telephone").toString());
|
inspectApiInfoVO.setTelephone(dataMap.get("telephone").toString());
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return success("没有查询到相关信息");
|
return success("没有查询到相关信息");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1184,7 +1174,8 @@ public class InspectPatientController {
|
|||||||
Object dataObj = responseMap.get("data");
|
Object dataObj = responseMap.get("data");
|
||||||
if (dataObj != null) {
|
if (dataObj != null) {
|
||||||
// 将 data 字段解析为一个 List<Map<String, Object>>
|
// 将 data 字段解析为一个 List<Map<String, Object>>
|
||||||
List<Map<String, Object>> dataList = objectMapper.convertValue(dataObj, new TypeReference<List<Map<String, Object>>>() {});
|
List<Map<String, Object>> dataList = objectMapper.convertValue(dataObj, new TypeReference<List<Map<String, Object>>>() {
|
||||||
|
});
|
||||||
|
|
||||||
InspectPatientSaveReqVO inspectPatientSaveReqVO = new InspectPatientSaveReqVO();
|
InspectPatientSaveReqVO inspectPatientSaveReqVO = new InspectPatientSaveReqVO();
|
||||||
inspectPatientSaveReqVO.setMedicalSn(medicalSn);
|
inspectPatientSaveReqVO.setMedicalSn(medicalSn);
|
||||||
@ -1287,9 +1278,9 @@ public class InspectPatientController {
|
|||||||
|
|
||||||
@PutMapping("/updatePrintStatus")
|
@PutMapping("/updatePrintStatus")
|
||||||
@Operation(summary = "更新打印状态")
|
@Operation(summary = "更新打印状态")
|
||||||
public CommonResult<Boolean> updatePrintStatus(@RequestParam("medicalSn") String medicalSn,
|
public CommonResult<Boolean> updatePrintStatus(@RequestParam("medicalSn") String medicalSn,
|
||||||
@RequestParam(value = "printtime", required = false)
|
@RequestParam(value = "printtime", required = false)
|
||||||
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) Date printtime) {
|
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) Date printtime) {
|
||||||
patientService.isprintupdate(medicalSn, printtime);
|
patientService.isprintupdate(medicalSn, printtime);
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
@ -1303,24 +1294,24 @@ public class InspectPatientController {
|
|||||||
if (patientDO == null) {
|
if (patientDO == null) {
|
||||||
return success("未找到该患者信息");
|
return success("未找到该患者信息");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查患者的检查状态
|
// 检查患者的检查状态
|
||||||
if (patientDO.getStatus() == null || patientDO.getStatus() != 1) {
|
if (patientDO.getStatus() == null || patientDO.getStatus() != 1) {
|
||||||
return success("患者未完成检查,无法生成报告");
|
return success("患者未完成检查,无法生成报告");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 构建请求JSON
|
// 构建请求JSON
|
||||||
Map<String, String> requestBody = new HashMap<>();
|
Map<String, String> requestBody = new HashMap<>();
|
||||||
requestBody.put("medicalSn", medicalSn);
|
requestBody.put("medicalSn", medicalSn);
|
||||||
|
|
||||||
// 将Map转换为JSON字符串
|
// 将Map转换为JSON字符串
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
String jsonRequestBody = objectMapper.writeValueAsString(requestBody);
|
String jsonRequestBody = objectMapper.writeValueAsString(requestBody);
|
||||||
|
|
||||||
// 发送POST请求
|
// 发送POST请求
|
||||||
String url = "http://114.55.171.231:48085/api/report/generate";
|
String url = "http://114.55.171.231:48085/api/report/generate";
|
||||||
String response = HttpUtils.postJson(url, jsonRequestBody);
|
String response = HttpUtils.postJson(url, jsonRequestBody);
|
||||||
if(response!=null) {
|
if (response != null) {
|
||||||
// 解析响应,如果成功则保存PDF URL
|
// 解析响应,如果成功则保存PDF URL
|
||||||
try {
|
try {
|
||||||
Map<String, Object> responseMap = objectMapper.readValue(response, Map.class);
|
Map<String, Object> responseMap = objectMapper.readValue(response, Map.class);
|
||||||
@ -1344,7 +1335,7 @@ public class InspectPatientController {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return success(response);
|
return success(response);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -1354,50 +1345,51 @@ public class InspectPatientController {
|
|||||||
|
|
||||||
@PutMapping("/updateReportUrl")
|
@PutMapping("/updateReportUrl")
|
||||||
@Operation(summary = "更新患者体检报告URL")
|
@Operation(summary = "更新患者体检报告URL")
|
||||||
public CommonResult<Boolean> updateReportUrl(@RequestParam("medicalSn") String medicalSn,
|
public CommonResult<Boolean> updateReportUrl(@RequestParam("medicalSn") String medicalSn,
|
||||||
@RequestParam("pdfUrl") String pdfUrl) {
|
@RequestParam("pdfUrl") String pdfUrl) {
|
||||||
try {
|
try {
|
||||||
// 获取患者信息
|
// 获取患者信息
|
||||||
InspectPatientDO patientDO = patientService.getPatientInfo(medicalSn);
|
InspectPatientDO patientDO = patientService.getPatientInfo(medicalSn);
|
||||||
if (patientDO == null) {
|
if (patientDO == null) {
|
||||||
return success(false, "未找到该患者信息");
|
return success(false, "未找到该患者信息");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新pdfurl字段
|
// 更新pdfurl字段
|
||||||
InspectPatientSaveReqVO updateReqVO = new InspectPatientSaveReqVO();
|
InspectPatientSaveReqVO updateReqVO = new InspectPatientSaveReqVO();
|
||||||
updateReqVO.setMedicalSn(medicalSn);
|
updateReqVO.setMedicalSn(medicalSn);
|
||||||
updateReqVO.setPdfurl(pdfUrl);
|
updateReqVO.setPdfurl(pdfUrl);
|
||||||
|
|
||||||
// 调用服务更新数据
|
// 调用服务更新数据
|
||||||
patientService.updatePatientPdfUrl(updateReqVO);
|
patientService.updatePatientPdfUrl(updateReqVO);
|
||||||
|
|
||||||
return success(true);
|
return success(true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return success(false, "更新报告URL失败:" + e.getMessage());
|
return success(false, "更新报告URL失败:" + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/getReportUrl")
|
@GetMapping("/getReportUrl")
|
||||||
@Operation(summary = "获取患者体检报告URL")
|
@Operation(summary = "获取患者体检报告URL")
|
||||||
public CommonResult<Map<String, Object>> getReportUrl(@RequestParam("cardId") String cardId) {
|
public CommonResult<Map<String, Object>> getReportUrl(@RequestParam("cardId") String cardId) {
|
||||||
try {
|
try {
|
||||||
// 根据身份证查询患者信息
|
// 根据身份证查询患者信息
|
||||||
InspectPatientDO patientDO = patientService.getPatientByCardId(cardId);
|
InspectPatientDO patientDO = patientService.getPatientByCardId(cardId);
|
||||||
|
|
||||||
// 如果找不到患者记录或者pdfurl为空,返回暂无报告
|
// 如果找不到患者记录或者pdfurl为空,返回暂无报告
|
||||||
if (patientDO == null) {
|
if (patientDO == null) {
|
||||||
return CommonResult.error(404, "未找到患者记录");
|
return CommonResult.error(404, "未找到患者记录");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (patientDO.getPdfurl() == null || patientDO.getPdfurl().trim().isEmpty()) {
|
if (patientDO.getPdfurl() == null || patientDO.getPdfurl().trim().isEmpty()) {
|
||||||
return CommonResult.error(404, "暂无报告");
|
return CommonResult.error(404, "暂无报告");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 提取体检编号的日期部分
|
// 提取体检编号的日期部分
|
||||||
String pdfUrl = patientDO.getPdfurl();
|
String pdfUrl = patientDO.getPdfurl();
|
||||||
String reportDate = "";
|
String reportDate = "";
|
||||||
String medicalSn = patientDO.getMedicalSn();
|
String medicalSn = patientDO.getMedicalSn();
|
||||||
|
|
||||||
// 使用medicalDateTime字段获取日期
|
// 使用medicalDateTime字段获取日期
|
||||||
LocalDateTime medicalDateTime = patientDO.getMedicalDateTime();
|
LocalDateTime medicalDateTime = patientDO.getMedicalDateTime();
|
||||||
if (medicalDateTime != null) {
|
if (medicalDateTime != null) {
|
||||||
@ -1413,13 +1405,13 @@ public class InspectPatientController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 构建返回的数据
|
// 构建返回的数据
|
||||||
Map<String, Object> resultMap = new HashMap<>();
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
resultMap.put("url", pdfUrl);
|
resultMap.put("url", pdfUrl);
|
||||||
resultMap.put("date", reportDate);
|
resultMap.put("date", reportDate);
|
||||||
resultMap.put("medicalSn", medicalSn);
|
resultMap.put("medicalSn", medicalSn);
|
||||||
|
|
||||||
// 返回结果
|
// 返回结果
|
||||||
return CommonResult.success(resultMap, "成功");
|
return CommonResult.success(resultMap, "成功");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -1427,13 +1419,57 @@ public class InspectPatientController {
|
|||||||
return CommonResult.error(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(), "查询异常:" + e.getMessage());
|
return CommonResult.error(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(), "查询异常:" + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/updateMedicalDateTime")
|
@PutMapping("/updateMedicalDateTime")
|
||||||
@Operation(summary = "更新体检日期")
|
@Operation(summary = "更新体检日期")
|
||||||
public CommonResult<Boolean> updateMedicalDateTime(@RequestParam("medicalSn") String medicalSn,
|
public CommonResult<Boolean> updateMedicalDateTime(@RequestParam("medicalSn") String medicalSn,
|
||||||
@RequestParam(value = "medicalDateTime", required = false)
|
@RequestParam(value = "medicalDateTime", required = false)
|
||||||
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) Date medicalDateTime)
|
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) Date medicalDateTime) {
|
||||||
{
|
|
||||||
patientService.updateMedicalDateTime(medicalSn, medicalDateTime);
|
patientService.updateMedicalDateTime(medicalSn, medicalDateTime);
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
@GetMapping("/GetbarcodeInfo")
|
||||||
|
@Operation(summary = "获取样本码信息")
|
||||||
|
public CommonResult<BarcodeInfoVO> GetbarcodeInfo(@RequestParam("medicalSn") String medicalSn) {
|
||||||
|
|
||||||
|
// 获取患者信息
|
||||||
|
InspectPatientDO patientDO = patientService.getPatientInfo(medicalSn);
|
||||||
|
if (patientDO == null) {
|
||||||
|
return success("未找到该患者信息");
|
||||||
|
}
|
||||||
|
if(patientDO.getNcgcode()==null || patientDO.getXcgcode()==null|| patientDO.getShqx()==null)
|
||||||
|
{
|
||||||
|
return success("条码不存在");
|
||||||
|
}
|
||||||
|
BarcodeInfoVO barcodeInfoVO = new BarcodeInfoVO();
|
||||||
|
barcodeInfoVO.setName(patientDO.getPName());
|
||||||
|
barcodeInfoVO.setGender(patientDO.getGender());
|
||||||
|
int age = StrUtils.calculateAgeFromIdCard(patientDO.getCardId());
|
||||||
|
barcodeInfoVO.setAge(age);
|
||||||
|
// 设置当前时间字符串
|
||||||
|
LocalDateTime currentDateTime = LocalDateTime.now();
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
String currentDateTimeStr = currentDateTime.format(formatter);
|
||||||
|
barcodeInfoVO.setExaminationDate(currentDateTimeStr);
|
||||||
|
// 初始化条形码集合
|
||||||
|
List<BarcodeInfoVO.Barcode> barcodes = new ArrayList<>();
|
||||||
|
BarcodeInfoVO.Barcode ncgbarcode = new BarcodeInfoVO.Barcode();
|
||||||
|
ncgbarcode.setCode(patientDO.getNcgcode());
|
||||||
|
ncgbarcode.setName("尿常规");
|
||||||
|
barcodes.add(ncgbarcode);
|
||||||
|
|
||||||
|
BarcodeInfoVO.Barcode xcgbarcode = new BarcodeInfoVO.Barcode();
|
||||||
|
xcgbarcode.setCode(patientDO.getXcgcode());
|
||||||
|
xcgbarcode.setName("血常规");
|
||||||
|
barcodes.add(xcgbarcode);
|
||||||
|
|
||||||
|
BarcodeInfoVO.Barcode shqxbarcode = new BarcodeInfoVO.Barcode();
|
||||||
|
shqxbarcode.setCode(patientDO.getShqx());
|
||||||
|
shqxbarcode.setName("生化");
|
||||||
|
barcodes.add(shqxbarcode);
|
||||||
|
barcodeInfoVO.setBarcodes(barcodes);
|
||||||
|
|
||||||
|
return success(barcodeInfoVO);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package cn.iocoder.yudao.module.inspect.controller.admin.inspectpatient.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BarcodeInfoVO {
|
||||||
|
|
||||||
|
@Schema(description = "姓名")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "性别")
|
||||||
|
private String gender;
|
||||||
|
|
||||||
|
@Schema(description = "年龄")
|
||||||
|
private Integer age;
|
||||||
|
|
||||||
|
@Schema(description = "体检日期")
|
||||||
|
private String examinationDate;
|
||||||
|
|
||||||
|
@Schema(description = "条形码集合")
|
||||||
|
private List<Barcode> barcodes;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class Barcode {
|
||||||
|
@Schema(description = "条形码编码")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@Schema(description = "条形码名称")
|
||||||
|
private String name;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user