|
@@ -3,6 +3,7 @@ package thyyxxk.wxservice_server.service;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;
|
|
|
import thyyxxk.wxservice_server.config.exception.BizException;
|
|
|
import thyyxxk.wxservice_server.config.exception.ExceptionEnum;
|
|
|
import thyyxxk.wxservice_server.dao.InspectionsDao;
|
|
@@ -20,7 +21,13 @@ import thyyxxk.wxservice_server.factory.pathology.model.PathologyRequest;
|
|
|
import thyyxxk.wxservice_server.factory.thmz.ThmzService;
|
|
|
import thyyxxk.wxservice_server.utils.*;
|
|
|
|
|
|
+import java.io.InputStream;
|
|
|
+import java.net.URL;
|
|
|
+import java.nio.file.Files;
|
|
|
+import java.nio.file.Path;
|
|
|
+import java.nio.file.StandardCopyOption;
|
|
|
import java.util.*;
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* @author light
|
|
@@ -127,8 +134,23 @@ public class InspectionsService {
|
|
|
PathologyService pathologyService = new PathologyService();
|
|
|
request.setSocialNo(dao.getPatSocialNo(request.getPatientId()));
|
|
|
List<PathologyIndex> list = pathologyService.queryOutpatientPathologyIndex(request);
|
|
|
+ list.forEach(item ->
|
|
|
+ item.setReportUrl(EncryptDecryptUtil.encrypt(request.getPatientId(), item.getReportUrl()))
|
|
|
+ );
|
|
|
list.sort(Comparator.comparing(PathologyIndex::getApplyDate).reversed());
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+ public StreamingResponseBody checkPathologyDetail(QueryReportDetail request) {
|
|
|
+ String reportUrl = EncryptDecryptUtil.decrypt(request.getPatientId(), request.getReportId());
|
|
|
+ return outputStream -> {
|
|
|
+ URL imageUrl = new URL(reportUrl);
|
|
|
+ InputStream in = imageUrl.openStream();
|
|
|
+ Path tempFile = Files.createTempFile("image", ".jpg");
|
|
|
+ Files.copy(in, tempFile, StandardCopyOption.REPLACE_EXISTING);
|
|
|
+ Files.copy(tempFile, outputStream);
|
|
|
+ outputStream.close();
|
|
|
+ in.close();
|
|
|
+ };
|
|
|
+ }
|
|
|
}
|