diff --git a/lis-interfaceCommon/src/main/java/com/czlis/interfaceCommon/utils/ReportUtil.java b/lis-interfaceCommon/src/main/java/com/czlis/interfaceCommon/utils/ReportUtil.java index ffc80a0..8ec7d63 100644 --- a/lis-interfaceCommon/src/main/java/com/czlis/interfaceCommon/utils/ReportUtil.java +++ b/lis-interfaceCommon/src/main/java/com/czlis/interfaceCommon/utils/ReportUtil.java @@ -125,7 +125,8 @@ public class ReportUtil { 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输出路径(多级目录会自动创建) + String pdfName1 = UUID.randomUUID().toString(); + String outputPath = staticpath+ File.separator + "printPDF"+ File.separator + pdfName1 + ".pdf"; // PDF输出路径(多级目录会自动创建) Map stringObjectMap = BeanUtil.beanToMap(reportParam); try { Connection connection = dataSource.getConnection(); @@ -134,7 +135,7 @@ public class ReportUtil { e.printStackTrace(); log.error("打印条码失败,参数{}", reportParam, e); } - String httpPath = getPrintURL(pdfName); + String httpPath = getPrintURL(pdfName1); log.info("传给前端的pdf地址:{}", httpPath); if (base64) { //删除图片文件 diff --git a/sql/lis8.0/函数/GetAge.sql b/sql/lis8.0/函数/GetAge.sql new file mode 100644 index 0000000..2a56c0e --- /dev/null +++ b/sql/lis8.0/函数/GetAge.sql @@ -0,0 +1,67 @@ + +/****** Object: UserDefinedFunction [dbo].[GetAge] Script Date: 01/04/2026 17:30:01 ******/ +SET ANSI_NULLS ON +GO + +SET QUOTED_IDENTIFIER ON +GO + + +CREATE FUNCTION [dbo].[GetAge] +( + @BirthDay nvarchar(20) --生日 +) + RETURNS varchar(20) +AS +BEGIN + if(@BirthDay is NUlL or @BirthDay='') + return ''; + -- Declare the return variable here + DECLARE @age varchar(20) + DECLARE @years int + DECLARE @months int + DECLARE @days int + -- Add the T-SQL statements to compute the return value here + set @age = '' + + set @years = year(GETDATE()) - year(@birthday) + set @months = month(GETDATE()) - month(@birthday) + if day(@birthday)<=day(GETDATE()) + set @days = day(GETDATE()) - day(@birthday) + else + begin + set @months = @months - 1 + if MONTH(@birthday) in (1,3,5,7,8,10,12) + set @days = 31-day(@birthday)+day(GETDATE()) + else if MONTH(@birthday) in (4,6,9,11) + set @days = 30-day(@birthday)+day(GETDATE()) + else if MONTH(@birthday) = 2 + if (year(@birthday)%4 = 0 and year(@birthday)%100 <> 0) or year(@birthday)%400 = 0 + set @days = 29-day(@birthday)+day(GETDATE()) + else + set @days = 28-day(@birthday)+day(GETDATE()) + end + if @months < 0 + begin + set @years = @years - 1 + set @months = @months + 12 + end + if @years = 0 and @months = 0 + begin + return convert(varchar,@days+1) + '天' + end + if @years > 0 + set @age = cast(@years as varchar(5)) + '岁' + if @years < 3 and @months > 0 and @years>-1 + begin + set @age = @age + cast(@months as varchar(5)) + '月' + end + if @years<0 + set @age='' + RETURN @age +END + + +GO + + diff --git a/zycx/src/main/java/com/czlis/zycx/service/impl/ZycxServiceImpl.java b/zycx/src/main/java/com/czlis/zycx/service/impl/ZycxServiceImpl.java index 2ee41c1..c8b1908 100644 --- a/zycx/src/main/java/com/czlis/zycx/service/impl/ZycxServiceImpl.java +++ b/zycx/src/main/java/com/czlis/zycx/service/impl/ZycxServiceImpl.java @@ -170,33 +170,9 @@ public class ZycxServiceImpl implements ZycxService { } public Result printBarCode(String sqh){ - LabReqmain labReqmainOne = commonUtil.getLabReqmainOne(sqh); - //List labReqdetailList = commonUtil.getLabReqdetailList(sqh); - if(labReqmainOne == null) return new Result("-1","未查到条码号:"+sqh+"的申请单数据!"); ReportParam reportParam = new ReportParam(); reportParam.setSqh(sqh); - Map ageFromBirthDay = LisUtil.getAgeFromBirthDay(DateUtil.format(labReqmainOne.getBrsr(), "yyyy-MM-dd HH:mm:ss")); - String age = ageFromBirthDay.get("age"); - String unit = ageFromBirthDay.get("unit"); - - reportParam.setNl(age + unit); - reportParam.setBrxm(labReqmainOne.getBrxm()); - String brxb = labReqmainOne.getBrxb(); - switch (brxb) { - case "1": - brxb = "男"; - break; - case "2": - brxb = "女"; - break; - default: - brxb = ""; - - } - reportParam.setBrxb(brxb); - reportParam.setSfxmmc(labReqmainOne.getJymd()); - log.info("传给打印的数据为:{},{}", reportParam,sqh); - return reportUtil.printToPdf(reportParam, sqh); + return reportUtil.printToPdf("barcode_zy",reportParam, sqh,false); } diff --git a/zycx/src/main/resources/mapper/ZycxMapper.xml b/zycx/src/main/resources/mapper/ZycxMapper.xml index 2636cb3..574d94b 100644 --- a/zycx/src/main/resources/mapper/ZycxMapper.xml +++ b/zycx/src/main/resources/mapper/ZycxMapper.xml @@ -13,7 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" (select yhxm from com_usr where yhdh = a.jsys) as jsysname, (select zdmc from com_dict where zdlb = 'DP' AND zddh = a.ksdh) as ksname, c.confirmdt as confirmdt - from lab_reqmain a,lab_feeitemclass b,lab_pat c where a.bgddh = b.sflbdh and a.sqh = c.sqh + from lab_reqmain a left join lab_feeitemclass b on (a.bgddh = b.sflbdh),lab_pat c where a.sqh = c.sqh