Compare commits
No commits in common. "b1bbb726cd93f2e87b9be99b6e40c00345f94fd0" and "b0906702ebdae13d982ecfc82cbef735028e07c9" have entirely different histories.
b1bbb726cd
...
b0906702eb
@ -1,33 +0,0 @@
|
||||
package com.czlis.common.core.domain.entity.lis;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ComReportInstr {
|
||||
|
||||
private Long reportId;
|
||||
private String reportYq;
|
||||
private Long reportBgdh;
|
||||
private String reportSize;
|
||||
private String reportType;
|
||||
private Long reportRows;
|
||||
private Long reportMinrows;
|
||||
private Long reportMaxrows;
|
||||
private String reportItems;
|
||||
private Long reportSort;
|
||||
private String status;
|
||||
private String createBy;
|
||||
private Date createTime;
|
||||
private String updateBy;
|
||||
private Date updateTime;
|
||||
private String remark;
|
||||
private String reportName;
|
||||
|
||||
|
||||
}
|
||||
@ -10,7 +10,7 @@ import lombok.NoArgsConstructor;
|
||||
public class LabReportinstr {
|
||||
private String yq;
|
||||
private Integer xh;
|
||||
private Long bgdh;
|
||||
private Integer bgdh;
|
||||
private String yljg;
|
||||
private String type;
|
||||
private String condition;
|
||||
|
||||
@ -1,254 +0,0 @@
|
||||
package com.czlis.interfaceCommon.utils;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czlis.common.config.RuoYiConfig;
|
||||
import com.czlis.common.utils.StringUtils;
|
||||
import com.czlis.common.utils.file.FileUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
@Component
|
||||
@Slf4j
|
||||
public class LisfileUtil extends FileUtils {
|
||||
|
||||
/**
|
||||
* 下载文件到客户端
|
||||
* @param response 客户端下载对话框
|
||||
* @param filepath 文件路径
|
||||
* @param filename 文件名称
|
||||
*/
|
||||
public static void downloadfile(HttpServletResponse response,String filepath, String filename) {
|
||||
// 1. 参数校验
|
||||
if (StrUtil.isBlank(filename)) {
|
||||
log.error("文件下载失败:文件名不能为空");
|
||||
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
|
||||
return;
|
||||
}
|
||||
// 2. 拼接完整文件路径(兼容Windows/Linux,Hutool工具类适配若依)
|
||||
String fullFilePath = FileUtil.normalize(filepath + File.separator + filename);
|
||||
File file = new File(fullFilePath);
|
||||
// 3. 校验文件是否存在且是合法文件(非目录)
|
||||
if (!file.exists() || file.isDirectory()) {
|
||||
log.error("文件下载失败:文件不存在或为目录,路径:{}", fullFilePath);
|
||||
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
|
||||
return;
|
||||
}
|
||||
// 4. 设置响应头(解决中文文件名乱码、指定下载类型)
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("application/octet-stream"); // 二进制流(通用下载类型)
|
||||
try {
|
||||
// 处理中文文件名编码,兼容不同浏览器
|
||||
String encodedFileName = URLEncoder.encode(filename,"UTF-8")
|
||||
.replaceAll("\\+", "%20");
|
||||
// 设置下载文件名
|
||||
response.setHeader("Content-Disposition",
|
||||
"attachment; filename=\"" + encodedFileName + "\"; filename*=UTF-8''" + encodedFileName);
|
||||
// 设置文件大小
|
||||
response.setHeader("Content-Length", String.valueOf(file.length()));
|
||||
|
||||
// 5. 流传输文件(JDK8 try-with-resources 自动关闭流,避免泄漏)
|
||||
try (FileInputStream fis = new FileInputStream(file);
|
||||
OutputStream os = response.getOutputStream()) {
|
||||
byte[] buffer = new byte[1024 * 8]; // 8KB缓冲区,提升传输效率
|
||||
int len;
|
||||
while ((len = fis.read(buffer)) != -1) {
|
||||
os.write(buffer, 0, len);
|
||||
}
|
||||
os.flush(); // 刷新输出流,确保文件完整传输
|
||||
log.info("文件下载成功:{}", fullFilePath);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("文件下载异常:{},异常信息:{}", fullFilePath, e.getMessage(), e);
|
||||
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 保存前端上传的MultipartFile到指定目录(保持原文件名)
|
||||
* @param file 前端上传的文件
|
||||
* @param filePath 后端保存目录(如:ruoyi-admin/upload)
|
||||
* @throws IOException 文件操作异常
|
||||
*/
|
||||
public static void saveFile(MultipartFile file, String filePath)throws IOException{
|
||||
// 示例:用原文件名作为目标文件名(根据你的业务调整)
|
||||
String originalFileName = file.getOriginalFilename();
|
||||
if (StrUtil.isBlank(originalFileName)) {
|
||||
throw new IllegalArgumentException("文件原名称不能为空");
|
||||
}
|
||||
saveFile(file, filePath,originalFileName);
|
||||
}
|
||||
public static void saveFile(MultipartFile file, String filePath, String filename) throws IOException {
|
||||
// 1. 基础校验
|
||||
if (file.isEmpty()) {
|
||||
throw new IllegalArgumentException("上传文件不能为空");
|
||||
}
|
||||
if (StrUtil.isBlank(filename)) {
|
||||
throw new IllegalArgumentException("目标文件名不能为空");
|
||||
}
|
||||
|
||||
// 2. 拼接最终保存路径
|
||||
String fullPath = FileUtil.normalize(filePath + File.separator + filename);
|
||||
File destFile = new File(fullPath);
|
||||
|
||||
// 3. 确保目标目录存在
|
||||
File parentDir = destFile.getParentFile();
|
||||
if (!parentDir.exists()) {
|
||||
boolean mkdirSuccess = parentDir.mkdirs();
|
||||
if (!mkdirSuccess) {
|
||||
throw new IOException("创建保存目录失败:" + parentDir.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
// ========== 核心修复:先将MultipartFile转成字节数组,脱离Tomcat临时文件 ==========
|
||||
byte[] fileBytes;
|
||||
try (InputStream is = file.getInputStream();
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
|
||||
byte[] buffer = new byte[1024];
|
||||
int len;
|
||||
while ((len = is.read(buffer)) != -1) {
|
||||
baos.write(buffer, 0, len);
|
||||
}
|
||||
fileBytes = baos.toByteArray(); // 把文件内容读入字节数组,不再依赖Tomcat临时文件
|
||||
} catch (IOException e) {
|
||||
log.error("读取上传文件内容失败", e);
|
||||
throw new IOException("读取上传文件失败:" + e.getMessage(), e);
|
||||
}
|
||||
|
||||
// 4. 将字节数组写入目标文件(不再调用file.getInputStream(),避免临时文件问题)
|
||||
try (OutputStream os = new FileOutputStream(destFile)) {
|
||||
os.write(fileBytes);
|
||||
os.flush();
|
||||
log.info("文件保存成功,路径:{}", fullPath);
|
||||
} catch (IOException e) {
|
||||
log.error("文件保存失败,路径:{}", fullPath, e);
|
||||
throw new IOException("文件保存失败:" + fullPath, e);
|
||||
}
|
||||
}
|
||||
/** 查找指定目录的地址
|
||||
* @param templates templates
|
||||
* @return
|
||||
*/
|
||||
public static String getfilepath(String templates){
|
||||
String dir = RuoYiConfig.getProfile();
|
||||
if (dir == null || dir.trim().isEmpty()) {
|
||||
throw new IllegalStateException("配置文件中未设置有效的 profile 路径,请检查 application.yml");
|
||||
}
|
||||
String templateDir = dir.trim();
|
||||
String templatePath = templateDir + File.separator+templates+File.separator;
|
||||
return templatePath;
|
||||
|
||||
}
|
||||
/**
|
||||
* 查找指定路径下的文件集合
|
||||
* @param filepath templates
|
||||
* @param filetype .jrxml
|
||||
* @return
|
||||
*/
|
||||
public static String[] getfilelist(String filepath,String filetype) {
|
||||
String[] filels=new String[0];
|
||||
List<String> extensions = Arrays.asList(filetype);
|
||||
List<File> filelist= listFilesByType(filepath, extensions, true);
|
||||
if(filelist.size()>0) {
|
||||
filels = new String[filelist.size()];
|
||||
int i=0;
|
||||
for (File file : filelist) {
|
||||
String fileName = getFilename(file.getName().toLowerCase());
|
||||
filels[i++]=fileName;
|
||||
}
|
||||
|
||||
}
|
||||
return filels;
|
||||
}
|
||||
/**
|
||||
* 获取指定文件夹下指定类型的所有文件
|
||||
*
|
||||
* @param folderPath 文件夹路径(绝对路径/相对路径)
|
||||
* @param extensions 指定文件类型(如 ".txt", ".xlsx",不区分大小写)
|
||||
* @param recursive 是否递归子文件夹
|
||||
* @return 符合条件的文件集合
|
||||
*/
|
||||
public static List<File> listFilesByType(String folderPath, List<String> extensions, boolean recursive) {
|
||||
List<File> fileList = new ArrayList<>();
|
||||
|
||||
// 1. 严格参数校验(避免后续调用 contains 时对象为 null)
|
||||
if (!StringUtils.hasText(folderPath)) {
|
||||
throw new IllegalArgumentException("文件夹路径不能为空!");
|
||||
}
|
||||
File folder = new File(folderPath);
|
||||
if (!folder.exists() || !folder.isDirectory()) {
|
||||
throw new IllegalArgumentException("文件夹不存在或不是有效目录:" + folderPath);
|
||||
}
|
||||
if (extensions == null || extensions.isEmpty()) {
|
||||
throw new IllegalArgumentException("文件类型列表不能为空!");
|
||||
}
|
||||
|
||||
// 2. 正确初始化 Set(Java 8 兼容)
|
||||
Set<String> extensionSet = new HashSet<>();
|
||||
for (String ext : extensions) {
|
||||
if (StringUtils.hasText(ext)) {
|
||||
String normalizedExt = ext.startsWith(".") ? ext.toLowerCase() : "." + ext.toLowerCase();
|
||||
extensionSet.add(normalizedExt);
|
||||
}
|
||||
}
|
||||
// 校验转换后的集合非空(避免 contains 调用在空集合上,虽不报错但无意义)
|
||||
if (extensionSet.isEmpty()) {
|
||||
throw new IllegalArgumentException("有效文件类型不能为空!");
|
||||
}
|
||||
|
||||
// 3. 递归遍历文件
|
||||
listFilesRecursive(folder, extensionSet, recursive, fileList);
|
||||
return fileList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归遍历文件(内部辅助方法)
|
||||
*/
|
||||
private static void listFilesRecursive(File folder, Set<String> extensionSet, boolean recursive, List<File> fileList) {
|
||||
File[] files = folder.listFiles();
|
||||
if (files == null || files.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (File file : files) {
|
||||
if (file.isFile()) {
|
||||
String fileName = file.getName().toLowerCase();
|
||||
String fileExt = getFileExtension(fileName);
|
||||
if (extensionSet.contains(fileExt)) {
|
||||
fileList.add(file);
|
||||
}
|
||||
} else if (recursive && file.isDirectory()) {
|
||||
listFilesRecursive(file, extensionSet, recursive, fileList);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 获取文件扩展名(小写,带点)
|
||||
*/
|
||||
private static String getFileExtension(String fileName) {
|
||||
int lastDotIndex = fileName.lastIndexOf(".");
|
||||
if (lastDotIndex == -1 || lastDotIndex == fileName.length() - 1) {
|
||||
return ""; // 无扩展名
|
||||
}
|
||||
return fileName.substring(lastDotIndex).toLowerCase();
|
||||
}
|
||||
/**
|
||||
* 获取文件名称
|
||||
*/
|
||||
private static String getFilename(String fileName) {
|
||||
int lastDotIndex = fileName.lastIndexOf(".");
|
||||
if (lastDotIndex == -1 || lastDotIndex == fileName.length() - 1) {
|
||||
return fileName; // 无扩展名
|
||||
}
|
||||
return fileName.substring(0,lastDotIndex).toLowerCase();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -3,12 +3,9 @@ package com.czlis.liswork.controller.xtwh;
|
||||
import com.czlis.common.annotation.Log;
|
||||
import com.czlis.common.core.controller.BaseController;
|
||||
import com.czlis.common.core.domain.AjaxResult;
|
||||
import com.czlis.common.core.domain.Result;
|
||||
import com.czlis.common.core.domain.entity.lis.ComDict;
|
||||
import com.czlis.common.core.domain.entity.lis.ComReportDict;
|
||||
import com.czlis.common.enums.BusinessType;
|
||||
import com.czlis.common.utils.poi.ExcelUtil;
|
||||
import com.czlis.interfaceCommon.utils.LisfileUtil;
|
||||
import com.czlis.liswork.service.ComReportDictService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@ -16,10 +13,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "参数模板设置")
|
||||
@ -30,26 +25,26 @@ public class ComReportDictController extends BaseController {
|
||||
@Autowired
|
||||
private ComReportDictService comReportDictService;
|
||||
/**
|
||||
* 获取报表模板列表
|
||||
* 获取字典列表
|
||||
*/
|
||||
@ApiOperation("获取报表模板列表")
|
||||
@ApiOperation("获取字典列表")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(ComReportDict post) {
|
||||
// startPage();
|
||||
List<ComReportDict> list = comReportDictService.selectComReportDictList(post);
|
||||
return success(list);
|
||||
}
|
||||
@ApiOperation("报表模板导出")
|
||||
@Log(title = "报表模板导出", businessType = BusinessType.EXPORT)
|
||||
@ApiOperation("字典导出")
|
||||
@Log(title = "字典导出", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ComReportDict post) {
|
||||
List<ComReportDict> list = comReportDictService.selectComReportDictList(post);
|
||||
ExcelUtil<ComReportDict> util = new ExcelUtil<>(ComReportDict.class);
|
||||
util.exportExcel(response, list, "报表模板数据");
|
||||
util.exportExcel(response, list, "字典数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据报表模板编号获取详细信息
|
||||
* 根据字典编号获取详细信息
|
||||
*/
|
||||
@ApiOperation("获取详细信息")
|
||||
@GetMapping(value = "/{dictId}")
|
||||
@ -58,77 +53,56 @@ public class ComReportDictController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增报表模板
|
||||
* 新增字典
|
||||
*/
|
||||
@ApiOperation("新增报表模板")
|
||||
@Log(title = "报表模板管理", businessType = BusinessType.INSERT)
|
||||
@ApiOperation("新增字典")
|
||||
@Log(title = "字典管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody ComReportDict post) {
|
||||
log.info("post:{}",post);
|
||||
|
||||
if (!comReportDictService.checkDictNameUnique(post)) {
|
||||
return error("新增报表模板'" + post.getReportName() + "'失败,报表模板名称已存在");
|
||||
return error("新增字典'" + post.getReportName() + "'失败,字典名称已存在");
|
||||
} else if (!comReportDictService.checkDictCodeUnique(post)) {
|
||||
return error("新增报表模板'" + post.getReportName() + "'失败,报表模板编码已存在");
|
||||
return error("新增字典'" + post.getReportName() + "'失败,字典编码已存在");
|
||||
}
|
||||
post.setCreateBy(getUsername());
|
||||
return toAjax(comReportDictService.insertDict(post));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改报表模板
|
||||
* 修改字典
|
||||
*/
|
||||
@ApiOperation("修改报表模板")
|
||||
@Log(title = "报表模板管理", businessType = BusinessType.UPDATE)
|
||||
@ApiOperation("修改字典")
|
||||
@Log(title = "字典管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody ComReportDict post) {
|
||||
if (!comReportDictService.checkDictNameUnique(post)) {
|
||||
return error("修改报表模板'" + post.getReportName() + "'失败,报表模板名称已存在");
|
||||
return error("修改字典'" + post.getReportName() + "'失败,字典名称已存在");
|
||||
} else if (!comReportDictService.checkDictCodeUnique(post)) {
|
||||
return error("修改报表模板'" + post.getReportName() + "'失败,报表模板编码已存在");
|
||||
return error("修改字典'" + post.getReportName() + "'失败,字典编码已存在");
|
||||
}
|
||||
post.setUpdateBy(getUsername());
|
||||
return toAjax(comReportDictService.updateDict(post));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除报表模板
|
||||
* 删除字典
|
||||
*/
|
||||
@ApiOperation("删除报表模板")
|
||||
@Log(title = "报表模板管理", businessType = BusinessType.DELETE)
|
||||
@ApiOperation("删除字典")
|
||||
@Log(title = "字典管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{dictIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] dictIds) {
|
||||
return toAjax(comReportDictService.deleteDictByIds(dictIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取报表模板选择框列表
|
||||
* 获取字典选择框列表
|
||||
*/
|
||||
@ApiOperation("获取报表模板选择框列表")
|
||||
@ApiOperation("获取字典选择框列表")
|
||||
@GetMapping("/optionselect")
|
||||
public AjaxResult optionselect(String reportType) {
|
||||
List<ComReportDict> posts = comReportDictService.selectComReportDictByType(reportType);
|
||||
public AjaxResult optionselect() {
|
||||
List<ComReportDict> posts = comReportDictService.selectComReportDictAll();
|
||||
return success(posts);
|
||||
}
|
||||
/**
|
||||
* 自动加载报表模板
|
||||
*/
|
||||
@ApiOperation("自动加载报表模板")
|
||||
@GetMapping("/autoload")
|
||||
public AjaxResult autoload() {
|
||||
return toAjax(comReportDictService.autoload());
|
||||
}
|
||||
@ApiOperation("导入模板")
|
||||
@Log(title = "导入模板", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/importfile")
|
||||
public AjaxResult importfile(MultipartFile file, Long reportId) {
|
||||
|
||||
return comReportDictService.importfile(file,reportId);
|
||||
}
|
||||
@ApiOperation("导出模板")
|
||||
@Log(title = "导出模板", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/downloadfile")
|
||||
public void downloadfile(HttpServletResponse response, @RequestParam String filename) {
|
||||
LisfileUtil.downloadfile(response,LisfileUtil.getfilepath("templates"),filename+".jrxml");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,97 +0,0 @@
|
||||
package com.czlis.liswork.controller.xtwh;
|
||||
|
||||
import com.czlis.common.annotation.Log;
|
||||
import com.czlis.common.core.controller.BaseController;
|
||||
import com.czlis.common.core.domain.AjaxResult;
|
||||
import com.czlis.common.core.domain.entity.lis.ComReportInstr;
|
||||
import com.czlis.common.enums.BusinessType;
|
||||
import com.czlis.common.utils.poi.ExcelUtil;
|
||||
import com.czlis.interfaceCommon.utils.LisfileUtil;
|
||||
import com.czlis.liswork.service.ComReportInstrService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "参数模板设置")
|
||||
@RestController
|
||||
@RequestMapping("/reportinstr")
|
||||
@Slf4j
|
||||
public class ComReportInstrController extends BaseController {
|
||||
@Autowired
|
||||
private ComReportInstrService comReportInstrService;
|
||||
/**
|
||||
* 获取仪器报告模板列表
|
||||
*/
|
||||
@ApiOperation("获取仪器报告模板列表")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(ComReportInstr post) {
|
||||
// startPage();
|
||||
List<ComReportInstr> list = comReportInstrService.selectComReportInstrList(post);
|
||||
return success(list);
|
||||
}
|
||||
@ApiOperation("仪器报告模板导出")
|
||||
@Log(title = "仪器报告模板导出", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ComReportInstr post) {
|
||||
List<ComReportInstr> list = comReportInstrService.selectComReportInstrList(post);
|
||||
ExcelUtil<ComReportInstr> util = new ExcelUtil<>(ComReportInstr.class);
|
||||
util.exportExcel(response, list, "仪器报告模板数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据仪器报告模板编号获取详细信息
|
||||
*/
|
||||
@ApiOperation("获取详细信息")
|
||||
@GetMapping(value = "/{InstrId}")
|
||||
public AjaxResult getInfo(@PathVariable Long InstrId) {
|
||||
return success(comReportInstrService.selectComReportInstrById(InstrId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增仪器报告模板
|
||||
*/
|
||||
@ApiOperation("新增仪器报告模板")
|
||||
@Log(title = "仪器报告模板管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody ComReportInstr post) {
|
||||
return toAjax(comReportInstrService.insertInstr(post));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改仪器报告模板
|
||||
*/
|
||||
@ApiOperation("修改仪器报告模板")
|
||||
@Log(title = "仪器报告模板管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody ComReportInstr post) {
|
||||
return toAjax(comReportInstrService.updateInstr(post));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除仪器报告模板
|
||||
*/
|
||||
@ApiOperation("删除仪器报告模板")
|
||||
@Log(title = "仪器报告模板管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{InstrIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] InstrIds) {
|
||||
return toAjax(comReportInstrService.deleteInstrByIds(InstrIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取仪器报告模板选择框列表
|
||||
*/
|
||||
@ApiOperation("获取仪器报告模板选择框列表")
|
||||
@GetMapping("/optionselect")
|
||||
public AjaxResult optionselect() {
|
||||
List<ComReportInstr> posts = comReportInstrService.selectComReportInstrAll();
|
||||
return success(posts);
|
||||
}
|
||||
|
||||
}
|
||||
@ -72,7 +72,7 @@ public interface ComReportDictMapper {
|
||||
* @param reportType 类别
|
||||
* @return 结果
|
||||
*/
|
||||
ComReportDict checkDictNameUnique( @Param("reportName")String reportName, @Param("reportType") String reportType);
|
||||
ComReportDict checkDictNameUnique(@Param("reportName") String reportName, @Param("reportType") String reportType);
|
||||
|
||||
/**
|
||||
* 校验报表模板编码
|
||||
@ -80,6 +80,6 @@ public interface ComReportDictMapper {
|
||||
* @param reportCode 报表模板编码
|
||||
* @return 结果
|
||||
*/
|
||||
ComReportDict checkDictCodeUnique(String reportCode);
|
||||
ComReportDict checkDictCodeUnique(@Param("reportCode") String reportCode,@Param("reportType") String reportType);
|
||||
|
||||
}
|
||||
|
||||
@ -1,68 +0,0 @@
|
||||
package com.czlis.liswork.mapper.xtwh;
|
||||
|
||||
import com.czlis.common.core.domain.entity.lis.ComReportInstr;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ComReportInstrMapper {
|
||||
Long getCountById(Long reportId);
|
||||
List<ComReportInstr> selectComReportInstrByInstr(String reportYq);
|
||||
|
||||
/**
|
||||
* 查询仪器报告模板数据集合
|
||||
*
|
||||
* @param Instr 仪器报告模板信息
|
||||
* @return 仪器报告模板数据集合
|
||||
*/
|
||||
List<ComReportInstr> selectComReportInstrList(ComReportInstr Instr);
|
||||
|
||||
/**
|
||||
* 查询所有仪器报告模板
|
||||
*
|
||||
* @return 仪器报告模板列表
|
||||
*/
|
||||
List<ComReportInstr> selectComReportInstrAll();
|
||||
|
||||
/**
|
||||
* 通过仪器报告模板ID查询仪器报告模板信息
|
||||
*
|
||||
* @param reportId 仪器报告模板ID
|
||||
* @return 角色对象信息
|
||||
*/
|
||||
ComReportInstr selectComReportInstrById(Long reportId);
|
||||
|
||||
|
||||
/**
|
||||
* 删除仪器报告模板信息
|
||||
*
|
||||
* @param reportId 仪器报告模板ID
|
||||
* @return 结果
|
||||
*/
|
||||
int delComReportInstrById(Long reportId);
|
||||
|
||||
/**
|
||||
* 批量删除仪器报告模板信息
|
||||
*
|
||||
* @param InstrIds 需要删除的仪器报告模板ID
|
||||
* @return 结果
|
||||
*/
|
||||
int delComReportInstrByIds(Long[] InstrIds);
|
||||
|
||||
/**
|
||||
* 修改仪器报告模板信息
|
||||
*
|
||||
* @param Instr 仪器报告模板信息
|
||||
* @return 结果
|
||||
*/
|
||||
int updateComReportInstr(ComReportInstr Instr);
|
||||
|
||||
/**
|
||||
* 新增仪器报告模板信息
|
||||
*
|
||||
* @param Instr 仪器报告模板信息
|
||||
* @return 结果
|
||||
*/
|
||||
int insertComReportInstr(ComReportInstr Instr);
|
||||
|
||||
}
|
||||
@ -1,8 +1,6 @@
|
||||
package com.czlis.liswork.service;
|
||||
|
||||
import com.czlis.common.core.domain.AjaxResult;
|
||||
import com.czlis.common.core.domain.entity.lis.ComReportDict;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -20,7 +18,7 @@ public interface ComReportDictService {
|
||||
*
|
||||
* @return 报表模板列表
|
||||
*/
|
||||
List<ComReportDict> selectComReportDictByType(String type);
|
||||
List<ComReportDict> selectComReportDictAll();
|
||||
|
||||
/**
|
||||
* 通过报表模板ID查询报表模板信息
|
||||
@ -86,6 +84,4 @@ public interface ComReportDictService {
|
||||
* @return 结果
|
||||
*/
|
||||
int updateDict(ComReportDict Dict);
|
||||
int autoload();
|
||||
AjaxResult importfile(MultipartFile file, Long reportId);
|
||||
}
|
||||
|
||||
@ -1,75 +0,0 @@
|
||||
package com.czlis.liswork.service;
|
||||
|
||||
import com.czlis.common.core.domain.AjaxResult;
|
||||
import com.czlis.common.core.domain.entity.lis.ComReportInstr;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ComReportInstrService {
|
||||
/**
|
||||
* 查询仪器报告模板信息集合
|
||||
*
|
||||
* @param Instr 仪器报告模板信息
|
||||
* @return 仪器报告模板信息集合
|
||||
*/
|
||||
List<ComReportInstr> selectComReportInstrList(ComReportInstr Instr);
|
||||
|
||||
/**
|
||||
* 查询所有仪器报告模板
|
||||
*
|
||||
* @return 仪器报告模板列表
|
||||
*/
|
||||
List<ComReportInstr> selectComReportInstrAll();
|
||||
|
||||
/**
|
||||
* 通过仪器报告模板ID查询仪器报告模板信息
|
||||
*
|
||||
* @param InstrId 仪器报告模板ID
|
||||
* @return 角色对象信息
|
||||
*/
|
||||
ComReportInstr selectComReportInstrById(Long InstrId);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 通过仪器报告模板ID查询仪器报告模板使用数量
|
||||
*
|
||||
* @param InstrId 仪器报告模板ID
|
||||
* @return 结果
|
||||
*/
|
||||
int countUserInstrById(Long InstrId);
|
||||
|
||||
/**
|
||||
* 删除仪器报告模板信息
|
||||
*
|
||||
* @param InstrId 仪器报告模板ID
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteInstrById(Long InstrId);
|
||||
|
||||
/**
|
||||
* 批量删除仪器报告模板信息
|
||||
*
|
||||
* @param InstrIds 需要删除的仪器报告模板ID
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteInstrByIds(Long[] InstrIds);
|
||||
|
||||
/**
|
||||
* 新增保存仪器报告模板信息
|
||||
*
|
||||
* @param Instr 仪器报告模板信息
|
||||
* @return 结果
|
||||
*/
|
||||
int insertInstr(ComReportInstr Instr);
|
||||
|
||||
/**
|
||||
* 修改保存仪器报告模板信息
|
||||
*
|
||||
* @param Instr 仪器报告模板信息
|
||||
* @return 结果
|
||||
*/
|
||||
int updateInstr(ComReportInstr Instr);
|
||||
}
|
||||
@ -13,6 +13,7 @@ import java.util.List;
|
||||
@Service
|
||||
@Slf4j
|
||||
public class LabReportinstrServiceImpl implements LabReportinstrService {
|
||||
|
||||
@Autowired
|
||||
LabReportinstrMapper labReportinstrMapper;
|
||||
|
||||
|
||||
@ -1,30 +1,16 @@
|
||||
package com.czlis.liswork.service.impl.xtwh;
|
||||
|
||||
import com.czlis.common.constant.UserConstants;
|
||||
import com.czlis.common.core.domain.AjaxResult;
|
||||
import com.czlis.common.core.domain.entity.lis.ComReportDict;
|
||||
import com.czlis.common.core.domain.entity.lis.ComReportInstr;
|
||||
import com.czlis.common.core.domain.entity.lis.LabReportinstr;
|
||||
import com.czlis.common.exception.ServiceException;
|
||||
import com.czlis.common.utils.SecurityUtils;
|
||||
import com.czlis.common.utils.StringUtils;
|
||||
import com.czlis.common.utils.file.FileUtils;
|
||||
import com.czlis.interfaceCommon.utils.LisfileUtil;
|
||||
import com.czlis.liswork.mapper.xtwh.ComReportDictMapper;
|
||||
import com.czlis.liswork.mapper.xtwh.ComReportInstrMapper;
|
||||
import com.czlis.liswork.mapper.xtwh.LabReportinstrMapper;
|
||||
import com.czlis.liswork.service.ComReportDictService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 配置参数报表模板,系统配置菜单依据本报表模板自动创建配置档
|
||||
@ -32,59 +18,9 @@ import java.util.*;
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ComReportDictServiceImpl implements ComReportDictService {
|
||||
private static final String templates="templates";
|
||||
private static final String filetype=".jrxml";
|
||||
private static final String filetypename="jrxml";
|
||||
@Autowired
|
||||
LisfileUtil lisfileUtil;
|
||||
|
||||
@Autowired
|
||||
ComReportDictMapper comReportDictMapper;
|
||||
@Autowired
|
||||
ComReportInstrMapper comReportInstrMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public AjaxResult importfile(MultipartFile file, Long reportId){
|
||||
String filepath=lisfileUtil.getfilepath(templates);
|
||||
String filename="";
|
||||
if(reportId!=0) {
|
||||
ComReportDict info= comReportDictMapper.selectComReportDictById(reportId);
|
||||
filename=info.getReportCode();
|
||||
if(!"".equals(filename)&&filename!=null){filename=filename+filetype;}
|
||||
}else{
|
||||
filename=file.getOriginalFilename();
|
||||
ComReportDict info = comReportDictMapper.checkDictCodeUnique(filename);
|
||||
if(info != null){
|
||||
return AjaxResult.error("模板新增失败,已存在模板:" +info.getReportName() );
|
||||
}
|
||||
}
|
||||
try {
|
||||
lisfileUtil.saveFile(file,filepath,filename);
|
||||
if(reportId==0)autoload();
|
||||
return AjaxResult.success("文件上传成功", file.getOriginalFilename());
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("文件上传失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int autoload(){
|
||||
String[] Filelist= lisfileUtil.getfilelist(lisfileUtil.getfilepath(templates),filetypename);
|
||||
for(String filename : Filelist) {
|
||||
ComReportDict info = comReportDictMapper.checkDictCodeUnique(filename);
|
||||
if(info == null){
|
||||
ComReportDict newInfo = new ComReportDict();
|
||||
newInfo.setReportCode(filename);
|
||||
newInfo.setReportName(filename);
|
||||
newInfo.setReportType("0");
|
||||
newInfo.setReportOptiontype("0");
|
||||
newInfo.setReportSort(0L);
|
||||
newInfo.setStatus("0");
|
||||
newInfo.setCreateBy(SecurityUtils.getLoginUser().getUsername());
|
||||
insertDict(newInfo);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/**
|
||||
* 查询报表模板信息集合
|
||||
*
|
||||
@ -102,8 +38,8 @@ public class ComReportDictServiceImpl implements ComReportDictService {
|
||||
* @return 报表模板列表
|
||||
*/
|
||||
@Override
|
||||
public List<ComReportDict> selectComReportDictByType(String type) {
|
||||
return comReportDictMapper.selectComReportDictByType(type);
|
||||
public List<ComReportDict> selectComReportDictAll() {
|
||||
return comReportDictMapper.selectComReportDictAll();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -143,7 +79,7 @@ public class ComReportDictServiceImpl implements ComReportDictService {
|
||||
@Override
|
||||
public boolean checkDictCodeUnique(ComReportDict Dict) {
|
||||
Long DictId = StringUtils.isNull(Dict.getReportId()) ? -1L : Dict.getReportId();
|
||||
ComReportDict info = comReportDictMapper.checkDictCodeUnique(Dict.getReportCode());
|
||||
ComReportDict info = comReportDictMapper.checkDictCodeUnique(Dict.getReportCode(),Dict.getReportType());
|
||||
if (StringUtils.isNotNull(info) && info.getReportId().longValue() != DictId.longValue()) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
@ -158,11 +94,7 @@ public class ComReportDictServiceImpl implements ComReportDictService {
|
||||
*/
|
||||
@Override
|
||||
public int countUserDictById(Long DictId) {
|
||||
ComReportInstr comReportInstr=new ComReportInstr();
|
||||
comReportInstr.setReportBgdh(DictId);
|
||||
List<ComReportInstr> comReportInstr0 =comReportInstrMapper.selectComReportInstrList(comReportInstr);
|
||||
if(comReportInstr0.size()>0)return 1;
|
||||
return 0;
|
||||
return 0;//comReportDictMapper.countUserDictById(DictId);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -171,38 +103,24 @@ public class ComReportDictServiceImpl implements ComReportDictService {
|
||||
* @param DictId 报表模板ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public int deleteDictById(Long DictId) {
|
||||
|
||||
ComReportDict info=comReportDictMapper.selectComReportDictById(DictId);
|
||||
if (countUserDictById(DictId) > 0) {
|
||||
throw new ServiceException(String.format("%1$s已分配设备,不能删除", info.getReportName()));
|
||||
}
|
||||
String filename=info.getReportCode();
|
||||
deletefile(filename);
|
||||
return comReportDictMapper.delComReportDictById(DictId);
|
||||
}
|
||||
public void deletefile(String filename) {
|
||||
String filepath=lisfileUtil.getfilepath(templates);
|
||||
String fileurl=filepath + File.separator + filename+filetype;
|
||||
FileUtils.deleteFile(fileurl);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除报表模板信息
|
||||
*
|
||||
* @param DictIds 需要删除的报表模板ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public int deleteDictByIds(Long[] DictIds) {
|
||||
for (Long DictId : DictIds) {
|
||||
ComReportDict Dict = selectComReportDictById(DictId);
|
||||
if (countUserDictById(DictId) > 0) {
|
||||
throw new ServiceException(String.format("%1$s已分配设备,不能删除", Dict.getReportName()));
|
||||
throw new ServiceException(String.format("%1$s已分配,不能删除", Dict.getReportName()));
|
||||
}
|
||||
deletefile(Dict.getReportCode());
|
||||
}
|
||||
return comReportDictMapper.delComReportDictByIds(DictIds);
|
||||
}
|
||||
@ -213,7 +131,6 @@ public class ComReportDictServiceImpl implements ComReportDictService {
|
||||
* @param Dict 报表模板信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public int insertDict(ComReportDict Dict) {
|
||||
return comReportDictMapper.insertComReportDict(Dict);
|
||||
@ -225,13 +142,9 @@ public class ComReportDictServiceImpl implements ComReportDictService {
|
||||
* @param Dict 报表模板信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public int updateDict(ComReportDict Dict) {
|
||||
return comReportDictMapper.updateComReportDict(Dict);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,128 +0,0 @@
|
||||
package com.czlis.liswork.service.impl.xtwh;
|
||||
|
||||
import com.czlis.common.constant.UserConstants;
|
||||
import com.czlis.common.core.domain.AjaxResult;
|
||||
import com.czlis.common.core.domain.entity.lis.ComReportInstr;
|
||||
import com.czlis.common.core.domain.entity.lis.LabReportinstr;
|
||||
import com.czlis.common.exception.ServiceException;
|
||||
import com.czlis.common.utils.SecurityUtils;
|
||||
import com.czlis.common.utils.StringUtils;
|
||||
import com.czlis.common.utils.file.FileUtils;
|
||||
import com.czlis.interfaceCommon.utils.LisfileUtil;
|
||||
import com.czlis.liswork.mapper.xtwh.ComReportInstrMapper;
|
||||
import com.czlis.liswork.mapper.xtwh.LabReportinstrMapper;
|
||||
import com.czlis.liswork.service.ComReportInstrService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 配置参数仪器报告模板,系统配置菜单依据本仪器报告模板自动创建配置档
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ComReportInstrServiceImpl implements ComReportInstrService {
|
||||
@Autowired
|
||||
ComReportInstrMapper comReportInstrMapper;
|
||||
/**
|
||||
* 查询仪器报告模板信息集合
|
||||
*
|
||||
* @param Instr 仪器报告模板信息
|
||||
* @return 仪器报告模板信息集合
|
||||
*/
|
||||
@Override
|
||||
public List<ComReportInstr> selectComReportInstrList(ComReportInstr Instr) {
|
||||
return comReportInstrMapper.selectComReportInstrByInstr(Instr.getReportYq());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有仪器报告模板
|
||||
*
|
||||
* @return 仪器报告模板列表
|
||||
*/
|
||||
@Override
|
||||
public List<ComReportInstr> selectComReportInstrAll() {
|
||||
return comReportInstrMapper.selectComReportInstrAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过仪器报告模板ID查询仪器报告模板信息
|
||||
*
|
||||
* @param InstrId 仪器报告模板ID
|
||||
* @return 角色对象信息
|
||||
*/
|
||||
@Override
|
||||
public ComReportInstr selectComReportInstrById(Long InstrId) {
|
||||
return comReportInstrMapper.selectComReportInstrById(InstrId);
|
||||
}
|
||||
/**
|
||||
* 通过仪器报告模板ID查询仪器报告模板使用数量
|
||||
*
|
||||
* @param Bgdh 仪器报告模板ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int countUserInstrById(Long Bgdh) {
|
||||
ComReportInstr comReportInstr=new ComReportInstr();
|
||||
comReportInstr.setReportBgdh(Bgdh);
|
||||
List<ComReportInstr> comReportInstr0 =comReportInstrMapper.selectComReportInstrList(comReportInstr);
|
||||
if(comReportInstr0.size()>0)return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除仪器报告模板信息
|
||||
*
|
||||
* @param InstrId 仪器报告模板ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public int deleteInstrById(Long InstrId) {
|
||||
return comReportInstrMapper.delComReportInstrById(InstrId);
|
||||
}
|
||||
/**
|
||||
* 批量删除仪器报告模板信息
|
||||
*
|
||||
* @param InstrIds 需要删除的仪器报告模板ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public int deleteInstrByIds(Long[] InstrIds) {
|
||||
return comReportInstrMapper.delComReportInstrByIds(InstrIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存仪器报告模板信息
|
||||
*
|
||||
* @param Instr 仪器报告模板信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public int insertInstr(ComReportInstr Instr) {
|
||||
return comReportInstrMapper.insertComReportInstr(Instr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存仪器报告模板信息
|
||||
*
|
||||
* @param Instr 仪器报告模板信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public int updateInstr(ComReportInstr Instr) {
|
||||
return comReportInstrMapper.updateComReportInstr(Instr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -59,7 +59,7 @@
|
||||
</select>
|
||||
<select id="selectComReportDictByType" parameterType="String" resultMap="ComReportDictResult">
|
||||
<include refid="selectComReportDictVo"/>
|
||||
where report_type = #{reportType} and status='0'
|
||||
where report_type = #{reportType}
|
||||
order by report_sort
|
||||
</select>
|
||||
|
||||
@ -75,7 +75,7 @@
|
||||
select top 1 report_id,report_type,report_code,report_name,report_optiontype,report_defvalue,report_sort,
|
||||
status,create_by,create_time,update_by,update_time,remark
|
||||
from com_report_dict
|
||||
where report_code=#{reportCode}
|
||||
where report_code=#{reportCode} and report_type = #{reportType}
|
||||
</select>
|
||||
<insert id="insertComReportDict" parameterType="com.czlis.common.core.domain.entity.lis.ComReportDict" useGeneratedKeys="true" keyProperty="reportId">
|
||||
insert into com_report_dict(
|
||||
|
||||
@ -1,139 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.czlis.liswork.mapper.xtwh.ComReportInstrMapper">
|
||||
<resultMap type="com.czlis.common.core.domain.entity.lis.ComReportInstr" id="ComReportInstrResult">
|
||||
<id property="reportId" column="report_id" />
|
||||
<result property="reportYq" column="report_yq" />
|
||||
<result property="reportBgdh" column="report_bgdh" />
|
||||
<result property="reportSize" column="report_size" />
|
||||
<result property="reportType" column="report_type" />
|
||||
<result property="reportRows" column="report_rows" />
|
||||
<result property="reportMinrows" column="report_minrows" />
|
||||
<result property="reportMaxrows" column="report_maxrows" />
|
||||
<result property="reportItems" column="report_items" />
|
||||
<result property="reportSort" column="report_sort" />
|
||||
<result property="status" column="status" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="reportName" column="report_name" />
|
||||
|
||||
</resultMap>
|
||||
<sql id="selectComReportInstrVo">
|
||||
select report_id,report_type,report_yq,report_size,report_bgdh,report_sort,
|
||||
report_rows,report_minrows,report_maxrows,report_items,
|
||||
status,create_by,create_time,update_by,update_time,remark from com_report_instr
|
||||
</sql>
|
||||
<select id="selectComReportInstrList" resultMap="ComReportInstrResult" parameterType="com.czlis.common.core.domain.entity.lis.ComReportInstr" >
|
||||
<include refid="selectComReportInstrVo"></include>
|
||||
<where>
|
||||
<if test="reportId != null and reportId != 0">
|
||||
and report_id = #{reportId}
|
||||
</if>
|
||||
<if test="reportBgdh != null and reportBgdh != 0">
|
||||
and report_bgdh = #{reportBgdh}
|
||||
</if>
|
||||
<if test="reportType != null and reportType != ''">
|
||||
and report_type = #{reportType}
|
||||
</if>
|
||||
<if test="reportYq != null and reportYq != ''">
|
||||
and report_yq = #{reportYq}
|
||||
</if>
|
||||
<if test="reportSize != null and reportSize != ''">
|
||||
and report_size = #{reportSize}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
and status = #{status}
|
||||
</if>
|
||||
</where>
|
||||
order by report_sort ASC
|
||||
</select>
|
||||
<select id="getCountById" resultType="Long">
|
||||
select count(1) from com_report_instr where report_id = #{reportId}
|
||||
</select>
|
||||
<select id="selectComReportInstrAll" resultMap="ComReportInstrResult">
|
||||
<include refid="selectComReportInstrVo"/>
|
||||
order by report_sort
|
||||
</select>
|
||||
|
||||
<select id="selectComReportInstrById" parameterType="Long" resultMap="ComReportInstrResult">
|
||||
<include refid="selectComReportInstrVo"/>
|
||||
where report_id = #{reportId}
|
||||
</select>
|
||||
<select id="selectComReportInstrByInstr" parameterType="String" resultMap="ComReportInstrResult">
|
||||
select com_report_instr.*,com_report_dict.report_name
|
||||
from com_report_instr left join com_report_dict on com_report_instr.report_bgdh=com_report_dict.report_id
|
||||
where com_report_instr.report_yq = #{reportYq}
|
||||
order by com_report_instr.report_sort
|
||||
</select>
|
||||
|
||||
<insert id="insertComReportInstr" parameterType="com.czlis.common.core.domain.entity.lis.ComReportInstr" useGeneratedKeys="true" keyProperty="reportId">
|
||||
insert into com_report_instr(
|
||||
<if test="reportId != null and reportId != 0">report_id,</if>
|
||||
<if test="reportType != null and reportType != ''">report_type,</if>
|
||||
<if test="reportYq != null and reportYq != ''">report_yq,</if>
|
||||
<if test="reportBgdh != null and reportBgdh != 0">report_bgdh,</if>
|
||||
<if test="reportSize != null and reportSize != ''">report_size,</if>
|
||||
<if test="reportRows != null and reportRows != 0">report_rows,</if>
|
||||
<if test="reportMinrows != null and reportMinrows != 0">report_minrows,</if>
|
||||
<if test="reportMaxrows != null and reportMaxrows != 0">report_maxrows,</if>
|
||||
<if test="reportItems != null and reportItems != ''">report_items,</if>
|
||||
<if test="reportSort != null">report_sort,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="reportId != null and reportId != 0">#{reportId},</if>
|
||||
<if test="reportType != null and reportType != ''">#{reportType},</if>
|
||||
<if test="reportYq != null and reportYq != ''">#{reportYq},</if>
|
||||
<if test="reportBgdh != null and reportBgdh != 0">#{reportBgdh},</if>
|
||||
<if test="reportSize != null and reportSize != ''">#{reportSize},</if>
|
||||
<if test="reportRows != null and reportRows != 0">#{reportRows},</if>
|
||||
<if test="reportMinrows != null and reportMinrows != 0">#{reportMinrows},</if>
|
||||
<if test="reportMaxrows != null and reportMaxrows != 0">#{reportMaxrows},</if>
|
||||
<if test="reportItems != null and reportItems != ''">#{reportItems},</if>
|
||||
<if test="reportSort != null">#{reportSort},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
getdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<delete id="delComReportInstrById" parameterType="Long">
|
||||
delete from com_report_instr where report_id = #{reportId}
|
||||
</delete>
|
||||
|
||||
<delete id="delComReportInstrByIds" parameterType="Long">
|
||||
delete from com_report_instr where report_id in
|
||||
<foreach collection="array" item="reportId" open="(" separator="," close=")">
|
||||
#{reportId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="updateComReportInstr" parameterType="com.czlis.common.core.domain.entity.lis.ComReportInstr">
|
||||
update com_report_instr
|
||||
<set>
|
||||
<if test="reportType != null and reportType != ''">report_type = #{reportType},</if>
|
||||
<if test="reportYq != null and reportYq != ''">report_yq = #{reportYq},</if>
|
||||
<if test="reportBgdh != null and reportBgdh != 0">report_bgdh = #{reportBgdh},</if>
|
||||
<if test="reportSize != null and reportSize != ''">report_size = #{reportSize},</if>
|
||||
<if test="reportRows != null and reportRows != 0">report_rows = #{reportRows},</if>
|
||||
<if test="reportMinrows != null and reportMinrows != 0">report_minrows = #{reportMinrows},</if>
|
||||
<if test="reportMaxrows != null and reportMaxrows != 0">report_maxrows = #{reportMaxrows},</if>
|
||||
<if test="reportItems != null and reportItems != ''">report_items = #{reportItems},</if>
|
||||
<if test="reportSort != null">report_sort = #{reportSort},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
update_time = getdate()
|
||||
</set>
|
||||
where report_id = #{reportId}
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -64,34 +64,19 @@ if not exists(select 1 from com_opt where yq = '' and xxdh = 'A5MERGEA4')
|
||||
end
|
||||
|
||||
--报告单仪器对应表
|
||||
if not exists(SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'com_report_instr')
|
||||
if not exists(SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'lab_reportinstr')
|
||||
begin
|
||||
CREATE TABLE [dbo].[com_report_instr](
|
||||
[report_id] [bigint] IDENTITY(1,1) NOT NULL,
|
||||
[report_yq] [varchar](20) NOT NULL,
|
||||
[report_bgdh] [bigint] NOT NULL,
|
||||
[report_size] [varchar](10) NULL,
|
||||
[report_type] [varchar](10) NULL,
|
||||
[report_rows] int NULL,
|
||||
[report_minrows] int NULL,
|
||||
[report_maxrows] int NULL,
|
||||
[report_items] [varchar](250) NULL,
|
||||
[report_sort] [int] NOT NULL,
|
||||
[status] [char](1) NOT NULL,
|
||||
[create_by] [varchar](64) NULL,
|
||||
[create_time] [datetime] NULL,
|
||||
[update_by] [varchar](64) NULL,
|
||||
[update_time] [datetime] NULL,
|
||||
[remark] [varchar](500) NULL,
|
||||
PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[report_id] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
) ON [PRIMARY];
|
||||
ALTER TABLE [dbo].[com_report_instr] ADD DEFAULT ('') FOR [create_by];
|
||||
ALTER TABLE [dbo].[com_report_instr] ADD DEFAULT ('') FOR [update_by];
|
||||
ALTER TABLE [dbo].[com_report_instr] ADD DEFAULT (NULL) FOR [remark];
|
||||
end
|
||||
create table lab_reportinstr
|
||||
(
|
||||
yq varchar(10),
|
||||
xh int ,
|
||||
bgdh varchar(100),
|
||||
yljg varchar(10),
|
||||
type int, --1.默认,2.参数,3.根据项目来判断
|
||||
condition varchar(500),
|
||||
PRIMARY KEY (yq, xh,bgdh)
|
||||
)
|
||||
end
|
||||
|
||||
if not exists(SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'reg_TransitSample')
|
||||
begin
|
||||
@ -383,30 +368,3 @@ ALTER TABLE [dbo].[com_config_dict] ADD DEFAULT ('') FOR [create_by]
|
||||
ALTER TABLE [dbo].[com_config_dict] ADD DEFAULT ('') FOR [update_by]
|
||||
ALTER TABLE [dbo].[com_config_dict] ADD DEFAULT (NULL) FOR [remark]
|
||||
end
|
||||
|
||||
--报告表
|
||||
if not exists(SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'com_report_dict')
|
||||
begin
|
||||
CREATE TABLE [dbo].[com_report_dict](
|
||||
[report_id] [bigint] IDENTITY(1,1) NOT NULL,
|
||||
[report_type] [varchar](20) NOT NULL,
|
||||
[report_code] [varchar](64) NOT NULL,
|
||||
[report_name] [varchar](250) NOT NULL,
|
||||
[report_optiontype] [char](1) NOT NULL,
|
||||
[report_defvalue] [varchar](250) NULL,
|
||||
[report_sort] [int] NOT NULL,
|
||||
[status] [char](1) NOT NULL,
|
||||
[create_by] [varchar](64) NULL,
|
||||
[create_time] [datetime] NULL,
|
||||
[update_by] [varchar](64) NULL,
|
||||
[update_time] [datetime] NULL,
|
||||
[remark] [varchar](500) NULL,
|
||||
PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[report_id] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
ALTER TABLE [dbo].[com_report_dict] ADD DEFAULT ('') FOR [create_by];
|
||||
ALTER TABLE [dbo].[com_report_dict] ADD DEFAULT ('') FOR [update_by];
|
||||
ALTER TABLE [dbo].[com_report_dict] ADD DEFAULT (NULL) FOR [remark];
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user