新增业务表的基础查询代码

This commit is contained in:
lxd 2025-03-12 17:56:25 +08:00
parent 8ca7942fbe
commit d999ef31d9
7 changed files with 145 additions and 4 deletions

View File

@ -5,6 +5,7 @@ import cn.hutool.core.map.TableMap;
import cn.hutool.core.net.url.UrlBuilder;
import cn.hutool.core.util.ReflectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.URLUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import org.springframework.util.StringUtils;
@ -176,4 +177,18 @@ public class HttpUtils {
return response.body();
}
}
/**
* HTTP get 请求基于 {@link cn.hutool.http.HttpUtil} 实现
*
* 为什么要封装该方法因为 HttpUtil 默认封装的方法没有允许传递 headers 参数
*
* @param url URL
* @return 请求结果
*/
public static String get(String url) {
try (HttpResponse response = HttpRequest.get(url)
.execute()) {
return response.body();
}
}
}

View File

@ -6,9 +6,11 @@ import cn.iocoder.yudao.framework.common.util.io.FileUtils;
import cn.iocoder.yudao.framework.common.util.string.StrUtils;
import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO;
import cn.iocoder.yudao.module.infra.service.config.ConfigService;
import cn.iocoder.yudao.module.inspect.controller.admin.inspectpacsdata.vo.InspectPacsDataSaveReqVO;
import cn.iocoder.yudao.module.inspect.controller.admin.inspectpatientitems.vo.InspectPatientitemsSaveReqVO;
import cn.iocoder.yudao.module.inspect.dal.dataobject.inspectitems.InspectitemsDO;
import cn.iocoder.yudao.module.inspect.service.exammodule.ExammoduleService;
import cn.iocoder.yudao.module.inspect.service.inspectpacsdata.InspectPacsDataService;
import cn.iocoder.yudao.module.inspect.service.inspectpatientitems.InspectPatientitemsService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.mysql.cj.result.Row;
@ -67,7 +69,8 @@ public class InspectPatientController {
private InspectPatientService patientService;
@Resource
private ConfigService configService;
@Resource
private InspectPacsDataService pacsDataService;
@Resource
private ExammoduleService exammoduleService;
@Resource
@ -281,7 +284,8 @@ public class InspectPatientController {
patientitemsService.createPatientListitems(batch);
}
}
@GetMapping("/syncinspectApplyTj")
@Operation(summary = "发送检验申请单")
public CommonResult<Boolean> syncinspectApplyTj(@RequestParam("medicalSn") String medicalSn) throws JsonProcessingException {
//获取患者信息
InspectPatientDO patientDO= patientService.getPatientInfo(medicalSn);
@ -323,14 +327,65 @@ public class InspectPatientController {
// Java 对象转换为 JSON 字符串
String jsonRequestBody = objectMapper.writeValueAsString(patient);
//获取配置项地址
ConfigDO config = configService.getConfigByKey("url.ftpurl");
// 发送 POST 请求
String url = "http://example.com/api/patient";
String url = config.getValue();
String response = HttpUtils.postJson(url, jsonRequestBody);
}
return success(true);
}
@GetMapping("/getReportTj")
@Operation(summary = "获取检验报告")
public CommonResult<Boolean> getReportTj(@RequestParam("medicalSn") String medicalSn,@RequestParam("type") String type)
{
//获取患者信息
InspectPatientDO patientDO= patientService.getPatientInfo(medicalSn);
if (patientDO!=null)
{
String model= "";
String barCode= "";
switch (type)
{
case "XCG":
model="cbc";
barCode=patientDO.getXcgcode();
break;
case "NCG":
model="rt";
barCode=patientDO.getNcgcode();
break;
case "SHQX":
model="bt";
barCode=patientDO.getShqx();
break;
}
ConfigDO config = configService.getConfigByKey("url.ftpurl");
String url = config.getValue();
String response = HttpUtils.get(url+"?"+"barCode="+barCode+"&"+"hospitalCode="+patientDO.getHospitalNo());
if(response!=null)
{
// 解析 JSON 响应
ObjectMapper objectMapper = new ObjectMapper();
try {
Map<String, Object> responseMap = objectMapper.readValue(response, Map.class);
String msg = (String) responseMap.get("msg");
InspectPacsDataSaveReqVO inspectPacs= new InspectPacsDataSaveReqVO();
inspectPacs.setCode(patientDO.getMedicalSn());
inspectPacs.setData(msg);
inspectPacs.setType(model);
inspectPacs.setPersonName(patientDO.getPName());
pacsDataService.createPacsData(inspectPacs);
} catch (IOException e) {
e.printStackTrace();
return success(false);
}
}
}
return success(true);
}
@PutMapping("/update")
@Operation(summary = "更新患者信息")

View File

@ -40,4 +40,16 @@ public class InspectPatientInfoVO {
@Schema(description = "检查编码")
private String examItemCode;
@Schema(description = "医院编码")
private String hospitalNo;
@Schema(description = "血常规")
private String xcgcode;
@Schema(description = "尿常规")
private String ncgcode;
@Schema(description = "生化全项")
private String shqx;
}

View File

@ -99,4 +99,15 @@ public class InspectPatientPageReqVO extends PageParam {
@Schema(description = "住址")
private String domicileaddress;
@Schema(description = "医院编码")
private String hospitalNo;
@Schema(description = "血常规")
private String xcgcode;
@Schema(description = "尿常规")
private String ncgcode;
@Schema(description = "生化全项")
private String shqx;
}

View File

@ -120,4 +120,15 @@ public class InspectPatientRespVO {
@ExcelProperty("住址")
private String domicileaddress;
@Schema(description = "医院编码")
private String hospitalNo;
@Schema(description = "血常规")
private String xcgcode;
@Schema(description = "尿常规")
private String ncgcode;
@Schema(description = "生化全项")
private String shqx;
}

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.inspect.controller.admin.inspectpatient.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
@ -89,4 +90,16 @@ public class InspectPatientSaveReqVO {
@Schema(description = "住址")
private String domicileaddress;
@Schema(description = "医院编码")
private String hospitalNo;
@Schema(description = "血常规")
private String xcgcode;
@Schema(description = "尿常规")
private String ncgcode;
@Schema(description = "生化全项")
private String shqx;
}

View File

@ -151,4 +151,28 @@ public class InspectPatientDO {
*/
@TableField("domicileaddress")
private String domicileaddress;
/**
* 医院编码
*/
@TableField("hospitalNo")
private String hospitalNo;
/**
* 血常规
*/
@TableField("xcgcode")
private String xcgcode;
/**
* 尿常规条码
*/
@TableField("ncgcode")
private String ncgcode;
/**
* 生化全项
*/
@TableField("shqx")
private String shqx;
}