|
|
@ -1,5 +1,6 @@ |
|
|
|
package com.ccsens.ht.api; |
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
import com.ccsens.ht.service.IImportService; |
|
|
|
import com.ccsens.ht.uitl.Constant; |
|
|
|
import com.ccsens.util.JsonResponse; |
|
|
@ -18,6 +19,8 @@ import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
import javax.servlet.http.Part; |
|
|
|
import java.io.File; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
@ -54,19 +57,26 @@ public class ImportController { |
|
|
|
String allowedExts = "xls,xlsx"; |
|
|
|
String dir = WebConstant.UPLOAD_PROJECT_WBS + File.separator; |
|
|
|
String path = UploadFileUtil_Servlet3.uploadFile(file, allowedExts, dir); |
|
|
|
File execlFile = new File(dir+path); |
|
|
|
File excelFile = new File(dir+path); |
|
|
|
long time2 = System.currentTimeMillis(); |
|
|
|
log.info("解析文件耗时:{}", (time2 - time1)); |
|
|
|
importService.importPosition(execlFile, 0); |
|
|
|
importService.importPosition(excelFile, 0); |
|
|
|
long time3 = System.currentTimeMillis(); |
|
|
|
log.info("导入职务耗时:{}", (time3 - time2)); |
|
|
|
importService.importTitle(execlFile, 1); |
|
|
|
importService.importTitle(excelFile, 1); |
|
|
|
long time4 = System.currentTimeMillis(); |
|
|
|
log.info("导入职称耗时:{}", (time4 - time3)); |
|
|
|
importService.importReport(execlFile, 2); |
|
|
|
List<String> codes = importService.importReport(excelFile, 2); |
|
|
|
long time5 = System.currentTimeMillis(); |
|
|
|
log.info("导入报告单耗时:{}", (time5 - time4)); |
|
|
|
importService.importQuestion(execlFile, Constant.Ht.Question.ALL); |
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(codes)) { |
|
|
|
for (String code: codes) { |
|
|
|
importService.importQuestion(excelFile, code); |
|
|
|
log.info("{}导入完成",code); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return JsonResponse.newInstance().ok(); |
|
|
|
} |
|
|
|
|
|
|
@ -89,19 +99,37 @@ public class ImportController { |
|
|
|
String allowedExts = "xls,xlsx"; |
|
|
|
String dir = WebConstant.UPLOAD_PROJECT_WBS + File.separator; |
|
|
|
String path = UploadFileUtil_Servlet3.uploadFile(file, allowedExts, dir); |
|
|
|
File execlFile = new File(dir+path); |
|
|
|
File excelFile = new File(dir+path); |
|
|
|
long time2 = System.currentTimeMillis(); |
|
|
|
log.info("解析文件耗时:{}", (time2 - time1)); |
|
|
|
// importService.importPosition(execlFile, 0);
|
|
|
|
// importService.importPosition(excelFile, 0);
|
|
|
|
// long time3 = System.currentTimeMillis();
|
|
|
|
// log.info("导入职务耗时:{}", (time3 - time2));
|
|
|
|
// importService.importTitle(execlFile, 1);
|
|
|
|
// importService.importTitle(excelFile, 1);
|
|
|
|
long time4 = System.currentTimeMillis(); |
|
|
|
// log.info("导入职称耗时:{}", (time4 - time3));
|
|
|
|
importService.importReport(execlFile, 2); |
|
|
|
importService.importReport(excelFile, 2); |
|
|
|
long time5 = System.currentTimeMillis(); |
|
|
|
log.info("导入报告单耗时:{}", (time5 - time4)); |
|
|
|
// importService.importQuestion(execlFile, Constant.Ht.Question.ALL);
|
|
|
|
// importService.importQuestion(excelFile, Constant.Ht.Question.ALL);
|
|
|
|
return JsonResponse.newInstance().ok(); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation(value = "导入指定测评类型",notes = "文件大小不能超过20M,支持后缀:.xls|.xlsx") |
|
|
|
@ApiImplicitParams({ |
|
|
|
@ApiImplicitParam(name = "file", value = "医疗项目表", required = true, paramType = "form",dataType = "__file"), |
|
|
|
@ApiImplicitParam(name = "code", value = "测评类型", required = true, paramType = "form",dataType = "__file") |
|
|
|
}) |
|
|
|
@RequestMapping(value = "/importEvaluation", method = RequestMethod.POST) |
|
|
|
public JsonResponse importEvaluation(@RequestParam(required = true) Part file, @RequestParam(required = true) String code) throws Exception{ |
|
|
|
|
|
|
|
//1.上传文件
|
|
|
|
String allowedExts = "xls,xlsx"; |
|
|
|
String dir = WebConstant.UPLOAD_PROJECT_WBS + File.separator; |
|
|
|
String path = UploadFileUtil_Servlet3.uploadFile(file, allowedExts, dir); |
|
|
|
File excelFile = new File(dir+path); |
|
|
|
importService.importQuestion(excelFile, code); |
|
|
|
log.info("导入{}",code); |
|
|
|
return JsonResponse.newInstance().ok(); |
|
|
|
} |
|
|
|
|
|
|
@ -120,14 +148,12 @@ public class ImportController { |
|
|
|
@RequestMapping(value = "/importMoca", method = RequestMethod.POST) |
|
|
|
public JsonResponse importMoca(@RequestParam(required = true) Part file) throws Exception{ |
|
|
|
|
|
|
|
long time1 = System.currentTimeMillis(); |
|
|
|
//1.上传文件
|
|
|
|
String allowedExts = "xls,xlsx"; |
|
|
|
String dir = WebConstant.UPLOAD_PROJECT_WBS + File.separator; |
|
|
|
String path = UploadFileUtil_Servlet3.uploadFile(file, allowedExts, dir); |
|
|
|
File execlFile = new File(dir+path); |
|
|
|
long time2 = System.currentTimeMillis(); |
|
|
|
importService.importQuestion(execlFile, Constant.Ht.Report.MOCA); |
|
|
|
File excelFile = new File(dir+path); |
|
|
|
importService.importQuestion(excelFile, Constant.Ht.Report.MOCA); |
|
|
|
log.info("导入moca"); |
|
|
|
return JsonResponse.newInstance().ok(); |
|
|
|
} |
|
|
@ -146,14 +172,12 @@ public class ImportController { |
|
|
|
@RequestMapping(value = "/importMMSE", method = RequestMethod.POST) |
|
|
|
public JsonResponse importMMSE(@RequestParam(required = true) Part file) throws Exception{ |
|
|
|
|
|
|
|
long time1 = System.currentTimeMillis(); |
|
|
|
//1.上传文件
|
|
|
|
String allowedExts = "xls,xlsx"; |
|
|
|
String dir = WebConstant.UPLOAD_PROJECT_WBS + File.separator; |
|
|
|
String path = UploadFileUtil_Servlet3.uploadFile(file, allowedExts, dir); |
|
|
|
File execlFile = new File(dir+path); |
|
|
|
long time2 = System.currentTimeMillis(); |
|
|
|
importService.importQuestion(execlFile, Constant.Ht.Report.MMSE); |
|
|
|
File excelFile = new File(dir+path); |
|
|
|
importService.importQuestion(excelFile, Constant.Ht.Report.MMSE); |
|
|
|
log.info("导入mmse"); |
|
|
|
return JsonResponse.newInstance().ok(); |
|
|
|
} |
|
|
@ -172,14 +196,12 @@ public class ImportController { |
|
|
|
@RequestMapping(value = "/importRey", method = RequestMethod.POST) |
|
|
|
public JsonResponse importRey(@RequestParam(required = true) Part file) throws Exception{ |
|
|
|
|
|
|
|
long time1 = System.currentTimeMillis(); |
|
|
|
//1.上传文件
|
|
|
|
String allowedExts = "xls,xlsx"; |
|
|
|
String dir = WebConstant.UPLOAD_PROJECT_WBS + File.separator; |
|
|
|
String path = UploadFileUtil_Servlet3.uploadFile(file, allowedExts, dir); |
|
|
|
File execlFile = new File(dir+path); |
|
|
|
long time2 = System.currentTimeMillis(); |
|
|
|
importService.importQuestion(execlFile, Constant.Ht.Report.REY); |
|
|
|
File excelFile = new File(dir+path); |
|
|
|
importService.importQuestion(excelFile, Constant.Ht.Report.REY); |
|
|
|
log.info("导入Rey"); |
|
|
|
return JsonResponse.newInstance().ok(); |
|
|
|
} |
|
|
@ -199,14 +221,12 @@ public class ImportController { |
|
|
|
@RequestMapping(value = "/importXFXPD", method = RequestMethod.POST) |
|
|
|
public JsonResponse importXFXPD(@RequestParam(required = true) Part file) throws Exception{ |
|
|
|
|
|
|
|
long time1 = System.currentTimeMillis(); |
|
|
|
//1.上传文件
|
|
|
|
String allowedExts = "xls,xlsx"; |
|
|
|
String dir = WebConstant.UPLOAD_PROJECT_WBS + File.separator; |
|
|
|
String path = UploadFileUtil_Servlet3.uploadFile(file, allowedExts, dir); |
|
|
|
File execlFile = new File(dir+path); |
|
|
|
long time2 = System.currentTimeMillis(); |
|
|
|
importService.importQuestion(execlFile, Constant.Ht.Report.XFXPD); |
|
|
|
File excelFile = new File(dir+path); |
|
|
|
importService.importQuestion(excelFile, Constant.Ht.Report.XFXPD); |
|
|
|
log.info("导入XFXPD"); |
|
|
|
return JsonResponse.newInstance().ok(); |
|
|
|
} |
|
|
|