新增对外接口
Some checks are pending
Java CI with Maven / build (11) (push) Waiting to run
Java CI with Maven / build (17) (push) Waiting to run
Java CI with Maven / build (8) (push) Waiting to run
yudao-ui-admin CI / build (14.x) (push) Waiting to run
yudao-ui-admin CI / build (16.x) (push) Waiting to run
Some checks are pending
Java CI with Maven / build (11) (push) Waiting to run
Java CI with Maven / build (17) (push) Waiting to run
Java CI with Maven / build (8) (push) Waiting to run
yudao-ui-admin CI / build (14.x) (push) Waiting to run
yudao-ui-admin CI / build (16.x) (push) Waiting to run
This commit is contained in:
parent
030c2005d8
commit
0903a188d1
@ -10,8 +10,13 @@ import org.springframework.web.util.UriComponents;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.net.URI;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.net.*;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -121,6 +126,52 @@ public class HttpUtils {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
*post请求 formdata形式
|
||||
|
||||
*/
|
||||
public static String sendPostFormData(String urlString, Map<String, String> formData) throws IOException {
|
||||
HttpURLConnection connection = null;
|
||||
try {
|
||||
URL url = new URL(urlString);
|
||||
connection = (HttpURLConnection) url.openConnection();
|
||||
|
||||
// 设置请求方法和属性
|
||||
connection.setRequestMethod("POST");
|
||||
connection.setDoOutput(true);
|
||||
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
||||
// 构建请求体
|
||||
StringBuilder postData = new StringBuilder();
|
||||
for (Map.Entry<String, String> entry : formData.entrySet()) {
|
||||
if (postData.length() != 0) postData.append("&");
|
||||
postData.append(URLEncoder.encode(entry.getKey(), StandardCharsets.UTF_8.toString()));
|
||||
postData.append("=");
|
||||
postData.append(URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8.toString()));
|
||||
}
|
||||
|
||||
// 发送请求体
|
||||
try (OutputStream os = connection.getOutputStream()) {
|
||||
byte[] input = postData.toString().getBytes(StandardCharsets.UTF_8);
|
||||
os.write(input, 0, input.length);
|
||||
}
|
||||
|
||||
// 读取响应
|
||||
StringBuilder response = new StringBuilder();
|
||||
try (BufferedReader br = new BufferedReader(
|
||||
new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) {
|
||||
String responseLine;
|
||||
while ((responseLine = br.readLine()) != null) {
|
||||
response.append(responseLine.trim());
|
||||
}
|
||||
}
|
||||
|
||||
return response.toString();
|
||||
} finally {
|
||||
if (connection != null) {
|
||||
connection.disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -132,6 +132,12 @@
|
||||
<version>2.1.0-jdk8-snapshot</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-module-ultrasoniccom-biz</artifactId>
|
||||
<version>2.1.0-jdk8-snapshot</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@ -1,5 +1,7 @@
|
||||
package cn.iocoder.yudao.module.applyregistration.controller.admin.applyform;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.util.http.HttpUtils;
|
||||
import cn.iocoder.yudao.module.applyregistration.dal.mysql.applyform.ApplyformMapper;
|
||||
import cn.iocoder.yudao.module.system.api.DatabaseUtils;
|
||||
import cn.iocoder.yudao.module.applyregistration.controller.admin.applyform.devicevo.DeviceVO;
|
||||
import cn.iocoder.yudao.module.applyregistration.controller.admin.applyform.devicevo.deviceupVO;
|
||||
@ -14,8 +16,17 @@ import cn.iocoder.yudao.module.system.service.apiconfig.ApiconfigService;
|
||||
import cn.iocoder.yudao.module.system.service.dicomworklist.DicomworklistService;
|
||||
import cn.iocoder.yudao.module.system.service.org.OrgUnitService;
|
||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import cn.iocoder.yudao.module.tblist.controller.admin.patientexamlist.vo.MedicalDataVO;
|
||||
import cn.iocoder.yudao.module.tblist.dal.dataobject.patientexamlist.PatientexamlistDO;
|
||||
import cn.iocoder.yudao.module.tblist.service.patientexamlist.PatientexamlistService;
|
||||
import cn.iocoder.yudao.module.ultrasoniccom.service.image.dicompatientsServiceImpl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.mzt.logapi.starter.annotation.LogRecord;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
@ -66,7 +77,8 @@ public class ApplyformController {
|
||||
private static final Logger log = LoggerFactory.getLogger(ApplyformController.class);
|
||||
@Resource
|
||||
private ApplyformService applyformService;
|
||||
|
||||
@Resource
|
||||
private ApplyformMapper applyformMapper;
|
||||
@Resource
|
||||
private DeviceService DeviceService;
|
||||
|
||||
@ -81,8 +93,9 @@ public class ApplyformController {
|
||||
private PatientexamlistService patientexamlistService;
|
||||
|
||||
@Resource
|
||||
private OrgUnitService Service;
|
||||
|
||||
private OrgUnitService Service;
|
||||
@Resource
|
||||
private dicompatientsServiceImpl dicompatientsService;
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建申请登记记录")
|
||||
@PreAuthorize("@ss.hasPermission('applyregistration:applyform:create')")
|
||||
@ -202,7 +215,7 @@ public class ApplyformController {
|
||||
}
|
||||
|
||||
//处理数据
|
||||
private @NotNull List<DicomworklistDO> getDicomworklistDOS(deviceupVO deviceVO, AdminUserDO user) {
|
||||
private @NotNull List<DicomworklistDO> getDicomworklistDOS(deviceupVO deviceVO, AdminUserDO user) {
|
||||
List<DicomworklistDO> dicomworklistDOS = new ArrayList<>();
|
||||
for (DicomWorklistVO item : deviceVO.getWorklist()) {
|
||||
// 处理每个元素
|
||||
@ -225,7 +238,7 @@ public class ApplyformController {
|
||||
}
|
||||
|
||||
//处理数据
|
||||
private @NotNull List<PatientexamlistDO> getPatientexamlistDOS(deviceupVO deviceVO, AdminUserDO user) {
|
||||
private @NotNull List<PatientexamlistDO> getPatientexamlistDOS(deviceupVO deviceVO, AdminUserDO user) {
|
||||
List<PatientexamlistDO> patientexamlistDOList = new ArrayList<>();
|
||||
OrgUnitDO aDo = Service.get(user.getOrgId());
|
||||
for (DicomWorklistVO item : deviceVO.getWorklist()) {
|
||||
@ -237,7 +250,7 @@ public class ApplyformController {
|
||||
patientexamlistDO.setId(guid.toString());
|
||||
patientexamlistDO.setExamId(item.getStudyInsta());
|
||||
patientexamlistDO.setPName(item.getPatientNam());
|
||||
patientexamlistDO.setGender(Objects.equals(item.getPatientSex(), "F") ?"女":"男");
|
||||
patientexamlistDO.setGender(Objects.equals(item.getPatientSex(), "F") ? "女" : "男");
|
||||
patientexamlistDO.setBirthday(PatientBir.atStartOfDay());
|
||||
patientexamlistDO.setDeviceType(item.getModality());
|
||||
patientexamlistDO.setExamItemName(item.getExamItemName());
|
||||
@ -332,7 +345,7 @@ public class ApplyformController {
|
||||
patientexamlistDO.setId(guid.toString());
|
||||
patientexamlistDO.setExamId(item.getStudyInsta());
|
||||
patientexamlistDO.setPName(item.getPatientNam());
|
||||
patientexamlistDO.setGender(Objects.equals(item.getPatientSex(), "F") ?"女":"男");
|
||||
patientexamlistDO.setGender(Objects.equals(item.getPatientSex(), "F") ? "女" : "男");
|
||||
patientexamlistDO.setBirthday(PatientBir.atStartOfDay());
|
||||
patientexamlistDO.setDeviceType(item.getModality());
|
||||
patientexamlistDO.setExamItemName(item.getExamItemName());
|
||||
@ -367,41 +380,186 @@ public class ApplyformController {
|
||||
|
||||
@GetMapping("/SyncDb")
|
||||
@PreAuthorize("@ss.hasPermission('applyregistration:applyform:query')")
|
||||
public CommonResult<Boolean> SyncDb(@RequestParam("AppCode") String AppCode) throws SQLException, ClassNotFoundException {
|
||||
public CommonResult<String> SyncDb(@RequestParam("AppCode") String AppCode, @RequestParam("type") String type) throws SQLException, ClassNotFoundException, IOException {
|
||||
|
||||
String StrMsg = "同步成功";
|
||||
|
||||
//先从数据表中那对应的配置
|
||||
ApiconfigDO apiconfigDO = apiconfigService.getApiCodeconfig(AppCode);
|
||||
if (apiconfigDO != null) {
|
||||
String sql = apiconfigDO.getApiUrl();
|
||||
switch (apiconfigDO.getDatabaseType()) {
|
||||
case "mysql":
|
||||
DatabaseUtils.setConnectionProperties(DatabaseUtils.DatabaseType.MYSQL, apiconfigDO.getDatabaseIP(), apiconfigDO.getDatabaseUserName(), apiconfigDO.getDatabasePwd(), apiconfigDO.getRemark(), apiconfigDO.getDatabasePort());
|
||||
DatabaseUtils.getConnection(DatabaseUtils.DatabaseType.MYSQL);
|
||||
List<Map<String, Object>> executeQuery = DatabaseUtils.executeQuery(DatabaseUtils.DatabaseType.MYSQL, sql);
|
||||
break;
|
||||
case "sqlserver":
|
||||
DatabaseUtils.setConnectionProperties(DatabaseUtils.DatabaseType.SQLSERVER, apiconfigDO.getDatabaseIP(), apiconfigDO.getDatabaseUserName(), apiconfigDO.getDatabasePwd(), apiconfigDO.getRemark(), apiconfigDO.getRemark());
|
||||
DatabaseUtils.getConnection(DatabaseUtils.DatabaseType.SQLSERVER);
|
||||
break;
|
||||
case "oracle":
|
||||
DatabaseUtils.setConnectionProperties(DatabaseUtils.DatabaseType.ORACLE, apiconfigDO.getDatabaseIP(), apiconfigDO.getDatabaseUserName(), apiconfigDO.getDatabasePwd(), apiconfigDO.getRemark(), apiconfigDO.getRemark());
|
||||
DatabaseUtils.getConnection(DatabaseUtils.DatabaseType.ORACLE);
|
||||
break;
|
||||
if(sql.isEmpty())
|
||||
{
|
||||
return success("请配置同步接口");
|
||||
}
|
||||
//获取当前登陆用户
|
||||
AdminUserDO user = userService.getUser(getLoginUserId());
|
||||
//1表示接口
|
||||
if (type.equals("1")) { //土贵乌拉
|
||||
if (user.getOrgId().equals("150926PDY564156")) {
|
||||
Map<String, String> tokendata = new HashMap<>();
|
||||
tokendata.put("appkey", "7653571505643966826");
|
||||
tokendata.put("appsecret", "z8SVG1NBFY9d74LM");
|
||||
String tokenresponse = HttpUtils.sendPostFormData(sql+"/api/pacs/getPacsToken", tokendata);
|
||||
|
||||
JsonObject jsonObject = JsonParser.parseString(tokenresponse).getAsJsonObject();
|
||||
JsonObject dataObject = jsonObject.get("data").getAsJsonObject();
|
||||
|
||||
String accessToken = dataObject.get("access_token").getAsString();
|
||||
int expiresIn = dataObject.get("expires_in").getAsInt();
|
||||
|
||||
LocalDate currentDate = LocalDate.now();
|
||||
Map<String, String> data = new HashMap<>();
|
||||
data.put("Yiyuanid", "150926PDY564156");
|
||||
data.put("dateStart",currentDate.toString());
|
||||
data.put("token", accessToken);
|
||||
data.put("dateEnd", currentDate.toString());
|
||||
String response = HttpUtils.sendPostFormData(sql+"/api/pacs/getpacsdata", data);
|
||||
JsonObject json = JsonParser.parseString(response).getAsJsonObject();
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
PatientInfoVO patientInfo = objectMapper.readValue(json.toString(), PatientInfoVO.class);
|
||||
if (!patientInfo.rows.isEmpty()) {
|
||||
|
||||
List<ApplyformDO> doList = new ArrayList<>();
|
||||
//表示多个患者
|
||||
for (rows rows : patientInfo.rows) { //存在循环下一个患者数据
|
||||
if (checkIfDataExists(rows.huanzheid)) {
|
||||
continue;
|
||||
}
|
||||
int i = 0;
|
||||
//一个患者多个检查
|
||||
for (Project project : rows.projects) {
|
||||
i++;
|
||||
//出生日期
|
||||
LocalDate PatientBir = LocalDate.parse(rows.birthdate, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
//开单时间
|
||||
LocalDateTime examdate = LocalDateTime.parse(rows.kaifangsj, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
//当前时间
|
||||
LocalDateTime dateTime = LocalDateTime.parse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
UUID guid = UUID.randomUUID();
|
||||
ApplyformDO applyformDO = new ApplyformDO();
|
||||
applyformDO.setId(guid.toString());
|
||||
applyformDO.setRegId(rows.jianchaid);//患者ID
|
||||
applyformDO.setRegSource(rows.visitType);
|
||||
applyformDO.setExamId(rows.jianchabh + "_" + i);//检查ID
|
||||
applyformDO.setPName(rows.name);
|
||||
applyformDO.setGender(rows.sex);
|
||||
applyformDO.setSfz(rows.sfz);
|
||||
applyformDO.setBirthday(PatientBir.atStartOfDay());
|
||||
applyformDO.setExamDate(examdate);
|
||||
applyformDO.setExamItemName(project.jianchamingcheng);
|
||||
applyformDO.setRegDate(examdate);
|
||||
applyformDO.setBillgDoctor(rows.resDoctorName);
|
||||
applyformDO.setExamStatus("未分检");
|
||||
applyformDO.setBillDoctorDepartment(rows.departmentName);
|
||||
applyformDO.setCreateDate(dateTime);
|
||||
applyformDO.setExamItemCode(project.nhbm);
|
||||
applyformDO.setOrgId(user.getOrgId());
|
||||
doList.add(applyformDO);
|
||||
}
|
||||
}
|
||||
//没有数据 表示数据都同步过了
|
||||
if (!doList.isEmpty()) {
|
||||
applyformService.insertbatch(doList);
|
||||
} else {
|
||||
StrMsg = "暂无需要同步的数据";
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
StrMsg = "暂无需要同步的数据";
|
||||
}
|
||||
}
|
||||
} else if (type.equals("2")) //2 数据库
|
||||
{
|
||||
switch (apiconfigDO.getDatabaseType()) {
|
||||
case "mysql":
|
||||
DatabaseUtils.setConnectionProperties(DatabaseUtils.DatabaseType.MYSQL, apiconfigDO.getDatabaseIP(), apiconfigDO.getDatabaseUserName(), apiconfigDO.getDatabasePwd(), apiconfigDO.getRemark(), apiconfigDO.getDatabasePort());
|
||||
DatabaseUtils.getConnection(DatabaseUtils.DatabaseType.MYSQL);
|
||||
List<Map<String, Object>> executeQuery = DatabaseUtils.executeQuery(DatabaseUtils.DatabaseType.MYSQL, sql);
|
||||
break;
|
||||
case "sqlserver":
|
||||
DatabaseUtils.setConnectionProperties(DatabaseUtils.DatabaseType.SQLSERVER, apiconfigDO.getDatabaseIP(), apiconfigDO.getDatabaseUserName(), apiconfigDO.getDatabasePwd(), apiconfigDO.getRemark(), apiconfigDO.getRemark());
|
||||
DatabaseUtils.getConnection(DatabaseUtils.DatabaseType.SQLSERVER);
|
||||
break;
|
||||
case "oracle":
|
||||
DatabaseUtils.setConnectionProperties(DatabaseUtils.DatabaseType.ORACLE, apiconfigDO.getDatabaseIP(), apiconfigDO.getDatabaseUserName(), apiconfigDO.getDatabasePwd(), apiconfigDO.getRemark(), apiconfigDO.getRemark());
|
||||
DatabaseUtils.getConnection(DatabaseUtils.DatabaseType.ORACLE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return success(true);
|
||||
return success(StrMsg);
|
||||
}
|
||||
|
||||
///判断数据是否存在
|
||||
private boolean checkIfDataExists(String id) {
|
||||
QueryWrapper<ApplyformDO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("regId", id); // 假设我们通过id来检查数据是否存在
|
||||
int count = Math.toIntExact(applyformMapper.selectCount(queryWrapper));
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
@GetMapping("/getreglisrcount")
|
||||
public CommonResult<ApplyformCountVO> GetReglistCount()
|
||||
{
|
||||
public CommonResult<ApplyformCountVO> GetReglistCount() {
|
||||
//获取当前登陆用户
|
||||
AdminUserDO user = userService.getUser(getLoginUserId());
|
||||
ApplyformCountVO applyformCountVO= applyformService.GetRegisCount(user.getOrgId());
|
||||
ApplyformCountVO applyformCountVO = applyformService.GetRegisCount(user.getOrgId());
|
||||
return success(applyformCountVO);
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/GetPatientPDFDcm")
|
||||
@Operation(summary = "获取患者的PDF和dcm信息")
|
||||
public String GetPatientPDFDcm(@RequestParam(value = "sfz", required = false) String sfz,@RequestParam("regId") String regId,@RequestParam("orgId") String orgId)
|
||||
{
|
||||
String msg="";
|
||||
String re="调取成功";
|
||||
if (regId != null && !regId.isEmpty() && orgId != null && !orgId.isEmpty()) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("regId", regId);
|
||||
params.put("orgId", orgId);
|
||||
//存放最后结果
|
||||
MedicalDataVO medicalDataVO = new MedicalDataVO();
|
||||
//查询出符合条件的患者数据
|
||||
List<PatientexamlistDO> patientexamlistDOList = patientexamlistService.selectMp(params);
|
||||
if (!patientexamlistDOList.isEmpty()) {
|
||||
//存放这个患者所有的pdf地址
|
||||
List<String> pdfurl = new ArrayList<>();
|
||||
//存放这个患者所有的dcm地址
|
||||
List<String> dcmurl = new ArrayList<>();
|
||||
for (PatientexamlistDO patientexamlistDO : patientexamlistDOList) {
|
||||
//条件不满足说明这个人没有进行分析 无法提供相关数据
|
||||
if (patientexamlistDO.getDiagDoctor() != null && !patientexamlistDO.getDiagDoctor().isEmpty()) {
|
||||
pdfurl.add(patientexamlistDO.getPdfurl());
|
||||
}
|
||||
}
|
||||
if(pdfurl.isEmpty())
|
||||
{
|
||||
re = "{\"msg\":\"该患者未进行分析\",\"code\":200,\"data\":{}}";
|
||||
}
|
||||
else
|
||||
{
|
||||
//取这个患者的所有的dcm地址
|
||||
dcmurl = dicompatientsService.GetDcmUrl(regId, orgId);
|
||||
medicalDataVO.setPdflist(pdfurl);
|
||||
medicalDataVO.setDcm(dcmurl);
|
||||
medicalDataVO.setPdf("");
|
||||
Gson gson = new GsonBuilder()
|
||||
.serializeSpecialFloatingPointValues() // 序列化特殊浮点数值(如 NaN, Infinity)
|
||||
.disableHtmlEscaping() // 禁用 HTML 转义
|
||||
.create();
|
||||
re = "{\"msg\":\""+re+"\",\"code\":200,\"data\":" + gson.toJson(medicalDataVO) + "}";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return re;
|
||||
}
|
||||
}
|
@ -147,4 +147,10 @@ public class ApplyformDO {
|
||||
@TableField("remark")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
@TableField("sfz")
|
||||
private String sfz;
|
||||
|
||||
}
|
@ -12,6 +12,7 @@ public class JwtTokenAutoConfiguration implements WebMvcConfigurer {
|
||||
registry.addInterceptor(new JwtTokenInterceptor())
|
||||
.addPathPatterns("/admin-api/ultrasoniccom/ultrasonic/InsImageInfo",
|
||||
"/admin-api/tblist/patientexamlist/GetAnalysisInfo",
|
||||
"/admin-api/applyregistration/applyform/GetPatientPDFDcm",
|
||||
"/admin-api/tblist/patientexamlist/addPatientExamInfo");
|
||||
}
|
||||
}
|
||||
|
@ -126,6 +126,11 @@
|
||||
<version>2.1.0-jdk8-snapshot</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-net</groupId>
|
||||
<artifactId>commons-net</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@ -6,9 +6,12 @@ import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import cn.iocoder.yudao.module.system.service.org.OrgUnitService;
|
||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import cn.iocoder.yudao.module.tblist.service.patientexamlist.org.OrgService;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.mzt.logapi.starter.annotation.LogRecord;
|
||||
import org.apache.commons.net.ftp.FTP;
|
||||
import org.apache.commons.net.ftp.FTPClient;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -20,6 +23,9 @@ import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.net.SocketException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
@ -396,5 +402,70 @@ public class PatientexamlistController {
|
||||
return success(msg);
|
||||
}
|
||||
|
||||
@PostMapping("/ftppdf")
|
||||
@Operation(summary = "获取pdf上传ftp")
|
||||
public void FtpPdf(@RequestBody inspdfscreenshotVO insimagescreenshotVO)
|
||||
{
|
||||
String base64String = insimagescreenshotVO.getImagebase();
|
||||
String ftpServer = "114.55.171.231";
|
||||
int ftpPort = 21; // FTP端口,默认为21
|
||||
String ftpUser = "pacs";
|
||||
String ftpPassword = "pacs";
|
||||
String uploadPath = "/";
|
||||
String fileName = System.currentTimeMillis()+".pdf";
|
||||
|
||||
FTPClient ftpClient = new FTPClient();
|
||||
|
||||
ftpClient.enterLocalPassiveMode();
|
||||
try {
|
||||
// 连接FTP服务器
|
||||
ftpClient.connect(ftpServer, ftpPort);
|
||||
ftpClient.login(ftpUser, ftpPassword);
|
||||
|
||||
// 设置文件传输类型为二进制
|
||||
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
|
||||
// 解码Base64字符串
|
||||
String base64Image = base64String.split(",")[1]; // 去掉数据URL的头部
|
||||
// 解码Base64字符串
|
||||
byte[] decodedBytes = Base64.getDecoder().decode(base64Image);
|
||||
|
||||
// 创建输入流
|
||||
InputStream inputStream = new ByteArrayInputStream(decodedBytes);
|
||||
|
||||
// 上传文件
|
||||
boolean result = ftpClient.storeFile(uploadPath + "/" + fileName, inputStream);
|
||||
if (result) {
|
||||
//上传成功
|
||||
//当前时间
|
||||
LocalDateTime dateTime = LocalDateTime.parse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")),
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
AdminUserDO user = userService.getUser(getLoginUserId());
|
||||
PatientexamlistSaveReqVO updateReqVO = new PatientexamlistSaveReqVO();
|
||||
updateReqVO.setId(insimagescreenshotVO.getID());
|
||||
updateReqVO.setPdfurl("http://114.55.171.231:48082/"+fileName);
|
||||
patientexamlistService.updatePatientexamlist(updateReqVO);
|
||||
} else {
|
||||
System.out.println("文件上传失败");
|
||||
}
|
||||
|
||||
// 断开连接
|
||||
ftpClient.logout();
|
||||
ftpClient.disconnect();
|
||||
} catch (SocketException e) {
|
||||
System.err.println("无法连接到FTP服务器: " + e.getMessage());
|
||||
} catch (IOException e) {
|
||||
System.err.println("IO异常: " + e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
if (ftpClient.isConnected()) {
|
||||
ftpClient.disconnect();
|
||||
}
|
||||
} catch (IOException ignored) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -180,4 +180,7 @@ public class PatientexamlistDO extends BaseDO {
|
||||
|
||||
@TableField(value = "FavouriteTime",updateStrategy = FieldStrategy.IGNORED)
|
||||
private LocalDateTime FavouriteTime;
|
||||
|
||||
@TableField(value = "pdfurl")
|
||||
private String pdfurl;
|
||||
}
|
@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.tblist.dal.dataobject.patientexamlist.PatientexamlistDO;
|
||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import cn.iocoder.yudao.module.tblist.controller.admin.patientexamlist.vo.*;
|
||||
|
||||
@ -15,6 +16,7 @@ import cn.iocoder.yudao.module.tblist.controller.admin.patientexamlist.vo.*;
|
||||
* @author 李晓东
|
||||
*/
|
||||
@Mapper
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
public interface PatientexamlistMapper extends BaseMapperX<PatientexamlistDO> {
|
||||
//更新
|
||||
@Update(" UPDATE tb_patientexamlist t1 SET t1.examItemName=#{examItemName} WHERE t1.ID=#{id} ")
|
||||
@ -65,7 +67,7 @@ public interface PatientexamlistMapper extends BaseMapperX<PatientexamlistDO> {
|
||||
.betweenIfPresent(PatientexamlistDO::getUploadDate, reqVO.getUploadDate())
|
||||
.likeIfPresent(PatientexamlistDO::getOrgName, reqVO.getOrgName())
|
||||
// .eqIfPresent(PatientexamlistDO::getOrgId, reqVO.getOrgId())
|
||||
|
||||
.likeIfPresent(PatientexamlistDO::getDeviceType,reqVO.getDeviceType())
|
||||
// .eqIfPresent(PatientexamlistDO::getHighLevelOrgId, reqVO.getHighLevelOrgId())
|
||||
.betweenIfPresent(PatientexamlistDO::getCreateDate, reqVO.getCreateDate())
|
||||
.eqIfPresent(PatientexamlistDO::getExamDescription, reqVO.getExamDescription())
|
||||
|
@ -18,11 +18,7 @@
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-module-applyregistration-biz</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-module-ultrasoniccom-api</artifactId>
|
||||
@ -134,6 +130,12 @@
|
||||
<groupId>commons-net</groupId>
|
||||
<artifactId>commons-net</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-module-system-biz</artifactId>
|
||||
<version>2.1.0-jdk8-snapshot</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import cn.iocoder.yudao.module.system.service.dicomworklist.DicomworklistService;
|
||||
import cn.iocoder.yudao.module.system.service.org.OrgUnitService;
|
||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
|
||||
import cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic.image.ImageVO;
|
||||
import cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic.image.PatientInfoVO;
|
||||
import cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic.image.SeriesVO;
|
||||
@ -31,9 +32,11 @@ import cn.iocoder.yudao.module.ultrasoniccom.service.medicalimg.medicalimgServic
|
||||
import cn.iocoder.yudao.module.ultrasoniccom.service.ultrasonic.ultrasonicService;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
|
||||
import cn.iocoder.yudao.module.applyregistration.controller.admin.applyform.ApplyformController;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@ -67,7 +70,7 @@ import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUti
|
||||
@Validated
|
||||
public class ultrasonicController {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ApplyformController.class);
|
||||
|
||||
@Resource
|
||||
private ultrasonicService ultrasonicService;
|
||||
@Resource
|
||||
@ -90,6 +93,8 @@ public class ultrasonicController {
|
||||
private dicomimagesMapeer dicomimagesMapeer;
|
||||
@Resource
|
||||
private dicompatientsServiceImpl dicompatientsService;
|
||||
|
||||
|
||||
@GetMapping("/reporttemplatetlist")
|
||||
@Operation(summary = "获取模版表数据")
|
||||
@DataPermission(enable = false)
|
||||
@ -275,7 +280,7 @@ public class ultrasonicController {
|
||||
}
|
||||
} else {
|
||||
|
||||
log.error("超声审核更新图片数据方法参数为空");
|
||||
|
||||
return success(false);
|
||||
}
|
||||
|
||||
@ -311,7 +316,6 @@ public class ultrasonicController {
|
||||
|
||||
@GetMapping("/getdcm")
|
||||
@Operation(summary = "获取dcm数据")
|
||||
|
||||
public CommonResult<String> GetDcmList(@RequestParam("orgID") String orgID, @RequestParam("studyInsta") String studyInsta, @RequestParam("regId") String regId) throws JsonProcessingException {
|
||||
String strJson = "";
|
||||
String json = "";
|
||||
@ -619,4 +623,6 @@ public class ultrasonicController {
|
||||
|
||||
return success("插入成功");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.ultrasoniccom.service.image;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.module.ultrasoniccom.dal.image.dicomimagesDO;
|
||||
import cn.iocoder.yudao.module.ultrasoniccom.dal.image.dicompatientsDO;
|
||||
import cn.iocoder.yudao.module.ultrasoniccom.dal.image.dicomseriesDO;
|
||||
@ -8,17 +9,19 @@ import cn.iocoder.yudao.module.ultrasoniccom.dal.ultrasonic.image.dicomimagesMap
|
||||
import cn.iocoder.yudao.module.ultrasoniccom.dal.ultrasonic.image.dicompatientsMapper;
|
||||
import cn.iocoder.yudao.module.ultrasoniccom.dal.ultrasonic.image.dicomseriesMapper;
|
||||
import cn.iocoder.yudao.module.ultrasoniccom.dal.ultrasonic.image.dicomstudiesMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Validated
|
||||
public class dicompatientsServiceImpl {
|
||||
public class dicompatientsServiceImpl {
|
||||
|
||||
@Autowired
|
||||
private dicompatientsMapper dicompatientsMapper;
|
||||
@ -42,4 +45,44 @@ public class dicompatientsServiceImpl {
|
||||
dicomseriesMapper.insertBatch(dicomseriesDOList);
|
||||
dicomimagesMapper.insertBatch(dicomimagesDOList);
|
||||
}
|
||||
|
||||
|
||||
public List<String> GetDcmUrl(String regId, String orgId) {
|
||||
//存放该患者所有的dcmurl
|
||||
List<String> dcmurl = new ArrayList<>();
|
||||
QueryWrapper<dicomstudiesDO> dicomstudiesWrapper = new QueryWrapper<>();
|
||||
dicomstudiesWrapper.eq("PatientID", regId);
|
||||
dicomstudiesWrapper.eq("orgId", orgId);
|
||||
List<dicomstudiesDO> dicomstudiesDOList = dicomstudiesMapper.selectList(dicomstudiesWrapper);
|
||||
if (!dicomstudiesDOList.isEmpty()) {
|
||||
for (dicomstudiesDO dicomstudiesDO : dicomstudiesDOList) {
|
||||
String StudyInsta = dicomstudiesDO.getStudyInsta();
|
||||
QueryWrapper<dicomseriesDO> dicomseriesWrapper = new QueryWrapper<>();
|
||||
dicomseriesWrapper.eq("StudyInsta", StudyInsta);
|
||||
dicomseriesWrapper.eq("orgId", orgId);
|
||||
dicomseriesWrapper.ne("BodyPartEx", "");
|
||||
// dicomseriesWrapper.and(wrapper -> wrapper.notLike("BodyPartEx", "").or().eq("BodyPartEx", ""));
|
||||
List<dicomseriesDO> dicomseriesDOS = dicomseriesMapper.selectList(dicomseriesWrapper);
|
||||
if (!dicomseriesDOS.isEmpty()) {
|
||||
for (dicomseriesDO dicomseriesDO : dicomseriesDOS) {
|
||||
String SeriesInst = dicomseriesDO.getSeriesInst();
|
||||
QueryWrapper<dicomimagesDO> dicomimagesWrapper = new QueryWrapper<>();
|
||||
dicomimagesWrapper.eq("SeriesInst", SeriesInst);
|
||||
dicomimagesWrapper.eq("orgId", orgId);
|
||||
List<dicomimagesDO> dicomimagesDOS = dicomimagesMapper.selectList(dicomimagesWrapper);
|
||||
if (!dicomimagesDOS.isEmpty()) {
|
||||
for (dicomimagesDO dicomimagesDO : dicomimagesDOS) {
|
||||
String obj= dicomimagesDO.getObjectFile();
|
||||
String url= dicomimagesDO.getUrlPrefix();
|
||||
dcmurl.add(url+obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return dcmurl;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.yudao.module.ultrasoniccom.service.ultrasonic;
|
||||
|
||||
import cn.iocoder.yudao.module.applyregistration.dal.dataobject.applyform.ApplyformDO;
|
||||
|
||||
import cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic.medicalimg.medicalimgVO;
|
||||
import cn.iocoder.yudao.module.ultrasoniccom.dal.ultrasonic.medicalimg.medicalimgDO;
|
||||
import cn.iocoder.yudao.module.ultrasoniccom.dal.ultrasonic.ultrasonicDO;
|
||||
|
@ -1,8 +1,7 @@
|
||||
package cn.iocoder.yudao.module.ultrasoniccom.service.ultrasonic;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.applyregistration.dal.dataobject.applyform.ApplyformDO;
|
||||
import cn.iocoder.yudao.module.applyregistration.dal.mysql.applyform.ApplyformMapper;
|
||||
|
||||
import cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic.medicalimg.medicalimgVO;
|
||||
import cn.iocoder.yudao.module.ultrasoniccom.dal.ultrasonic.medicalimg.medicalimgDO;
|
||||
import cn.iocoder.yudao.module.ultrasoniccom.dal.ultrasonic.ultrasonicDO;
|
||||
|
Loading…
Reference in New Issue
Block a user