Merge remote-tracking branch 'lis8.0/master'
This commit is contained in:
commit
45683f8296
@ -12,7 +12,7 @@ import java.util.Date;
|
||||
@AllArgsConstructor
|
||||
public class ComReportDict {
|
||||
|
||||
private Long reportId;
|
||||
private Long reportBgdh;
|
||||
private String reportType;
|
||||
private String reportCode;
|
||||
private String reportName;
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
}
|
||||
@ -10,7 +10,7 @@ import lombok.NoArgsConstructor;
|
||||
public class LabReportinstr {
|
||||
private String yq;
|
||||
private Integer xh;
|
||||
private Integer bgdh;
|
||||
private Long bgdh;
|
||||
private String yljg;
|
||||
private String type;
|
||||
private String condition;
|
||||
|
||||
@ -1,10 +1,15 @@
|
||||
package com.czlis.interfaceCommon.mapper;
|
||||
|
||||
import com.czlis.common.core.domain.entity.lis.ComReportInstr;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface LabReportvsitemMapper {
|
||||
int getLabReportvsitemCount(@Param("jyrq") Date jyrq, @Param("yq")String yq, @Param("ybh")String ybh);
|
||||
int getLabReport2(@Param("jyrq") Date jyrq, @Param("yq")String yq, @Param("ybh")String ybh);
|
||||
int getLabReportCount(@Param("jyrq") Date jyrq, @Param("yq")String yq, @Param("ybh")String ybh);
|
||||
List<ComReportInstr> getComReportInstrByInstr(String reportYq);
|
||||
String getreportCode(Long reportId);
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ import java.util.Date;
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class BarCodeParam {
|
||||
public class ReportParam {
|
||||
private String sqh;
|
||||
private String brxm;
|
||||
private String brxb;
|
||||
@ -69,8 +69,6 @@ public class CommonUtil {
|
||||
@Autowired
|
||||
LabResultMedMapper labResultMedMapper;
|
||||
@Autowired
|
||||
LabReportvsitemMapper labReportvsitemMapper;
|
||||
@Autowired
|
||||
LabInputcolMapper labInputcolMapper;
|
||||
@Autowired
|
||||
ComLocalconfigMapper comLocalconfigMapper;
|
||||
@ -475,9 +473,7 @@ public class CommonUtil {
|
||||
public List<LabInstr> getLabInstrList(LabInstr labInstr) {
|
||||
return labInstrMapper.getLabInstrList(labInstr);
|
||||
}
|
||||
public int getLabReport2(Date jyrq, String yq, String ybh) {
|
||||
return labReportvsitemMapper.getLabReport2(jyrq, yq, ybh);
|
||||
}
|
||||
|
||||
//获取流水号种子
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long getNextSeq(String seqid) {
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,17 +1,15 @@
|
||||
package com.czlis.interfaceCommon.utils;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.czlis.common.core.domain.Result;
|
||||
import com.czlis.common.core.domain.entity.lis.LabReqmain;
|
||||
import com.czlis.common.core.domain.entity.lis.LabReqpack;
|
||||
import com.czlis.common.utils.DateUtils;
|
||||
import com.czlis.interfaceCommon.pojo.entity.BarCodeParam;
|
||||
import com.czlis.interfaceCommon.pojo.entity.ReportParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
@ -73,12 +71,12 @@ public class PackBarcodeUtil {
|
||||
}
|
||||
public Result printpackid(String ksmc){
|
||||
String packid=getNextPackID();
|
||||
BarCodeParam barCodeParam = new BarCodeParam();
|
||||
barCodeParam.setSqh(packid);
|
||||
barCodeParam.setBrxm("检验样本");
|
||||
barCodeParam.setSfxmmc("样本数量____");
|
||||
barCodeParam.setKsmc(ksmc);
|
||||
return reportUtil.printToPdf(barCodeParam, packid);
|
||||
ReportParam reportParam = new ReportParam();
|
||||
reportParam.setSqh(packid);
|
||||
reportParam.setBrxm("检验样本");
|
||||
reportParam.setSfxmmc("样本数量____");
|
||||
reportParam.setKsmc(ksmc);
|
||||
return reportUtil.printToPdf(reportParam, packid);
|
||||
}
|
||||
public Result packup(List<LabReqpack> labReqpacks){
|
||||
commonUtil.batchInsertLabReqpack(labReqpacks);
|
||||
|
||||
@ -6,6 +6,7 @@ import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czlis.common.config.RuoYiConfig;
|
||||
import com.czlis.common.core.domain.Result;
|
||||
import com.czlis.common.core.domain.entity.lis.ComReportInstr;
|
||||
import com.czlis.common.core.domain.entity.lis.LabGraph;
|
||||
import com.czlis.common.core.domain.entity.lis.LabPat;
|
||||
import com.czlis.common.utils.file.FileUtils;
|
||||
@ -13,10 +14,11 @@ import com.czlis.common.utils.file.ImageUtils;
|
||||
import com.czlis.common.utils.ip.IpUtils;
|
||||
import com.czlis.common.utils.uuid.UUID;
|
||||
import com.czlis.interfaceCommon.mapper.BackPaperMapper;
|
||||
import com.czlis.interfaceCommon.mapper.LabReportvsitemMapper;
|
||||
import com.czlis.interfaceCommon.pojo.entity.BackPaperDetail;
|
||||
import com.czlis.interfaceCommon.pojo.entity.BackPaperParam;
|
||||
import com.czlis.interfaceCommon.pojo.entity.LabRptgetruledetailCX;
|
||||
import com.czlis.interfaceCommon.pojo.entity.BarCodeParam;
|
||||
import com.czlis.interfaceCommon.pojo.entity.ReportParam;
|
||||
import com.itextpdf.io.source.ByteArrayOutputStream;
|
||||
import com.itextpdf.kernel.geom.PageSize;
|
||||
import com.itextpdf.kernel.geom.Rectangle;
|
||||
@ -50,6 +52,8 @@ public class ReportUtil {
|
||||
@Autowired
|
||||
BackPaperMapper backPaperMapper;
|
||||
@Autowired
|
||||
LabReportvsitemMapper labReportvsitemMapper;
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
|
||||
@Value("${server.port:}")
|
||||
@ -58,17 +62,17 @@ public class ReportUtil {
|
||||
String printURL;
|
||||
|
||||
|
||||
public void printBarCode(BarCodeParam mzBarCodeParam) {
|
||||
public void printBarCode(ReportParam mzReportParam) {
|
||||
Map<String,Object> parameters=new HashMap<>();
|
||||
parameters.put("barcode", mzBarCodeParam.getSqh());
|
||||
parameters.put("line1", mzBarCodeParam.getBrxm() + " " + mzBarCodeParam.getBrxb() + " " + mzBarCodeParam.getNl());
|
||||
parameters.put("line2", mzBarCodeParam.getSfxmmc());
|
||||
parameters.put("barcode", mzReportParam.getSqh());
|
||||
parameters.put("line1", mzReportParam.getBrxm() + " " + mzReportParam.getBrxb() + " " + mzReportParam.getNl());
|
||||
parameters.put("line2", mzReportParam.getSfxmmc());
|
||||
try {
|
||||
//构造数据
|
||||
JasperReportUtil.print(RuoYiConfig.getMzPrintName(), "barcode", parameters);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("打印条码报错,条码号:{}", mzBarCodeParam.getSqh(), e);
|
||||
log.error("打印条码报错,条码号:{}", mzReportParam.getSqh(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -113,27 +117,27 @@ public class ReportUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public Result printToPdf(BarCodeParam barCodeParam, String pdfName) {
|
||||
public Result printToPdf(ReportParam reportParam, String pdfName) {
|
||||
String templatePath = RuoYiConfig.getProfile() + "/templates/barcode_zy.jrxml"; // 模板文件路径
|
||||
return printToPdf("barcode_zy", barCodeParam, pdfName, false);
|
||||
return printToPdf("barcode_zy", reportParam, pdfName, false);
|
||||
}
|
||||
|
||||
public Result printToPdf(String templatename, BarCodeParam barCodeParam, String pdfName, boolean base64) {
|
||||
public Result printToPdf(String templatename, ReportParam reportParam, String pdfName, boolean base64) {
|
||||
String staticpath=ImageUtils.getStaticPath()+ File.separator;
|
||||
String outputPath = staticpath+ File.separator + "printPDF"+ File.separator + UUID.randomUUID() + ".pdf"; // PDF输出路径(多级目录会自动创建)
|
||||
Map<String, Object> stringObjectMap = BeanUtil.beanToMap(barCodeParam);
|
||||
Map<String, Object> stringObjectMap = BeanUtil.beanToMap(reportParam);
|
||||
try {
|
||||
Connection connection = dataSource.getConnection();
|
||||
JasperReportUtil.exportToPdf(templatename, stringObjectMap, connection, outputPath);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("打印条码失败,参数{}", barCodeParam, e);
|
||||
log.error("打印条码失败,参数{}", reportParam, e);
|
||||
}
|
||||
String httpPath = getPrintURL(pdfName);
|
||||
log.info("传给前端的pdf地址:{}", httpPath);
|
||||
if (base64) {
|
||||
//删除图片文件
|
||||
String[] pic = barCodeParam.getPic();
|
||||
String[] pic = reportParam.getPic();
|
||||
if(pic != null){
|
||||
for (String s : pic) {
|
||||
String picFilePath = staticpath + File.separator + "graphs" + File.separator + StrUtil.splitToArray(s, "graphs/")[1];
|
||||
@ -215,7 +219,7 @@ public class ReportUtil {
|
||||
}
|
||||
}
|
||||
//常规报告如果报告使用报告二模板,判断报告二是否A4
|
||||
int bg2 = commonUtil.getLabReport2(jyrq, yq, ybh);
|
||||
int bg2 = labReportvsitemMapper.getLabReport2(jyrq, yq, ybh);
|
||||
if (bg2 > 0) {
|
||||
if ("3".equals(NOBOTH)) {
|
||||
return "A4";
|
||||
@ -342,20 +346,39 @@ public class ReportUtil {
|
||||
String ybh = labPat.getYbh();
|
||||
String yljg=commonUtil.getLabInstr(yq).getYljg();
|
||||
String hospitalName = commonUtil.getCompany(yljg);
|
||||
BarCodeParam barCodeParam = new BarCodeParam();
|
||||
barCodeParam.setJyrq(jyrq);
|
||||
barCodeParam.setYq(yq);
|
||||
barCodeParam.setYbh(ybh);
|
||||
barCodeParam.setHospitalName(hospitalName);
|
||||
barCodeParam.setUsernopic(getSignName(labPat.getYhdh())); //检验者
|
||||
barCodeParam.setCheckerpic(getSignName(labPat.getHdys())); //审核者
|
||||
barCodeParam.setCheckercbpic(getSignName(labPat.getChecker())); //初审者
|
||||
ReportParam reportParam = new ReportParam();
|
||||
reportParam.setJyrq(jyrq);
|
||||
reportParam.setYq(yq);
|
||||
reportParam.setYbh(ybh);
|
||||
reportParam.setHospitalName(hospitalName);
|
||||
reportParam.setUsernopic(getSignName(labPat.getYhdh())); //检验者
|
||||
reportParam.setCheckerpic(getSignName(labPat.getHdys())); //审核者
|
||||
reportParam.setCheckercbpic(getSignName(labPat.getChecker())); //初审者
|
||||
String[] picPath = getReportpic(jyrq, yq, ybh);
|
||||
barCodeParam.setPic(picPath);
|
||||
return printToPdf("report_image2", barCodeParam, UUID.randomUUID().toString(), true);
|
||||
reportParam.setPic(picPath);
|
||||
return printToPdf("report_image2", reportParam, UUID.randomUUID().toString(), true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取报告单模板
|
||||
* @param labPat
|
||||
* @return
|
||||
*/
|
||||
public String getReportTemplate(LabPat labPat) {
|
||||
Date jyrq = labPat.getJyrq();
|
||||
String yq = labPat.getYq().trim();
|
||||
String ybh = labPat.getYbh();
|
||||
int rows=labReportvsitemMapper.getLabReportCount(jyrq,yq,ybh);
|
||||
List<ComReportInstr> info=labReportvsitemMapper.getComReportInstrByInstr(yq);
|
||||
for (ComReportInstr comReportInstr : info) {
|
||||
Long rid=comReportInstr.getReportBgdh();
|
||||
}
|
||||
|
||||
|
||||
|
||||
return "";
|
||||
}
|
||||
public String[] getReportpic(Date jyrq, String yq, String ybh) {
|
||||
List<LabGraph> labGraphList = commonUtil.getLabGraphAll(jyrq, yq, ybh);
|
||||
String filepath = "graphs";
|
||||
|
||||
@ -2,6 +2,32 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.czlis.interfaceCommon.mapper.LabReportvsitemMapper">
|
||||
<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>
|
||||
<select id="getComReportInstrByInstr" parameterType="String" resultMap="ComReportInstrResult">
|
||||
select * from com_report_instr where report_yq = #{reportYq}
|
||||
</select>
|
||||
<select id="getreportCode" resultType="String" parameterType="Long">
|
||||
select report_code from com_report_dict where report_id = #{reportId}
|
||||
</select>
|
||||
<select id="getLabReportvsitem" resultType="com.czlis.common.core.domain.entity.lis.LabReportvsitem" parameterType="String">
|
||||
select * from lab_reportvsitem where yq = #{yq}
|
||||
</select>
|
||||
|
||||
@ -3,9 +3,12 @@ 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;
|
||||
@ -13,8 +16,10 @@ 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 = "参数模板设置")
|
||||
@ -25,26 +30,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}")
|
||||
@ -53,56 +58,77 @@ 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() {
|
||||
List<ComReportDict> posts = comReportDictService.selectComReportDictAll();
|
||||
public AjaxResult optionselect(String reportType) {
|
||||
List<ComReportDict> posts = comReportDictService.selectComReportDictByType(reportType);
|
||||
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 reportBgdh) {
|
||||
|
||||
return comReportDictService.importfile(file,reportBgdh);
|
||||
}
|
||||
@ApiOperation("导出模板")
|
||||
@Log(title = "导出模板", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/downloadfile")
|
||||
public void downloadfile(HttpServletResponse response, @RequestParam String filename) {
|
||||
LisfileUtil.downloadfile(response,LisfileUtil.getfilepath("templates"),filename+".jrxml");
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@ -6,7 +6,7 @@ import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
|
||||
public interface ComReportDictMapper {
|
||||
Long getCountById(Long reportId);
|
||||
Long getCountById(Long reportBgdh);
|
||||
List<ComReportDict> selectComReportDictByType(String reportType);
|
||||
|
||||
/**
|
||||
@ -27,19 +27,19 @@ public interface ComReportDictMapper {
|
||||
/**
|
||||
* 通过报表模板ID查询报表模板信息
|
||||
*
|
||||
* @param reportId 报表模板ID
|
||||
* @param reportBgdh 报表模板ID
|
||||
* @return 角色对象信息
|
||||
*/
|
||||
ComReportDict selectComReportDictById(Long reportId);
|
||||
ComReportDict selectComReportDictById(Long reportBgdh);
|
||||
|
||||
|
||||
/**
|
||||
* 删除报表模板信息
|
||||
*
|
||||
* @param reportId 报表模板ID
|
||||
* @param reportBgdh 报表模板ID
|
||||
* @return 结果
|
||||
*/
|
||||
int delComReportDictById(Long reportId);
|
||||
int delComReportDictById(Long reportBgdh);
|
||||
|
||||
/**
|
||||
* 批量删除报表模板信息
|
||||
@ -80,6 +80,6 @@ public interface ComReportDictMapper {
|
||||
* @param reportCode 报表模板编码
|
||||
* @return 结果
|
||||
*/
|
||||
ComReportDict checkDictCodeUnique(@Param("reportCode") String reportCode,@Param("reportType") String reportType);
|
||||
ComReportDict checkDictCodeUnique(String reportCode);
|
||||
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
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;
|
||||
|
||||
@ -18,7 +20,7 @@ public interface ComReportDictService {
|
||||
*
|
||||
* @return 报表模板列表
|
||||
*/
|
||||
List<ComReportDict> selectComReportDictAll();
|
||||
List<ComReportDict> selectComReportDictByType(String type);
|
||||
|
||||
/**
|
||||
* 通过报表模板ID查询报表模板信息
|
||||
@ -84,4 +86,6 @@ public interface ComReportDictService {
|
||||
* @return 结果
|
||||
*/
|
||||
int updateDict(ComReportDict Dict);
|
||||
int autoload();
|
||||
AjaxResult importfile(MultipartFile file, Long reportId);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
@ -13,7 +13,6 @@ import java.util.List;
|
||||
@Service
|
||||
@Slf4j
|
||||
public class LabReportinstrServiceImpl implements LabReportinstrService {
|
||||
|
||||
@Autowired
|
||||
LabReportinstrMapper labReportinstrMapper;
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ import com.alibaba.fastjson2.JSON;
|
||||
import com.czlis.common.core.domain.entity.lis.*;
|
||||
import com.czlis.common.utils.SecurityUtils;
|
||||
import com.czlis.interfaceCommon.utils.CommonUtil;
|
||||
import com.czlis.liswork.mapper.xtwh.ComReportDictMapper;
|
||||
import com.czlis.liswork.mapper.xtwh.LocalconfigMapper;
|
||||
import com.czlis.liswork.service.ComConfigDictService;
|
||||
import com.czlis.liswork.service.ComLocalconfigService;
|
||||
@ -28,7 +29,8 @@ public class ComLocalconfigServiceImpl implements ComLocalconfigService {
|
||||
LocalconfigMapper localconfigMapper;
|
||||
@Autowired
|
||||
CommonUtil commonUtil;
|
||||
|
||||
@Autowired
|
||||
ComReportDictMapper comReportDictMapper;
|
||||
/**
|
||||
* 获取登录客户端浏览器唯一ID
|
||||
**/
|
||||
@ -174,12 +176,40 @@ public class ComLocalconfigServiceImpl implements ComLocalconfigService {
|
||||
|
||||
@Override
|
||||
public Object getComDicts(String zdlb) {
|
||||
if ("INSTR".equals(zdlb)) {
|
||||
if ("INSTR".equals(zdlb)||"instr".equals(zdlb)||"yq".equals(zdlb)) {
|
||||
return getInstr();
|
||||
}else if (zdlb.contains("item:")) {
|
||||
String yq=zdlb.trim().substring(5);
|
||||
return getitem(yq);
|
||||
}else if ("barcode".equals(zdlb)) {
|
||||
return getreportdict("2");
|
||||
} else if ("reback".equals(zdlb)) {
|
||||
return getreportdict("3");
|
||||
}
|
||||
return commonUtil.getComDictList(zdlb);
|
||||
}
|
||||
|
||||
public List<Map<String, String>> getreportdict(String type) {
|
||||
List<Map<String, String>> list = new ArrayList<>();
|
||||
List<ComReportDict> xmInfolist = comReportDictMapper.selectComReportDictByType(type);
|
||||
for (ComReportDict xmInfo : xmInfolist) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("zddh", xmInfo.getReportBgdh().toString());
|
||||
map.put("zdmc", xmInfo.getReportName());
|
||||
list.add(map);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
public List<Map<String, String>> getitem(String yq) {
|
||||
List<Map<String, String>> list = new ArrayList<>();
|
||||
List<XmInfo> xmInfolist = commonUtil.getXmInfoList(yq);
|
||||
for (XmInfo xmInfo : xmInfolist) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("zddh", xmInfo.getXmdh().trim());
|
||||
map.put("zdmc", xmInfo.getXmmc().trim());
|
||||
list.add(map);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
public List<Map<String, String>> getInstr() {
|
||||
List<Map<String, String>> list = new ArrayList<>();
|
||||
String yljg = getYLJG();
|
||||
|
||||
@ -1,16 +1,30 @@
|
||||
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.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
|
||||
@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;
|
||||
}
|
||||
/**
|
||||
* 查询报表模板信息集合
|
||||
*
|
||||
@ -38,8 +102,8 @@ public class ComReportDictServiceImpl implements ComReportDictService {
|
||||
* @return 报表模板列表
|
||||
*/
|
||||
@Override
|
||||
public List<ComReportDict> selectComReportDictAll() {
|
||||
return comReportDictMapper.selectComReportDictAll();
|
||||
public List<ComReportDict> selectComReportDictByType(String type) {
|
||||
return comReportDictMapper.selectComReportDictByType(type);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -62,9 +126,9 @@ public class ComReportDictServiceImpl implements ComReportDictService {
|
||||
*/
|
||||
@Override
|
||||
public boolean checkDictNameUnique(ComReportDict Dict) {
|
||||
Long DictId = StringUtils.isNull(Dict.getReportId()) ? -1L : Dict.getReportId();
|
||||
Long DictId = StringUtils.isNull(Dict.getReportBgdh()) ? -1L : Dict.getReportBgdh();
|
||||
ComReportDict info = comReportDictMapper.checkDictNameUnique(Dict.getReportName(),Dict.getReportType());
|
||||
if (StringUtils.isNotNull(info) && info.getReportId().longValue() != DictId.longValue()) {
|
||||
if (StringUtils.isNotNull(info) && info.getReportBgdh().longValue() != DictId.longValue()) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
@ -78,9 +142,9 @@ 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(),Dict.getReportType());
|
||||
if (StringUtils.isNotNull(info) && info.getReportId().longValue() != DictId.longValue()) {
|
||||
Long DictId = StringUtils.isNull(Dict.getReportBgdh()) ? -1L : Dict.getReportBgdh();
|
||||
ComReportDict info = comReportDictMapper.checkDictCodeUnique(Dict.getReportCode());
|
||||
if (StringUtils.isNotNull(info) && info.getReportBgdh().longValue() != DictId.longValue()) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
@ -94,7 +158,11 @@ public class ComReportDictServiceImpl implements ComReportDictService {
|
||||
*/
|
||||
@Override
|
||||
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
|
||||
* @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);
|
||||
}
|
||||
@ -131,6 +213,7 @@ public class ComReportDictServiceImpl implements ComReportDictService {
|
||||
* @param Dict 报表模板信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public int insertDict(ComReportDict Dict) {
|
||||
return comReportDictMapper.insertComReportDict(Dict);
|
||||
@ -142,9 +225,13 @@ public class ComReportDictServiceImpl implements ComReportDictService {
|
||||
* @param Dict 报表模板信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public int updateDict(ComReportDict Dict) {
|
||||
return comReportDictMapper.updateComReportDict(Dict);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -3,7 +3,7 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.czlis.liswork.mapper.xtwh.ComReportDictMapper">
|
||||
<resultMap type="com.czlis.common.core.domain.entity.lis.ComReportDict" id="ComReportDictResult">
|
||||
<id property="reportId" column="report_id" />
|
||||
<id property="reportBgdh" column="report_bgdh" />
|
||||
<result property="reportType" column="report_type" />
|
||||
<result property="reportCode" column="report_code" />
|
||||
<result property="reportName" column="report_name" />
|
||||
@ -18,14 +18,14 @@
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
<sql id="selectComReportDictVo">
|
||||
select report_id,report_type,report_code,report_name,report_optiontype,report_defvalue,report_sort,
|
||||
select report_bgdh,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
|
||||
</sql>
|
||||
<select id="selectComReportDictList" resultMap="ComReportDictResult" parameterType="com.czlis.common.core.domain.entity.lis.ComReportDict" >
|
||||
<include refid="selectComReportDictVo"></include>
|
||||
<where>
|
||||
<if test="reportId != null and reportId != 0">
|
||||
and report_id = #{reportId}
|
||||
<if test="reportBgdh != null and reportBgdh != 0">
|
||||
and report_bgdh = #{reportBgdh}
|
||||
</if>
|
||||
<if test="reportType != null and reportType != ''">
|
||||
and report_type = #{reportType}
|
||||
@ -46,7 +46,7 @@
|
||||
order by report_sort ASC
|
||||
</select>
|
||||
<select id="getCountById" resultType="Long">
|
||||
select count(1) from com_report_dict where report_id = #{reportId}
|
||||
select count(1) from com_report_dict where report_bgdh = #{reportBgdh}
|
||||
</select>
|
||||
<select id="selectComReportDictAll" resultMap="ComReportDictResult">
|
||||
<include refid="selectComReportDictVo"/>
|
||||
@ -55,31 +55,31 @@
|
||||
|
||||
<select id="selectComReportDictById" parameterType="Long" resultMap="ComReportDictResult">
|
||||
<include refid="selectComReportDictVo"/>
|
||||
where report_id = #{reportId}
|
||||
where report_bgdh = #{reportBgdh}
|
||||
</select>
|
||||
<select id="selectComReportDictByType" parameterType="String" resultMap="ComReportDictResult">
|
||||
<include refid="selectComReportDictVo"/>
|
||||
where report_type = #{reportType}
|
||||
where report_type = #{reportType} and status='0'
|
||||
order by report_sort
|
||||
</select>
|
||||
|
||||
|
||||
<select id="checkDictNameUnique" parameterType="String" resultMap="ComReportDictResult">
|
||||
select top 1 report_id,report_type,report_code,report_name,report_optiontype,report_defvalue,report_sort,
|
||||
select top 1 report_bgdh,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_name=#{reportName} and report_type = #{reportType}
|
||||
</select>
|
||||
|
||||
<select id="checkDictCodeUnique" parameterType="String" resultMap="ComReportDictResult">
|
||||
select top 1 report_id,report_type,report_code,report_name,report_optiontype,report_defvalue,report_sort,
|
||||
select top 1 report_bgdh,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} and report_type = #{reportType}
|
||||
where report_code=#{reportCode}
|
||||
</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="reportBgdh">
|
||||
insert into com_report_dict(
|
||||
<if test="reportId != null and reportId != 0">report_id,</if>
|
||||
<if test="reportBgdh != null and reportBgdh != 0">report_bgdh,</if>
|
||||
<if test="reportType != null and reportType != ''">report_type,</if>
|
||||
<if test="reportCode != null and reportCode != ''">report_code,</if>
|
||||
<if test="reportName != null and reportName != ''">report_name,</if>
|
||||
@ -91,7 +91,7 @@
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="reportId != null and reportId != 0">#{reportId},</if>
|
||||
<if test="reportBgdh != null and reportBgdh != 0">#{reportBgdh},</if>
|
||||
<if test="reportType != null and reportType != ''">#{reportType},</if>
|
||||
<if test="reportCode != null and reportCode != ''">#{reportCode},</if>
|
||||
<if test="reportName != null and reportName != ''">#{reportName},</if>
|
||||
@ -106,13 +106,13 @@
|
||||
</insert>
|
||||
|
||||
<delete id="delComReportDictById" parameterType="Long">
|
||||
delete from com_report_dict where report_id = #{reportId}
|
||||
delete from com_report_dict where report_bgdh = #{reportBgdh}
|
||||
</delete>
|
||||
|
||||
<delete id="delComReportDictByIds" parameterType="Long">
|
||||
delete from com_report_dict where report_id in
|
||||
<foreach collection="array" item="reportId" open="(" separator="," close=")">
|
||||
#{reportId}
|
||||
delete from com_report_dict where report_bgdh in
|
||||
<foreach collection="array" item="reportBgdh" open="(" separator="," close=")">
|
||||
#{reportBgdh}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
@ -130,7 +130,7 @@
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
update_time = getdate()
|
||||
</set>
|
||||
where report_id = #{reportId}
|
||||
where report_bgdh = #{reportBgdh}
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
139
liswork/src/main/resources/mapper/ComReportInstrMapper.xml
Normal file
139
liswork/src/main/resources/mapper/ComReportInstrMapper.xml
Normal 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_bgdh
|
||||
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>
|
||||
@ -8,7 +8,7 @@ import com.czlis.common.core.domain.entity.lis.LabReqmain;
|
||||
import com.czlis.common.utils.SecurityUtils;
|
||||
import com.czlis.common.utils.ip.IpUtils;
|
||||
import com.czlis.interfaceCommon.constants.LisinterfaceNameConstants;
|
||||
import com.czlis.interfaceCommon.pojo.entity.BarCodeParam;
|
||||
import com.czlis.interfaceCommon.pojo.entity.ReportParam;
|
||||
import com.czlis.interfaceCommon.pojo.inter.DayMessage;
|
||||
import com.czlis.interfaceCommon.pojo.inter.GetReqInterface;
|
||||
import com.czlis.interfaceCommon.utils.CommonUtil;
|
||||
@ -94,14 +94,14 @@ public class MZCXServiceImpl implements MZCXService {
|
||||
public Result printSQD(String sqh) {
|
||||
LabReqmain labReqmainOne = commonUtil.getLabReqmainOne(sqh);
|
||||
//List<LabReqdetail> labReqdetailList = commonUtil.getLabReqdetailList(sqh);
|
||||
BarCodeParam mzBarCodeParam = new BarCodeParam();
|
||||
mzBarCodeParam.setSqh(sqh);
|
||||
ReportParam mzReportParam = new ReportParam();
|
||||
mzReportParam.setSqh(sqh);
|
||||
Map<String, String> ageFromBirthDay = LisUtil.getAgeFromBirthDay(DateUtil.format(labReqmainOne.getBrsr(), "yyyy-MM-dd HH:mm:ss"));
|
||||
String age = ageFromBirthDay.get("age");
|
||||
String unit = ageFromBirthDay.get("unit");
|
||||
|
||||
mzBarCodeParam.setNl(age + unit);
|
||||
mzBarCodeParam.setBrxm(labReqmainOne.getBrxm());
|
||||
mzReportParam.setNl(age + unit);
|
||||
mzReportParam.setBrxm(labReqmainOne.getBrxm());
|
||||
String brxb = labReqmainOne.getBrxb();
|
||||
switch (brxb) {
|
||||
case "1":
|
||||
@ -114,9 +114,9 @@ public class MZCXServiceImpl implements MZCXService {
|
||||
brxb = "";
|
||||
|
||||
}
|
||||
mzBarCodeParam.setBrxb(brxb);
|
||||
mzBarCodeParam.setSfxmmc(labReqmainOne.getJymd());
|
||||
reportUtil.printBarCode(mzBarCodeParam);
|
||||
mzReportParam.setBrxb(brxb);
|
||||
mzReportParam.setSfxmmc(labReqmainOne.getJymd());
|
||||
reportUtil.printBarCode(mzReportParam);
|
||||
return new Result("0", "打印成功!");
|
||||
}
|
||||
|
||||
|
||||
@ -64,18 +64,33 @@ 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 = 'lab_reportinstr')
|
||||
if not exists(SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'com_report_instr')
|
||||
begin
|
||||
create table lab_reportinstr
|
||||
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
|
||||
(
|
||||
yq varchar(10),
|
||||
xh int ,
|
||||
bgdh varchar(100),
|
||||
yljg varchar(10),
|
||||
type int, --1.默认,2.参数,3.根据项目来判断
|
||||
condition varchar(500),
|
||||
PRIMARY KEY (yq, xh,bgdh)
|
||||
)
|
||||
[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')
|
||||
@ -368,3 +383,30 @@ 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
|
||||
|
||||
@ -5,7 +5,7 @@ import com.czlis.common.core.domain.Result;
|
||||
import com.czlis.common.core.domain.entity.lis.LabReqdetail;
|
||||
import com.czlis.common.core.domain.entity.lis.LabReqmain;
|
||||
import com.czlis.interfaceCommon.constants.LisinterfaceNameConstants;
|
||||
import com.czlis.interfaceCommon.pojo.entity.BarCodeParam;
|
||||
import com.czlis.interfaceCommon.pojo.entity.ReportParam;
|
||||
import com.czlis.interfaceCommon.pojo.inter.GetReqInterface;
|
||||
import com.czlis.interfaceCommon.pojo.inter.SetReqStatus;
|
||||
import com.czlis.interfaceCommon.utils.CommonUtil;
|
||||
@ -173,14 +173,14 @@ public class ZycxServiceImpl implements ZycxService {
|
||||
LabReqmain labReqmainOne = commonUtil.getLabReqmainOne(sqh);
|
||||
//List<LabReqdetail> labReqdetailList = commonUtil.getLabReqdetailList(sqh);
|
||||
if(labReqmainOne == null) return new Result("-1","未查到条码号:"+sqh+"的申请单数据!");
|
||||
BarCodeParam barCodeParam = new BarCodeParam();
|
||||
barCodeParam.setSqh(sqh);
|
||||
ReportParam reportParam = new ReportParam();
|
||||
reportParam.setSqh(sqh);
|
||||
Map<String, String> ageFromBirthDay = LisUtil.getAgeFromBirthDay(DateUtil.format(labReqmainOne.getBrsr(), "yyyy-MM-dd HH:mm:ss"));
|
||||
String age = ageFromBirthDay.get("age");
|
||||
String unit = ageFromBirthDay.get("unit");
|
||||
|
||||
barCodeParam.setNl(age + unit);
|
||||
barCodeParam.setBrxm(labReqmainOne.getBrxm());
|
||||
reportParam.setNl(age + unit);
|
||||
reportParam.setBrxm(labReqmainOne.getBrxm());
|
||||
String brxb = labReqmainOne.getBrxb();
|
||||
switch (brxb) {
|
||||
case "1":
|
||||
@ -193,10 +193,10 @@ public class ZycxServiceImpl implements ZycxService {
|
||||
brxb = "";
|
||||
|
||||
}
|
||||
barCodeParam.setBrxb(brxb);
|
||||
barCodeParam.setSfxmmc(labReqmainOne.getJymd());
|
||||
log.info("传给打印的数据为:{},{}",barCodeParam,sqh);
|
||||
return reportUtil.printToPdf(barCodeParam, sqh);
|
||||
reportParam.setBrxb(brxb);
|
||||
reportParam.setSfxmmc(labReqmainOne.getJymd());
|
||||
log.info("传给打印的数据为:{},{}", reportParam,sqh);
|
||||
return reportUtil.printToPdf(reportParam, sqh);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user