检验项目修改
This commit is contained in:
parent
edd34c62a7
commit
9b0d6934f1
@ -17,11 +17,15 @@ import com.czlis.interfaceCommon.pojo.entity.BackPaperDetail;
|
|||||||
import com.czlis.interfaceCommon.pojo.entity.BackPaperParam;
|
import com.czlis.interfaceCommon.pojo.entity.BackPaperParam;
|
||||||
import com.czlis.interfaceCommon.pojo.entity.LabRptgetruledetailCX;
|
import com.czlis.interfaceCommon.pojo.entity.LabRptgetruledetailCX;
|
||||||
import com.czlis.interfaceCommon.pojo.entity.BarCodeParam;
|
import com.czlis.interfaceCommon.pojo.entity.BarCodeParam;
|
||||||
|
import com.itextpdf.io.source.ByteArrayOutputStream;
|
||||||
|
import com.itextpdf.kernel.geom.PageSize;
|
||||||
import com.itextpdf.kernel.geom.Rectangle;
|
import com.itextpdf.kernel.geom.Rectangle;
|
||||||
import com.itextpdf.kernel.pdf.PdfDocument;
|
import com.itextpdf.kernel.pdf.PdfDocument;
|
||||||
import com.itextpdf.kernel.pdf.PdfPage;
|
import com.itextpdf.kernel.pdf.PdfPage;
|
||||||
import com.itextpdf.kernel.pdf.PdfReader;
|
import com.itextpdf.kernel.pdf.PdfReader;
|
||||||
import com.itextpdf.kernel.pdf.PdfWriter;
|
import com.itextpdf.kernel.pdf.PdfWriter;
|
||||||
|
import com.itextpdf.kernel.pdf.canvas.PdfCanvas;
|
||||||
|
import com.itextpdf.kernel.pdf.xobject.PdfFormXObject;
|
||||||
import com.itextpdf.layout.Canvas;
|
import com.itextpdf.layout.Canvas;
|
||||||
import com.itextpdf.layout.element.Image;
|
import com.itextpdf.layout.element.Image;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -31,6 +35,7 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@ -401,4 +406,61 @@ public class ReportUtil {
|
|||||||
}
|
}
|
||||||
return httpPath+"/"+filepath;
|
return httpPath+"/"+filepath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String convertA5ToA4Blank(String a5PdfBase64) throws IOException {
|
||||||
|
// 1. 清理并解码Base64(必做:去除可能的data前缀)
|
||||||
|
String pureBase64 = a5PdfBase64.replaceFirst("^data:application/pdf;base64,", "");
|
||||||
|
byte[] a5PdfBytes = org.apache.commons.codec.binary.Base64.decodeBase64(pureBase64);
|
||||||
|
if (a5PdfBytes.length < 100) {
|
||||||
|
throw new IllegalArgumentException("原Base64不是有效PDF(字节数过少)");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 读取原A5 PDF
|
||||||
|
ByteArrayInputStream a5Stream = new ByteArrayInputStream(a5PdfBytes);
|
||||||
|
PdfReader reader = new PdfReader(a5Stream);
|
||||||
|
PdfDocument originalDoc = new PdfDocument(reader);
|
||||||
|
if (originalDoc.getNumberOfPages() == 0) {
|
||||||
|
originalDoc.close();
|
||||||
|
reader.close();
|
||||||
|
throw new IllegalArgumentException("原A5 PDF无页面");
|
||||||
|
}
|
||||||
|
PdfPage originalPage = originalDoc.getPage(1);
|
||||||
|
|
||||||
|
// 3. 初始化A4 PDF输出流
|
||||||
|
ByteArrayOutputStream a4OutStream = new ByteArrayOutputStream();
|
||||||
|
PdfWriter writer = new PdfWriter(a4OutStream);
|
||||||
|
PdfDocument a4Doc = new PdfDocument(writer);
|
||||||
|
|
||||||
|
// 4. 创建A4横向页面
|
||||||
|
Rectangle a4Landscape = (Rectangle) PageSize.A4.rotate(); // 显式强转,消除类型歧义
|
||||||
|
PdfPage a4Page = a4Doc.addNewPage((PageSize) a4Landscape);
|
||||||
|
PdfCanvas pdfCanvas = new PdfCanvas(a4Page);
|
||||||
|
|
||||||
|
|
||||||
|
Canvas canvas = new Canvas(pdfCanvas, a4Landscape);
|
||||||
|
|
||||||
|
// 5. 正确转换原页面并绘制(无参数错误)
|
||||||
|
PdfFormXObject formX = originalPage.copyAsFormXObject(a4Doc);
|
||||||
|
Image a5Image = new Image(formX);
|
||||||
|
// 固定A5尺寸,位置靠左(右侧留空白)
|
||||||
|
a5Image.setWidth(PageSize.A5.getWidth())
|
||||||
|
.setHeight(PageSize.A5.getHeight())
|
||||||
|
.setFixedPosition(0, 0);
|
||||||
|
canvas.add(a5Image);
|
||||||
|
|
||||||
|
// 6. 按顺序关闭资源(关键:先关画布,再关文档,最后读流)
|
||||||
|
canvas.close(); // 确保内容刷入PDF
|
||||||
|
a4Doc.close(); // 关闭A4文档,触发内容写入输出流
|
||||||
|
writer.close(); // 关闭Writer
|
||||||
|
originalDoc.close(); // 关闭原文档
|
||||||
|
reader.close(); // 关闭Reader
|
||||||
|
|
||||||
|
// 7. 生成最终Base64
|
||||||
|
byte[] a4PdfBytes = a4OutStream.toByteArray();
|
||||||
|
if (a4PdfBytes.length < 200) {
|
||||||
|
throw new RuntimeException("生成的A4 PDF内容异常");
|
||||||
|
}
|
||||||
|
return org.apache.commons.codec.binary.Base64.encodeBase64String(a4PdfBytes);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,6 @@ public class ReportItemController extends BaseController {
|
|||||||
@GetMapping("/query")
|
@GetMapping("/query")
|
||||||
public TableDataInfo query(XmInfoNew xmInfoNew) {
|
public TableDataInfo query(XmInfoNew xmInfoNew) {
|
||||||
startPage();
|
startPage();
|
||||||
log.info("查询列表:"+xmInfoNew);
|
|
||||||
List<XmInfoNew> xmInfoNewList = reportItemService.query(xmInfoNew);
|
List<XmInfoNew> xmInfoNewList = reportItemService.query(xmInfoNew);
|
||||||
return getDataTable(xmInfoNewList);
|
return getDataTable(xmInfoNewList);
|
||||||
}
|
}
|
||||||
@ -71,7 +70,7 @@ public class ReportItemController extends BaseController {
|
|||||||
@ApiOperation("修改检验项目")
|
@ApiOperation("修改检验项目")
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
public Result update(@RequestBody XmInfoNewDTO xmInfoNewDTO){
|
public Result update(@RequestBody XmInfoNewDTO xmInfoNewDTO){
|
||||||
log.info("入参xmInfoNewDTO:{}",xmInfoNewDTO);
|
log.info("修改数据,入参xmInfoNewDTO:{}",xmInfoNewDTO);
|
||||||
return reportItemService.update(xmInfoNewDTO);
|
return reportItemService.update(xmInfoNewDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,8 +97,8 @@ public class ReportItemController extends BaseController {
|
|||||||
@Log(title = SysLogConstants.XMFILTER_LOG,businessType = BusinessType.INSERT)
|
@Log(title = SysLogConstants.XMFILTER_LOG,businessType = BusinessType.INSERT)
|
||||||
@ApiOperation("新增滤光片波长对照表")
|
@ApiOperation("新增滤光片波长对照表")
|
||||||
@PostMapping("/addXmFilter")
|
@PostMapping("/addXmFilter")
|
||||||
public Result addXmFilter(@RequestBody XmFilter xmFilter){
|
public Result addXmFilter(@RequestBody List<XmFilter> xmFilterList){
|
||||||
return reportItemService.addXmFilter(xmFilter);
|
return reportItemService.addXmFilter(xmFilterList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log(title = SysLogConstants.XMFILTER_LOG,businessType = BusinessType.DELETE)
|
@Log(title = SysLogConstants.XMFILTER_LOG,businessType = BusinessType.DELETE)
|
||||||
@ -170,7 +169,7 @@ public class ReportItemController extends BaseController {
|
|||||||
return reportItemService.queryBatch(xmInfoNew);
|
return reportItemService.queryBatch(xmInfoNew);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Anonymous
|
|
||||||
@Log(title = SysLogConstants.REPORTITEM_LOG,businessType = BusinessType.INSERT_VS)
|
@Log(title = SysLogConstants.REPORTITEM_LOG,businessType = BusinessType.INSERT_VS)
|
||||||
@ApiOperation("批量新增数据")
|
@ApiOperation("批量新增数据")
|
||||||
@PostMapping("/addBatch")
|
@PostMapping("/addBatch")
|
||||||
@ -178,11 +177,22 @@ public class ReportItemController extends BaseController {
|
|||||||
return reportItemService.addBatch(xmInfoNewList);
|
return reportItemService.addBatch(xmInfoNewList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Anonymous
|
|
||||||
@Log(title = SysLogConstants.REPORTITEM_LOG,businessType = BusinessType.DELETE)
|
@Log(title = SysLogConstants.REPORTITEM_LOG,businessType = BusinessType.DELETE)
|
||||||
@ApiOperation("批量删除对应")
|
@ApiOperation("批量删除对应")
|
||||||
@PostMapping("/delBatch")
|
@PostMapping("/delBatch")
|
||||||
public Result delBatch(@RequestBody List<Integer> vsidList ){
|
public Result delBatch(@RequestBody List<XmInfoNew> xmInfoNewList ){
|
||||||
return reportItemService.delBatch(vsidList);
|
return reportItemService.delBatch(xmInfoNewList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = SysLogConstants.REPORTITEM_LOG,businessType = BusinessType.DELETE)
|
||||||
|
@ApiOperation("删除参考值明细")
|
||||||
|
@GetMapping("/delXmRefNew")
|
||||||
|
public Result delXmRefNew(XmRefNew xmRefNew){
|
||||||
|
if(xmRefNew == null) return new Result("-1","入参不能为空!");
|
||||||
|
if(xmRefNew.getXmid() == null) return new Result("-1","项目ID不能为空!");
|
||||||
|
if(xmRefNew.getXh() == null) return new Result("-1","项目序号不能为空!");
|
||||||
|
return reportItemService.delXmRefNew(xmRefNew);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,7 @@ public interface ReportItemMapper {
|
|||||||
void deleteXmDouble(XmDouble xmDouble);
|
void deleteXmDouble(XmDouble xmDouble);
|
||||||
void deleteXmInter(XmInter xmInter);
|
void deleteXmInter(XmInter xmInter);
|
||||||
void deleteXmTextResult(XmTextresultNew xmTextresultNew);
|
void deleteXmTextResult(XmTextresultNew xmTextresultNew);
|
||||||
void deleteXmRef(XmRefNew xmRefNew);
|
void deleteXmRefNew(XmRefNew xmRefNew);
|
||||||
void deleteXmValNew(XmValNew xmValNew);
|
void deleteXmValNew(XmValNew xmValNew);
|
||||||
|
|
||||||
Long getXmInfoVsCount(Integer xmid);
|
Long getXmInfoVsCount(Integer xmid);
|
||||||
@ -36,6 +36,7 @@ public interface ReportItemMapper {
|
|||||||
void updateXmValNewRow(XmValNew xmValRow);
|
void updateXmValNewRow(XmValNew xmValRow);
|
||||||
void updateXmTextResultRow(XmTextresultNew xmTextResultRow);
|
void updateXmTextResultRow(XmTextresultNew xmTextResultRow);
|
||||||
void updateXminfoVs(XmInfoVs xmInfoVs);
|
void updateXminfoVs(XmInfoVs xmInfoVs);
|
||||||
|
void updateXmFilter(XmFilter xmFilter);
|
||||||
|
|
||||||
void addXmInfoVs(XmInfoVs xmInfoVs);
|
void addXmInfoVs(XmInfoVs xmInfoVs);
|
||||||
void deleteXmInfoVs(Integer vsid);
|
void deleteXmInfoVs(Integer vsid);
|
||||||
@ -66,5 +67,5 @@ public interface ReportItemMapper {
|
|||||||
|
|
||||||
void addBatch(@Param("xmInfoNewList") List<XmInfoNew> xmInfoNewList);
|
void addBatch(@Param("xmInfoNewList") List<XmInfoNew> xmInfoNewList);
|
||||||
|
|
||||||
void delBatch(@Param("vsidList") List<Integer> vsidList);
|
void delBatch(@Param("xmInfoNewList") List<XmInfoNew> xmInfoNewList);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,7 +22,7 @@ public interface ReportItemService {
|
|||||||
|
|
||||||
Result getXmFilter(XmFilter xmFilter);
|
Result getXmFilter(XmFilter xmFilter);
|
||||||
|
|
||||||
Result addXmFilter(XmFilter xmFilter);
|
Result addXmFilter(List<XmFilter> xmFilter);
|
||||||
|
|
||||||
Result deleteXmFilter(String yq, String lgph);
|
Result deleteXmFilter(String yq, String lgph);
|
||||||
|
|
||||||
@ -50,5 +50,7 @@ public interface ReportItemService {
|
|||||||
|
|
||||||
Result addBatch(List<XmInfoNew> xmInfoNewList);
|
Result addBatch(List<XmInfoNew> xmInfoNewList);
|
||||||
|
|
||||||
Result delBatch(List<Integer> vsidList);
|
Result delBatch(List<XmInfoNew> xmInfoNewList);
|
||||||
|
|
||||||
|
Result delXmRefNew(XmRefNew xmRefNew);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -120,7 +120,7 @@ public class ReportItemServiceImpl implements ReportItemService {
|
|||||||
reportItemMapper.deleteXmTextResult(xmTextresultNew);
|
reportItemMapper.deleteXmTextResult(xmTextresultNew);
|
||||||
XmRefNew xmRefNew = new XmRefNew();
|
XmRefNew xmRefNew = new XmRefNew();
|
||||||
xmRefNew.setXmid(xmInfoNew.getXmid());
|
xmRefNew.setXmid(xmInfoNew.getXmid());
|
||||||
reportItemMapper.deleteXmRef(xmRefNew);
|
reportItemMapper.deleteXmRefNew(xmRefNew);
|
||||||
XmValNew xmValNew = new XmValNew();
|
XmValNew xmValNew = new XmValNew();
|
||||||
xmValNew.setXmid(xmid);
|
xmValNew.setXmid(xmid);
|
||||||
reportItemMapper.deleteXmValNew(xmValNew);
|
reportItemMapper.deleteXmValNew(xmValNew);
|
||||||
@ -272,8 +272,17 @@ public class ReportItemServiceImpl implements ReportItemService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result addXmFilter(XmFilter xmFilter) {
|
public Result addXmFilter(List<XmFilter> xmFilterList) {
|
||||||
|
for (XmFilter xmFilter : xmFilterList) {
|
||||||
|
List<XmFilter> xmFilterListOne = reportItemMapper.getXmFilter(xmFilter);
|
||||||
|
if(xmFilterListOne.size() > 0){
|
||||||
|
reportItemMapper.updateXmFilter(xmFilter);
|
||||||
|
}else{
|
||||||
reportItemMapper.addXmFilter(xmFilter);
|
reportItemMapper.addXmFilter(xmFilter);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return new Result("0","新增成功!");
|
return new Result("0","新增成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,10 +390,17 @@ public class ReportItemServiceImpl implements ReportItemService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result delBatch(List<Integer> vsidList) {
|
public Result delBatch(List<XmInfoNew> xmInfoNewList) {
|
||||||
reportItemMapper.delBatch(vsidList);
|
|
||||||
|
reportItemMapper.delBatch(xmInfoNewList);
|
||||||
return new Result("0","批量删除数据成功!");
|
return new Result("0","批量删除数据成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result delXmRefNew(XmRefNew xmRefNew) {
|
||||||
|
reportItemMapper.deleteXmRefNew(xmRefNew);
|
||||||
|
return new Result("0","删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -363,8 +363,9 @@
|
|||||||
delete from xm_textresult_new where xmid = #{xmid}
|
delete from xm_textresult_new where xmid = #{xmid}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteXmRef">
|
<delete id="deleteXmRefNew">
|
||||||
delete from xm_ref_new where xmid = #{xmid}
|
delete from xm_ref_new where xmid = #{xmid}
|
||||||
|
<if test="xh != null">and xh = #{xh}</if>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteXmValNew">
|
<delete id="deleteXmValNew">
|
||||||
@ -485,6 +486,10 @@
|
|||||||
where xmid = #{xmid} and yq = #{yq}
|
where xmid = #{xmid} and yq = #{yq}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="updateXmFilter">
|
||||||
|
update xm_filter set lgph = #{lgph} , bc = #{bc} where yq = #{yq} and lgph = #{lgph}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
<delete id="deleteXmInfoVs">
|
<delete id="deleteXmInfoVs">
|
||||||
delete from xm_info_vs where vsid = #{vsid}
|
delete from xm_info_vs where vsid = #{vsid}
|
||||||
@ -494,6 +499,8 @@
|
|||||||
select * from xm_filter
|
select * from xm_filter
|
||||||
<where>
|
<where>
|
||||||
<if test="yq != null and yq != ''">and yq = #{yq}</if>
|
<if test="yq != null and yq != ''">and yq = #{yq}</if>
|
||||||
|
<if test="lgph != null and lgph != ''">and lgph = #{lgph}</if>
|
||||||
|
<if test="bc != null and bc != ''">and bc = #{bc}</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@ -526,7 +533,7 @@
|
|||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<delete id="deleteXmLot">
|
<delete id="deleteXmLot">
|
||||||
delete from xm_log where yq = #{yq} and sjph = #{sjph}
|
delete from xm_lot where yq = #{yq} and sjph = #{sjph}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<select id="queryXmAlarmdetailNew" resultType="com.czlis.common.core.domain.entity.lis.XmAlarmdetailNew">
|
<select id="queryXmAlarmdetailNew" resultType="com.czlis.common.core.domain.entity.lis.XmAlarmdetailNew">
|
||||||
@ -575,7 +582,8 @@
|
|||||||
<if test="inputcode != null and inputcode != ''" >and (xmdh like '%'+#{inputcode}+'%' or xmmc like '%'+#{inputcode}+'%' or zjf like '%'+#{inputcode}+'%')</if>
|
<if test="inputcode != null and inputcode != ''" >and (xmdh like '%'+#{inputcode}+'%' or xmmc like '%'+#{inputcode}+'%' or zjf like '%'+#{inputcode}+'%')</if>
|
||||||
<if test="yqdl != null and yqdl != ''">and yqdl = #{yqdl}</if>
|
<if test="yqdl != null and yqdl != ''">and yqdl = #{yqdl}</if>
|
||||||
<if test="xmid != null and xmid != ''">and xmid = #{xmid}</if>
|
<if test="xmid != null and xmid != ''">and xmid = #{xmid}</if>
|
||||||
<if test="isWsw != null and isWsw !=''"><![CDATA[and yqdl <> '细菌仪']]></if>
|
<if test="isWsw == '1'"><![CDATA[and yqdl = '细菌仪']]></if>
|
||||||
|
<if test="isWsw == '0'"><![CDATA[and yqdl <> '细菌仪']]></if>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@ -589,9 +597,9 @@
|
|||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<delete id="delBatch">
|
<delete id="delBatch">
|
||||||
delete from xm_info_vs where vsid in
|
delete from xm_info_vs where (yq,xmid) in
|
||||||
<foreach collection="vsidList" item="vsid" open="(" close=")" separator=",">
|
<foreach collection="xmInfoNewList" item="xmInfoNew" open="(" close=")" separator=",">
|
||||||
#{vsid}
|
(#{xmInfoNew.yq},#{xmInfoNew.xmid})
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -70,6 +70,8 @@ public class ZybgcxServcieImpl implements ZybgcxService {
|
|||||||
public Result printReport(String[] bgdh) {
|
public Result printReport(String[] bgdh) {
|
||||||
List<Map<String,Object>> bgdhBase64List = new ArrayList<>();
|
List<Map<String,Object>> bgdhBase64List = new ArrayList<>();
|
||||||
List<String> mergeBgdhList = new ArrayList<>();
|
List<String> mergeBgdhList = new ArrayList<>();
|
||||||
|
String brdh = "";
|
||||||
|
int j = 0;
|
||||||
for (String string : bgdh) {
|
for (String string : bgdh) {
|
||||||
String[] stringParam = StrUtil.splitToArray(string, "_");
|
String[] stringParam = StrUtil.splitToArray(string, "_");
|
||||||
if(stringParam.length != 3) return new Result("-1","传入的报告单号不对!"+ Arrays.toString(stringParam));
|
if(stringParam.length != 3) return new Result("-1","传入的报告单号不对!"+ Arrays.toString(stringParam));
|
||||||
@ -80,7 +82,11 @@ public class ZybgcxServcieImpl implements ZybgcxService {
|
|||||||
if(labReqreportPdffileOne == null) continue;
|
if(labReqreportPdffileOne == null) continue;
|
||||||
LabPat labPatOne = commonUtil.getLabPatOne(DateUtil.parse(jyrqStr, "yyyyMMdd"), yq, ybh);
|
LabPat labPatOne = commonUtil.getLabPatOne(DateUtil.parse(jyrqStr, "yyyyMMdd"), yq, ybh);
|
||||||
if(labPatOne == null) return new Result("-1","未找到该报告单的信息!"+ Arrays.toString(stringParam));
|
if(labPatOne == null) return new Result("-1","未找到该报告单的信息!"+ Arrays.toString(stringParam));
|
||||||
|
if(j > 0){
|
||||||
|
if(!brdh.equals(labPatOne.getBrdh())) return new Result("-1","只能选中一个病人的报告单打印!");
|
||||||
|
}
|
||||||
String base64PDF = labReqreportPdffileOne.getBASE64PDF();
|
String base64PDF = labReqreportPdffileOne.getBASE64PDF();
|
||||||
|
|
||||||
if(base64PDF == null || base64PDF.equals("")) continue;
|
if(base64PDF == null || base64PDF.equals("")) continue;
|
||||||
Map<String,Object> map = new HashMap<>();
|
Map<String,Object> map = new HashMap<>();
|
||||||
map.put("data", base64PDF);
|
map.put("data", base64PDF);
|
||||||
@ -90,8 +96,10 @@ public class ZybgcxServcieImpl implements ZybgcxService {
|
|||||||
map.put("brdh",labPatOne.getBrdh());
|
map.put("brdh",labPatOne.getBrdh());
|
||||||
map.put("confirmdt",labPatOne.getConfirmdt());
|
map.put("confirmdt",labPatOne.getConfirmdt());
|
||||||
bgdhBase64List.add(map);
|
bgdhBase64List.add(map);
|
||||||
|
brdh = labPatOne.getBrdh();
|
||||||
|
j++;
|
||||||
}
|
}
|
||||||
log.info("bgdhBase64List:"+bgdhBase64List);
|
//log.info("bgdhBase64List:"+bgdhBase64List);
|
||||||
//过滤A4的报告单
|
//过滤A4的报告单
|
||||||
List<Map<String, Object>> collectA4 = bgdhBase64List.stream().filter(bgdhBase64 -> bgdhBase64.get("pageType").equals("A4")).collect(Collectors.toList());
|
List<Map<String, Object>> collectA4 = bgdhBase64List.stream().filter(bgdhBase64 -> bgdhBase64.get("pageType").equals("A4")).collect(Collectors.toList());
|
||||||
for (Map<String, Object> stringObjectMap : collectA4) {
|
for (Map<String, Object> stringObjectMap : collectA4) {
|
||||||
@ -113,7 +121,7 @@ public class ZybgcxServcieImpl implements ZybgcxService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("collectA5:"+collectA5);
|
//log.info("collectA5:"+collectA5);
|
||||||
|
|
||||||
//对A5格式的报告单进行排序
|
//对A5格式的报告单进行排序
|
||||||
collectA5.sort(new Comparator<Map<String, Object>>() {
|
collectA5.sort(new Comparator<Map<String, Object>>() {
|
||||||
@ -134,10 +142,25 @@ public class ZybgcxServcieImpl implements ZybgcxService {
|
|||||||
|
|
||||||
|
|
||||||
//合并A5格式的pdf为A4格式
|
//合并A5格式的pdf为A4格式
|
||||||
|
String A5BlankStr = "";
|
||||||
for (int i = 0; i < collectA5.size(); i++) {
|
for (int i = 0; i < collectA5.size(); i++) {
|
||||||
if(i+1 >= collectA5.size()){
|
if(i+1 >= collectA5.size()){
|
||||||
//代表到了最后一个单数
|
//代表到了最后一个单数,把这个A5格式的先转换成A4格式的pdf
|
||||||
mergeBgdhList.add(collectA5.get(i).get("data").toString());
|
try {
|
||||||
|
A5BlankStr = reportUtil.convertA5ToA4Blank(collectA5.get(i).get("data").toString());
|
||||||
|
//旋转90度,把之前的文件变成pdf
|
||||||
|
String path2 = RuoYiConfig.getProfile() +"/config/static/printPDF/"+UUID.randomUUID().toString()+".pdf";
|
||||||
|
String path3 = RuoYiConfig.getProfile() +"/config/static/printPDF/"+UUID.randomUUID().toString()+".pdf";
|
||||||
|
Base64.decodeToFile(A5BlankStr,new File(path2));
|
||||||
|
reportUtil.rotatePdf90Degrees(path2,path3,1);
|
||||||
|
A5BlankStr = Base64.encode(new File(path3));
|
||||||
|
//删除文件
|
||||||
|
FileUtils.deleteFile(path2);
|
||||||
|
FileUtils.deleteFile(path3);
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("把A5格式的pdf增加空白变成A4格式的pdf失败:",e);
|
||||||
|
}
|
||||||
|
mergeBgdhList.add(A5BlankStr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
String path = RuoYiConfig.getProfile() +"/config/static/printPDF/"+UUID.randomUUID().toString()+".pdf";
|
String path = RuoYiConfig.getProfile() +"/config/static/printPDF/"+UUID.randomUUID().toString()+".pdf";
|
||||||
@ -161,7 +184,7 @@ public class ZybgcxServcieImpl implements ZybgcxService {
|
|||||||
|
|
||||||
String encode = "";
|
String encode = "";
|
||||||
try {
|
try {
|
||||||
//合并成一个pdf
|
//合并成一个pdf交给前端
|
||||||
String pdfName = UUID.randomUUID().toString();
|
String pdfName = UUID.randomUUID().toString();
|
||||||
String path = RuoYiConfig.getProfile() +"/config/static/printPDF/"+pdfName+".pdf";
|
String path = RuoYiConfig.getProfile() +"/config/static/printPDF/"+pdfName+".pdf";
|
||||||
LisUtil.mergeToFile(mergeBgdhList,path);
|
LisUtil.mergeToFile(mergeBgdhList,path);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user