新增回传体检信息接口

This commit is contained in:
lxd 2025-04-17 09:47:18 +08:00
parent c02d7b0044
commit 4a320569fd
4 changed files with 351 additions and 32 deletions

View File

@ -89,7 +89,7 @@ import java.util.Locale;
@RequestMapping("/inspect/patient") @RequestMapping("/inspect/patient")
@Validated @Validated
public class InspectPatientController { public class InspectPatientController {
// private static final AtomicInteger counter = new AtomicInteger(0); // private static final AtomicInteger counter = new AtomicInteger(0);
@Resource @Resource
private InspectPatientService patientService; private InspectPatientService patientService;
@Resource @Resource
@ -345,8 +345,8 @@ public class InspectPatientController {
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);
// 生成一个唯一的6位的随机数 // 生成一个唯一的6位的随机数
Random random = new Random(); Random random = new Random();
String sequencePart; String sequencePart;
@ -664,12 +664,12 @@ public class InspectPatientController {
case "WBC": case "WBC":
case "NIT": case "NIT":
if (result.getItemValue() != null && result.getItemValue().contains("+")) { if (result.getItemValue() != null && result.getItemValue().contains("+")) {
ncgsb.append("" + result.getItemName() + "" + "阳性,值为:" +result.getItemValue()+ "" + "\n"); ncgsb.append("" + result.getItemName() + "" + "阳性,值为:" + result.getItemValue() + "" + "\n");
} }
break; break;
case "URO": case "URO":
if (result.getItemValue() != null && !result.getItemValue().contains("Normal")) { if (result.getItemValue() != null && !result.getItemValue().contains("Normal")) {
ncgsb.append("" + result.getItemName() + "" + "该项异常,值为:" +result.getItemValue()+ "" + "\n"); ncgsb.append("" + result.getItemName() + "" + "该项异常,值为:" + result.getItemValue() + "" + "\n");
} }
break; break;
case "PRO": case "PRO":
@ -678,29 +678,25 @@ public class InspectPatientController {
case "KET": case "KET":
case "GLU": case "GLU":
if (result.getItemValue() != null && result.getItemValue().contains("+")) { if (result.getItemValue() != null && result.getItemValue().contains("+")) {
ncgsb.append("" + result.getItemName() + "" + "阳性,值为:" +result.getItemValue()+ "" + "\n"); ncgsb.append("" + result.getItemName() + "" + "阳性,值为:" + result.getItemValue() + "" + "\n");
} }
break; break;
case "PH": case "PH":
if (result.getItemValue() != null) { if (result.getItemValue() != null) {
if(NumberUtils.isNumeric(result.getItemValue())) if (NumberUtils.isNumeric(result.getItemValue())) {
{
double ph = Double.parseDouble(result.getItemValue()); double ph = Double.parseDouble(result.getItemValue());
if(ph<5.0 || ph>8.0) if (ph < 5.0 || ph > 8.0) {
{ ncgsb.append("" + result.getItemName() + "" + "该项异常,值为:" + result.getItemValue() + "" + "\n");
ncgsb.append("" + result.getItemName() + "" + "该项异常,值为:" +result.getItemValue()+ "" + "\n");
} }
} }
} }
break; break;
case "SG": case "SG":
if (result.getItemValue() != null) { if (result.getItemValue() != null) {
if(NumberUtils.isNumeric(result.getItemValue())) if (NumberUtils.isNumeric(result.getItemValue())) {
{
double sg = Double.parseDouble(result.getItemValue()); double sg = Double.parseDouble(result.getItemValue());
if(sg<1.015 || sg>1.025) if (sg < 1.015 || sg > 1.025) {
{ ncgsb.append("" + result.getItemName() + "" + "该项异常,值为:" + result.getItemValue() + "" + "\n");
ncgsb.append("" + result.getItemName() + "" + "该项异常,值为:" +result.getItemValue()+ "" + "\n");
} }
} }
} }
@ -719,7 +715,6 @@ public class InspectPatientController {
// break; // break;
} }
} }
@ -739,6 +734,189 @@ public class InspectPatientController {
} }
return success(true); return success(true);
} }
@GetMapping("/PushJYPatientInfo")
@Operation(summary = "回传体检相关信息")
public CommonResult<Boolean> PushJYPatientInfo(@RequestParam("medicalSn") String medicalSn) throws JsonProcessingException {
//获取患者信息
InspectPatientDO patientDO = patientService.getPatientInfo(medicalSn);
if (patientDO != null) {
if (patientDO.getNcgcode() != null && patientDO.getXcgcode() != null && patientDO.getShqx() != null) {
// 定义条形码列表
List<String> barcodes = Arrays.asList(
patientDO.getNcgcode(),
patientDO.getXcgcode(),
patientDO.getShqx()
);
ConfigDO config = configService.getConfigByKey("url.reporttj");
String url = config.getValue();
//返回实体类
PatientJYInfoVO patientJYInfoVO = new PatientJYInfoVO();
//先添加基本信息
patientJYInfoVO.setPatientname(patientDO.getPName());
patientJYInfoVO.setIdcard(patientDO.getCardId());
patientJYInfoVO.setExamindate(patientDO.getMedicalDateTime().toString());
//心电图信息
InspectPacsDataDO ecg = pacsDataService.getPacsDataByCode(medicalSn,"ecg");
if(ecg!=null)
{
if(ecg.getData()!=null)
{
patientJYInfoVO.setElectrokardiagramtypeid(1);
patientJYInfoVO.setElectrocardiogramimg(ecg.getData());
}
}
for (String barCode : barcodes) {
String response = HttpUtils.get(url + "?" + "barCode=" + barCode + "&" + "hospitalCode=" + patientDO.getHospitalNo());
if (response != null) {
// 解析 JSON 响应
ObjectMapper objectMapper = new ObjectMapper();
try {
ReportResponse reportResponse = objectMapper.readValue(response, ReportResponse.class);
if ("操作成功".equals(reportResponse.getMsg()) && reportResponse.getCode() == 200) {
ReportData reportData = reportResponse.getData();
// 获取 reportPath
String reportPath = reportData.getReportPath();
if (!reportPath.contains("报告暂未出")) {
if (reportData.getResultsAll() != null && reportData.getResultsAll().size() > 0) {
// 获取 results 数组并遍历
List<ResultItem> results = reportData.getResultsAll();
for (ResultItem result : results) {
switch (result.getItemCode()) {
case "HGB"://血常规血红蛋白
if (result.getItemValue() != null) {
if (NumberUtils.isNumeric(result.getItemValue())) {
double value = Double.parseDouble(result.getItemValue());
patientJYInfoVO.setHemoglobin(value);
}
}
break;
case "WBC"://血常规白细胞
if (result.getItemValue() != null) {
if (NumberUtils.isNumeric(result.getItemValue())) {
double value = Double.parseDouble(result.getItemValue());
patientJYInfoVO.setLeukocyte(value);
}
}
break;
case "PLT"://血常规血小板
if (result.getItemValue() != null) {
if (NumberUtils.isNumeric(result.getItemValue())) {
double value = Double.parseDouble(result.getItemValue());
patientJYInfoVO.setBloodplatelet(value);
}
}
break;
case "PRO"://尿常规尿蛋白
if (result.getItemValue() != null)
{
patientJYInfoVO.setUrineprotein(result.getItemValue());
}
break;
case "GLU"://尿常规尿糖
if (result.getItemValue() != null)
{
patientJYInfoVO.setUrinesugar(result.getItemValue());
}
case "KET"://尿常规尿酮体
if (result.getItemValue() != null)
{
patientJYInfoVO.setUnrineketone(result.getItemValue());
}
break;
case "BLD"://尿常规潜血
if (result.getItemValue() != null)
{
patientJYInfoVO.setUnrineoccultblood(result.getItemValue());
}
break;
case "RBC"://血常规红细胞
if (result.getItemValue() != null) {
if (NumberUtils.isNumeric(result.getItemValue())) {
double value = Double.parseDouble(result.getItemValue());
patientJYInfoVO.setErythrocyte(value);
}
}
break;
case "TG"://甘油三酯
if (result.getItemValue() != null) {
if (NumberUtils.isNumeric(result.getItemValue())) {
double value = Double.parseDouble(result.getItemValue());
patientJYInfoVO.setTriglycercide(value);
}
}
break;
case "TC"://总胆固醇
if (result.getItemValue() != null) {
if (NumberUtils.isNumeric(result.getItemValue())) {
double value = Double.parseDouble(result.getItemValue());
patientJYInfoVO.setTotalcholesterol(value);
}
}
break;
case "LDL-C"://低密度脂蛋白胆固醇
if (result.getItemValue() != null) {
if (NumberUtils.isNumeric(result.getItemValue())) {
double value = Double.parseDouble(result.getItemValue());
patientJYInfoVO.setLdlc(value);
}
}
break;
case "HDL-C"://高密度脂蛋白胆固醇
if (result.getItemValue() != null) {
if (NumberUtils.isNumeric(result.getItemValue())) {
double value = Double.parseDouble(result.getItemValue());
patientJYInfoVO.setHdlc(value);
}
}
break;
}
}
}
}
}
} catch (IOException e) {
e.printStackTrace();
return success(true);
}
}
}
//获取配置项地址
ConfigDO configDO = configService.getConfigByKey("url.tjhc");
// 发送 POST 请求
String doValue = configDO.getValue();
// 创建 ObjectMapper 实例
ObjectMapper objectMapper = new ObjectMapper();
// Java 对象转换为 JSON 字符串
String jsonRequestBody = objectMapper.writeValueAsString(patientJYInfoVO);
// 记录接口返回值
InspectApplylogSaveReqVO responseLogVO = new InspectApplylogSaveReqVO();
responseLogVO.setTime(LocalDateTime.now());
responseLogVO.setMedicalsn(patientDO.getMedicalSn());
responseLogVO.setIdcard(patientDO.getCardId());
responseLogVO.setJson(jsonRequestBody);
applylogService.createApplylog(responseLogVO);
String response = HttpUtils.postJson(doValue, jsonRequestBody);
// 记录接口返回值
InspectApplylogSaveReqVO responseLogVO1 = new InspectApplylogSaveReqVO();
responseLogVO1.setTime(LocalDateTime.now());
responseLogVO1.setMedicalsn(patientDO.getMedicalSn());
responseLogVO1.setIdcard(patientDO.getCardId());
responseLogVO1.setJson(response);
applylogService.createApplylog(responseLogVO1);
}
}
return success(true);
}
@GetMapping("/getUSTj") @GetMapping("/getUSTj")
@Operation(summary = "获取超声报告") @Operation(summary = "获取超声报告")
@ -1043,7 +1221,7 @@ public class InspectPatientController {
for (Map.Entry<String, Object> entry : dataMap.entrySet()) { for (Map.Entry<String, Object> entry : dataMap.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
if (value == null) value="";//一般检查可能为NULL if (value == null) value = "";//一般检查可能为NULL
InspectPatientitemsSaveReqVO inspectPatientitemsSaveReqVO = null; InspectPatientitemsSaveReqVO inspectPatientitemsSaveReqVO = null;
switch (key) { switch (key) {
case "temperature": case "temperature":
@ -1188,15 +1366,13 @@ public class InspectPatientController {
InspectPatientDO patient = patientService.getPatient(id); InspectPatientDO patient = patientService.getPatient(id);
return success(BeanUtils.toBean(patient, InspectPatientRespVO.class)); return success(BeanUtils.toBean(patient, InspectPatientRespVO.class));
} }
@GetMapping("/MedicalSnPatientInfo") @GetMapping("/MedicalSnPatientInfo")
@Operation(summary = "获得患者信息 对外暴露") @Operation(summary = "获得患者信息 对外暴露")
public CommonResult<PersonalInfoVO> getMedicalSnPatientInfo(@RequestParam("medicalSn") String medicalSn) public CommonResult<PersonalInfoVO> getMedicalSnPatientInfo(@RequestParam("medicalSn") String medicalSn) {
{ if (medicalSn != null && !medicalSn.isEmpty()) {
if(medicalSn!=null&&!medicalSn.isEmpty()) InspectPatientDO patientDO = patientService.getPatientOfMedicalSn(medicalSn);
{ if (patientDO != null) {
InspectPatientDO patientDO= patientService.getPatientOfMedicalSn(medicalSn);
if(patientDO!=null)
{
PersonalInfoVO personalInfoVO = new PersonalInfoVO(); PersonalInfoVO personalInfoVO = new PersonalInfoVO();
personalInfoVO.setIdCard(patientDO.getCardId()); personalInfoVO.setIdCard(patientDO.getCardId());
personalInfoVO.setName(patientDO.getPName()); personalInfoVO.setName(patientDO.getPName());
@ -1206,13 +1382,10 @@ public class InspectPatientController {
personalInfoVO.setAddress(patientDO.getDomicileaddress()); personalInfoVO.setAddress(patientDO.getDomicileaddress());
personalInfoVO.setTelephone(patientDO.getPhoneNum()); personalInfoVO.setTelephone(patientDO.getPhoneNum());
return success(personalInfoVO); return success(personalInfoVO);
} } else {
else
{
return success("未查询到体检信息"); return success("未查询到体检信息");
} }
} } else {
else {
return success("体检编号为空"); return success("体检编号为空");
} }

View File

@ -0,0 +1,134 @@
package cn.iocoder.yudao.module.inspect.controller.admin.inspectpatient.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class PatientJYInfoVO {
@Schema(description = "姓名")
private String patientname;
@Schema(description = "身份证号")
private String idcard;
@Schema(description = "体检日期")
private String examindate;
@Schema(description = "血红蛋白")
private double hemoglobin;
@Schema(description = "白细胞")
private double leukocyte;
@Schema(description = "血小板")
private double bloodplatelet;
@Schema(description = "红细胞")
private double erythrocyte;
@Schema(description = "其他常规")
private String otherroutine;
@Schema(description = "尿蛋白")
private String urineprotein;
@Schema(description = "尿糖")
private String urinesugar;
@Schema(description = "尿酮体")
private String unrineketone;
@Schema(description = "尿潜血")
private String unrineoccultblood;
@Schema(description = "尿微量白蛋白")
private double unrinemicroalbumin;
@Schema(description = "其他尿常规")
private String otherunrineroutine;
@Schema(description = "心电图类型ID")
private int electrokardiagramtypeid;
@Schema(description = "心电图类型")
private String electrokardiagramtype;
@Schema(description = "心电图图片")
private String electrocardiogramimg;
@Schema(description = "SGPT")
private double sgpt;
@Schema(description = "SGOT")
private double sgot;
@Schema(description = "白蛋白")
private double albumen;
@Schema(description = "总胆红素")
private double totalbilirubin;
@Schema(description = "结合胆红素")
private double conjugatedbilirubin;
@Schema(description = "血肌酐")
private double serumcreatinine;
@Schema(description = "尿素氮")
private double bun;
@Schema(description = "血钾")
private double serumpotassium;
@Schema(description = "血钠")
private double serumsodium;
@Schema(description = "低密度脂蛋白胆固醇")
private double ldlc;
@Schema(description = "高密度脂蛋白胆固醇")
private double hdlc;
@Schema(description = "甘油三酯")
private double triglycercide;
@Schema(description = "总胆固醇")
private double totalcholesterol;
@Schema(description = "空腹血糖mmol/L")
private double fastplasmaglucoseml;
@Schema(description = "空腹血糖mg/dL")
private double fastplasmaglucosemgl;
@Schema(description = "粪便潜血类型ID")
private int fecaloccbloodtypeid;
@Schema(description = "糖化血红蛋白")
private double glycatedhemog;
@Schema(description = "HBsAg类型ID")
private int hbsagid;
@Schema(description = "HBsAg")
private String hbsag;
@Schema(description = "胸片类型ID")
private int chestxrayid;
@Schema(description = "胸片")
private String chestxray;
@Schema(description = "超声类型ID")
private int bultrasoundid;
@Schema(description = "超声")
private String bultrasound;
@Schema(description = "随机血糖mmol/L")
private String randomglucosemml;
@Schema(description = "随机血糖mg/dL")
private String randomglucosemgl;
}

View File

@ -62,6 +62,11 @@ public interface InspectPacsDataService {
* 根据体检编号和类型判断是否存在pacs数据 * 根据体检编号和类型判断是否存在pacs数据
* */ * */
Boolean IspacsDataExist(String code, String type); Boolean IspacsDataExist(String code, String type);
/*
* 根据体检编号和类型查询指定数据
* */
InspectPacsDataDO getPacsDataByCode(String code, String type);
/* /*
* *
* 根据体检编号和类型判断是否存在pacs的item数据 * 根据体检编号和类型判断是否存在pacs的item数据

View File

@ -96,6 +96,13 @@ public class InspectPacsDataServiceImpl implements InspectPacsDataService {
queryWrapper.eq("type", type); queryWrapper.eq("type", type);
return pacsDataMapper.selectList(queryWrapper).size()>0? true:false; return pacsDataMapper.selectList(queryWrapper).size()>0? true:false;
} }
@Override
public InspectPacsDataDO getPacsDataByCode(String code,String type) {
QueryWrapper<InspectPacsDataDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("code", code);
queryWrapper.eq("type", type);
return pacsDataMapper.selectOne(queryWrapper);
}
@Override @Override
public Boolean IspacsDataitemExist(String code, String type) { public Boolean IspacsDataitemExist(String code, String type) {