报告模板菜单

This commit is contained in:
tangw 2025-12-25 20:14:19 +08:00
parent 0291351702
commit 44263fd098
15 changed files with 1003 additions and 51 deletions

View File

@ -0,0 +1,33 @@
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;
}

View File

@ -10,7 +10,7 @@ import lombok.NoArgsConstructor;
public class LabReportinstr { public class LabReportinstr {
private String yq; private String yq;
private Integer xh; private Integer xh;
private Integer bgdh; private Long bgdh;
private String yljg; private String yljg;
private String type; private String type;
private String condition; private String condition;

View File

@ -0,0 +1,254 @@
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();
}
}

View File

@ -3,9 +3,12 @@ package com.czlis.liswork.controller.xtwh;
import com.czlis.common.annotation.Log; import com.czlis.common.annotation.Log;
import com.czlis.common.core.controller.BaseController; import com.czlis.common.core.controller.BaseController;
import com.czlis.common.core.domain.AjaxResult; 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.core.domain.entity.lis.ComReportDict;
import com.czlis.common.enums.BusinessType; import com.czlis.common.enums.BusinessType;
import com.czlis.common.utils.poi.ExcelUtil; import com.czlis.common.utils.poi.ExcelUtil;
import com.czlis.interfaceCommon.utils.LisfileUtil;
import com.czlis.liswork.service.ComReportDictService; import com.czlis.liswork.service.ComReportDictService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -13,8 +16,10 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.util.List; import java.util.List;
@Api(tags = "参数模板设置") @Api(tags = "参数模板设置")
@ -25,26 +30,26 @@ public class ComReportDictController extends BaseController {
@Autowired @Autowired
private ComReportDictService comReportDictService; private ComReportDictService comReportDictService;
/** /**
* 获取字典列表 * 获取报表模板列表
*/ */
@ApiOperation("获取字典列表") @ApiOperation("获取报表模板列表")
@GetMapping("/list") @GetMapping("/list")
public AjaxResult list(ComReportDict post) { public AjaxResult list(ComReportDict post) {
// startPage(); // startPage();
List<ComReportDict> list = comReportDictService.selectComReportDictList(post); List<ComReportDict> list = comReportDictService.selectComReportDictList(post);
return success(list); return success(list);
} }
@ApiOperation("字典导出") @ApiOperation("报表模板导出")
@Log(title = "字典导出", businessType = BusinessType.EXPORT) @Log(title = "报表模板导出", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, ComReportDict post) { public void export(HttpServletResponse response, ComReportDict post) {
List<ComReportDict> list = comReportDictService.selectComReportDictList(post); List<ComReportDict> list = comReportDictService.selectComReportDictList(post);
ExcelUtil<ComReportDict> util = new ExcelUtil<>(ComReportDict.class); ExcelUtil<ComReportDict> util = new ExcelUtil<>(ComReportDict.class);
util.exportExcel(response, list, "字典数据"); util.exportExcel(response, list, "报表模板数据");
} }
/** /**
* 根据字典编号获取详细信息 * 根据报表模板编号获取详细信息
*/ */
@ApiOperation("获取详细信息") @ApiOperation("获取详细信息")
@GetMapping(value = "/{dictId}") @GetMapping(value = "/{dictId}")
@ -53,56 +58,77 @@ public class ComReportDictController extends BaseController {
} }
/** /**
* 新增字典 * 新增报表模板
*/ */
@ApiOperation("新增字典") @ApiOperation("新增报表模板")
@Log(title = "字典管理", businessType = BusinessType.INSERT) @Log(title = "报表模板管理", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@Validated @RequestBody ComReportDict post) { public AjaxResult add(@Validated @RequestBody ComReportDict post) {
log.info("post:{}",post); log.info("post:{}",post);
if (!comReportDictService.checkDictNameUnique(post)) { if (!comReportDictService.checkDictNameUnique(post)) {
return error("新增字典'" + post.getReportName() + "'失败,字典名称已存在"); return error("新增报表模板'" + post.getReportName() + "'失败,报表模板名称已存在");
} else if (!comReportDictService.checkDictCodeUnique(post)) { } else if (!comReportDictService.checkDictCodeUnique(post)) {
return error("新增字典'" + post.getReportName() + "'失败,字典编码已存在"); return error("新增报表模板'" + post.getReportName() + "'失败,报表模板编码已存在");
} }
post.setCreateBy(getUsername()); post.setCreateBy(getUsername());
return toAjax(comReportDictService.insertDict(post)); return toAjax(comReportDictService.insertDict(post));
} }
/** /**
* 修改字典 * 修改报表模板
*/ */
@ApiOperation("修改字典") @ApiOperation("修改报表模板")
@Log(title = "字典管理", businessType = BusinessType.UPDATE) @Log(title = "报表模板管理", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody ComReportDict post) { public AjaxResult edit(@Validated @RequestBody ComReportDict post) {
if (!comReportDictService.checkDictNameUnique(post)) { if (!comReportDictService.checkDictNameUnique(post)) {
return error("修改字典'" + post.getReportName() + "'失败,字典名称已存在"); return error("修改报表模板'" + post.getReportName() + "'失败,报表模板名称已存在");
} else if (!comReportDictService.checkDictCodeUnique(post)) { } else if (!comReportDictService.checkDictCodeUnique(post)) {
return error("修改字典'" + post.getReportName() + "'失败,字典编码已存在"); return error("修改报表模板'" + post.getReportName() + "'失败,报表模板编码已存在");
} }
post.setUpdateBy(getUsername()); post.setUpdateBy(getUsername());
return toAjax(comReportDictService.updateDict(post)); return toAjax(comReportDictService.updateDict(post));
} }
/** /**
* 删除字典 * 删除报表模板
*/ */
@ApiOperation("删除字典") @ApiOperation("删除报表模板")
@Log(title = "字典管理", businessType = BusinessType.DELETE) @Log(title = "报表模板管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictIds}") @DeleteMapping("/{dictIds}")
public AjaxResult remove(@PathVariable Long[] dictIds) { public AjaxResult remove(@PathVariable Long[] dictIds) {
return toAjax(comReportDictService.deleteDictByIds(dictIds)); return toAjax(comReportDictService.deleteDictByIds(dictIds));
} }
/** /**
* 获取字典选择框列表 * 获取报表模板选择框列表
*/ */
@ApiOperation("获取字典选择框列表") @ApiOperation("获取报表模板选择框列表")
@GetMapping("/optionselect") @GetMapping("/optionselect")
public AjaxResult optionselect() { public AjaxResult optionselect(String reportType) {
List<ComReportDict> posts = comReportDictService.selectComReportDictAll(); List<ComReportDict> posts = comReportDictService.selectComReportDictByType(reportType);
return success(posts); 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");
}
} }

View File

@ -0,0 +1,97 @@
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);
}
}

View File

@ -72,7 +72,7 @@ public interface ComReportDictMapper {
* @param reportType 类别 * @param reportType 类别
* @return 结果 * @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 报表模板编码 * @param reportCode 报表模板编码
* @return 结果 * @return 结果
*/ */
ComReportDict checkDictCodeUnique(@Param("reportCode") String reportCode,@Param("reportType") String reportType); ComReportDict checkDictCodeUnique(String reportCode);
} }

View File

@ -0,0 +1,68 @@
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);
}

View File

@ -1,6 +1,8 @@
package com.czlis.liswork.service; package com.czlis.liswork.service;
import com.czlis.common.core.domain.AjaxResult;
import com.czlis.common.core.domain.entity.lis.ComReportDict; import com.czlis.common.core.domain.entity.lis.ComReportDict;
import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
@ -18,7 +20,7 @@ public interface ComReportDictService {
* *
* @return 报表模板列表 * @return 报表模板列表
*/ */
List<ComReportDict> selectComReportDictAll(); List<ComReportDict> selectComReportDictByType(String type);
/** /**
* 通过报表模板ID查询报表模板信息 * 通过报表模板ID查询报表模板信息
@ -84,4 +86,6 @@ public interface ComReportDictService {
* @return 结果 * @return 结果
*/ */
int updateDict(ComReportDict Dict); int updateDict(ComReportDict Dict);
int autoload();
AjaxResult importfile(MultipartFile file, Long reportId);
} }

View File

@ -0,0 +1,75 @@
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);
}

View File

@ -13,7 +13,6 @@ import java.util.List;
@Service @Service
@Slf4j @Slf4j
public class LabReportinstrServiceImpl implements LabReportinstrService { public class LabReportinstrServiceImpl implements LabReportinstrService {
@Autowired @Autowired
LabReportinstrMapper labReportinstrMapper; LabReportinstrMapper labReportinstrMapper;

View File

@ -1,16 +1,30 @@
package com.czlis.liswork.service.impl.xtwh; package com.czlis.liswork.service.impl.xtwh;
import com.czlis.common.constant.UserConstants; 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.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.exception.ServiceException;
import com.czlis.common.utils.SecurityUtils;
import com.czlis.common.utils.StringUtils; 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.ComReportDictMapper;
import com.czlis.liswork.mapper.xtwh.ComReportInstrMapper;
import com.czlis.liswork.mapper.xtwh.LabReportinstrMapper;
import com.czlis.liswork.service.ComReportDictService; import com.czlis.liswork.service.ComReportDictService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
/** /**
* 配置参数报表模板,系统配置菜单依据本报表模板自动创建配置档 * 配置参数报表模板,系统配置菜单依据本报表模板自动创建配置档
@ -18,9 +32,59 @@ import java.util.List;
@Service @Service
@Slf4j @Slf4j
public class ComReportDictServiceImpl implements ComReportDictService { 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 @Autowired
ComReportDictMapper comReportDictMapper; 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;
}
/** /**
* 查询报表模板信息集合 * 查询报表模板信息集合
* *
@ -38,8 +102,8 @@ public class ComReportDictServiceImpl implements ComReportDictService {
* @return 报表模板列表 * @return 报表模板列表
*/ */
@Override @Override
public List<ComReportDict> selectComReportDictAll() { public List<ComReportDict> selectComReportDictByType(String type) {
return comReportDictMapper.selectComReportDictAll(); return comReportDictMapper.selectComReportDictByType(type);
} }
/** /**
@ -79,7 +143,7 @@ public class ComReportDictServiceImpl implements ComReportDictService {
@Override @Override
public boolean checkDictCodeUnique(ComReportDict Dict) { public boolean checkDictCodeUnique(ComReportDict Dict) {
Long DictId = StringUtils.isNull(Dict.getReportId()) ? -1L : Dict.getReportId(); Long DictId = StringUtils.isNull(Dict.getReportId()) ? -1L : Dict.getReportId();
ComReportDict info = comReportDictMapper.checkDictCodeUnique(Dict.getReportCode(),Dict.getReportType()); ComReportDict info = comReportDictMapper.checkDictCodeUnique(Dict.getReportCode());
if (StringUtils.isNotNull(info) && info.getReportId().longValue() != DictId.longValue()) { if (StringUtils.isNotNull(info) && info.getReportId().longValue() != DictId.longValue()) {
return UserConstants.NOT_UNIQUE; return UserConstants.NOT_UNIQUE;
} }
@ -94,7 +158,11 @@ public class ComReportDictServiceImpl implements ComReportDictService {
*/ */
@Override @Override
public int countUserDictById(Long DictId) { public int countUserDictById(Long DictId) {
return 0;//comReportDictMapper.countUserDictById(DictId); ComReportInstr comReportInstr=new ComReportInstr();
comReportInstr.setReportBgdh(DictId);
List<ComReportInstr> comReportInstr0 =comReportInstrMapper.selectComReportInstrList(comReportInstr);
if(comReportInstr0.size()>0)return 1;
return 0;
} }
/** /**
@ -103,24 +171,38 @@ public class ComReportDictServiceImpl implements ComReportDictService {
* @param DictId 报表模板ID * @param DictId 报表模板ID
* @return 结果 * @return 结果
*/ */
@Transactional(rollbackFor = Exception.class)
@Override @Override
public int deleteDictById(Long DictId) { 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); 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 * @param DictIds 需要删除的报表模板ID
* @return 结果 * @return 结果
*/ */
@Transactional(rollbackFor = Exception.class)
@Override @Override
public int deleteDictByIds(Long[] DictIds) { public int deleteDictByIds(Long[] DictIds) {
for (Long DictId : DictIds) { for (Long DictId : DictIds) {
ComReportDict Dict = selectComReportDictById(DictId); ComReportDict Dict = selectComReportDictById(DictId);
if (countUserDictById(DictId) > 0) { 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); return comReportDictMapper.delComReportDictByIds(DictIds);
} }
@ -131,6 +213,7 @@ public class ComReportDictServiceImpl implements ComReportDictService {
* @param Dict 报表模板信息 * @param Dict 报表模板信息
* @return 结果 * @return 结果
*/ */
@Transactional(rollbackFor = Exception.class)
@Override @Override
public int insertDict(ComReportDict Dict) { public int insertDict(ComReportDict Dict) {
return comReportDictMapper.insertComReportDict(Dict); return comReportDictMapper.insertComReportDict(Dict);
@ -142,9 +225,13 @@ public class ComReportDictServiceImpl implements ComReportDictService {
* @param Dict 报表模板信息 * @param Dict 报表模板信息
* @return 结果 * @return 结果
*/ */
@Transactional(rollbackFor = Exception.class)
@Override @Override
public int updateDict(ComReportDict Dict) { public int updateDict(ComReportDict Dict) {
return comReportDictMapper.updateComReportDict(Dict); return comReportDictMapper.updateComReportDict(Dict);
} }
} }

View File

@ -0,0 +1,128 @@
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);
}
}

View File

@ -59,7 +59,7 @@
</select> </select>
<select id="selectComReportDictByType" parameterType="String" resultMap="ComReportDictResult"> <select id="selectComReportDictByType" parameterType="String" resultMap="ComReportDictResult">
<include refid="selectComReportDictVo"/> <include refid="selectComReportDictVo"/>
where report_type = #{reportType} where report_type = #{reportType} and status='0'
order by report_sort order by report_sort
</select> </select>
@ -75,7 +75,7 @@
select top 1 report_id,report_type,report_code,report_name,report_optiontype,report_defvalue,report_sort, 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 status,create_by,create_time,update_by,update_time,remark
from com_report_dict from com_report_dict
where report_code=#{reportCode} and report_type = #{reportType} where report_code=#{reportCode}
</select> </select>
<insert id="insertComReportDict" parameterType="com.czlis.common.core.domain.entity.lis.ComReportDict" useGeneratedKeys="true" keyProperty="reportId"> <insert id="insertComReportDict" parameterType="com.czlis.common.core.domain.entity.lis.ComReportDict" useGeneratedKeys="true" keyProperty="reportId">
insert into com_report_dict( insert into com_report_dict(

View File

@ -0,0 +1,139 @@
<?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>

View File

@ -64,19 +64,34 @@ if not exists(select 1 from com_opt where yq = '' and xxdh = 'A5MERGEA4')
end end
--报告单仪器对应表 --报告单仪器对应表
if not exists(SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'lab_reportinstr') if not exists(SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'com_report_instr')
begin begin
create table lab_reportinstr CREATE TABLE [dbo].[com_report_instr](
( [report_id] [bigint] IDENTITY(1,1) NOT NULL,
yq varchar(10), [report_yq] [varchar](20) NOT NULL,
xh int , [report_bgdh] [bigint] NOT NULL,
bgdh varchar(100), [report_size] [varchar](10) NULL,
yljg varchar(10), [report_type] [varchar](10) NULL,
type int, --1.默认,2.参数,3.根据项目来判断 [report_rows] int NULL,
condition varchar(500), [report_minrows] int NULL,
PRIMARY KEY (yq, xh,bgdh) [report_maxrows] int NULL,
) [report_items] [varchar](250) NULL,
end [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
if not exists(SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'reg_TransitSample') if not exists(SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'reg_TransitSample')
begin begin
@ -367,4 +382,31 @@ CREATE TABLE [dbo].[com_config_dict](
ALTER TABLE [dbo].[com_config_dict] ADD DEFAULT ('') FOR [create_by] 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 ('') FOR [update_by]
ALTER TABLE [dbo].[com_config_dict] ADD DEFAULT (NULL) FOR [remark] ALTER TABLE [dbo].[com_config_dict] ADD DEFAULT (NULL) FOR [remark]
end 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