Compare commits

...

28 Commits

Author SHA1 Message Date
wyb 41866475ff feat: 厦门中医院联众人工处理,多级 5 months ago
wyb 55d7ef547e feat: 厦门中医院联众人工处理 5 months ago
wyb 81a2672a65 imp: 改进线程池使用 5 months ago
wyb 59bba70ffe imp: 改进线程池使用 5 months ago
wyb eb30e54eef feat: 添加job补偿人工部分 5 months ago
wyb dc62b04aee feat: 添加后期人工处理接口 5 months ago
wyb a5ff268a86 fix: 批量传根据第一次删除全部 5 months ago
wyb cc2b6d06d5 fix: 优化获取目录 5 months ago
wyb 1d15965dc9 fix: 优化目录确认规则直接使用equals 5 months ago
wyb 6201f3c7a5 fix: 修复目录确认规则,添加出院日期确认 5 months ago
wyb 930a9b3494 feat: 厦门中医院联众采集端 6 months ago
wyb 93b710be70 feat: 厦门中医院联众采集端 6 months ago
wyb c316a76c66 feat: 添加分批次调用 8 months ago
wyb 79593b9a9d fix:检查成功修复未删除文件 8 months ago
wyb cdbe3d579e fix:检查添加结果日志 8 months ago
wyb 470192354a feat: 市一联众添加检查接口 8 months ago
wyb 46499927e1 feat: 市一联众添加接口修改状态 10 months ago
wyb 03eb85f2f9 feat: 市一联众同步添加web,可以补偿同步 10 months ago
zhanghai 966e66abec 修改注释 12 months ago
zhanghai 15462c6a27 修改文件的上传超时时间,
修改线程数
12 months ago
zhanghai 9fdc6a8dbc 1. 打印日志
2. 调整同时并发上传参数。
3. 调整上传内容
1 year ago
zhanghai 2dcd666b7c 1. 打印日志
2. 调整同时并发上传参数。
3. 调整上传内容
1 year ago
zhanghai befeed1979 1. 打印日志
2. 调整同时并发上传参数。
3. 调整上传内容
1 year ago
zhanghai 7ad3f4f7b9 上传联众代码 1 year ago
zhanghai 26d841d833 上传联众代码 1 year ago
zhanghai 768bf819d4 打开配置信息 1 year ago
zhanghai 5f6feb7a57 修改为广州市市一 1 year ago
zhanghai aaf6559e4d 修改为广州市市一 1 year ago

@ -2,6 +2,7 @@
<project version="4"> <project version="4">
<component name="CompilerConfiguration"> <component name="CompilerConfiguration">
<annotationProcessing> <annotationProcessing>
<profile default="true" name="Default" enabled="true" />
<profile name="Maven default annotation processors profile" enabled="true"> <profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" /> <sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" /> <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />

@ -13,8 +13,48 @@
<version>2.4.9</version> <version>2.4.9</version>
<relativePath/> <!-- lookup parent from repository --> <relativePath/> <!-- lookup parent from repository -->
</parent> </parent>
<dependencies> <dependencies>
<!-- RESTful APIs swagger2 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${swagger.version}</version>
<exclusions>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.version}</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.21</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.5.21</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>swagger-bootstrap-ui</artifactId>
<version>1.9.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp --> <!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->
<dependency> <dependency>
<groupId>com.squareup.okhttp3</groupId> <groupId>com.squareup.okhttp3</groupId>
@ -35,6 +75,11 @@
<artifactId>spring-boot-starter</artifactId> <artifactId>spring-boot-starter</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
@ -57,6 +102,28 @@
<version>2.8.6</version> <version>2.8.6</version>
</dependency> </dependency>
<dependency>
<groupId>net.coobird</groupId>
<artifactId>thumbnailator</artifactId>
<version>0.4.8</version>
</dependency>
<dependency>
<groupId>com.twelvemonkeys.imageio</groupId>
<artifactId>imageio-jpeg</artifactId>
<version>3.8.1</version>
</dependency>
<dependency>
<groupId>com.twelvemonkeys.imageio</groupId>
<artifactId>imageio-tiff</artifactId>
<version>3.8.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
@ -68,14 +135,15 @@
<version>2.3.4.RELEASE</version> <version>2.3.4.RELEASE</version>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
<properties> <properties>
<maven.compiler.source>8</maven.compiler.source> <maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target> <maven.compiler.target>8</maven.compiler.target>
<swagger.version>2.9.2</swagger.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<log4jdbc.version>1.16</log4jdbc.version>
</properties> </properties>
</project> </project>

@ -21,4 +21,19 @@ public class CommonResult<T> {
private T data; private T data;
public static <T> CommonResult<T> success(T data){
CommonResult commonResult = new CommonResult();
commonResult.setCode(0);
commonResult.setMsg("操作成功");
commonResult.setData(data);
return commonResult;
}
public static <T> CommonResult<T> failed(T data){
CommonResult commonResult = new CommonResult();
commonResult.setCode(500);
commonResult.setMsg("操作失败");
commonResult.setData(data);
return commonResult;
}
} }

@ -0,0 +1,96 @@
package com.jiashi;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.Objects;
/**
* @author
*/
public class FilePathUtil {
private static final Logger logger = LoggerFactory.getLogger(FilePathUtil.class);
/**
*
*
* @return
*/
public static String currentPath() {
try {
File file = new File(".");
return file.getCanonicalPath();
} catch (Exception ex) {
return null;
}
}
/**
*
*
* @return
*/
public static String tempPath() {
String tempPath;
try {
tempPath = currentPath() + File.separator + "temp";
} catch (Exception ex) {
tempPath = "C:\\docus\\temp";
}
mkdirs(tempPath);
return tempPath;
}
/**
*
* @param path
*/
public static void mkdirs(String path) {
path = Objects.requireNonNull(path);
mkdirs(new File(path));
}
/**
*
* @param file
*/
public static void mkdirs(File file) {
if (!file.exists()) {
if (!file.mkdirs()) {
// Not processed
logger.warn("mkdirs error {}", file);
}
}
}
/**
*
* @param dir
*/
public static void deleteDir(File dir) {
if (dir.isDirectory()) {
String[] children = dir.list();
if (children!=null) {
//递归删除目录中的子目录下
for (String child : children) {
deleteDir(new File(dir, child));
}
}
}
// 目录此时为空,可以删除
dir.delete();
}
/**
*
* @param dir
*/
public static void deleteDir(String dir) {
deleteDir(new File(dir));
}
}

@ -2,44 +2,52 @@ package com.jiashi;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.jiashi.service.FormField; import com.jiashi.service.FormField;
import okhttp3.*; import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
public class FileUploader { public class FileUploader {
public static CommonResult uploadFilesWithParams(List<File> files, String uploadUrl, List<FormField> params) throws IOException { public static CommonResult uploadFilesWithParams(List<File> files, String uploadUrl, List<FormField> params) {
OkHttpClient client = new OkHttpClient.Builder() try {
.connectTimeout(600, TimeUnit.SECONDS) OkHttpClient client = new OkHttpClient.Builder()
.readTimeout(600, TimeUnit.SECONDS) .connectTimeout(6000, TimeUnit.SECONDS)
.writeTimeout(600, TimeUnit.SECONDS) .readTimeout(6000, TimeUnit.SECONDS)
.build(); .writeTimeout(6000, TimeUnit.SECONDS)
MultipartBody.Builder builder = new MultipartBody.Builder(); .build();
for (File file : files) { MultipartBody.Builder builder = new MultipartBody.Builder();
RequestBody body = RequestBody.create(MediaType.parse("multipart/form-data"), file); for (File file : files) {
RequestBody body = RequestBody.create(MediaType.parse("multipart/form-data"), file);
// RequestBody body = RequestBody.create(MediaType.parse("image/jpeg"), file); // RequestBody body = RequestBody.create(MediaType.parse("image/jpeg"), file);
builder.addFormDataPart("files", file.getName(), body); builder.addFormDataPart("files", file.getName(), body);
} }
for(FormField formField:params){ for(FormField formField:params){
builder.addFormDataPart(formField.getKey(), formField.getValue()); builder.addFormDataPart(formField.getKey(), formField.getValue());
} }
// 下行是上传的json的对象其中上面的fileName和下行的fromData需和后台接口名字一致 // 下行是上传的json的对象其中上面的fileName和下行的fromData需和后台接口名字一致
RequestBody requestBody = builder.setType(MultipartBody.FORM).build(); RequestBody requestBody = builder.setType(MultipartBody.FORM).build();
final Request request = new Request.Builder() final Request request = new Request.Builder()
.url(uploadUrl) .url(uploadUrl)
.post(requestBody) .post(requestBody)
.build(); .build();
Response response = client.newCall(request).execute();
String responseBody = response.body().string();
CommonResult commonResult = new Gson().fromJson(responseBody, CommonResult.class);
return commonResult;
Response response = client.newCall(request).execute();
String responseBody = response.body().string();
CommonResult commonResult = new Gson().fromJson(responseBody, CommonResult.class);
return commonResult;
}catch (Exception ex){
throw new RuntimeException(ex);
}
} }
public static void deleteFolder(File folder) { public static void deleteFolder(File folder) {
@ -54,28 +62,58 @@ public class FileUploader {
folder.delete(); folder.delete();
} }
public static void main(String[] args) throws IOException { public static void main(String[] args) {
List<File> files = new ArrayList<>(); FileUploader fileUploader = new FileUploader();
files.add(new File("C:\\jiahsi-saomiao\\413425_刘燊杨_20221009_004624\\16763947060057863381.jpg")); ExecutorService syncExecutors = Executors.newFixedThreadPool(2);
// files.add(new File("C:\\jiahsi-saomiao\\413425_刘燊杨_20221009_004624\\16763947060420811242.jpg")); syncExecutors.execute(fileUploader::t1);
try {
syncExecutors.execute(fileUploader::t2);
// 额外的表单字段参数 }catch (Exception ex){
List<FormField> params = new ArrayList<>(); ex.printStackTrace();
params.add(new FormField("uploadFileParams", "[ {\"inpatientNo\":\"35131\", \"disDate\":\"2020-07-30 00:00:00.000\", \"fileTitle\":\"16763947060057863381.jpg\", \"uploadFileName\":\"16763947060057863381.jpg\", \"assortId\":\"078F7675CB0048EDBE586D59831C57B0\" ,\n" + }finally {
"\"patientId\":\"12312312\",\n" + syncExecutors.shutdown();
"\"name\":\"长三\",\n" + }
"\"admissDate\":\"2022-02-01\",\n" + }
"\"sex\":\"男女\"\n" + public void t1(){
"}\n" + for (int i = 0; i < 10; i++) {
"]")); System.out.println("t1 >>>> "+i);
try {
// 上传URL Thread.sleep(3*1000);
String uploadUrl = "http://192.168.16.116:8711/api/downplatform/fileUploadJpg"; } catch (InterruptedException e) {
e.printStackTrace();
}
}
}
// 执行批量上传 public void t2(){
uploadFilesWithParams(files, uploadUrl, params); for (int i = 0; i < 10; i++) {
System.out.println("t2 >>>> "+i);
}
} }
// public static void main(String[] args) throws IOException {
// List<File> files = new ArrayList<>();
// files.add(new File("C:\\jiahsi-saomiao\\413425_刘燊杨_20221009_004624\\16763947060057863381.jpg"));
//// files.add(new File("C:\\jiahsi-saomiao\\413425_刘燊杨_20221009_004624\\16763947060420811242.jpg"));
//
//
// // 额外的表单字段参数
// List<FormField> params = new ArrayList<>();
// params.add(new FormField("uploadFileParams", "[ {\"inpatientNo\":\"35132331\", \"admiss_id\":\"12312342342312\",\"admiss_times\":\"1\",\"disDate\":\"2020-07-30 00:00:00.000\", \"fileTitle\":\"16763947060057863381.jpg\", \"uploadFileName\":\"16763947060057863381.jpg\", \"assortId\":\"078F7675CB0048EDBE586D59831C57B0\" ,\n" +
// "\"patientId\":\"12323432412312\",\n" +
// "\"name\":\"长三\",\n" +
// "\"admissDate\":\"2022-02-01\",\n" +
// "\"sex\":\"男\"\n" +
// "}\n" +
// "]"));
//
// // 上传URL
// String uploadUrl = "http://192.168.16.116:9511/fileUploadJpg";
//
// // 执行批量上传
// CommonResult commonResult = uploadFilesWithParams(files, uploadUrl, params);
// System.out.println(new Gson().toJson(commonResult));
// }
} }

@ -1,6 +1,6 @@
package com.jiashi; package com.jiashi;
import com.jiashi.service.UpdateService;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing; import org.springframework.data.jpa.repository.config.EnableJpaAuditing;

@ -0,0 +1,22 @@
package com.jiashi.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class CorsConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
// 所有接口
registry.addMapping("/**")
// 是否发送 Cookie
.allowCredentials(true)
// 支持域
.allowedOriginPatterns("*")
// 支持方法
.allowedMethods(new String[]{"GET", "POST", "PUT", "DELETE"})
.allowedHeaders("*")
.exposedHeaders("*");
}
}

@ -0,0 +1,45 @@
package com.jiashi.config;
import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
import com.google.common.base.Predicates;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.ParameterBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* api /swagger-ui.html
* @author Zheng Jie
* @date 2018-11-23
*/
@Configuration
@EnableSwagger2
@EnableSwaggerBootstrapUI
public class SwaggerConfig {
@Bean
public Docket createRestApi() {
ParameterBuilder ticketPar = new ParameterBuilder();
return new Docket(DocumentationType.SWAGGER_2)
.enable(true)
.apiInfo(apiInfo())
.select()
.paths(Predicates.not(PathSelectors.regex("/error.*")))
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("接口文档")
.version("1.0")
.build();
}
}

@ -0,0 +1,46 @@
package com.jiashi.controller;
import com.jiashi.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* @author YongBin Wen
* @date 2025/2/16 15:52
*/
@Api(value = "测试", tags = "测试")
@RestController()
@RequestMapping("/test")
@Slf4j
public class TestController {
@ApiOperation("厦门中医院联众同步人工处理模拟数据")
@GetMapping("/listPatPicDirNotFound")
public CommonResult listPatPicDirNotFound(){
ArrayList<Map<String, Object>> maps = new ArrayList<>();
int idinit=2015;
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
for (int i = 0; i < 10; i++) {
HashMap<String, Object> map = new HashMap<>();
idinit++;
map.put("id",idinit);
map.put("patno","0002015000"+idinit);
map.put("gestno","0002015000"+idinit+"001");
map.put("outdate",format.format(new Date()));
maps.add(map);
}
return CommonResult.success(maps);
}
}

@ -0,0 +1,291 @@
package com.jiashi.controller;
import com.jiashi.dao.DataQuery;
import com.jiashi.service.CardInfo;
import com.jiashi.service.CardInfoPath;
import com.jiashi.service.Picture;
import com.jiashi.service.XiamenZhongHospConfirm;
import net.coobird.thumbnailator.Thumbnails;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author YongBin Wen
* @date 2025/2/16 19:27
*/
@Controller
public class WebController {
/*
index 2 falg + or , 6
index2 6 or 7
index3 7 like 8
index4 8 not in 9
2 index 9
*/
@Autowired
private DataQuery dataQuery;
@RequestMapping("/index")
public String index(Model model) {
ArrayList<XiamenZhongHospConfirm> list = new ArrayList<>();
List<CardInfo> cardInfos = dataQuery.queryFailedL1CardInfo();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for (CardInfo cardInfo : cardInfos) {
String flag = cardInfo.getPat_path().substring(0, 2);
List<CardInfoPath> cardInfoPaths = dataQuery.queryPath(flag, cardInfo.getPatno(), cardInfo.getGestno());
if (CollectionUtils.isEmpty(cardInfoPaths)) {
dataQuery.updateBatchState(cardInfo, 6);
continue;
}
List<String> firstPageFilePaths = new ArrayList<>();
List<String> firstPageFileNames = findFirstPageFileName(cardInfo);
for (CardInfoPath cardInfoPath : cardInfoPaths) {
for (String firstPageFileName : firstPageFileNames) {
String firstPageFilePath = cardInfoPath.getPath() + File.separator + firstPageFileName;
if (new File(firstPageFilePath).exists()) {
firstPageFilePaths.add(firstPageFilePath);
}
}
}
XiamenZhongHospConfirm hospConfirm = new XiamenZhongHospConfirm();
hospConfirm.setId(cardInfo.getId());
hospConfirm.setPatname(cardInfo.getPatname());
hospConfirm.setPatno(cardInfo.getPatno());
hospConfirm.setGestno(cardInfo.getGestno());
hospConfirm.setOutdate(sdf.format(cardInfo.getOutdate()));
hospConfirm.setPaths(firstPageFilePaths);
list.add(hospConfirm);
}
model.addAttribute("confirms", list);
return "index";
}
@RequestMapping("/index2")
public String index2(Model model) {
List<XiamenZhongHospConfirm> list = new ArrayList<>();
List<CardInfo> cardInfos = dataQuery.queryFailedL2CardInfo();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for (CardInfo cardInfo : cardInfos) {
List<CardInfoPath> cardInfoPaths = dataQuery.queryPath(cardInfo.getPatno(), cardInfo.getGestno());
if (CollectionUtils.isEmpty(cardInfoPaths)) {
dataQuery.updateBatchState(cardInfo, 7);
continue;
}
List<String> firstPageFilePaths = new ArrayList<>();
List<String> firstPageFileNames = findFirstPageFileName(cardInfo);
for (CardInfoPath cardInfoPath : cardInfoPaths) {
for (String firstPageFileName : firstPageFileNames) {
String firstPageFilePath = cardInfoPath.getPath() + File.separator + firstPageFileName;
if (new File(firstPageFilePath).exists()) {
firstPageFilePaths.add(firstPageFilePath);
}
}
}
XiamenZhongHospConfirm hospConfirm = new XiamenZhongHospConfirm();
hospConfirm.setId(cardInfo.getId());
hospConfirm.setPatname(cardInfo.getPatname());
hospConfirm.setPatno(cardInfo.getPatno());
hospConfirm.setGestno(cardInfo.getGestno());
hospConfirm.setOutdate(sdf.format(cardInfo.getOutdate()));
hospConfirm.setPaths(firstPageFilePaths);
list.add(hospConfirm);
}
if (!list.isEmpty()) {
list= Collections.singletonList(list.get(0));
}
model.addAttribute("confirms", list);
return "index2";
}
@RequestMapping("/index3")
public String index3(Model model) {
List<XiamenZhongHospConfirm> list = new ArrayList<>();
List<CardInfo> cardInfos = dataQuery.queryFailedL3CardInfo();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for (CardInfo cardInfo : cardInfos) {
String flag = cardInfo.getPat_path().substring(0, 2);
List<CardInfoPath> cardInfoPaths = dataQuery.queryPath(flag, cardInfo.getPatno(), cardInfo.getGestno());
if (CollectionUtils.isEmpty(cardInfoPaths)) {
dataQuery.updateBatchState(cardInfo, 8);
continue;
}
List<String> firstPageFilePaths = new ArrayList<>();
List<String> firstPageFileNames = findFirstPageFileName(cardInfo);
for (CardInfoPath cardInfoPath : cardInfoPaths) {
for (String firstPageFileName : firstPageFileNames) {
String firstPageFilePath = cardInfoPath.getPath() + File.separator + firstPageFileName;
if (new File(firstPageFilePath).exists()) {
firstPageFilePaths.add(firstPageFilePath);
}
}
}
XiamenZhongHospConfirm hospConfirm = new XiamenZhongHospConfirm();
hospConfirm.setId(cardInfo.getId());
hospConfirm.setPatname(cardInfo.getPatname());
hospConfirm.setPatno(cardInfo.getPatno());
hospConfirm.setGestno(cardInfo.getGestno());
hospConfirm.setOutdate(sdf.format(cardInfo.getOutdate()));
hospConfirm.setPaths(firstPageFilePaths);
list.add(hospConfirm);
}
if (!list.isEmpty()) {
list= Collections.singletonList(list.get(0));
}
model.addAttribute("confirms", list);
return "index3";
}
@RequestMapping("/index4")
public String index4(Model model) {
List<XiamenZhongHospConfirm> list = new ArrayList<>();
List<CardInfo> cardInfos = dataQuery.queryFailedL4CardInfo();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for (CardInfo cardInfo : cardInfos) {
List<CardInfoPath> cardInfoPaths = dataQuery.queryNotUsedPath();
if (CollectionUtils.isEmpty(cardInfoPaths)) {
dataQuery.updateBatchState(cardInfo, 9);
continue;
}
List<String> firstPageFilePaths = new ArrayList<>();
List<String> firstPageFileNames = findFirstPageFileName(cardInfo);
for (CardInfoPath cardInfoPath : cardInfoPaths) {
for (String firstPageFileName : firstPageFileNames) {
String firstPageFilePath = cardInfoPath.getPath() + File.separator + firstPageFileName;
if (new File(firstPageFilePath).exists()) {
firstPageFilePaths.add(firstPageFilePath);
}
}
}
XiamenZhongHospConfirm hospConfirm = new XiamenZhongHospConfirm();
hospConfirm.setId(cardInfo.getId());
hospConfirm.setPatname(cardInfo.getPatname());
hospConfirm.setPatno(cardInfo.getPatno());
hospConfirm.setGestno(cardInfo.getGestno());
hospConfirm.setOutdate(sdf.format(cardInfo.getOutdate()));
hospConfirm.setPaths(firstPageFilePaths);
list.add(hospConfirm);
}
if (!list.isEmpty()) {
list= Collections.singletonList(list.get(0));
}
model.addAttribute("confirms", list);
return "index4";
}
private List<String> findFirstPageFileName(CardInfo cardInfo) {
List<Picture> pictures = dataQuery.getPictures(cardInfo.getId());
List<Picture> firstPageFiles = pictures.stream()
.filter(pic -> "1".equals(pic.getPickind()))
.collect(Collectors.toList());
return firstPageFiles.stream().map(e-> removeFileExtension(e.getPicname())+".tif")
.collect(Collectors.toList());
}
public static String removeFileExtension(String fileName) {
// 检查文件名是否为空或没有后缀
if (fileName == null || !fileName.contains(".")) {
return fileName;
}
// 找到最后一个'.'字符的位置
int lastDotIndex = fileName.lastIndexOf('.');
// 截取不包含后缀的部分
return fileName.substring(0, lastDotIndex);
}
@GetMapping("/readfile")
public void readFile(@RequestParam("path") String path, HttpServletResponse response) {
try (ServletOutputStream outputStream = response.getOutputStream()) {
BufferedImage bufferedImage = ImageIO.read(new File(path));
Thumbnails.of(bufferedImage)
.scale(1)
.outputFormat("jpg")
.rotate(90)
.toOutputStream(outputStream);
} catch (Exception ex) {
ex.printStackTrace();
}
}
@GetMapping("/comfirmpath")
@ResponseBody
public String confirmPath(@RequestParam("path") String path, @RequestParam("id") String id) {
String dir = new File(path).getParentFile().getPath();
CardInfo cardInfo = new CardInfo();
cardInfo.setId(id);
dataQuery.confirmPicPathAnRecollect(cardInfo, dir);
return "success";
}
@GetMapping("/notconfirmPath")
@ResponseBody
public String notconfirmPath(@RequestParam("id") String id) {
CardInfo cardInfo = new CardInfo();
cardInfo.setId(id);
dataQuery.updateBatchState(cardInfo, 6);
return "success";
}
@GetMapping("/notconfirmPath2")
@ResponseBody
public String notconfirmPath2(@RequestParam("id") String id) {
CardInfo cardInfo = new CardInfo();
cardInfo.setId(id);
dataQuery.updateBatchState(cardInfo, 7);
return "success";
}
@GetMapping("/notconfirmPath3")
@ResponseBody
public String notconfirmPath3(@RequestParam("id") String id) {
CardInfo cardInfo = new CardInfo();
cardInfo.setId(id);
dataQuery.updateBatchState(cardInfo, 8);
return "success";
}
@GetMapping("/notconfirmPath4")
@ResponseBody
public String notconfirmPath4(@RequestParam("id") String id) {
CardInfo cardInfo = new CardInfo();
cardInfo.setId(id);
dataQuery.updateBatchState(cardInfo, 9);
return "success";
}
}

@ -0,0 +1,18 @@
package com.jiashi.dao;
import com.jiashi.service.CardInfoPath;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface CardInfoPathRepository extends JpaRepository<CardInfoPath, String>, JpaSpecificationExecutor<CardInfoPath> {
@Query(value = "select * from t_card_info_upload_path where path not in (select findpicpath from t_card_info_upload where state in (2,3,4) )",nativeQuery = true)
List<CardInfoPath> queryNotUsedPath();
}

@ -22,4 +22,19 @@ public interface CardInfoRepository extends JpaRepository<CardInfo, String>, Jpa
@Modifying @Modifying
@Query("update CardInfo set state=:state where id in :ids") @Query("update CardInfo set state=:state where id in :ids")
public void updateState(List<String> ids, Integer state); public void updateState(List<String> ids, Integer state);
@Transactional(rollbackFor = Exception.class)
@Modifying
@Query("update CardInfo set state=:state,describe = :describe where id = :id")
void updateState(String id, Integer state, String describe);
@Transactional(rollbackFor = Exception.class)
@Modifying
@Query("update CardInfo set findpicpath=:findpicpath where id = :id")
void updatePicPath(String id, String findpicpath);
@Transactional(rollbackFor = Exception.class)
@Modifying
@Query("update CardInfo set findpicpath = :findpicpath ,state = 4 where id = :id")
void confirmPicPathAnRecollect(String id, String findpicpath);
} }

@ -1,21 +1,30 @@
package com.jiashi.dao; package com.jiashi.dao;
import com.jiashi.service.CardInfo; import com.jiashi.service.CardInfo;
import com.jiashi.service.CardInfoPath;
import com.jiashi.service.Picture; import com.jiashi.service.Picture;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification; import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import org.springframework.util.StringUtils;
import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Predicate;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
@Repository @Repository
@Slf4j
public class DataQuery { public class DataQuery {
@ -25,48 +34,218 @@ public class DataQuery {
@Autowired @Autowired
private PictureRepository pictureRepository; private PictureRepository pictureRepository;
public List<CardInfo> dateQuery(){ @Autowired
Specification<CardInfo> specification = (root, query, cb) -> { private CardInfoPathRepository cardInfoPathRepository;
List<Predicate> predicates = new ArrayList<>();
predicates.add(cb.equal(root.<String>get("state"), 0)); @Value("${lz.disdate-range:}")
return cb.and(predicates.toArray(new Predicate[predicates.size()])); private String disdateRange;
};
Sort.Order sortCreateTime = Sort.Order.asc("outdate"); private static final Lock cardInfoTableLock = new ReentrantLock();
Sort sort = Sort.by(sortCreateTime);
Pageable pageable = PageRequest.of(0, 100, sort); public List<CardInfo> dateQuery() {
Page<CardInfo> all = cardInfoRepository.findAll(specification, pageable); cardInfoTableLock.lock();
return all.toList(); try {
Specification<CardInfo> specification = (root, query, cb) -> {
List<Predicate> predicates = new ArrayList<>();
predicates.add(cb.equal(root.<String>get("state"), 0));
if (StringUtils.hasText(disdateRange)) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String[] split = disdateRange.split(",");
try {
predicates.add(cb.between(root.<Date>get("outdate"), simpleDateFormat.parse(split[0]), simpleDateFormat.parse(split[1])));
} catch (ParseException e) {
log.error("出院时间条件错误:" + disdateRange + "," + e.getMessage(), e);
}
}
return cb.and(predicates.toArray(new Predicate[predicates.size()]));
};
Sort.Order sortCreateTime = Sort.Order.asc("outdate");
Sort sort = Sort.by(sortCreateTime);
Pageable pageable = PageRequest.of(0, 1000, sort);
Page<CardInfo> all = cardInfoRepository.findAll(specification, pageable);
return all.toList();
} finally {
cardInfoTableLock.unlock();
}
} }
public List<CardInfo> dateQuery(int state) {
cardInfoTableLock.lock();
try {
Specification<CardInfo> specification = (root, query, cb) -> {
List<Predicate> predicates = new ArrayList<>();
predicates.add(cb.equal(root.<String>get("state"), state));
return cb.and(predicates.toArray(new Predicate[predicates.size()]));
};
List<CardInfo> all = cardInfoRepository.findAll(specification);
return all;
} finally {
cardInfoTableLock.unlock();
public void updateBatch(List<CardInfo> cardInfos){
for(CardInfo cardInfo:cardInfos){
cardInfo.setState(1);
} }
cardInfoRepository.saveAll(cardInfos);
} }
/**
* 1 2
*/
public List<CardInfo> queryFailedL1CardInfo() {
cardInfoTableLock.lock();
try {
Specification<CardInfo> specification = (root, query, cb) -> {
List<Predicate> predicates = new ArrayList<>();
predicates.add(cb.equal(root.<String>get("state"), 2));
predicates.add(cb.equal(root.<String>get("describe"), "未找到联众数据文件夹!"));
return cb.and(predicates.toArray(new Predicate[predicates.size()]));
};
Sort.Order sortCreateTime = Sort.Order.asc("outdate");
Sort sort = Sort.by(sortCreateTime);
Pageable pageable = PageRequest.of(0, 20, sort);
Page<CardInfo> all = cardInfoRepository.findAll(specification,pageable);
return all.toList();
} finally {
cardInfoTableLock.unlock();
public void updateBatchState(List<CardInfo> cardInfos,Integer state){ }
List<String> ids = new ArrayList<>();
for(CardInfo cardInfo:cardInfos){
String id = cardInfo.getId();
ids.add(id);
}
cardInfoRepository.updateState(ids,state);
} }
/**
* 2 6
*/
public List<CardInfo> queryFailedL2CardInfo() {
cardInfoTableLock.lock();
try {
Specification<CardInfo> specification = (root, query, cb) -> {
List<Predicate> predicates = new ArrayList<>();
predicates.add(cb.equal(root.<String>get("state"), 6));
return cb.and(predicates.toArray(new Predicate[predicates.size()]));
};
Sort.Order sortCreateTime = Sort.Order.asc("outdate");
Sort sort = Sort.by(sortCreateTime);
Pageable pageable = PageRequest.of(0, 20, sort);
Page<CardInfo> all = cardInfoRepository.findAll(specification,pageable);
return all.toList();
} finally {
cardInfoTableLock.unlock();
}
}
public void updateBatchState(CardInfo cardInfo,Integer state){ /**
* 3 7
*/
public List<CardInfo> queryFailedL3CardInfo() {
cardInfoTableLock.lock();
try {
Specification<CardInfo> specification = (root, query, cb) -> {
List<Predicate> predicates = new ArrayList<>();
predicates.add(cb.equal(root.<String>get("state"), 7));
return cb.and(predicates.toArray(new Predicate[predicates.size()]));
};
Sort.Order sortCreateTime = Sort.Order.asc("outdate");
Sort sort = Sort.by(sortCreateTime);
Pageable pageable = PageRequest.of(0, 20, sort);
cardInfoRepository.updateState(cardInfo.getId(),state); Page<CardInfo> all = cardInfoRepository.findAll(specification,pageable);
return all.toList();
} finally {
cardInfoTableLock.unlock();
}
} }
public List<Picture> getPictures(String FileId){ /**
* 8
*/
public List<CardInfo> queryFailedL4CardInfo() {
cardInfoTableLock.lock();
try {
Specification<CardInfo> specification = (root, query, cb) -> {
List<Predicate> predicates = new ArrayList<>();
predicates.add(cb.equal(root.<String>get("state"), 8));
return cb.and(predicates.toArray(new Predicate[predicates.size()]));
};
Sort.Order sortCreateTime = Sort.Order.asc("outdate");
Sort sort = Sort.by(sortCreateTime);
Pageable pageable = PageRequest.of(0, 20, sort);
Page<CardInfo> all = cardInfoRepository.findAll(specification,pageable);
return all.toList();
} finally {
cardInfoTableLock.unlock();
}
}
public List<CardInfo> dateQueryByInpNo(String inpNo) {
cardInfoTableLock.lock();
try {
Specification<CardInfo> specification = (root, query, cb) -> {
List<Predicate> predicates = new ArrayList<>();
predicates.add(cb.equal(root.<String>get("patno"), inpNo));
return cb.and(predicates.toArray(new Predicate[predicates.size()]));
};
Sort.Order sortCreateTime = Sort.Order.asc("outdate");
Sort sort = Sort.by(sortCreateTime);
Pageable pageable = PageRequest.of(0, 1000, sort);
Page<CardInfo> all = cardInfoRepository.findAll(specification, pageable);
return all.toList();
} finally {
cardInfoTableLock.unlock();
}
}
public void updateBatch(List<CardInfo> cardInfos) {
cardInfoTableLock.lock();
try {
for (CardInfo cardInfo : cardInfos) {
cardInfo.setState(1);
}
cardInfoRepository.saveAll(cardInfos);
} finally {
cardInfoTableLock.unlock();
}
}
public void updateBatchState(List<CardInfo> cardInfos, Integer state) {
cardInfoTableLock.lock();
try {
List<String> ids = new ArrayList<>();
for (CardInfo cardInfo : cardInfos) {
String id = cardInfo.getId();
ids.add(id);
}
cardInfoRepository.updateState(ids, state);
} finally {
cardInfoTableLock.unlock();
}
}
public void updateBatchState(CardInfo cardInfo, Integer state) {
cardInfoTableLock.lock();
try {
cardInfoRepository.updateState(cardInfo.getId(), state);
} finally {
cardInfoTableLock.unlock();
}
}
public List<Picture> getPictures(String FileId) {
Specification<Picture> specification = (root, query, cb) -> { Specification<Picture> specification = (root, query, cb) -> {
List<Predicate> predicates = new ArrayList<>(); List<Predicate> predicates = new ArrayList<>();
predicates.add(cb.equal(root.<String>get("fileid"), FileId)); predicates.add(cb.equal(root.<String>get("fileid"), FileId));
@ -77,4 +256,76 @@ public class DataQuery {
} }
public void updateBatchState(CardInfo cardInfo, Integer state, String desc) {
cardInfoTableLock.lock();
try {
cardInfoRepository.updateState(cardInfo.getId(), state, desc);
} finally {
cardInfoTableLock.unlock();
}
}
public void updatePicPath(CardInfo cardInfo, String findpicpath) {
cardInfoTableLock.lock();
try {
cardInfoRepository.updatePicPath(cardInfo.getId(), findpicpath);
} finally {
cardInfoTableLock.unlock();
}
}
public void confirmPicPathAnRecollect(CardInfo cardInfo, String findpicpath) {
cardInfoTableLock.lock();
try {
cardInfoRepository.confirmPicPathAnRecollect(cardInfo.getId(), findpicpath);
} finally {
cardInfoTableLock.unlock();
}
}
public List<CardInfoPath> queryPath(String flag, String patno, String gestno) {
Specification<CardInfoPath> specification = (root, query, cb) -> {
Predicate or1 = cb.equal(root.<String>get("patnopart"), patno);
Predicate or2 = cb.equal(root.<String>get("patnopart"), gestno);
List<Predicate> predicates = new ArrayList<>();
predicates.add(cb.equal(root.<String>get("flag"), flag));
predicates.add(cb.or(or1,or2));
return cb.and(predicates.toArray(new Predicate[predicates.size()]));
};
List<CardInfoPath> all = cardInfoPathRepository.findAll(specification);
return all;
}
public List<CardInfoPath> queryPath(String patno, String gestno) {
Specification<CardInfoPath> specification = (root, query, cb) -> {
Predicate or1 = cb.equal(root.<String>get("patnopart"), patno);
Predicate or2 = cb.equal(root.<String>get("patnopart"), gestno);
List<Predicate> predicates = new ArrayList<>();
predicates.add(cb.or(or1,or2));
return cb.and(predicates.toArray(new Predicate[predicates.size()]));
};
List<CardInfoPath> all = cardInfoPathRepository.findAll(specification);
return all;
}
public List<CardInfoPath> queryPathLike(String patno) {
Specification<CardInfoPath> specification = (root, query, cb) -> {
Predicate like = cb.like(root.<String>get("patnopart"), patno);
List<Predicate> predicates = new ArrayList<>();
predicates.add(like);
return cb.and(predicates.toArray(new Predicate[predicates.size()]));
};
List<CardInfoPath> all = cardInfoPathRepository.findAll(specification);
return all;
}
public List<CardInfoPath> queryNotUsedPath() {
return cardInfoPathRepository.queryNotUsedPath();
}
} }

@ -1,10 +1,8 @@
package com.jiashi.service; package com.jiashi.service;
import com.jiashi.MyDateUtil;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.springframework.boot.test.autoconfigure.data.cassandra.DataCassandraTest;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
@ -32,27 +30,47 @@ public class CardInfo {
private Date outdate; private Date outdate;
@Column(name="indate") @Column(name="indate")
private Date indate; private Date indate;
private String outdeptcode;
@Column(name="outdeptname") @Column(name="outdeptname")
private String outdeptname; private String outdeptname;
@Column(name="patsex") @Column(name="patsex")
private String patsex; private String patsex;
@Column(name="pat_path")
private String pat_path;
@Column(name="patbirthday") @Column(name="patbirthday")
private Date patbirthday; private Date patbirthday;
private Integer state; private Integer state;
private String describe;
@Column(name="findpicpath")
private String findpicpath;
private String icdecode11;
private String icdename11;
@Column(name="mjwesticde")
private String mjwesticde;
@Column(name="mjwestname")
private String mjwestname;
private String patciticard;
private Integer patage;
private String indeptcode;
private String indeptname;
private String outwardname;
public String getOutdateStr(){
return MyDateUtil.dateToString(this.outdate,"yyyy-MM-dd");
}
public String getOutdateStr2(){ private Integer patnum;
return MyDateUtil.dateToString(this.outdate,"yyyy-MM-dd HH:mm:ss");
}
private String gestno;
public String getIndateStr(){
return MyDateUtil.dateToString(this.indate,"yyyy-MM-dd HH:mm:ss");
}
} }

@ -0,0 +1,30 @@
package com.jiashi.service;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "t_card_info_upload_path")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class CardInfoPath {
@Id
@Column(name="path")
private String path;
@Column(name="flag")
private String flag;
@Column(name="patnopart")
private String patnopart;
@Column(name="datepart")
private String datepart;
}

@ -0,0 +1,109 @@
package com.jiashi.service;
import lombok.Data;
import java.util.List;
/**
*
*/
@Data
public class LianZhongUploadInfo {
/**
*
*
*/
@Data
public static class PatientInfo {
/**
*
*/
private String inpatientNo;
/**
*
*/
private Integer admissTimes;
/**
*
*/
private String name;
/**
* 12
*/
private String sex;
/**
*
*/
private String sexName;
/**
* -
*/
private Integer age;
/**
* yyyy-MM-dd HH:mm:ss
*/
private String admissDate;
/**
* yyyy-MM-dd HH:mm:ss
*/
private String disDate;
/**
*
*/
private String admissDeptName;
/**
*
*/
private String disDeptName;
/**
*
*/
private String idCard;
/**
*
*/
private String mainDiagCode;
/**
*
*/
private String mainDiagName;
/**
*
*/
private String mainOperateCode;
/**
*
*/
private String mainOperateName;
}
/**
*
*
*/
@Data
public static class FileInfo {
/**
* id
*/
private String assortId;
/**
*
*/
private String fileTitle;
/**
*
*/
private String uploadFileName;
/**
*
*/
private int sort;
}
private PatientInfo patientInfo;
private List<FileInfo> fileInfos;
private int delAllFile;
}

@ -4,23 +4,22 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import javax.persistence.Column; import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity @Entity
@Table(name = "T_Picture") @Table(name = "T_Picture")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@IdClass(PicturePk.class)
public class Picture { public class Picture {
@Id
@Column(name="picid") @Column(name="picid")
private String picid; private String picid;
@Id
@Column(name="picname") @Column(name="picname")
private String picname; private String picname;
@Id
@Column(name="fileid") @Column(name="fileid")
private String fileid; private String fileid;
@Column(name="rotatedegree") @Column(name="rotatedegree")
@ -29,9 +28,7 @@ public class Picture {
@Column(name="pickind") @Column(name="pickind")
private String pickind; private String pickind;
public String getFileUrl(){ @Column(name="picno")
String fileUrl = "d:/pic/" + this.getFileid() + "/" + this.getPicname(); private Integer picno;
return fileUrl;
}
} }

@ -0,0 +1,11 @@
package com.jiashi.service;
import lombok.Data;
import java.io.Serializable;
@Data
public class PicturePk implements Serializable {
private String picname;
private String fileid;
}

@ -1,157 +0,0 @@
package com.jiashi.service;
import com.google.gson.Gson;
import com.jiashi.CommonResult;
import com.jiashi.FileUploader;
import com.jiashi.dao.DataQuery;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.PostConstruct;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
@Component
@Slf4j
public class UpdateService {
@Autowired
private DataQuery dataQuery;
public List<CardInfo> updateData(){
List<CardInfo> cardInfos = dataQuery.dateQuery();
dataQuery.updateBatchState(cardInfos,1);
return cardInfos;
}
@PostConstruct
public void upload() {
String uniUrl = "http://10.2.3.24";
List<CardInfo> cardInfos = null;
ExecutorService executor2 = Executors.newFixedThreadPool(2);
ExecutorService executor = Executors.newFixedThreadPool(5);
do {
try{
cardInfos = this.updateData();
List<Future> futures2 = new ArrayList<>();
for (CardInfo cardInfo : cardInfos) {
log.info("开始同步"+cardInfo.getPatno());
Future future2 = executor2.submit(()->{
try{
List<Picture> pictures = dataQuery.getPictures(cardInfo.getId());
if(pictures==null||pictures.size()==0){
//如果是空的则不同步
dataQuery.updateBatchState(cardInfo,5);
return;
}
List<Future> futures = new ArrayList<>();
for (Picture picture : pictures) {
Future future = executor.submit(() -> {
try {
String dir = "d:\\pic\\"+picture.getFileid();
// 创建File对象
File directory = new File(dir);
// 判断目录是否存在
if (!directory.exists()) {
// 目录不存在,创建目录
boolean created = directory.mkdirs();
if (created) {
log.info("目录创建成功:" + dir);
} else {
log.info("目录创建失败:" + dir);
}
}
String cmd = "D:\\lianzhong\\Debug\\Debug\\lianzhong.exe 003 192.168.8.74 " + cardInfo.getId() + " " + picture.getPicid() + " " + cardInfo.getPatno() + " " + cardInfo.getOutdateStr() + " " + picture.getPicname() + " " + picture.getFileUrl() + " " + uniUrl + " " + picture.getRotatedegree();
log.info(cmd);
java.lang.Process process = java.lang.Runtime.getRuntime().exec(cmd);//执行命令生成cube
process.waitFor();
} catch (Exception e) {
log.error(e.getMessage(),e);
e.printStackTrace();
}
});
futures.add(future);
}
for (Future future : futures) {
try {
future.get();
} catch (InterruptedException e) {
throw new RuntimeException(e);
} catch (ExecutionException e) {
throw new RuntimeException(e);
}
}
List<File> files = new ArrayList<>();
List<UploadInfo> uploadInfos = new ArrayList<>();
for(Picture picture : pictures){
files.add(new File(picture.getFileUrl()));
UploadInfo uploadInfo = new UploadInfo(cardInfo.getPatno(), cardInfo.getOutdateStr2(), picture.getPicname(), picture.getPicname(), picture.getPickind(), cardInfo.getId(), cardInfo.getPatname(), cardInfo.getIndateStr(), cardInfo.getPatsex());
uploadInfos.add(uploadInfo);
}
// 额外的表单字段参数
List<FormField> params = new ArrayList<>();
String s = new Gson().toJson(uploadInfos);
params.add(new FormField("uploadFileParams", s));
log.info("请求参数:"+s);
// 上传
try {
CommonResult commonResult = FileUploader.uploadFilesWithParams(files, "http://10.2.130.59:8712/api/downplatform/fileUploadJpg", params);
if(commonResult.getCode()==0){
dataQuery.updateBatchState(cardInfo,3);
}else{
dataQuery.updateBatchState(cardInfo,4);
log.error(commonResult.getMsg());
}
} catch (Exception e) {
dataQuery.updateBatchState(cardInfo,4);
log.error(e.getMessage(),e);
}
// 删除文件
// String dir = "d:\\pic\\"+cardInfo.getId();
// File file = new File(dir);
// FileUploader.deleteFolder(file);
}catch (Exception e){
dataQuery.updateBatchState(cardInfo,4);
log.error(e.getMessage(),e);
e.printStackTrace();
}
});
futures2.add(future2);
}
for (Future future : futures2) {
try {
future.get();
} catch (InterruptedException e) {
throw new RuntimeException(e);
} catch (ExecutionException e) {
throw new RuntimeException(e);
}
}
}catch(Exception e) {
log.error(e.getMessage(),e);
}
}while (cardInfos != null && cardInfos.size() > 0) ;
}
}

@ -1,150 +0,0 @@
package com.jiashi.service;
import lombok.AllArgsConstructor;
import lombok.Data;
/**
* [ {"inpatientNo":"35131", "disDate":"2020-07-30 00:00:00.000", "fileTitle":"0001.jpg", "uploadFileName":"1.jpg", "assortId":"078F7675CB0048EDBE586D59831C57B0" ,
* "patientId":"12312312",
* "name":"长三",
* "admissDate":"住院时间",
* "sex":"男女"
* }
* ]
*/
@Data
public class UploadInfo {
private String inpatientNo;
private String disDate;
private String fileTitle;
private String uploadFileName;
private String assortId;
private String patientId;
private String name;
private String admissDate;
private String sex;
public UploadInfo(String inpatientNo, String disDate, String fileTitle, String uploadFileName, String assortId, String patientId, String name, String admissDate, String sex) {
this.inpatientNo = inpatientNo;
this.disDate = disDate;
this.fileTitle = fileTitle;
this.uploadFileName = uploadFileName;
this.assortId = assortId;
this.patientId = patientId;
this.name = name;
this.admissDate = admissDate;
this.sex = sex;
this.ssAssortId();
}
public void ssAssortId() {
switch (assortId) {
case "1":
this.assortId = "2111";
break;
case "2":
this.assortId = "2112";
break;
case "3":
this.assortId = "2113";
break;
case "4":
this.assortId = "2114";
break;
case "5":
this.assortId = "2115";
break;
case "6":
this.assortId = "2116";
break;
case "7":
this.assortId = "2117";
break;
case "8":
this.assortId = "2118";
break;
case "9":
this.assortId = "2119";
break;
case "10":
this.assortId = "21110";
break;
case "11":
this.assortId = "21111";
break;
case "12":
this.assortId = "21112";
break;
case "13":
this.assortId = "21113";
break;
case "14":
this.assortId = "21114";
break;
case "15":
this.assortId = "21115";
break;
case "16":
this.assortId = "21116";
break;
case "17":
this.assortId = "21117";
break;
case "18":
this.assortId = "21118";
break;
case "19":
this.assortId = "21119";
break;
case "20":
this.assortId = "21120";
break;
case "21":
this.assortId = "21121";
break;
case "22":
this.assortId = "21122";
break;
case "23":
this.assortId = "21123";
break;
case "24":
this.assortId = "21124";
break;
case "25":
this.assortId = "21125";
break;
case "26":
this.assortId = "21126";
break;
case "27":
this.assortId = "21127";
break;
case "28":
this.assortId = "21128";
break;
case "29":
this.assortId = "21129";
break;
case "30":
this.assortId = "21130";
break;
case "31":
this.assortId = "21131";
break;
case "32":
this.assortId = "21132";
break;
case "33":
this.assortId = "21133";
break;
default:
this.assortId = "21133";
}
}
}

@ -0,0 +1,19 @@
package com.jiashi.service;
import lombok.Data;
import java.util.List;
/**
* @author YongBin Wen
* @date 2025/2/16 22:32
*/
@Data
public class XiamenZhongHospConfirm {
private String id;
private String patname;
private String patno;
private String gestno;
private String outdate;
private List<String> paths;
}

@ -2,16 +2,25 @@
server: server:
port: 8282 port: 8282
lz:
disdate-range: 2024-01-01 00:00:00,2024-08-01 00:00:00
uploadUrl: http://129.7.1.25:9511/lianzhong/batchFileUploadJpg
spring: spring:
datasource: datasource:
url: jdbc:sqlserver://10.2.130.59:1433;DatabaseName=u_medrecord url: jdbc:sqlserver://192.169.2.170:1433;DatabaseName=u_medrecord
username: sa username: sa
password: admin123 password: 17931@Uni
# url: jdbc:sqlserver://10.36.116.108:1433;DatabaseName=emr_record # url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=u_medrecord
# username: sa # username: sa
# password: xjgs+docus911 # password: 123456
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
jpa: jpa:
database-platform: org.hibernate.dialect.SQLServerDialect database-platform: org.hibernate.dialect.SQLServerDialect
#database-platform: org.hibernate.dialect.MySQL5Dialect
thymeleaf:
cache: false

@ -12,4 +12,8 @@ ON [dbo].[t_card_info_upload] (
CREATE NONCLUSTERED INDEX [index_outdate] CREATE NONCLUSTERED INDEX [index_outdate]
ON [dbo].[t_card_info_upload] ( ON [dbo].[t_card_info_upload] (
[outdate] [outdate]
) )
--
-- t_card_info_upload id

@ -0,0 +1,69 @@
<!-- Logback configuration. See http://logback.qos.ch/manual/index.html -->
<configuration scan="true" scanPeriod="10 seconds">
<!-- 以下配置修改自springboot -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
<conversionRule conversionWord="wex"
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
<conversionRule conversionWord="wEx"
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
<!-- Simple file output -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- encoder defaults to ch.qos.logback.classic.encoder.PatternLayoutEncoder -->
<encoder>
<pattern>${FILE_LOG_PATTERN:-%d{yyyy-MM-dd HH:mm:ss.SSS} [${HOSTNAME}]${LOG_LEVEL_PATTERN:-%5p} ${PID:- }
--- [%t] %-40.40logger{39} %L : %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}
</pattern>
<charset>UTF-8</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>log/discovery-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>debug</level>
</filter>
<!-- Safely log to the same file from multiple JVMs. Degrades performance! -->
<prudent>true</prudent>
</appender>
<appender name="FILE_ASYNC" class="ch.qos.logback.classic.AsyncAppender">
<discardingThreshold>0</discardingThreshold>
<queueSize>512</queueSize>
<appender-ref ref="FILE"/>
</appender>
<!-- Console output -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoder defaults to ch.qos.logback.classic.encoder.PatternLayoutEncoder -->
<encoder>
<pattern>${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint}
[${HOSTNAME}]%clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint}
%clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %L %clr(:){faint}
%m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}
</pattern>
<charset>UTF-8</charset>
</encoder>
<!-- Only log level WARN and above -->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>debug</level>
</filter>
</appender>
<!-- For loggers in the these namespaces, log at all levels. -->
<logger name="pedestal" level="ALL"/>
<logger name="hammock-cafe" level="ALL"/>
<logger name="user" level="ALL"/>
<!--显示日志-->
<logger name="org.springframework.jdbc.core" additivity="false" level="DEBUG">
<appender-ref ref="STDOUT"/>
<appender-ref ref="FILE_ASYNC"/>
</logger>
<root level="INFO">
<appender-ref ref="FILE_ASYNC"/>
<appender-ref ref="STDOUT"/>
</root>
</configuration>

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8" >
<title>静态资源hello</title>
</head>
<body>
静态资源hello
</body>
</html>

@ -0,0 +1,94 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>患者信息列表</title>
</head>
<style>
/* 隐藏放大的图片容器直到它被JavaScript显示 */
.zoomed-image-container {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.8);
display: none;
justify-content: center;
align-items: center;
z-index: 9999;
}
.zoomed-image {
max-width: 90%;
max-height: 90%;
}
.each-pat-container {
border: 3px solid black;
margin: 5px;
}
/* 样式调整,确保图片容器是内联块元素,以便可以正确设置边距 */
.image-container {
display: inline-block;
cursor: pointer;
margin: 10px;
}
</style>
<body>
<h1 style="text-align: center">处理状态2+不确定目录,路径标识+病案号部分</h1>
<div>
<div th:each="confirm:${confirms}" th:id="${confirm.getId()}" class="each-pat-container">
<h4 style="margin:2px;text-align: center"
th:text="|姓名:${confirm.getPatname()},病案号:${confirm.getPatno()},住院号:${confirm.getGestno()},出院日期:${confirm.getOutdate()}|"></h4>
<p style="margin:10px;">
<button onclick="displayNone(this)" th:parentid="${confirm.getId()}"
style="margin-left: 20em;margin-right: 5em" width="70px" height="25px">已处理
</button>
<a target="_blank" th:href="@{/notconfirmPath(id=${confirm.getId()})}"><b>上级处理</b></a>
</p>
<div th:each="filepath:${confirm.getPaths()}" style="display: inline">
<img th:src="@{/readfile(path=${filepath})}" height="595px" onclick="openZoomedImage(this)"/>
<a target="_blank" th:href="@{/comfirmpath(path=${filepath},id=${confirm.getId()})}"><b>确认</b></a>
</div>
</div>
</div>
<!-- 放大的图片容器 -->
<div class="zoomed-image-container" id="zoomedImageContainer">
<img id="zoomedImage" class="zoomed-image" src="" alt="Zoomed Image"/>
</div>
</body>
<script>
function displayNone(button) {
var id = button.getAttribute("parentid");
// document.getElementById(id).style.display = 'none';
document.getElementById(id).remove();
}
// 打开放大图片的函数
function openZoomedImage(imgElement) {
// 获取被点击图片的src属性
var imgSrc = imgElement.src;
// 设置放大图片容器的图片的src属性
document.getElementById('zoomedImage').src = imgSrc;
// 显示放大图片容器
document.getElementById('zoomedImageContainer').style.display = 'flex';
}
// 关闭放大图片的函数
function closeZoomedImage() {
// 隐藏放大图片容器
document.getElementById('zoomedImageContainer').style.display = 'none';
}
// 为放大图片容器添加点击事件监听器,以便点击时关闭放大图片
document.getElementById('zoomedImageContainer').addEventListener('click', closeZoomedImage);
</script>
</html>

@ -0,0 +1,94 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>患者信息列表</title>
</head>
<style>
/* 隐藏放大的图片容器直到它被JavaScript显示 */
.zoomed-image-container {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.8);
display: none;
justify-content: center;
align-items: center;
z-index: 9999;
}
.zoomed-image {
max-width: 90%;
max-height: 90%;
}
.each-pat-container {
border: 3px solid black;
margin: 5px;
}
/* 样式调整,确保图片容器是内联块元素,以便可以正确设置边距 */
.image-container {
display: inline-block;
cursor: pointer;
margin: 10px;
}
</style>
<body>
<h1 style="text-align: center">处理状态6,匹配病案号部分</h1>
<div>
<div th:each="confirm:${confirms}" th:id="${confirm.getId()}" class="each-pat-container">
<h4 style="margin:2px;text-align: center"
th:text="|姓名:${confirm.getPatname()},病案号:${confirm.getPatno()},住院号:${confirm.getGestno()},出院日期:${confirm.getOutdate()}|"></h4>
<p style="margin:10px;">
<button onclick="displayNone(this)" th:parentid="${confirm.getId()}"
style="margin-left: 20em;margin-right: 5em" width="70px" height="25px">已处理
</button>
<a target="_blank" th:href="@{/notconfirmPath2(id=${confirm.getId()})}"><b>上级处理</b></a>
</p>
<div th:each="filepath:${confirm.getPaths()}" style="display: inline">
<img th:src="@{/readfile(path=${filepath})}" height="595px" onclick="openZoomedImage(this)"/>
<a target="_blank" th:href="@{/comfirmpath(path=${filepath},id=${confirm.getId()})}"><b>确认</b></a>
</div>
</div>
</div>
<!-- 放大的图片容器 -->
<div class="zoomed-image-container" id="zoomedImageContainer">
<img id="zoomedImage" class="zoomed-image" src="" alt="Zoomed Image"/>
</div>
</body>
<script>
function displayNone(button) {
var id = button.getAttribute("parentid");
// document.getElementById(id).style.display = 'none';
document.getElementById(id).remove();
}
// 打开放大图片的函数
function openZoomedImage(imgElement) {
// 获取被点击图片的src属性
var imgSrc = imgElement.src;
// 设置放大图片容器的图片的src属性
document.getElementById('zoomedImage').src = imgSrc;
// 显示放大图片容器
document.getElementById('zoomedImageContainer').style.display = 'flex';
}
// 关闭放大图片的函数
function closeZoomedImage() {
// 隐藏放大图片容器
document.getElementById('zoomedImageContainer').style.display = 'none';
}
// 为放大图片容器添加点击事件监听器,以便点击时关闭放大图片
document.getElementById('zoomedImageContainer').addEventListener('click', closeZoomedImage);
</script>
</html>

@ -0,0 +1,94 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>患者信息列表</title>
</head>
<style>
/* 隐藏放大的图片容器直到它被JavaScript显示 */
.zoomed-image-container {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.8);
display: none;
justify-content: center;
align-items: center;
z-index: 9999;
}
.zoomed-image {
max-width: 90%;
max-height: 90%;
}
.each-pat-container {
border: 3px solid black;
margin: 5px;
}
/* 样式调整,确保图片容器是内联块元素,以便可以正确设置边距 */
.image-container {
display: inline-block;
cursor: pointer;
margin: 10px;
}
</style>
<body>
<h1 style="text-align: center">处理状态7,病案号相似的路径</h1>
<div>
<div th:each="confirm:${confirms}" th:id="${confirm.getId()}" class="each-pat-container">
<h4 style="margin:2px;text-align: center"
th:text="|姓名:${confirm.getPatname()},病案号:${confirm.getPatno()},住院号:${confirm.getGestno()},出院日期:${confirm.getOutdate()}|"></h4>
<p style="margin:10px;">
<button onclick="displayNone(this)" th:parentid="${confirm.getId()}"
style="margin-left: 20em;margin-right: 5em" width="70px" height="25px">已处理
</button>
<a target="_blank" th:href="@{/notconfirmPath3(id=${confirm.getId()})}"><b>上级处理</b></a>
</p>
<div th:each="filepath:${confirm.getPaths()}" style="display: inline">
<img th:src="@{/readfile(path=${filepath})}" height="595px" onclick="openZoomedImage(this)"/>
<a target="_blank" th:href="@{/comfirmpath(path=${filepath},id=${confirm.getId()})}"><b>确认</b></a>
</div>
</div>
</div>
<!-- 放大的图片容器 -->
<div class="zoomed-image-container" id="zoomedImageContainer">
<img id="zoomedImage" class="zoomed-image" src="" alt="Zoomed Image"/>
</div>
</body>
<script>
function displayNone(button) {
var id = button.getAttribute("parentid");
// document.getElementById(id).style.display = 'none';
document.getElementById(id).remove();
}
// 打开放大图片的函数
function openZoomedImage(imgElement) {
// 获取被点击图片的src属性
var imgSrc = imgElement.src;
// 设置放大图片容器的图片的src属性
document.getElementById('zoomedImage').src = imgSrc;
// 显示放大图片容器
document.getElementById('zoomedImageContainer').style.display = 'flex';
}
// 关闭放大图片的函数
function closeZoomedImage() {
// 隐藏放大图片容器
document.getElementById('zoomedImageContainer').style.display = 'none';
}
// 为放大图片容器添加点击事件监听器,以便点击时关闭放大图片
document.getElementById('zoomedImageContainer').addEventListener('click', closeZoomedImage);
</script>
</html>

@ -0,0 +1,94 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>患者信息列表</title>
</head>
<style>
/* 隐藏放大的图片容器直到它被JavaScript显示 */
.zoomed-image-container {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.8);
display: none;
justify-content: center;
align-items: center;
z-index: 9999;
}
.zoomed-image {
max-width: 90%;
max-height: 90%;
}
.each-pat-container {
border: 3px solid black;
margin: 5px;
}
/* 样式调整,确保图片容器是内联块元素,以便可以正确设置边距 */
.image-container {
display: inline-block;
cursor: pointer;
margin: 10px;
}
</style>
<body>
<h1 style="text-align: center">处理状态8,未匹配的路径</h1>
<div>
<div th:each="confirm:${confirms}" th:id="${confirm.getId()}" class="each-pat-container">
<h4 style="margin:2px;text-align: center"
th:text="|姓名:${confirm.getPatname()},病案号:${confirm.getPatno()},住院号:${confirm.getGestno()},出院日期:${confirm.getOutdate()}|"></h4>
<p style="margin:10px;">
<button onclick="displayNone(this)" th:parentid="${confirm.getId()}"
style="margin-left: 20em;margin-right: 5em" width="70px" height="25px">已处理
</button>
<a target="_blank" th:href="@{/notconfirmPath4(id=${confirm.getId()})}"><b>上级处理</b></a>
</p>
<div th:each="filepath:${confirm.getPaths()}" style="display: inline">
<img th:src="@{/readfile(path=${filepath})}" height="595px" onclick="openZoomedImage(this)"/>
<a target="_blank" th:href="@{/comfirmpath(path=${filepath},id=${confirm.getId()})}"><b>确认</b></a>
</div>
</div>
</div>
<!-- 放大的图片容器 -->
<div class="zoomed-image-container" id="zoomedImageContainer">
<img id="zoomedImage" class="zoomed-image" src="" alt="Zoomed Image"/>
</div>
</body>
<script>
function displayNone(button) {
var id = button.getAttribute("parentid");
// document.getElementById(id).style.display = 'none';
document.getElementById(id).remove();
}
// 打开放大图片的函数
function openZoomedImage(imgElement) {
// 获取被点击图片的src属性
var imgSrc = imgElement.src;
// 设置放大图片容器的图片的src属性
document.getElementById('zoomedImage').src = imgSrc;
// 显示放大图片容器
document.getElementById('zoomedImageContainer').style.display = 'flex';
}
// 关闭放大图片的函数
function closeZoomedImage() {
// 隐藏放大图片容器
document.getElementById('zoomedImageContainer').style.display = 'none';
}
// 为放大图片容器添加点击事件监听器,以便点击时关闭放大图片
document.getElementById('zoomedImageContainer').addEventListener('click', closeZoomedImage);
</script>
</html>

@ -1,7 +1,13 @@
package com.jiashi; package com.jiashi;
import okhttp3.*; import com.google.gson.Gson;
import com.jiashi.service.LianZhongUploadInfo;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -43,23 +49,45 @@ public class FileUploader {
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
List<File> files = new ArrayList<>(); List<File> files = new ArrayList<>();
files.add(new File("C:\\Downloads\\LH0001.jpg")); File file1 = new File("C:\\Users\\wyb\\Pictures\\head.jpg");
File file2 = new File("C:\\Users\\wyb\\Pictures\\毒王90.jpg");
files.add(file1);
files.add(file2);
// files.add(new File("C:\\jiahsi-saomiao\\413425_刘燊杨_20221009_004624\\16763947060420811242.jpg")); // files.add(new File("C:\\jiahsi-saomiao\\413425_刘燊杨_20221009_004624\\16763947060420811242.jpg"));
LianZhongUploadInfo.PatientInfo patientInfo = new LianZhongUploadInfo.PatientInfo();
patientInfo.setInpatientNo("wyb-lianzhong001");
patientInfo.setAdmissTimes(1);
patientInfo.setDisDate("2025-01-01 00:00:00");
patientInfo.setName("厦门中医院联众测试");
LianZhongUploadInfo.FileInfo fileInfo1 = new LianZhongUploadInfo.FileInfo();
fileInfo1.setSort(1);
fileInfo1.setFileTitle("head");
fileInfo1.setUploadFileName(file1.getName());
fileInfo1.setAssortId("wyb-lianzhong");
LianZhongUploadInfo.FileInfo fileInfo2 = new LianZhongUploadInfo.FileInfo();
fileInfo2.setSort(2);
fileInfo2.setFileTitle("head2");
fileInfo2.setUploadFileName(file2.getName());
fileInfo2.setAssortId("wyb-lianzhong-2");
ArrayList<LianZhongUploadInfo.FileInfo> fileInfos = new ArrayList<>();
fileInfos.add(fileInfo1);
fileInfos.add(fileInfo2);
LianZhongUploadInfo uploadInfo = new LianZhongUploadInfo();
uploadInfo.setPatientInfo(patientInfo);
uploadInfo.setFileInfos(fileInfos);
// 额外的表单字段参数 // 额外的表单字段参数
List<FormField> params = new ArrayList<>(); List<FormField> params = new ArrayList<>();
params.add(new FormField("uploadFileParams", "[ {\"inpatientNo\":\"35131\", \"disDate\":\"2020-07-30 00:00:00.000\", \"fileTitle\":\"16763947060057863381.jpg\", \"uploadFileName\":\"16763947060057863381.jpg\", \"assortId\":\"078F7675CB0048EDBE586D59831C57B0\" ,\n" + params.add(new FormField("uploadFileParams", new Gson().toJson(uploadInfo)));
"\"patientId\":\"12312312\",\n" +
"\"name\":\"长三\",\n" +
"\"admissDate\":\"2022-02-01\",\n" +
"\"sex\":\"男女\"\n" +
"}\n" +
"]"));
// 上传URL // 上传URL
String uploadUrl = "http://192.168.16.116:8711/api/downplatform/fileUploadJpg"; String uploadUrl = "http://127.0.0.1:9511/lianzhong/batchFileUploadJpg";
// 执行批量上传 // 执行批量上传
uploadFilesWithParams(files, uploadUrl, params); uploadFilesWithParams(files, uploadUrl, params);

Loading…
Cancel
Save