报告模板菜单

This commit is contained in:
tangw 2025-12-29 14:12:32 +08:00
parent 463a6c101e
commit 3ee6611354
4 changed files with 59 additions and 15 deletions

View File

@ -10,6 +10,7 @@ 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);
int getLabReportCountwithitem(@Param("jyrq") Date jyrq, @Param("yq")String yq, @Param("ybh")String ybh,@Param("items")List<String> items);
List<ComReportInstr> getComReportInstrByInstr(String reportYq);
String getreportCode(Long reportBgdh);
}

View File

@ -22,6 +22,7 @@ public class ReportParam {
private String yq;
private String ybh;
private String hospitalName;
private Long ReportId;
/**结果图片数组*/private String[] pic;
/**检验医生签名*/private String usernopic;
/**审核医生签名*/private String checkerpic;

View File

@ -42,6 +42,7 @@ import java.io.File;
import java.io.IOException;
import java.sql.Connection;
import java.util.*;
import java.util.stream.Collectors;
@Component
@ -356,29 +357,59 @@ public class ReportUtil {
reportParam.setCheckercbpic(getSignName(labPat.getChecker())); //初审者
String[] picPath = getReportpic(jyrq, yq, ybh);
reportParam.setPic(picPath);
return printToPdf("report_image2", reportParam, UUID.randomUUID().toString(), true);
ComReportInstr comReportInstr=getReportTemplate(jyrq, yq, ybh);
if(comReportInstr==null) {
return new Result("-1","未找到打印模板,请检查报告单设置");
}
reportParam.setReportId(comReportInstr.getReportId());
String filename=labReportvsitemMapper.getreportCode(comReportInstr.getReportBgdh());
return printToPdf(filename, reportParam, UUID.randomUUID().toString(), true);
}
/**
* 获取报告单模板
* @param labPat
* @return
* @param jyrq 检验日期
* @param yq 仪器
* @param ybh 样本号
* @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);
public ComReportInstr getReportTemplate(Date jyrq, String yq, String ybh) {
ComReportInstr comReportInstr0=new ComReportInstr();
String yqdl=commonUtil.getYqdl(yq);
List<ComReportInstr> info=labReportvsitemMapper.getComReportInstrByInstr(yq);
for (ComReportInstr comReportInstr : info) {
Long bgdh=comReportInstr.getReportBgdh();
if("细菌仪".equals(yqdl)) {
String tyep;
int med = commonUtil.getLabResultMedCountAll(jyrq, yq, ybh);
if (med > 1)tyep="2";
else {
tyep = "1";
}
return "";
List<ComReportInstr> info0 = info.stream().filter(ss -> tyep.equals(ss.getReportType())).collect(Collectors.toList());
if(info0.isEmpty()||info0==null)return comReportInstr0;
return info0.get(0);
}
int rows=labReportvsitemMapper.getLabReportCount(jyrq,yq,ybh);
for (ComReportInstr comReportInstr : info) {
Long minrows=comReportInstr.getReportMinrows();
Long maxrows=comReportInstr.getReportMaxrows();
if(minrows!=null&&minrows>0){
if(rows<minrows){continue;}
}
if(maxrows!=null&&maxrows>0){
if(rows>maxrows){continue;}
}
String items=comReportInstr.getReportItems();
if(items!=null&&!"".equals(items)) {
List<String> itemList = Arrays.asList(items.split(","));
int xms=labReportvsitemMapper.getLabReportCountwithitem(jyrq, yq, ybh, itemList);
if(xms>0){
return comReportInstr;
}
}
comReportInstr0=comReportInstr;
}
return comReportInstr0;
}
public String[] getReportpic(Date jyrq, String yq, String ybh) {
List<LabGraph> labGraphList = commonUtil.getLabGraphAll(jyrq, yq, ybh);

View File

@ -41,6 +41,17 @@
xm_info.yq=lab_result.yq and xm_info.xmdh=lab_result.xmdh and xm_info.dylx !='3' and
AND ( lab_result.jyrq =#{jyrq} ) AND ( lab_result.yq = #{yq}) AND ( lab_result.ybh = #{ybh} )
</select>
<select id="getLabReportCountwithitem" resultType="int">
SELECT count(1) FROM lab_result WHERE jyrq =#{jyrq} AND yq = #{yq} AND ybh = #{ybh}
and xmdh in
<foreach collection="items"
item="itemVal"
open="("
close=")"
separator=",">
#{itemVal}
</foreach>
</select>
<select id="getLabReport2" resultType="int">
select count(1) from (SELECT (sum(LEN(refs) - LEN(REPLACE(refs, '|', '')))+count(1)) as sl,count(lab_reportvsitem.xmdh) as bg2xms,count(com_rpt.bgdh) as slbgd
FROM lab_result join xm_info on xm_info.yq=lab_result.yq and xm_info.xmdh=lab_result.xmdh and xm_info.dylx !='3'