20250407 更新

1.提供feign调用接口去获取检验记录数据
This commit is contained in:
2025-04-07 10:51:35 +08:00
parent 222bbb6eb4
commit 25c8014fff
5 changed files with 100 additions and 6 deletions

View File

@@ -0,0 +1,39 @@
package digital.laboratory.platform.inspection.controller;
import cn.hutool.json.JSONObject;
import digital.laboratory.platform.common.core.util.R;
import digital.laboratory.platform.inspection.service.PushDataToLabsCareService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* @author ChenJiangBao
* @version 1.0
* @description: 推送数据到LabsCare平台接口管理
* @date 2025/4/3 10:48
*/
@RestController
@RequestMapping("/pushDataToLabsCare")
@Api(tags = "19-推送数据到LabsCare平台接口管理", description = "推送数据到LabsCare平台接口管理")
public class PushDataToLabsCareController {
@Resource
private PushDataToLabsCareService pushDataToLabsCareService;
@ApiOperation("获取推送检验记录的数据")
@PostMapping("/inspectRecord")
public R<JSONObject> inspectRecord(@RequestParam("entrustId") String entrustId) {
try {
return R.ok(pushDataToLabsCareService.fetchInspectRecordData(entrustId));
} catch (Exception e) {
return R.failed(e.getMessage());
}
}
}

View File

@@ -1,5 +1,7 @@
package digital.laboratory.platform.inspection.service;
import cn.hutool.json.JSONObject;
/**
* @author ChenJiangBao
* @version 1.0
@@ -20,4 +22,10 @@ public interface PushDataToLabsCareService {
*/
void pushBiologyQualitativeRecordData(String testId);
/**
* 根据委托id获取检验记录数据
* @param entrustId 委托id
* @return
*/
JSONObject fetchInspectRecordData(String entrustId);
}

View File

@@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import digital.laboratory.platform.common.core.exception.CheckedException;
import digital.laboratory.platform.inspection.config.ApiPathProperties;
import digital.laboratory.platform.inspection.constant.TestRecordSampleDataConstant;
import digital.laboratory.platform.inspection.convert.TestRecordSampleDataConverter;
@@ -26,6 +27,7 @@ import digital.laboratory.platform.othersys.utils.HttpsUtils;
import digital.laboratory.platform.sys.entity.Drug;
import digital.laboratory.platform.sys.entity.SysUser;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.weaver.ast.Test;
import org.springframework.http.*;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
@@ -222,6 +224,30 @@ public class PushDataToLabsCareServiceImpl implements PushDataToLabsCareService
}
}
/**
* 根据委托id获取检验记录数据
* @param entrustId 委托id
* @return
*/
@Override
public JSONObject fetchInspectRecordData(String entrustId) {
EntrustInfo entrustInfo = entrustInfoService.getById(entrustId);
if (entrustInfo == null) {
log.error("委托id为 {} 的委托信息不存在", entrustId);
throw new CheckedException(String.format("委托id为 %s 的委托信息查询不到", entrustId));
}
// 根据委托id查询对应的实验信息
TestRecord testRecord = testRecordService.getOne(Wrappers.<TestRecord>lambdaQuery().eq(TestRecord::getBusinessId, entrustId).last("LIMIT 1"));
if (testRecord == null) {
log.error("委托id为 {} 对应的实验信息不存在", entrustId);
throw new CheckedException(String.format("委托id为 %s 对应的实验信息查询不到", entrustId));
}
if (entrustInfo.getBusinessType().equals(BusinessType.BOINT_CASE.getBusinessType())) {
return buildBiologyQualitativeRecordJsonPayload(entrustInfo, testRecord);
}
return buildNonInfraredGeneralQualitativeRecordJsonPayload(entrustInfo, testRecord);
}
/**
* 构建生物检材定性记录Json数据
*