住院采血,打印修改
This commit is contained in:
parent
eb596432a7
commit
8b12ea09b8
@ -0,0 +1,22 @@
|
||||
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 LabReqreportPdffile {
|
||||
private String sqh;
|
||||
private Date jyrq;
|
||||
private String yq;
|
||||
private String ybh;
|
||||
private String filetype;
|
||||
private String bz;
|
||||
private Date filedt;
|
||||
private String bk1;
|
||||
private String BASE64PDF;
|
||||
}
|
||||
@ -48,6 +48,10 @@
|
||||
<groupId>org.apache.xmlgraphics</groupId>
|
||||
<artifactId>batik-all</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.pdfbox</groupId>
|
||||
<artifactId>pdfbox</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
package com.czlis.interfaceCommon.mapper;
|
||||
|
||||
import com.czlis.common.core.domain.entity.lis.LabReqreportPdffile;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface LabReqreportPdffileMapper {
|
||||
List<LabReqreportPdffile> getLabReqreportPdffileList(String sqh);
|
||||
LabReqreportPdffile getLabReqreportPdffileOne(@Param("jyrq") Date jyrq,@Param("yq") String yq,@Param("ybh") String ybh);
|
||||
}
|
||||
@ -46,6 +46,8 @@ public class CommonUtil {
|
||||
LabInstrMapper labInstrMapper;
|
||||
@Autowired
|
||||
XmAlarmdetailMapper xmAlarmdetailMapper;
|
||||
@Autowired
|
||||
LabReqreportPdffileMapper labReqreportPdffileMapper;
|
||||
|
||||
//====检验主表操作方法集合===
|
||||
public LabPat getLabPatOne(Date jyrq, String yq, String ybh) {
|
||||
@ -299,4 +301,12 @@ public class CommonUtil {
|
||||
if ("Y".equals(userPower.substring(powerIdx - 1, 1))) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<LabReqreportPdffile> getLabReqreportPdffileList(String sqh) {
|
||||
return labReqreportPdffileMapper.getLabReqreportPdffileList(sqh);
|
||||
}
|
||||
|
||||
public LabReqreportPdffile getLabReqreportPdffileOne(Date jyrq,String yq,String ybh) {
|
||||
return labReqreportPdffileMapper.getLabReqreportPdffileOne(jyrq,yq,ybh);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,25 +2,36 @@ package com.czlis.interfaceCommon.utils;
|
||||
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.czlis.common.config.RuoYiConfig;
|
||||
|
||||
import com.czlis.interfaceCommon.mapper.BackPaperMapper;
|
||||
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.MZBarCodeParam;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.pdfbox.pdmodel.common.PDRectangle;
|
||||
import org.apache.pdfbox.printing.Orientation;
|
||||
import org.apache.pdfbox.printing.PDFPrintable;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.print.*;
|
||||
import javax.print.attribute.HashPrintRequestAttributeSet;
|
||||
import javax.print.attribute.PrintRequestAttributeSet;
|
||||
import javax.print.attribute.standard.Copies;
|
||||
import javax.print.attribute.standard.MediaPrintableArea;
|
||||
import javax.print.attribute.standard.MediaSizeName;
|
||||
import java.awt.print.*;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||
import org.apache.pdfbox.printing.Scaling;
|
||||
import org.apache.pdfbox.pdmodel.PDPage;
|
||||
import javax.print.attribute.standard.OrientationRequested;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Component
|
||||
@ -88,6 +99,127 @@ public class ReportUtil {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印 Base64 编码的 PDF
|
||||
* @param base64Pdf Base64 编码的 PDF 字符串
|
||||
* @param printerName 打印机名称(可为 null,使用默认打印机)
|
||||
* @param copies 打印份数
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
public static void printBase64Pdf(String base64Pdf, String printerName, int copies) throws Exception {
|
||||
// 1. Base64 解码为 PDF 字节数组
|
||||
byte[] pdfBytes = Base64.getDecoder().decode(base64Pdf);
|
||||
|
||||
// 2. 加载 PDF 文档
|
||||
try (PDDocument document = PDDocument.load(pdfBytes)) {
|
||||
|
||||
// 3. 获取打印服务
|
||||
PrinterJob job = PrinterJob.getPrinterJob();
|
||||
|
||||
// 选择打印机(若指定名称)
|
||||
if (printerName != null && !printerName.isEmpty()) {
|
||||
PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);
|
||||
for (PrintService service : services) {
|
||||
if (service.getName().contains(printerName)) {
|
||||
job.setPrintService(service);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 4. 配置打印属性
|
||||
PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
|
||||
attributes.add(new Copies(copies));
|
||||
attributes.add(OrientationRequested.LANDSCAPE);
|
||||
|
||||
// 5. 配置页面格式和可打印区域
|
||||
Book book = new Book();
|
||||
PageFormat pageFormat = job.defaultPage();
|
||||
|
||||
Paper paper = new Paper();
|
||||
//paper.setSize(595, 842); // A4 宽度和高度(1/72 英寸)
|
||||
paper.setSize(419, 595); // A5 宽度和高度(1/72 英寸)
|
||||
paper.setImageableArea(0, 0, 419, 595); // 边距 40 点,可打印区域宽 515、高 762
|
||||
pageFormat.setPaper(paper);
|
||||
|
||||
// 设置打印缩放
|
||||
//ACTUAL_SIZE 不缩放,按 PDF 实际尺寸打印
|
||||
//SCALE_TO_FIT 按比例缩放,使 PDF 内容适应纸张(宽、高同时适配,保持纵横比)
|
||||
PDFPrintable printable = new PDFPrintable(document, Scaling.ACTUAL_SIZE);
|
||||
book.append(printable, pageFormat, document.getNumberOfPages());
|
||||
job.setPageable(book);
|
||||
|
||||
// 6. 执行打印
|
||||
job.print(attributes);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 打印已存在的 PDF 文件(兼容各版本 PDFBox)
|
||||
* @param pdfFilePath PDF 文件路径
|
||||
* @param printerName 目标打印机名称(null 则使用默认打印机)
|
||||
* @throws IOException PDF 文件加载异常
|
||||
* @throws javax.print.PrintException 打印服务异常
|
||||
*/
|
||||
public static void printPdf(String pdfFilePath, String printerName) throws IOException, javax.print.PrintException {
|
||||
// 1. 加载 PDF 文档
|
||||
try (PDDocument document = PDDocument.load(new File(pdfFilePath))) {
|
||||
// 2. 创建打印任务
|
||||
PrinterJob job = PrinterJob.getPrinterJob();
|
||||
|
||||
// 5. 选择打印机
|
||||
if (printerName != null && !printerName.isEmpty()) {
|
||||
PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);
|
||||
PrintService targetService = null;
|
||||
for (PrintService service : services) {
|
||||
if (service.getName().contains(printerName)) {
|
||||
targetService = service;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (targetService == null) {
|
||||
throw new javax.print.PrintException("未找到打印机:" + printerName);
|
||||
}
|
||||
job.setPrintService(targetService);
|
||||
} else {
|
||||
// 使用默认打印机
|
||||
PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService();
|
||||
if (defaultService != null) {
|
||||
job.setPrintService(defaultService);
|
||||
} else {
|
||||
throw new javax.print.PrintException("未找到默认打印机");
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 配置打印内容(使用 PDFPrintable)
|
||||
PDFPrintable printable = new PDFPrintable(document, Scaling.ACTUAL_SIZE); // 原始模式
|
||||
|
||||
// 4. 设置页面格式和打印属性
|
||||
Book book = new Book();
|
||||
PageFormat pageFormat = job.defaultPage();
|
||||
// 设置打印方向(纵向PORTRAIT/横向LANDSCAPE)
|
||||
pageFormat.setOrientation(PageFormat.LANDSCAPE); // 纵向
|
||||
|
||||
// 2. 自定义纸张大小(例如 A4:210×297 毫米,转换为 1/72 英寸:(210/25.4)*72 ≈ 595,(297/25.4)*72 ≈ 842)
|
||||
//(A5纸张:148*210 (148/25.4)*72 = 419.5 (210/25.4)*72 = 595.3)
|
||||
Paper paper = new Paper();
|
||||
//paper.setSize(595, 842); // A4 宽度和高度(1/72 英寸)
|
||||
paper.setSize(419, 595); // A5 宽度和高度(1/72 英寸)
|
||||
paper.setImageableArea(0, 0, 419, 595); // 边距 40 点,可打印区域宽 515、高 762
|
||||
pageFormat.setPaper(paper);
|
||||
|
||||
book.append(printable, pageFormat, document.getNumberOfPages());
|
||||
job.setPageable(book);
|
||||
|
||||
// 6. 提交打印任务
|
||||
job.print();
|
||||
System.out.println("打印任务已提交至:" + job.getPrintService().getName());
|
||||
} catch (PrinterException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*** 获取服务器当前的数据库连接事务对象
|
||||
* 通过@Qualifier获取实际当前连接事务对象,一般是DynamicDataSource
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
<?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.interfaceCommon.mapper.LabReqreportPdffileMapper">
|
||||
|
||||
<select id="getLabReqreportPdffileList" resultType="com.czlis.common.core.domain.entity.lis.LabReqreportPdffile">
|
||||
select * from lab_reqreport_pdffile where sqh = #{sqh}
|
||||
</select>
|
||||
|
||||
<select id="getLabReqreportPdffileOne" resultType="com.czlis.common.core.domain.entity.lis.LabReqreportPdffile">
|
||||
select * from lab_reqreport_pdffile where jyrq = #{jyrq} and yq = #{yq} and ybh = #{ybh}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@ -61,6 +61,11 @@
|
||||
<artifactId>lis-quartz</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.czlis</groupId>
|
||||
<artifactId>lisresources</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Web容器 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@ -160,6 +165,7 @@
|
||||
mzcx-8.0.0.jar
|
||||
zybgcx-8.0.0.jar
|
||||
zycx-8.0.0.jar
|
||||
lisresources-8.0.0.jar
|
||||
</Class-Path>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.czlis.system.config;
|
||||
|
||||
import com.czlis.common.asyncmanager.AsyncManager;
|
||||
import com.czlis.common.config.RuoYiConfig;
|
||||
import com.czlis.common.utils.ComDictUtils;
|
||||
import com.czlis.interfaceCommon.mapper.ComDictMapper;
|
||||
import com.czlis.quartz.service.impl.SysJobServiceImpl;
|
||||
@ -13,6 +14,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
@ -108,6 +110,29 @@ public class ApplicationConfig {
|
||||
AsyncManager.me().execute(task);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建文件夹
|
||||
*/
|
||||
@Bean
|
||||
public void createFolder(){
|
||||
String folderPath = RuoYiConfig.getProfile();
|
||||
|
||||
// 创建File对象
|
||||
File folder = new File(folderPath);
|
||||
|
||||
// 检查文件夹是否存在,不存在则创建(包括多级目录)
|
||||
if (!folder.exists()) {
|
||||
boolean isCreated = folder.mkdirs(); // mkdirs()可创建多级目录,mkdir()仅创建单级目录
|
||||
if (isCreated) {
|
||||
System.out.println("文件夹创建成功:" + folderPath);
|
||||
} else {
|
||||
System.out.println("文件夹创建失败:" + folderPath);
|
||||
}
|
||||
} else {
|
||||
System.out.println("文件夹已存在:" + folderPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ czlis:
|
||||
# 版权年份
|
||||
copyrightYear: 2025
|
||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||
profile: D:/czlis/upload
|
||||
profile: D:/czlis
|
||||
mzPrintName: pdfFactory Pro
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
|
||||
18
lisresources/pom.xml
Normal file
18
lisresources/pom.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.czlis</groupId>
|
||||
<artifactId>czlis</artifactId>
|
||||
<version>8.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>lisresources</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>lisresources</name>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
</project>
|
||||
@ -46,6 +46,7 @@ public class MZCXController extends BaseController {
|
||||
* @param sqh
|
||||
* @return
|
||||
*/
|
||||
@Anonymous
|
||||
@GetMapping("/printBarcode")
|
||||
public Result printSQD(String sqh){
|
||||
return mzcxService.printSQD(sqh);
|
||||
|
||||
15
pom.xml
15
pom.xml
@ -43,6 +43,7 @@
|
||||
<jasperreports.version>6.8.0</jasperreports.version>
|
||||
<itext.version>2.1.7</itext.version>
|
||||
<barbecue.version>1.5-beta1</barbecue.version>
|
||||
<pdfbox.version>2.0.29</pdfbox.version>
|
||||
|
||||
<!-- override dependency version -->
|
||||
<tomcat.version>9.0.98</tomcat.version>
|
||||
@ -259,6 +260,12 @@
|
||||
<version>${czlis.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.czlis</groupId>
|
||||
<artifactId>lisresources</artifactId>
|
||||
<version>${czlis.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- hutool工具类 -->
|
||||
<dependency>
|
||||
@ -323,6 +330,13 @@
|
||||
<artifactId>batik-all</artifactId>
|
||||
<version>${batik.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.pdfbox</groupId>
|
||||
<artifactId>pdfbox</artifactId>
|
||||
<version>${pdfbox.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
@ -337,6 +351,7 @@
|
||||
<module>zybgcx</module>
|
||||
<module>lis-quartz</module>
|
||||
<module>lis-interfaceCommon</module>
|
||||
<module>lisresources</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.czlis.zybgcx.controller;
|
||||
|
||||
import com.czlis.common.annotation.Anonymous;
|
||||
import com.czlis.common.core.controller.BaseController;
|
||||
import com.czlis.common.core.domain.Result;
|
||||
import com.czlis.common.core.page.TableDataInfo;
|
||||
@ -44,6 +45,7 @@ public class ZybgcxController extends BaseController {
|
||||
* @param webGetResultMed
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("获取微生物报告单信息")
|
||||
@PostMapping("/MedList")
|
||||
public TableDataInfo getResultMed(@RequestBody Web_getResultMed webGetResultMed){
|
||||
startPage();
|
||||
@ -54,11 +56,13 @@ public class ZybgcxController extends BaseController {
|
||||
|
||||
/**
|
||||
* 打印报告单
|
||||
* @param bgdh
|
||||
* @param bgdh 格式为:jyrq_yq_ybh
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("print")
|
||||
@Anonymous
|
||||
@ApiOperation("打印报告单")
|
||||
@GetMapping("/print")
|
||||
public Result printReport(String bgdh){
|
||||
return null;
|
||||
return zybgcxService.printReport(bgdh);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.czlis.zybgcx.service;
|
||||
|
||||
import com.czlis.common.core.domain.Result;
|
||||
import com.czlis.zybgcx.pojo.Web_getReportsList;
|
||||
import com.czlis.zybgcx.pojo.Web_getResultMed;
|
||||
|
||||
@ -9,4 +10,5 @@ public interface ZybgcxService {
|
||||
List<Web_getReportsList> getPatList(Web_getReportsList webGetReportsList);
|
||||
List<Web_getResultMed> getResultMed(Web_getResultMed webGetResultMed);
|
||||
|
||||
Result printReport(String bgdh);
|
||||
}
|
||||
|
||||
@ -1,5 +1,14 @@
|
||||
package com.czlis.zybgcx.service.impl;
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
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.LabReqreportPdffile;
|
||||
import com.czlis.interfaceCommon.utils.CommonUtil;
|
||||
import com.czlis.interfaceCommon.utils.ReportUtil;
|
||||
import com.czlis.zybgcx.mapper.ZybgcxMapper;
|
||||
import com.czlis.zybgcx.pojo.Web_getReportsList;
|
||||
import com.czlis.zybgcx.pojo.Web_getResultMed;
|
||||
@ -8,6 +17,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.print.PrintException;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@ -17,6 +28,8 @@ public class ZybgcxServcieImpl implements ZybgcxService {
|
||||
|
||||
@Autowired
|
||||
private ZybgcxMapper zybgcxMapper;
|
||||
@Autowired
|
||||
private CommonUtil commonUtil;
|
||||
|
||||
|
||||
/**
|
||||
@ -39,5 +52,34 @@ public class ZybgcxServcieImpl implements ZybgcxService {
|
||||
return zybgcxMapper.getResultMed(webGetResultMed);
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印报告单
|
||||
* @param bgdh
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Result printReport(String bgdh) {
|
||||
String[] strings = StrUtil.splitToArray(bgdh, "_");
|
||||
if(strings.length != 3) return new Result("-1","传入的报告单号不对!");
|
||||
String jyrqStr = strings[0];
|
||||
String yq = strings[1];
|
||||
String ybh = strings[2];
|
||||
LabReqreportPdffile labReqreportPdffileOne = commonUtil.getLabReqreportPdffileOne(DateUtil.parse(jyrqStr, "yyyyMMdd"), yq, ybh);
|
||||
byte[] decode = Base64.decode(labReqreportPdffileOne.getBASE64PDF());
|
||||
String pdfName = bgdh+".pdf";
|
||||
String path = RuoYiConfig.getProfile() +"/printPDF/"+pdfName;
|
||||
log.info("打印目录文件为:{}",path);
|
||||
FileUtil.writeBytes(decode, path);
|
||||
try {
|
||||
ReportUtil.printPdf(path,"");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("打印pdf报告失败:",e);
|
||||
return new Result("-1","打印pdf报告失败:"+e.getMessage());
|
||||
}
|
||||
|
||||
return new Result("0","打印成功!");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -50,11 +50,12 @@ public class ZycxController extends BaseController {
|
||||
|
||||
@ApiOperation("执行条码")
|
||||
@GetMapping("/print")
|
||||
public Result execSQD(String sqh,String userid,String status,String yljg){
|
||||
public Result execSQD(String[] sqh,String userid,String status,String yljg){
|
||||
log.info("执行条码接口:{},{},{},{}",sqh,userid,status,yljg);
|
||||
return zycxService.execSQD(sqh,userid,status,yljg);
|
||||
}
|
||||
|
||||
|
||||
// @GetMapping("/test1")
|
||||
// public Result test1(String inValue){
|
||||
// log.info("测试的数据:{}",inValue);
|
||||
|
||||
@ -11,7 +11,7 @@ import java.util.Date;
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Web_getBarcode extends BaseEntity {
|
||||
public class Web_getBarcode {
|
||||
private String sqh;
|
||||
private String ksdh;
|
||||
private String sqys;
|
||||
|
||||
@ -10,5 +10,5 @@ public interface ZycxService {
|
||||
|
||||
Result createSQD(String dept, String userid, String st, String et, String yljg);
|
||||
|
||||
Result execSQD(String sqh,String userid,String status,String yljg );
|
||||
Result execSQD(String[] sqh,String userid,String status,String yljg );
|
||||
}
|
||||
|
||||
@ -1,11 +1,22 @@
|
||||
package com.czlis.zycx.service.impl;
|
||||
|
||||
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.interfaceCommon.constants.LisinterfaceNameConstants;
|
||||
import com.czlis.interfaceCommon.pojo.entity.MZBarCodeParam;
|
||||
import com.czlis.interfaceCommon.pojo.inter.GetReqInterface;
|
||||
import com.czlis.interfaceCommon.pojo.inter.SetReqStatus;
|
||||
import com.czlis.interfaceCommon.service.LisInterfaceType;
|
||||
import com.czlis.interfaceCommon.utils.CommonUtil;
|
||||
import com.czlis.interfaceCommon.utils.LisInterfaceUtil;
|
||||
import com.czlis.interfaceCommon.utils.LisUtil;
|
||||
import com.czlis.interfaceCommon.utils.ReportUtil;
|
||||
import com.czlis.zycx.mapper.ZycxMapper;
|
||||
import com.czlis.zycx.service.ZycxService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
@ -18,6 +29,15 @@ public class ZycxServiceImpl implements ZycxService {
|
||||
|
||||
@Autowired
|
||||
private ZycxMapper zycxMapper;
|
||||
@Autowired
|
||||
private LisInterfaceUtil lisInterfaceUtil;
|
||||
@Autowired
|
||||
private CommonUtil commonUtil;
|
||||
@Autowired
|
||||
private ReportUtil reportUtil;
|
||||
|
||||
@Value("${lisinterface.sp:}")
|
||||
String sp;
|
||||
|
||||
|
||||
@Override
|
||||
@ -27,6 +47,38 @@ public class ZycxServiceImpl implements ZycxService {
|
||||
|
||||
@Override
|
||||
public Result createSQD(String dept, String userid, String st, String et, String yljg) {
|
||||
if(sp.equals("1")){
|
||||
return createSQDExecSP(dept, userid, st, et, yljg);
|
||||
}else{
|
||||
return createSQDExecHTTP(dept, userid, st, et, yljg);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result execSQD(String[] sqh,String userid,String status,String yljg) {
|
||||
String sqhOne = "";
|
||||
for (int i = 0; i < sqh.length; i++) {
|
||||
sqhOne = sqh[i];
|
||||
if(sp.equals("1")){
|
||||
Result result = execSQDExecSP(sqhOne, userid, status, yljg);
|
||||
if(!result.equals("0")) return result;
|
||||
}else{
|
||||
Result result = execSQDExecHTTP(sqhOne, userid, status, yljg);
|
||||
if(!result.equals("0")) return result;
|
||||
}
|
||||
//打印条码
|
||||
if(status.equals("11")){
|
||||
printBarCode(sqhOne);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return new Result("0","执行成功!");
|
||||
|
||||
}
|
||||
|
||||
|
||||
public Result createSQDExecSP(String dept, String userid, String st, String et, String yljg){
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("dept", dept);
|
||||
map.put("userid", userid);
|
||||
@ -46,8 +98,19 @@ public class ZycxServiceImpl implements ZycxService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result execSQD(String sqh,String userid,String status,String yljg) {
|
||||
|
||||
public Result createSQDExecHTTP(String dept, String userid, String st, String et, String yljg){
|
||||
GetReqInterface getReqInterface = new GetReqInterface();
|
||||
getReqInterface.setDept(dept);
|
||||
getReqInterface.setUserid(userid);
|
||||
getReqInterface.setUserid(userid);
|
||||
getReqInterface.setStime(st);
|
||||
getReqInterface.setEtime(et);
|
||||
getReqInterface.setYljg(yljg);
|
||||
return lisInterfaceUtil.invokeLisInterface(LisinterfaceNameConstants.GETREQINTERFACE, getReqInterface);
|
||||
}
|
||||
|
||||
public Result execSQDExecSP(String sqh,String userid,String status,String yljg){
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("sqh", sqh);
|
||||
map.put("userid", userid);
|
||||
@ -66,4 +129,43 @@ public class ZycxServiceImpl implements ZycxService {
|
||||
}
|
||||
}
|
||||
|
||||
public Result execSQDExecHTTP(String sqh,String userid,String status,String yljg){
|
||||
SetReqStatus setReqStatus = new SetReqStatus();
|
||||
setReqStatus.setStatus(status);
|
||||
setReqStatus.setSqh(sqh);
|
||||
setReqStatus.setUserid(userid);
|
||||
return lisInterfaceUtil.invokeLisInterface(LisinterfaceNameConstants.SETREQSTATUS, setReqStatus);
|
||||
}
|
||||
|
||||
public Result printBarCode(String sqh){
|
||||
LabReqmain labReqmainOne = commonUtil.getLabReqmainOne(sqh);
|
||||
//List<LabReqdetail> labReqdetailList = commonUtil.getLabReqdetailList(sqh);
|
||||
MZBarCodeParam mzBarCodeParam = new MZBarCodeParam();
|
||||
mzBarCodeParam.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());
|
||||
String brxb = labReqmainOne.getBrxb();
|
||||
switch (brxb) {
|
||||
case "1":
|
||||
brxb = "男";
|
||||
break;
|
||||
case "2":
|
||||
brxb = "女";
|
||||
break;
|
||||
default:
|
||||
brxb = "";
|
||||
|
||||
}
|
||||
mzBarCodeParam.setBrxb(brxb);
|
||||
mzBarCodeParam.setSfxmmc(labReqmainOne.getJymd());
|
||||
reportUtil.printBarCode(mzBarCodeParam);
|
||||
return new Result("0", "打印成功!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user