diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/PublicController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/PublicController.java index 664f1a2..a446afe 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/PublicController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/PublicController.java @@ -155,16 +155,6 @@ public class PublicController extends BaseController { } - /** - * 查询试验预填表单列表 - */ - @GetMapping("/studyFormPreList") - public AjaxResult studyFormPreList(StudyFormPreSearchForm form) { - if (form.getStudyId() == null || form.getStudyId().longValue() < 0) { - throw new ServiceException("试验id不能为空"); - } - return AjaxResult.success(studyFormPreService.queryList(form)); - } /** * 查询暂存柜列表 diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyFormFillController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyFormFillController.java index 21cb675..88c49a8 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyFormFillController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyFormFillController.java @@ -100,22 +100,8 @@ public class StudyFormFillController extends BaseController { StudyFormFillQmxx studyFormFillQmxx = new StudyFormFillQmxx(); studyFormFillQmxx.setFormId(form.getFormId()); List studyFormFillQmxxList = studyFormFillQmxxService.queryList(studyFormFillQmxx); - StudyFormFill studyFormFill=studyFormFillService.getById(form.getFormId()); - Template template=templateService.getById(studyFormFill.getTemplateId()); - if(template!=null){ - return AjaxResult.success(localFilePrefix + PdfExportUtil.export( - "com.hxhq.business.utils.pdf.template."+template.getSn(), - "exportDetail", - studyFormFill, - template, - studyFormFillQmxxList, - studyFormFillJcgjList, - form.getLang(), - localFilePath)); - }else{ - return AjaxResult.error("模板不存在或已删除"); - } - + StudyFormFill studyFormFill=studyFormFillService.queryInfo(form.getFormId()); + return AjaxResult.success(localFilePrefix + PdfExportUtil.export(studyFormFill.getTemplateExportClass(), studyFormFill.getTemplateExportMethod(),studyFormFill,studyFormFillQmxxList,studyFormFillJcgjList,form.getLang(),form.getJcgjlx(),localFilePath)); } /** diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyFormPreController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyFormPreController.java index cdd4002..98738f5 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyFormPreController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyFormPreController.java @@ -3,14 +3,20 @@ package com.hxhq.business.controller; import java.util.Arrays; import java.util.List; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hxhq.business.domain.*; import com.hxhq.business.dto.study.StudyFormPreListDto; +import com.hxhq.business.enums.study.StudyStatusEnum; import com.hxhq.business.form.study.StudyFormPreAuditForm; import com.hxhq.business.form.study.StudyFormPreSearchForm; import com.hxhq.business.form.study.StudyFormUpdateForm; import com.hxhq.business.service.IStudyFormPreJcgjService; import com.hxhq.business.service.IStudyFormPreQmxxService; +import com.hxhq.business.service.IStudyService; +import com.hxhq.common.core.exception.ServiceException; import com.hxhq.common.security.annotation.RequiresPermissions; +import org.aspectj.weaver.loadtime.Aj; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; @@ -36,6 +42,36 @@ public class StudyFormPreController extends BaseController private IStudyFormPreJcgjService studyFormPreJcgjService; @Autowired private IStudyFormPreQmxxService studyFormPreQmxxService; + @Autowired + private IStudyService studyService; + + /** + * 查询试验列表 + */ + @GetMapping("/studyList") + @RequiresPermissions({"business:studyFormPre:bj","business:studyFormPre:xz", + "business:nonTrialFormPre:bj","business:nonTrialFormPre:xz", + "business:drugFormPre:bj","business:drugFormPre:xz"}) + public AjaxResult studyList(Study study) { + QueryWrapper queryWrapper = Wrappers.query(); + queryWrapper.ne("status", StudyStatusEnum.dgd.getValue()); + return AjaxResult.success(studyService.list(queryWrapper)); + } + + + /** + * 查询试验预填表单列表 + */ + @GetMapping("/studyFormPreList") + @RequiresPermissions({"business:studyFormPre:bj","business:studyFormPre:xz", + "business:nonTrialFormPre:bj","business:nonTrialFormPre:xz", + "business:drugFormPre:bj","business:drugFormPre:xz"}) + public AjaxResult studyFormPreList(StudyFormPreSearchForm form) { + if (form.getStudyId() == null || form.getStudyId().longValue() < 0) { + throw new ServiceException("试验id不能为空"); + } + return AjaxResult.success(studyFormPreService.queryList(form)); + } /** * 列表 diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyFormFill.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyFormFill.java index 157c6da..fe7e0e8 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyFormFill.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyFormFill.java @@ -109,10 +109,26 @@ public class StudyFormFill extends MpBaseEntity @Compare(name = "模板名称") private String templateMc; + /** 模板名称-英文 */ + @TableField(exist = false) + private String templateMcEn; + /** 模板编号 */ @TableField(exist = false) private String templateSn; + /** 模板编号 */ + @TableField(exist = false) + private String templateShowSn; + + /** 模板导出类 */ + @TableField(exist = false) + private String templateExportClass; + + /** 模板导出方法 */ + @TableField(exist = false) + private String templateExportMethod; + /** 模板所属部门/学科 */ @TableField(exist = false) private Long templateDeptId; @@ -125,6 +141,38 @@ public class StudyFormFill extends MpBaseEntity @TableField(exist = false) private String studyMc; + public String getTemplateShowSn() { + return templateShowSn; + } + + public void setTemplateShowSn(String templateShowSn) { + this.templateShowSn = templateShowSn; + } + + public String getTemplateExportClass() { + return templateExportClass; + } + + public void setTemplateExportClass(String templateExportClass) { + this.templateExportClass = templateExportClass; + } + + public String getTemplateExportMethod() { + return templateExportMethod; + } + + public void setTemplateExportMethod(String templateExportMethod) { + this.templateExportMethod = templateExportMethod; + } + + public String getTemplateMcEn() { + return templateMcEn; + } + + public void setTemplateMcEn(String templateMcEn) { + this.templateMcEn = templateMcEn; + } + public String getUserMcEn() { return userMcEn; } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/Template.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/Template.java index 0825fb7..28001e1 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/Template.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/Template.java @@ -22,6 +22,15 @@ public class Template extends MpBaseEntity /** 模板名称 */ private String name; + /** 模板名称-英文 */ + private String nameEn; + + /** 导出类 */ + private String exportClass; + + /** 导出方法 */ + private String exportMethod; + /** 所属部门/学科 */ private Long deptId; @@ -47,6 +56,30 @@ public class Template extends MpBaseEntity @TableField(exist = false) private String deptName; + public String getExportMethod() { + return exportMethod; + } + + public void setExportMethod(String exportMethod) { + this.exportMethod = exportMethod; + } + + public String getNameEn() { + return nameEn; + } + + public void setNameEn(String nameEn) { + this.nameEn = nameEn; + } + + public String getExportClass() { + return exportClass; + } + + public void setExportClass(String exportClass) { + this.exportClass = exportClass; + } + public Integer getProduct() { return product; } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GyzjFfjlJcgjServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GyzjFfjlJcgjServiceImpl.java index 09515a0..d3fec72 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GyzjFfjlJcgjServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GyzjFfjlJcgjServiceImpl.java @@ -4,17 +4,15 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hxhq.business.domain.GyzjFfjlJcgj; -import com.hxhq.business.domain.GyzjFfjlJcgj; import com.hxhq.business.mapper.GyzjFfjlJcgjMapper; import com.hxhq.business.service.IGyzjFfjlJcgjService; import com.hxhq.business.utils.JctUtil; -import com.hxhq.business.utils.GyzjJcnrUtil; +import com.hxhq.business.utils.lang.GyzjJcnrUtil; import com.hxhq.common.core.exception.ServiceException; import com.hxhq.common.core.utils.StringUtils; import com.hxhq.system.api.domain.SysUser; import org.springframework.stereotype.Service; -import java.rmi.ServerException; import java.util.List; import java.util.Map; diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GyzjJcgjServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GyzjJcgjServiceImpl.java index 2a0637c..7124da8 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GyzjJcgjServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GyzjJcgjServiceImpl.java @@ -6,16 +6,13 @@ import java.util.Map; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hxhq.business.domain.GyzjJcgj; -import com.hxhq.business.domain.GyzjJcgj; -import com.hxhq.business.domain.GyzjJcgj; import com.hxhq.business.utils.JctUtil; -import com.hxhq.business.utils.GyzjJcnrUtil; +import com.hxhq.business.utils.lang.GyzjJcnrUtil; import com.hxhq.common.core.exception.ServiceException; import com.hxhq.common.core.utils.StringUtils; import com.hxhq.system.api.domain.SysUser; import org.springframework.stereotype.Service; import com.hxhq.business.mapper.GyzjJcgjMapper; -import com.hxhq.business.domain.GyzjJcgj; import com.hxhq.business.service.IGyzjJcgjService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GyzjTzServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GyzjTzServiceImpl.java index 7e92e49..d7632c3 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GyzjTzServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GyzjTzServiceImpl.java @@ -3,14 +3,12 @@ package com.hxhq.business.service.impl; import java.util.List; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.hxhq.business.domain.GyzjJcgj; import com.hxhq.business.domain.GyzjTz; -import com.hxhq.business.utils.GyzjJcnrUtil; +import com.hxhq.business.utils.lang.GyzjJcnrUtil; import com.hxhq.common.core.exception.ServiceException; import com.hxhq.system.api.domain.SysUser; import org.springframework.stereotype.Service; import com.hxhq.business.mapper.GyzjTzMapper; -import com.hxhq.business.domain.GyzjTz; import com.hxhq.business.service.IGyzjTzService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyFfjlJcgjServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyFfjlJcgjServiceImpl.java index d71b7ce..fcd6d8f 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyFfjlJcgjServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyFfjlJcgjServiceImpl.java @@ -3,12 +3,10 @@ package com.hxhq.business.service.impl; import java.util.List; import java.util.Map; -import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.hxhq.business.domain.MjyJcgj; import com.hxhq.business.utils.JctUtil; -import com.hxhq.business.utils.MjyJcnrUtil; +import com.hxhq.business.utils.lang.MjyJcnrUtil; import com.hxhq.common.core.exception.ServiceException; import com.hxhq.common.core.utils.StringUtils; import com.hxhq.system.api.domain.SysUser; diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyJcgjServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyJcgjServiceImpl.java index d94325d..668543a 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyJcgjServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyJcgjServiceImpl.java @@ -3,12 +3,11 @@ package com.hxhq.business.service.impl; import java.util.List; import java.util.Map; -import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hxhq.business.domain.MjyJcgj; import com.hxhq.business.utils.JctUtil; -import com.hxhq.business.utils.MjyJcnrUtil; +import com.hxhq.business.utils.lang.MjyJcnrUtil; import com.hxhq.common.core.exception.ServiceException; import com.hxhq.common.core.utils.StringUtils; import com.hxhq.system.api.domain.SysUser; diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyTzServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyTzServiceImpl.java index e180c96..5d4b07c 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyTzServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyTzServiceImpl.java @@ -4,7 +4,7 @@ import java.util.List; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.hxhq.business.utils.MjyJcnrUtil; +import com.hxhq.business.utils.lang.MjyJcnrUtil; import com.hxhq.common.core.exception.ServiceException; import com.hxhq.system.api.domain.SysUser; import org.springframework.stereotype.Service; diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormApplyJcgjServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormApplyJcgjServiceImpl.java index 88dd4b2..b9f3189 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormApplyJcgjServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormApplyJcgjServiceImpl.java @@ -7,16 +7,13 @@ import java.util.Map; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hxhq.business.domain.StudyFormApplyJcgj; -import com.hxhq.business.domain.StudyFormPreJcgj; import com.hxhq.business.utils.JctUtil; -import com.hxhq.business.utils.StudyFormUtil; +import com.hxhq.business.utils.lang.StudyFormUtil; import com.hxhq.common.core.exception.ServiceException; -import com.hxhq.common.core.utils.DateUtils; import com.hxhq.common.core.utils.StringUtils; import com.hxhq.system.api.domain.SysUser; import org.springframework.stereotype.Service; import com.hxhq.business.mapper.StudyFormApplyJcgjMapper; -import com.hxhq.business.domain.StudyFormApplyJcgj; import com.hxhq.business.service.IStudyFormApplyJcgjService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormApplyQmxxServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormApplyQmxxServiceImpl.java index 18a8fe0..d4587bc 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormApplyQmxxServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormApplyQmxxServiceImpl.java @@ -4,14 +4,11 @@ import java.util.List; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hxhq.business.domain.StudyFormApplyQmxx; -import com.hxhq.business.domain.StudyFormPreQmxx; -import com.hxhq.business.utils.StudyFormUtil; +import com.hxhq.business.utils.lang.StudyFormUtil; import com.hxhq.common.core.exception.ServiceException; -import com.hxhq.common.core.utils.DateUtils; import com.hxhq.system.api.domain.SysUser; import org.springframework.stereotype.Service; import com.hxhq.business.mapper.StudyFormApplyQmxxMapper; -import com.hxhq.business.domain.StudyFormApplyQmxx; import com.hxhq.business.service.IStudyFormApplyQmxxService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormApplyServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormApplyServiceImpl.java index 22490e1..e33abff 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormApplyServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormApplyServiceImpl.java @@ -6,21 +6,18 @@ import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hxhq.business.domain.*; -import com.hxhq.business.dto.mjy.DetailDto; import com.hxhq.business.dto.study.StudyFormApplyListDto; import com.hxhq.business.enums.NormalEnum; import com.hxhq.business.enums.study.StudyFormApplyBdztEnum; -import com.hxhq.business.enums.study.StudyFormApplyBdztEnum; import com.hxhq.business.enums.zykgl.JcgjlxEnum; import com.hxhq.business.enums.zykgl.JcmcysEnum; -import com.hxhq.business.enums.zykgl.JlztEnum; import com.hxhq.business.form.study.*; import com.hxhq.business.form.study.StudyFormApplySearchForm; import com.hxhq.business.service.IStudyFormApplyJcgjService; import com.hxhq.business.service.IStudyFormApplyQmxxService; import com.hxhq.business.utils.JctUtil; import com.hxhq.business.utils.ObjectCompareUtil; -import com.hxhq.business.utils.StudyFormUtil; +import com.hxhq.business.utils.lang.StudyFormUtil; import com.hxhq.common.core.exception.ServiceException; import com.hxhq.common.core.utils.StringUtils; import com.hxhq.common.security.utils.SecurityUtils; diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormFillJcgjServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormFillJcgjServiceImpl.java index 156b0b1..51169a1 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormFillJcgjServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormFillJcgjServiceImpl.java @@ -6,13 +6,10 @@ import java.util.Map; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.hxhq.business.domain.GyzjJcgj; -import com.hxhq.business.domain.StudyFormPreJcgj; -import com.hxhq.business.utils.StudyFormUtil; +import com.hxhq.business.enums.zykgl.JcgjlxEnum; +import com.hxhq.business.utils.lang.StudyFormUtil; import com.hxhq.business.utils.JctUtil; -import com.hxhq.business.utils.StudyFormUtil; import com.hxhq.common.core.exception.ServiceException; -import com.hxhq.common.core.utils.DateUtils; import com.hxhq.common.core.utils.StringUtils; import com.hxhq.system.api.domain.SysUser; import org.springframework.stereotype.Service; @@ -44,7 +41,12 @@ public class StudyFormFillJcgjServiceImpl extends ServiceImpl0){ - queryWrapper.eq("jcgjlx",studyFormFillJcgj.getJcgjlx()); + Integer jcgjlxExport=999; + if(studyFormFillJcgj.getJcgjlx().intValue()==jcgjlxExport){ + queryWrapper.notIn("jcgjlx", JcgjlxEnum.xg.getValue()); + }else{ + queryWrapper.eq("jcgjlx",studyFormFillJcgj.getJcgjlx()); + } } if (StringUtils.isNoneBlank(studyFormFillJcgj.getJcmc())) { queryWrapper.and(p -> p.like("`jcmc`", studyFormFillJcgj.getJcmc()) diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormFillQmxxServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormFillQmxxServiceImpl.java index 08b3ed7..0370a73 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormFillQmxxServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormFillQmxxServiceImpl.java @@ -3,10 +3,8 @@ package com.hxhq.business.service.impl; import java.util.List; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.hxhq.business.domain.StudyFormPreQmxx; -import com.hxhq.business.utils.StudyFormUtil; +import com.hxhq.business.utils.lang.StudyFormUtil; import com.hxhq.common.core.exception.ServiceException; -import com.hxhq.common.core.utils.DateUtils; import com.hxhq.system.api.domain.SysUser; import org.springframework.stereotype.Service; import com.hxhq.business.mapper.StudyFormFillQmxxMapper; diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormFillServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormFillServiceImpl.java index 57c1325..75c514b 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormFillServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormFillServiceImpl.java @@ -17,7 +17,7 @@ import com.hxhq.business.form.study.StudyFormFillSearchForm; import com.hxhq.business.service.*; import com.hxhq.business.utils.JctUtil; import com.hxhq.business.utils.ObjectCompareUtil; -import com.hxhq.business.utils.StudyFormUtil; +import com.hxhq.business.utils.lang.StudyFormUtil; import com.hxhq.common.core.exception.ServiceException; import com.hxhq.common.core.utils.StringUtils; import com.hxhq.common.security.utils.SecurityUtils; diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormPlanJcgjServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormPlanJcgjServiceImpl.java index 090c4bd..f162229 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormPlanJcgjServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormPlanJcgjServiceImpl.java @@ -7,16 +7,13 @@ import java.util.Map; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hxhq.business.domain.StudyFormPlanJcgj; -import com.hxhq.business.domain.StudyFormPlanJcgj; import com.hxhq.business.utils.JctUtil; -import com.hxhq.business.utils.StudyFormUtil; +import com.hxhq.business.utils.lang.StudyFormUtil; import com.hxhq.common.core.exception.ServiceException; -import com.hxhq.common.core.utils.DateUtils; import com.hxhq.common.core.utils.StringUtils; import com.hxhq.system.api.domain.SysUser; import org.springframework.stereotype.Service; import com.hxhq.business.mapper.StudyFormPlanJcgjMapper; -import com.hxhq.business.domain.StudyFormPlanJcgj; import com.hxhq.business.service.IStudyFormPlanJcgjService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormPlanQmxxServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormPlanQmxxServiceImpl.java index 3c3ab6b..a5624c3 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormPlanQmxxServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormPlanQmxxServiceImpl.java @@ -4,14 +4,11 @@ import java.util.List; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hxhq.business.domain.StudyFormPlanQmxx; -import com.hxhq.business.domain.StudyFormPlanQmxx; -import com.hxhq.business.utils.StudyFormUtil; +import com.hxhq.business.utils.lang.StudyFormUtil; import com.hxhq.common.core.exception.ServiceException; -import com.hxhq.common.core.utils.DateUtils; import com.hxhq.system.api.domain.SysUser; import org.springframework.stereotype.Service; import com.hxhq.business.mapper.StudyFormPlanQmxxMapper; -import com.hxhq.business.domain.StudyFormPlanQmxx; import com.hxhq.business.service.IStudyFormPlanQmxxService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormPlanServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormPlanServiceImpl.java index 5da583e..613555e 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormPlanServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormPlanServiceImpl.java @@ -9,7 +9,6 @@ import com.hxhq.business.domain.*; import com.hxhq.business.domain.StudyFormPlan; import com.hxhq.business.dto.study.StudyFormPlanListDto; import com.hxhq.business.enums.study.StudyFormPlanBdztEnum; -import com.hxhq.business.enums.study.StudyFormPlanBdztEnum; import com.hxhq.business.enums.zykgl.JcgjlxEnum; import com.hxhq.business.enums.zykgl.JcmcysEnum; import com.hxhq.business.form.study.StudyFormPlanSearchForm; @@ -18,7 +17,7 @@ import com.hxhq.business.service.IStudyFormPlanJcgjService; import com.hxhq.business.service.IStudyFormPlanQmxxService; import com.hxhq.business.utils.JctUtil; import com.hxhq.business.utils.ObjectCompareUtil; -import com.hxhq.business.utils.StudyFormUtil; +import com.hxhq.business.utils.lang.StudyFormUtil; import com.hxhq.common.core.exception.ServiceException; import com.hxhq.common.core.utils.StringUtils; import com.hxhq.common.security.utils.SecurityUtils; diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormPreJcgjServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormPreJcgjServiceImpl.java index 8ee107b..46fefa0 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormPreJcgjServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormPreJcgjServiceImpl.java @@ -6,17 +6,14 @@ import java.util.Map; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.hxhq.business.domain.MjyJcgj; import com.hxhq.business.domain.StudyFormPreJcgj; import com.hxhq.business.utils.JctUtil; -import com.hxhq.business.utils.StudyFormUtil; +import com.hxhq.business.utils.lang.StudyFormUtil; import com.hxhq.common.core.exception.ServiceException; -import com.hxhq.common.core.utils.DateUtils; import com.hxhq.common.core.utils.StringUtils; import com.hxhq.system.api.domain.SysUser; import org.springframework.stereotype.Service; import com.hxhq.business.mapper.StudyFormPreJcgjMapper; -import com.hxhq.business.domain.StudyFormPreJcgj; import com.hxhq.business.service.IStudyFormPreJcgjService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormPreQmxxServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormPreQmxxServiceImpl.java index e133943..e475bef 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormPreQmxxServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormPreQmxxServiceImpl.java @@ -4,15 +4,11 @@ import java.util.List; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hxhq.business.domain.StudyFormPreQmxx; -import com.hxhq.business.domain.StudyFormPreJcgj; -import com.hxhq.business.utils.StudyFormUtil; +import com.hxhq.business.utils.lang.StudyFormUtil; import com.hxhq.common.core.exception.ServiceException; -import com.hxhq.common.core.utils.DateUtils; -import com.hxhq.common.core.utils.StringUtils; import com.hxhq.system.api.domain.SysUser; import org.springframework.stereotype.Service; import com.hxhq.business.mapper.StudyFormPreQmxxMapper; -import com.hxhq.business.domain.StudyFormPreQmxx; import com.hxhq.business.service.IStudyFormPreQmxxService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormPreServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormPreServiceImpl.java index 10a2c9b..404784e 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormPreServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormPreServiceImpl.java @@ -7,20 +7,17 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hxhq.business.domain.*; import com.hxhq.business.dto.study.StudyFormPreListDto; -import com.hxhq.business.enums.NormalEnum; -import com.hxhq.business.enums.study.StudyFormPlanBdztEnum; import com.hxhq.business.enums.study.StudyFormPreBdztEnum; import com.hxhq.business.enums.study.StudyFormPreFzrshztEnum; import com.hxhq.business.enums.zykgl.JcgjlxEnum; import com.hxhq.business.enums.zykgl.JcmcysEnum; -import com.hxhq.business.form.common.SignForm; import com.hxhq.business.form.study.StudyFormPreAuditForm; import com.hxhq.business.form.study.StudyFormPreSearchForm; import com.hxhq.business.form.study.StudyFormUpdateForm; import com.hxhq.business.service.*; import com.hxhq.business.utils.JctUtil; import com.hxhq.business.utils.ObjectCompareUtil; -import com.hxhq.business.utils.StudyFormUtil; +import com.hxhq.business.utils.lang.StudyFormUtil; import com.hxhq.common.core.exception.ServiceException; import com.hxhq.common.core.utils.StringUtils; import com.hxhq.common.security.utils.SecurityUtils; @@ -30,7 +27,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.hxhq.business.mapper.StudyFormPreMapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.web.bind.annotation.PostMapping; /** * 试验-预填单Service业务层处理 diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/GyzjJcnrUtil.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/lang/GyzjJcnrUtil.java similarity index 97% rename from hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/GyzjJcnrUtil.java rename to hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/lang/GyzjJcnrUtil.java index 3b08616..8616bf7 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/GyzjJcnrUtil.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/lang/GyzjJcnrUtil.java @@ -1,5 +1,6 @@ -package com.hxhq.business.utils; +package com.hxhq.business.utils.lang; +import com.hxhq.business.utils.JctUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -96,6 +97,7 @@ public class GyzjJcnrUtil { mapLang.put("领取发放","Distribution"); mapLang.put("存储","Storage"); mapLang.put("取出","Take Out"); + mapLang.put("给药制剂详情","Dose Information"); mapLang.put("表单名称","Preset Name"); mapLang.put("锁定发放记录","Lock Record"); diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/MjyJcnrUtil.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/lang/MjyJcnrUtil.java similarity index 97% rename from hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/MjyJcnrUtil.java rename to hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/lang/MjyJcnrUtil.java index 6b73853..ccf0b48 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/MjyJcnrUtil.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/lang/MjyJcnrUtil.java @@ -1,6 +1,6 @@ -package com.hxhq.business.utils; +package com.hxhq.business.utils.lang; -import com.alibaba.fastjson2.JSONObject; +import com.hxhq.business.utils.JctUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -98,6 +98,8 @@ public class MjyJcnrUtil { mapLang.put("解锁发放记录","Unlock Record"); mapLang.put("麻精药入库","Controlled Drug Check-in"); mapLang.put("目的","Purpose"); + mapLang.put("麻精药详情","Drug Information"); + mapLang.put("入库位置","入库位置"); mapLang.put("入库条件","入库条件"); mapLang.put("减少量","减少量"); diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/StudyFormUtil.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/lang/StudyFormUtil.java similarity index 97% rename from hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/StudyFormUtil.java rename to hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/lang/StudyFormUtil.java index f1d60e4..9540743 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/StudyFormUtil.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/lang/StudyFormUtil.java @@ -1,5 +1,6 @@ -package com.hxhq.business.utils; +package com.hxhq.business.utils.lang; +import com.hxhq.business.utils.JctUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/TemplateUtil.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/lang/TemplateUtil.java similarity index 98% rename from hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/TemplateUtil.java rename to hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/lang/TemplateUtil.java index dc688cb..39315df 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/TemplateUtil.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/lang/TemplateUtil.java @@ -1,5 +1,6 @@ -package com.hxhq.business.utils; +package com.hxhq.business.utils.lang; +import com.hxhq.business.utils.JctUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -67,6 +68,9 @@ public class TemplateUtil { mapLang.put("签名时间","Date"); mapLang.put("备注原因","Comment/Reason"); + + + } public static void main(String[] args) { diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/PdfBaseUtil.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/PdfBaseUtil.java index 0cea8e3..bcdbf9d 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/PdfBaseUtil.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/PdfBaseUtil.java @@ -33,7 +33,7 @@ public class PdfBaseUtil { * * @return 完整文件路径, */ - public static String getFilePath(String localFilePath) { + public static String getFilePath(String localFilePath,String type) { // 1. 获取当前年月日并创建文件夹 Date now = new Date(); SimpleDateFormat yearFormat = new SimpleDateFormat("yyyy"); @@ -55,13 +55,13 @@ public class PdfBaseUtil { dir.mkdirs(); } // 4. 生成文件名 - String fileName = "document_" + timestamp + ".pdf"; + String fileName =type+ "_" + timestamp + ".pdf"; // 5. 完整文件路径 return Paths.get(folderPath, fileName).toString(); } /** - * 添加带下划线的标题 + * 添加标题 * * @param document PDF文档对象 * @param titleText 标题文本 @@ -107,7 +107,7 @@ public class PdfBaseUtil { * @param filePath * @param signText */ - public static Document init(Document document, FileOutputStream fos, String filePath, String signText, String headerText) { + public static Document init(Document document, FileOutputStream fos, String filePath, String signText, String headerText,Boolean showHaderLine) { try { // 创建PDF文档 设置文档边距,避免内容遮挡页眉页脚 // 顶部边距(为页眉留出空间) @@ -125,11 +125,11 @@ public class PdfBaseUtil { fos = new FileOutputStream(filePath); PdfWriter writer = PdfWriter.getInstance(document, fos); // 设置页面事件,每页添加文字页眉 - writer.setPageEvent(new PdfBaseUtil.TextHeaderEvent(signText, headerText)); + writer.setPageEvent(new PdfBaseUtil.TextHeaderEvent(signText, headerText,showHaderLine)); // 5. 设置PDF属性 - document.addTitle("华西海圻"); - document.addAuthor("华西海圻"); - document.addCreator("华西海圻"); + document.addTitle("hxhq"); + document.addAuthor("hxhq"); + document.addCreator("hxhq"); document.addCreationDate(); document.open(); return document; @@ -234,11 +234,13 @@ public class PdfBaseUtil { private String signText; private String headerText; private BaseFont baseFont; + private Boolean showHaderLine=true; private int totalPages = 0; private PdfTemplate total; - public TextHeaderEvent(String signText, String headerText) throws Exception { + public TextHeaderEvent(String signText, String headerText,Boolean showHaderLine) throws Exception { try { + this.showHaderLine = showHaderLine; this.signText = signText; this.headerText = headerText; // 创建字体(支持中文) @@ -350,8 +352,10 @@ public class PdfBaseUtil { canvas.showText(headerText); canvas.endText(); - // 添加页眉分隔线(可选) - addHeaderLine(canvas, pageWidth, textY - 10); + if(showHaderLine){ + // 添加页眉分隔线(可选) + addHeaderLine(canvas, pageWidth, textY - 10); + } } } catch (Exception e) { @@ -369,13 +373,13 @@ public class PdfBaseUtil { */ private void addRepeatedWatermark(PdfContentByte content, float width, float height, String signText) { // 计算文字尺寸 - float fontSize = Convert.toFloat("8"); - float textWidth = baseFont.getWidthPoint(signText, fontSize); + float fontSize = Convert.toFloat("10"); + float textWidth = baseFont.getWidthPoint(signText, fontSize)+50; float textHeight = baseFont.getAscentPoint(signText, fontSize) - baseFont.getDescentPoint(signText, fontSize); // 计算间距 - float stepX = textWidth + 150; + float stepX = textWidth + 70; float stepY = textHeight + 100; // 添加重复水印 diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/resource/Dosage.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/resource/Dosage.java index b884f0f..83a49c4 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/resource/Dosage.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/resource/Dosage.java @@ -6,7 +6,7 @@ import com.hxhq.business.domain.GyzjJcgj; import com.hxhq.business.domain.GyzjTz; import com.hxhq.business.dto.gyzj.DetailDto; import com.hxhq.business.enums.zykgl.ZjztEnum; -import com.hxhq.business.utils.GyzjJcnrUtil; +import com.hxhq.business.utils.lang.GyzjJcnrUtil; import com.hxhq.business.utils.pdf.PdfBaseUtil; import com.hxhq.business.utils.pdf.PdfExportUtil; import com.hxhq.common.core.utils.StringUtils; @@ -41,14 +41,14 @@ public class Dosage { language=lang; Document document = null; FileOutputStream fos = null; - String filePath = PdfBaseUtil.getFilePath(localFilePath); + String filePath = PdfBaseUtil.getFilePath(localFilePath,"Dosage"); try { String sign = "hxhq"; LoginUser loginUser = SecurityUtils.getLoginUser(); if (loginUser != null) { sign = loginUser.getSysUser().getNickName(); } - document = PdfBaseUtil.init(document, fos, filePath, sign + PdfExportUtil.parseDateToStr(new Date()), null); + document = PdfBaseUtil.init(document, fos, filePath, sign + PdfExportUtil.parseDateToStr(new Date()), getName("麻精药详情"),false); // 基本信息 PdfBaseUtil.addUnderlinedTitle(document, getName("基本信息"), 10, true); Map formData1 = new LinkedHashMap<>(); @@ -149,9 +149,9 @@ public class Dosage { */ public void addJcgj(Document document, List gyzjJcgjList, String lang) throws IOException, DocumentException { for (GyzjJcgj jcgj : gyzjJcgjList) { - PdfBaseUtil.addUnderlinedTitle(document, PdfExportUtil.parseDateToStr(jcgj.getCreateTime())+ " " + getName(jcgj.getJcmc()), 10, false); StringJoiner result = new StringJoiner(", "); if ("en".equals(lang)) { + PdfBaseUtil.addUnderlinedTitle(document, PdfExportUtil.parseDateToStr(jcgj.getCreateTime())+ " " + jcgj.getJcmcEn(), 10, false); if (StringUtils.isNoneBlank(jcgj.getJcnrEn())) { ObjectMapper mapper = new ObjectMapper(); JsonNode jsonArray = mapper.readTree(jcgj.getJcnrEn()); @@ -159,11 +159,12 @@ public class Dosage { if (node.get("name") != null) { String name = node.get("name").asText(); String value = node.get("value").asText(); - result.add(name + ":" + value); + result.add(name + ":" + value); } } } } else { + PdfBaseUtil.addUnderlinedTitle(document, PdfExportUtil.parseDateToStr(jcgj.getCreateTime())+ " " + jcgj.getJcmc(), 10, false); if (StringUtils.isNoneBlank(jcgj.getJcnr())) { ObjectMapper mapper = new ObjectMapper(); JsonNode jsonArray = mapper.readTree(jcgj.getJcnr()); @@ -171,7 +172,7 @@ public class Dosage { if (node.get("name") != null) { String name = node.get("name").asText(); String value = node.get("value").asText(); - result.add(name + ":" + value); + result.add(name + ":" + value); } } } @@ -179,7 +180,7 @@ public class Dosage { if (StringUtils.isNoneBlank(jcgj.getRemark())) { result.add(getName("备注")+":" + jcgj.getRemark()); } - if (StringUtils.isNoneBlank(jcgj.getRemark())) { + if (StringUtils.isNoneBlank(jcgj.getQmrMc())) { result.add(getName("签名人")+":" + jcgj.getQmrMc()); } PdfBaseUtil.addUnderlinedTitle(document, result.toString(), 10, false); diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/resource/Drug.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/resource/Drug.java index d67a7d3..b0fd093 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/resource/Drug.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/resource/Drug.java @@ -5,7 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.hxhq.business.domain.*; import com.hxhq.business.dto.mjy.DetailDto; import com.hxhq.business.enums.zykgl.ZjztEnum; -import com.hxhq.business.utils.MjyJcnrUtil; +import com.hxhq.business.utils.lang.MjyJcnrUtil; import com.hxhq.business.utils.pdf.PdfBaseUtil; import com.hxhq.business.utils.pdf.PdfExportUtil; import com.hxhq.common.core.utils.StringUtils; @@ -40,14 +40,14 @@ public class Drug { language=lang; Document document = null; FileOutputStream fos = null; - String filePath = PdfBaseUtil.getFilePath(localFilePath); + String filePath = PdfBaseUtil.getFilePath(localFilePath,"Drug"); try { String sign = "hxhq" ; LoginUser loginUser = SecurityUtils.getLoginUser(); if (loginUser != null) { sign = loginUser.getSysUser().getNickName(); } - document = PdfBaseUtil.init(document, fos, filePath, sign + PdfExportUtil.parseDateToStr(new Date()), null); + document = PdfBaseUtil.init(document, fos, filePath, sign + PdfExportUtil.parseDateToStr(new Date()), getName("麻精药详情"),false); // 基本信息 PdfBaseUtil.addUnderlinedTitle(document, getName("基本信息"), 10, true); Map formData1 = new LinkedHashMap<>(); @@ -148,9 +148,9 @@ public class Drug { */ public void addJcgj(Document document, List mjyJcgjList, String lang) throws IOException, DocumentException { for (MjyJcgj jcgj : mjyJcgjList) { - PdfBaseUtil.addUnderlinedTitle(document, PdfExportUtil.parseDateToStr(jcgj.getCreateTime())+ " " + getName(jcgj.getJcmc()), 10, false); StringJoiner result = new StringJoiner(", "); if ("en".equals(lang)) { + PdfBaseUtil.addUnderlinedTitle(document, PdfExportUtil.parseDateToStr(jcgj.getCreateTime())+ " " + jcgj.getJcmcEn(), 10, false); if (StringUtils.isNoneBlank(jcgj.getJcnrEn())) { ObjectMapper mapper = new ObjectMapper(); JsonNode jsonArray = mapper.readTree(jcgj.getJcnrEn()); @@ -158,11 +158,12 @@ public class Drug { if (node.get("name") != null) { String name = node.get("name").asText(); String value = node.get("value").asText(); - result.add(name + ":" + value); + result.add(name + ":" + value); } } } } else { + PdfBaseUtil.addUnderlinedTitle(document, PdfExportUtil.parseDateToStr(jcgj.getCreateTime())+ " " + jcgj.getJcmc(), 10, false); if (StringUtils.isNoneBlank(jcgj.getJcnr())) { ObjectMapper mapper = new ObjectMapper(); JsonNode jsonArray = mapper.readTree(jcgj.getJcnr()); @@ -170,7 +171,7 @@ public class Drug { if (node.get("name") != null) { String name = node.get("name").asText(); String value = node.get("value").asText(); - result.add(name + ":" + value); + result.add(name + ":" + value); } } } @@ -178,7 +179,7 @@ public class Drug { if (StringUtils.isNoneBlank(jcgj.getRemark())) { result.add(getName("备注")+":" + jcgj.getRemark()); } - if (StringUtils.isNoneBlank(jcgj.getRemark())) { + if (StringUtils.isNoneBlank(jcgj.getQmrMc())) { result.add(getName("签名人")+":" + jcgj.getQmrMc()); } PdfBaseUtil.addUnderlinedTitle(document, result.toString(), 10, false); diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/template/SP001.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/template/SP001.java deleted file mode 100644 index 1621b94..0000000 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/template/SP001.java +++ /dev/null @@ -1,258 +0,0 @@ -package com.hxhq.business.utils.pdf.template; - -import com.alibaba.fastjson2.JSONArray; -import com.alibaba.fastjson2.JSONObject; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.hxhq.business.domain.*; -import com.hxhq.business.utils.TemplateUtil; -import com.hxhq.business.utils.pdf.PdfBaseUtil; -import com.hxhq.business.utils.pdf.PdfExportUtil; -import com.hxhq.common.core.utils.StringUtils; -import com.hxhq.common.security.utils.SecurityUtils; -import com.hxhq.system.api.model.LoginUser; -import com.itextpdf.text.*; -import com.itextpdf.text.pdf.BaseFont; -import com.itextpdf.text.pdf.PdfPCell; -import com.itextpdf.text.pdf.PdfPTable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.*; -import java.util.List; - -/** - * 色谱-生物样品分析溶液配制表 - * - * @author tanfei - */ -public class SP001 { - private static final Logger logger = LoggerFactory.getLogger(SP001.class.getName()); - public String language = "zh"; - - /** - * 导出 - * - * @param studyFormFill - * @return - */ - public String exportDetail(StudyFormFill studyFormFill,Template template, List studyFormFillQmxxList, List studyFormFillJcgjList, String lang, String localFilePath) { - language = lang; - Document document = null; - FileOutputStream fos = null; - String filePath = PdfBaseUtil.getFilePath(localFilePath); - try { - String sign = "hxhq"; - LoginUser loginUser = SecurityUtils.getLoginUser(); - if (loginUser != null) { - sign = loginUser.getSysUser().getNickName(); - } - document = PdfBaseUtil.init(document, fos, filePath, sign +PdfExportUtil.parseDateToStr(new Date()), "en".equals(language)?template.getShowSn():template.getName()); - // 基本信息 - - JSONObject bdnr = JSONObject.parseObject(studyFormFill.getBdnr()); - PdfBaseUtil.addUnderlinedTitle(document, getName("试验基本信息"), 10, true); - Map formData1 = new LinkedHashMap<>(); - formData1.put(getName("试验名称"), studyFormFill.getStudyMc()); - formData1.put(getName("试验编号"), studyFormFill.getStudySn()); - formData1.put(getName("方法编号"), bdnr.getString("methodCode")); - formData1.put(getName("版本号"), bdnr.getString("methodCode")); - PdfBaseUtil.addFormTableColumns(document, formData1, 2); - - PdfBaseUtil.addUnderlinedTitle(document, getName("试验配置条件"), 10, true); - Map formData2 = new LinkedHashMap<>(); - formData2.put(getName("预填"), bdnr.getString("pre") + (StringUtils.isNoneBlank(bdnr.getString("preOther")) ? bdnr.getString("preOther") : "")); - formData2.put(getName("实际"), bdnr.getString("act") + (StringUtils.isNoneBlank(bdnr.getString("actOther")) ? bdnr.getString("actOther") : "")); - PdfBaseUtil.addFormTableColumns(document, formData2, 2); - - PdfBaseUtil.addUnderlinedTitle(document, getName("配置时间"), 10, true); - Map formData3 = new LinkedHashMap<>(); - formData3.put(getName("开始时间"), studyFormFill.getStartDate() != null ? PdfExportUtil.parseDateToStr(studyFormFill.getStartDate()) : ""); - formData3.put(getName("结束时间"), studyFormFill.getEndDate() != null ? PdfExportUtil.parseDateToStr(studyFormFill.getEndDate()) : ""); - PdfBaseUtil.addFormTableColumns(document, formData3, 2); - - // 签名信息 - PdfBaseUtil.addUnderlinedTitle(document, getName("试验试剂信息"), 10, true); - addResource(document, studyFormFill.getResource()); - - PdfBaseUtil.addUnderlinedTitle(document, getName("仪器使用信息"), 10, true); - PdfBaseUtil.addUnderlinedTitle(document, getName("存储条件"), 10, true); - Map formData4 = new LinkedHashMap<>(); - formData4.put(getName("存储条件"), bdnr.getString("storageCondition") + (StringUtils.isNoneBlank(bdnr.getString("storageConditionOther")) ? bdnr.getString("storageConditionOther") : "")); - PdfBaseUtil.addFormTableColumns(document, formData4, 1); - - PdfBaseUtil.addUnderlinedTitle(document, getName("操作步骤"), 10, true); - Map formData5 = new LinkedHashMap<>(); - formData5.put(getName("目标溶液名称"), bdnr.getString("targetName")); - formData5.put(getName("目标溶液编号"), bdnr.getString("targetCode") + bdnr.getString("targetCodeSn")); - formData5.put(getName("目标溶液预计浓度"), bdnr.getString("targetPreConcentration") + bdnr.getString("targetPreConcentrationUnit")); - formData5.put(getName("目标溶液实际浓度"), bdnr.getString("targetActConcentration") + bdnr.getString("targetPreConcentrationUnit")); - formData5.put(getName("目标溶液预计体积"), bdnr.getString("targetPreVolume") + bdnr.getString("targetPreVolumeUnit")); - formData5.put(getName("目标溶液实际体积"), bdnr.getString("targetActVolume") + bdnr.getString("targetActVolumeUnit")); - formData5.put(getName("有效周期"), bdnr.getString("effectivePeriod") + bdnr.getString("effectivePeriodUnit")); - formData5.put(getName("失效日"), bdnr.getString("sxrq")); - PdfBaseUtil.addFormTableColumns(document, formData5, 2); - PdfBaseUtil.addUnderlinedTitle(document, getName("备注") + ":" +(StringUtils.isNoneBlank(bdnr.getString("remark")) ? bdnr.getString("remark") : ""), 10, false); - - // 签名信息 - PdfBaseUtil.addUnderlinedTitle(document, getName("签名信息"), 10, true); - addQmxx(document, studyFormFillQmxxList); - //稽查轨迹 - PdfBaseUtil.addUnderlinedTitle(document, getName("稽查轨迹"), 10, true); - addJcgj(document, studyFormFillJcgjList); - logger.info("生成成功:{}", filePath); - } catch (Exception e) { - logger.error("生成失败", e); - throw new RuntimeException("生成失败: " + e.getMessage()); - } finally { - if (document != null) { - document.close(); - } - if (fos != null) { - try { - fos.close(); - } catch (IOException e) { - logger.error("关闭文件流失败", e); - } - } - } - return filePath; - } - - /** - * 仪器使用信息 - * - * @param document - * @param resource - * @throws IOException - * @throws DocumentException - */ - public void addResource(Document document, String resource) throws IOException, DocumentException { -// [{"mc":"布洛芬","bh":"BLF260115-0014","ph":"","nd":"18ng/mL","source":"ELN配制","ndz":18,"nddw":"ng/mL","kc":1190,"kcdw":"3","syl":"4","syldw":"3","yxzq":360,"yxzqdw":"days"}] - if (StringUtils.isNoneBlank(resource)) { - JSONArray jsonArray = JSONArray.parseArray(resource); - // 9. 表头 - BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED); - Font headerFont = new Font(bfChinese, 10, Font.NORMAL); - Font contentFont = new Font(bfChinese, 10, Font.NORMAL); - // 8. 创建表格 - PdfPTable table = new PdfPTable(6); - table.setWidthPercentage(100); - String[] headers = {getName("试剂名称"), getName("编号"), getName("批号"), getName("浓度/含量/纯度"), getName("来源"), getName("失效日")}; - for (String header : headers) { - PdfPCell cell = new PdfPCell(new Phrase(header, headerFont)); - cell.setHorizontalAlignment(Element.ALIGN_CENTER); - cell.setPadding(8); - cell.setBorderWidth(1); - table.addCell(cell); - } - int rowNum = 0; - for (int i = 0; i < jsonArray.size(); i++) { - JSONObject obj = jsonArray.getJSONObject(i); - // 交替行颜色 - if (rowNum % 2 == 0) { - table.getDefaultCell().setBackgroundColor(BaseColor.WHITE); - } else { - table.getDefaultCell().setBackgroundColor(BaseColor.WHITE); - } - table.addCell(PdfBaseUtil.createCell(obj.getString("mc"), contentFont)); - table.addCell(PdfBaseUtil.createCell(obj.getString("bh"), contentFont)); - table.addCell(PdfBaseUtil.createCell(obj.getString("ph"), contentFont)); - table.addCell(PdfBaseUtil.createCell(obj.getString("nd"), contentFont)); - table.addCell(PdfBaseUtil.createCell(obj.getString("source"), contentFont)); - table.addCell(PdfBaseUtil.createCell(StringUtils.isNoneBlank(obj.getString("sxrq")) ? obj.getString("sxrq") : "", contentFont)); - rowNum++; - } - document.add(table); - - } - } - - - /** - * 签名信息 - * - * @param document - * @param studyFormFillQmxxList - * @throws IOException - * @throws DocumentException - */ - public void addQmxx(Document document, List studyFormFillQmxxList) throws IOException, DocumentException { - // 9. 表头 - BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED); - Font headerFont = new Font(bfChinese, 10, Font.NORMAL); - Font contentFont = new Font(bfChinese, 10, Font.NORMAL); - // 8. 创建表格 - PdfPTable table = new PdfPTable(4); - table.setWidthPercentage(100); - String[] headers = {getName("签名人"), getName("签名意义"), getName("签名时间"), getName("备注原因")}; - for (String header : headers) { - PdfPCell cell = new PdfPCell(new Phrase(header, headerFont)); - cell.setHorizontalAlignment(Element.ALIGN_CENTER); - cell.setPadding(8); - cell.setBorderWidth(1); - table.addCell(cell); - } - int rowNum = 0; - for (StudyFormFillQmxx studyFormFillQmxx : studyFormFillQmxxList) { - // 交替行颜色 - if (rowNum % 2 == 0) { - table.getDefaultCell().setBackgroundColor(BaseColor.WHITE); - } else { - table.getDefaultCell().setBackgroundColor(BaseColor.WHITE); - } - table.addCell(PdfBaseUtil.createCell(studyFormFillQmxx.getQmrMc(), contentFont)); - table.addCell(PdfBaseUtil.createCell(studyFormFillQmxx.getQmyy(), contentFont)); - table.addCell(PdfBaseUtil.createCell(PdfExportUtil.parseDateToStr(studyFormFillQmxx.getCreateTime()), contentFont)); - table.addCell(PdfBaseUtil.createCell(studyFormFillQmxx.getRemark(), contentFont)); - rowNum++; - } - document.add(table); - } - - /** - * 稽查轨迹 - * - * @param document - * @param studyFormFillJcgjList - * @throws IOException - * @throws DocumentException - */ - public void addJcgj(Document document, List studyFormFillJcgjList) throws IOException, DocumentException { - for (StudyFormFillJcgj jcgj : studyFormFillJcgjList) { - PdfBaseUtil.addUnderlinedTitle(document, PdfExportUtil.parseDateToStr(jcgj.getCreateTime()) + " " + jcgj.getJcmc(), 10, false); - StringJoiner result = new StringJoiner(", "); - if (StringUtils.isNoneBlank(jcgj.getJcnr())) { - ObjectMapper mapper = new ObjectMapper(); - JsonNode jsonArray = mapper.readTree(jcgj.getJcnr()); - for (JsonNode node : jsonArray) { - if (node.get("name") != null) { - String name = node.get("name").asText(); - String value = node.get("value") != null ? node.get("value").asText() : ""; - result.add(name + ":" + value); - } - } - } - if (StringUtils.isNoneBlank(jcgj.getRemark())) { - result.add(getName("备注") + ":" + jcgj.getRemark()); - } - if (StringUtils.isNoneBlank(jcgj.getRemark())) { - result.add(getName("签名人") + ":" + jcgj.getQmrMc()); - } - PdfBaseUtil.addUnderlinedTitle(document, result.toString(), 10, false); - } - } - - /** - * 获取名称 - * - * @param name - * @return - */ - public String getName(String name) { - return "en".equals(language) ? TemplateUtil.getEn(name) : name; - } - -} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/template/TemplateBaseUtil.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/template/TemplateBaseUtil.java new file mode 100644 index 0000000..68a85ba --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/template/TemplateBaseUtil.java @@ -0,0 +1,242 @@ +package com.hxhq.business.utils.pdf.template; + +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.hxhq.business.domain.StudyFormFillJcgj; +import com.hxhq.business.domain.StudyFormFillQmxx; +import com.hxhq.business.utils.lang.TemplateUtil; +import com.hxhq.business.utils.pdf.PdfBaseUtil; +import com.hxhq.business.utils.pdf.PdfExportUtil; +import com.hxhq.common.core.utils.StringUtils; +import com.itextpdf.text.*; +import com.itextpdf.text.pdf.BaseFont; +import com.itextpdf.text.pdf.PdfPCell; +import com.itextpdf.text.pdf.PdfPTable; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.util.List; +import java.util.*; + +/** + * 色谱-生物样品分析溶液配制表 + * + * @author tanfei + */ +public class TemplateBaseUtil { + private static final Logger logger = LoggerFactory.getLogger(TemplateBaseUtil.class.getName()); + public static String language = "zh"; + + /** + * 试验试剂信息 + * + * @param document + * @param resource + * @throws IOException + * @throws DocumentException + */ + public static void addResource(Document document, String resource, String lang) throws IOException, DocumentException { +// [{"mc":"布洛芬","bh":"BLF260115-0014","ph":"","nd":"18ng/mL","source":"ELN配制","ndz":18,"nddw":"ng/mL","kc":1190,"kcdw":"3","syl":"4","syldw":"3","yxzq":360,"yxzqdw":"days"}] + language = lang; + // 9. 表头 + BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED); + Font headerFont = new Font(bfChinese, 10, Font.NORMAL); + Font contentFont = new Font(bfChinese, 10, Font.NORMAL); + // 8. 创建表格 + PdfPTable table = new PdfPTable(6); + table.setWidthPercentage(100); + String[] headers = {getName("试剂名称"), getName("编号"), getName("批号"), getName("浓度/含量/纯度"), getName("来源"), getName("失效日")}; + for (String header : headers) { + PdfPCell cell = new PdfPCell(new Phrase(header, headerFont)); + cell.setHorizontalAlignment(Element.ALIGN_CENTER); + cell.setPadding(8); + table.addCell(cell); + } + if (StringUtils.isNoneBlank(resource)) { + JSONArray jsonArray = JSONArray.parseArray(resource); + int rowNum = 0; + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject obj = jsonArray.getJSONObject(i); + // 交替行颜色 + if (rowNum % 2 == 0) { + table.getDefaultCell().setBackgroundColor(BaseColor.WHITE); + } else { + table.getDefaultCell().setBackgroundColor(BaseColor.WHITE); + } + table.addCell(PdfBaseUtil.createCell(obj.getString("mc"), contentFont)); + table.addCell(PdfBaseUtil.createCell(obj.getString("bh"), contentFont)); + table.addCell(PdfBaseUtil.createCell(obj.getString("ph"), contentFont)); + table.addCell(PdfBaseUtil.createCell(obj.getString("nd"), contentFont)); + table.addCell(PdfBaseUtil.createCell(obj.getString("source"), contentFont)); + table.addCell(PdfBaseUtil.createCell(StringUtils.isNoneBlank(obj.getString("sxrq")) ? obj.getString("sxrq") : "", contentFont)); + rowNum++; + } + } + document.add(table); + } + + /** + * 仪器使用信息 + * + * @param document + * @param instrument + * @throws IOException + * @throws DocumentException + */ + public static void addInstrument(Document document, String instrument, String lang) throws IOException, DocumentException { + language = lang; + // 9. 表头 + BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED); + Font headerFont = new Font(bfChinese, 10, Font.NORMAL); + Font contentFont = new Font(bfChinese, 10, Font.NORMAL); + // 8. 创建表格 + PdfPTable table = new PdfPTable(4); + table.setWidthPercentage(100); + String[] headers = {getName("仪器名称"), getName("仪器型号"), getName("仪器编号"), getName("下次测试/校准/检定日期")}; + for (String header : headers) { + PdfPCell cell = new PdfPCell(new Phrase(header, headerFont)); + cell.setHorizontalAlignment(Element.ALIGN_CENTER); + cell.setPadding(8); + table.addCell(cell); + } + if (StringUtils.isNoneBlank(instrument)) { +// JSONArray jsonArray = JSONArray.parseArray(instrument); +// int rowNum = 0; +// for (int i = 0; i < jsonArray.size(); i++) { +// JSONObject obj = jsonArray.getJSONObject(i); +// // 交替行颜色 +// if (rowNum % 2 == 0) { +// table.getDefaultCell().setBackgroundColor(BaseColor.WHITE); +// } else { +// table.getDefaultCell().setBackgroundColor(BaseColor.WHITE); +// } +// table.addCell(PdfBaseUtil.createCell(obj.getString("mc"), contentFont)); +// table.addCell(PdfBaseUtil.createCell(obj.getString("bh"), contentFont)); +// table.addCell(PdfBaseUtil.createCell(obj.getString("ph"), contentFont)); +// table.addCell(PdfBaseUtil.createCell(obj.getString("nd"), contentFont)); +// table.addCell(PdfBaseUtil.createCell(obj.getString("source"), contentFont)); +// table.addCell(PdfBaseUtil.createCell(StringUtils.isNoneBlank(obj.getString("sxrq")) ? obj.getString("sxrq") : "", contentFont)); +// rowNum++; +// } + } + document.add(table); + } + + + /** + * 签名信息 + * + * @param document + * @param studyFormFillQmxxList + * @throws IOException + * @throws DocumentException + */ + public static void addQmxx(Document document, List studyFormFillQmxxList, String lang) throws IOException, DocumentException { + language = lang; + // 9. 表头 + BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED); + Font headerFont = new Font(bfChinese, 10, Font.NORMAL); + Font contentFont = new Font(bfChinese, 10, Font.NORMAL); + // 8. 创建表格 + PdfPTable table = new PdfPTable(4); + table.setWidthPercentage(100); + String[] headers = {getName("签名人"), getName("签名意义"), getName("签名时间"), getName("备注原因")}; + for (String header : headers) { + PdfPCell cell = new PdfPCell(new Phrase(header, headerFont)); + cell.setHorizontalAlignment(Element.ALIGN_CENTER); + cell.setPadding(8); + table.addCell(cell); + } + if(studyFormFillQmxxList.size()>0){ + int rowNum = 0; + for (StudyFormFillQmxx studyFormFillQmxx : studyFormFillQmxxList) { + // 交替行颜色 + if (rowNum % 2 == 0) { + table.getDefaultCell().setBackgroundColor(BaseColor.WHITE); + } else { + table.getDefaultCell().setBackgroundColor(BaseColor.WHITE); + } + table.addCell(PdfBaseUtil.createCell(studyFormFillQmxx.getQmrMc(), contentFont)); + table.addCell(PdfBaseUtil.createCell("en".equals(language)?studyFormFillQmxx.getQmyyEn():studyFormFillQmxx.getQmyy(), contentFont)); + table.addCell(PdfBaseUtil.createCell(PdfExportUtil.parseDateToStr(studyFormFillQmxx.getCreateTime()), contentFont)); + table.addCell(PdfBaseUtil.createCell(studyFormFillQmxx.getRemark(), contentFont)); + rowNum++; + } + } + document.add(table); + } + + /** + * 稽查轨迹 + * + * @param document + * @param studyFormFillJcgjList + * @throws IOException + * @throws DocumentException + */ + public static void addJcgj(Document document, List studyFormFillJcgjList, String lang) throws IOException, DocumentException { + language = lang; + for (StudyFormFillJcgj jcgj : studyFormFillJcgjList) { + StringJoiner result = new StringJoiner(", "); + if ("en".equals(lang)) { + PdfBaseUtil.addUnderlinedTitle(document, PdfExportUtil.parseDateToStr(jcgj.getCreateTime()) + " " + jcgj.getJcmcEn(), 10, false); + if (StringUtils.isNoneBlank(jcgj.getJcnrEn())) { + ObjectMapper mapper = new ObjectMapper(); + JsonNode jsonArray = mapper.readTree(jcgj.getJcnrEn()); + for (JsonNode node : jsonArray) { + if (node.get("name") != null) { + String name = node.get("name").asText(); + String value = node.get("value") != null ? node.get("value").asText() : ""; + result.add(name + ":" + value); + } + } + } + }else{ + PdfBaseUtil.addUnderlinedTitle(document, PdfExportUtil.parseDateToStr(jcgj.getCreateTime()) + " " + jcgj.getJcmc(), 10, false); + if (StringUtils.isNoneBlank(jcgj.getJcnr())) { + ObjectMapper mapper = new ObjectMapper(); + JsonNode jsonArray = mapper.readTree(jcgj.getJcnr()); + for (JsonNode node : jsonArray) { + if (node.get("name") != null) { + String name = node.get("name").asText(); + String value = node.get("value") != null ? node.get("value").asText() : ""; + result.add(name + ":" + value); + } + } + } + } + + if (StringUtils.isNoneBlank(jcgj.getRemark())) { + result.add(getName("备注") + ":" + jcgj.getRemark()); + } + if (StringUtils.isNoneBlank(jcgj.getQmrMc())) { + result.add(getName("签名人") + ":" + jcgj.getQmrMc()); + } + PdfBaseUtil.addUnderlinedTitle(document, result.toString(), 10, false); + } + } + + /** + * 获取名称 + * + * @param name + * @return + */ + public static String getNameByLanguage(String name, String lang) { + return "en".equals(lang) ? TemplateUtil.getEn(name) : name; + } + + /** + * 获取名称 + * + * @param name + * @return + */ + public static String getName(String name) { + return "en".equals(language) ? TemplateUtil.getEn(name) : name; + } + +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/template/sp/SP001.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/template/sp/SP001.java new file mode 100644 index 0000000..debd4f5 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/template/sp/SP001.java @@ -0,0 +1,135 @@ +package com.hxhq.business.utils.pdf.template.sp; + +import com.alibaba.fastjson2.JSONObject; +import com.hxhq.business.domain.*; +import com.hxhq.business.utils.pdf.PdfBaseUtil; +import com.hxhq.business.utils.pdf.PdfExportUtil; +import com.hxhq.business.utils.pdf.template.TemplateBaseUtil; +import com.hxhq.common.core.utils.StringUtils; +import com.hxhq.common.security.utils.SecurityUtils; +import com.hxhq.system.api.model.LoginUser; +import com.itextpdf.text.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.*; +import java.util.List; + +/** + * 色谱-生物样品分析溶液配制表 + * + * @author tanfei + */ +public class SP001 { + private static final Logger logger = LoggerFactory.getLogger(SP001.class.getName()); + public String language = "zh"; + + /** + * 导出 + * + * @param studyFormFill + * @return + */ + public String exportDetail(StudyFormFill studyFormFill, List studyFormFillQmxxList, List studyFormFillJcgjList, String lang,Integer jcgjlx, String localFilePath) { + language = lang; + Document document = null; + FileOutputStream fos = null; + String filePath = PdfBaseUtil.getFilePath(localFilePath,"SP001"); + try { + String sign = "hxhq"; + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (loginUser != null) { + sign = loginUser.getSysUser().getNickName(); + } + document = PdfBaseUtil.init(document, fos, filePath, sign +PdfExportUtil.parseDateToStr(new Date()), "en".equals(language)?studyFormFill.getTemplateMcEn():studyFormFill.getTemplateMc(),false); + // 基本信息 + + JSONObject bdnr = JSONObject.parseObject(studyFormFill.getBdnr()); + PdfBaseUtil.addUnderlinedTitle(document, getName("试验基本信息"), 10, true); + Map formData1 = new LinkedHashMap<>(); + formData1.put(getName("试验名称"), studyFormFill.getStudyMc()); + formData1.put(getName("试验编号"), studyFormFill.getStudySn()); + formData1.put(getName("方法编号"), (StringUtils.isNoneBlank(bdnr.getString("methodCode"))? bdnr.getString("methodCode"):"")); + formData1.put(getName("版本号"), (StringUtils.isNoneBlank(bdnr.getString("methodCode"))? bdnr.getString("methodCode"):"")); + PdfBaseUtil.addFormTableColumns(document, formData1, 2); + + PdfBaseUtil.addUnderlinedTitle(document, getName("试验配置条件"), 10, true); + Map formData2 = new LinkedHashMap<>(); + formData2.put(getName("预填"),(StringUtils.isNoneBlank(bdnr.getString("pre"))? bdnr.getString("pre"):"") + (StringUtils.isNoneBlank(bdnr.getString("preOther")) ? bdnr.getString("preOther") : "")); + formData2.put(getName("实际"),(StringUtils.isNoneBlank(bdnr.getString("act"))? bdnr.getString("act"):"") + (StringUtils.isNoneBlank(bdnr.getString("actOther")) ? bdnr.getString("actOther") : "")); + PdfBaseUtil.addFormTableColumns(document, formData2, 2); + + PdfBaseUtil.addUnderlinedTitle(document, getName("配置时间"), 10, true); + Map formData3 = new LinkedHashMap<>(); + formData3.put(getName("开始时间"), studyFormFill.getStartDate() != null ? PdfExportUtil.parseDateToStr(studyFormFill.getStartDate()) : ""); + formData3.put(getName("结束时间"), studyFormFill.getEndDate() != null ? PdfExportUtil.parseDateToStr(studyFormFill.getEndDate()) : ""); + PdfBaseUtil.addFormTableColumns(document, formData3, 2); + + // 签名信息 + PdfBaseUtil.addUnderlinedTitle(document, getName("试验试剂信息"), 10, true); + TemplateBaseUtil.addResource(document, studyFormFill.getResource(),language); + + PdfBaseUtil.addUnderlinedTitle(document, getName("仪器使用信息"), 10, true); + TemplateBaseUtil.addInstrument(document, "",language); + + PdfBaseUtil.addUnderlinedTitle(document, getName("存储条件"), 10, true); + + Map formData4 = new LinkedHashMap<>(); + formData4.put(getName("存储条件"), bdnr.getString("storageCondition") + (StringUtils.isNoneBlank(bdnr.getString("storageConditionOther")) ? bdnr.getString("storageConditionOther") : "")); + PdfBaseUtil.addFormTableColumns(document, formData4, 1); + + PdfBaseUtil.addUnderlinedTitle(document, getName("操作步骤"), 10, true); + Map formData5 = new LinkedHashMap<>(); + formData5.put(getName("目标溶液名称"), bdnr.getString("targetName")); + formData5.put(getName("目标溶液编号"), bdnr.getString("targetCode") + bdnr.getString("targetCodeSn")); + formData5.put(getName("目标溶液预计浓度"), bdnr.getString("targetPreConcentration") + bdnr.getString("targetPreConcentrationUnit")); + formData5.put(getName("目标溶液实际浓度"), bdnr.getString("targetActConcentration") + bdnr.getString("targetPreConcentrationUnit")); + formData5.put(getName("目标溶液预计体积"), bdnr.getString("targetPreVolume") + bdnr.getString("targetPreVolumeUnit")); + formData5.put(getName("目标溶液实际体积"), bdnr.getString("targetActVolume") + bdnr.getString("targetActVolumeUnit")); + formData5.put(getName("有效周期"), bdnr.getString("effectivePeriod") + bdnr.getString("effectivePeriodUnit")); + formData5.put(getName("失效日"), bdnr.getString("sxrq")); + PdfBaseUtil.addFormTableColumns(document, formData5, 2); + PdfBaseUtil.addUnderlinedTitle(document, getName("备注") + ":" +(StringUtils.isNoneBlank(bdnr.getString("remark")) ? bdnr.getString("remark") : ""), 10, false); + + // 签名信息 + PdfBaseUtil.addUnderlinedTitle(document, getName("签名信息"), 10, true); + TemplateBaseUtil.addQmxx(document, studyFormFillQmxxList,language); + //稽查轨迹 + Integer jcgjlxMark=999; + if(!jcgjlx.equals(jcgjlxMark)){ + PdfBaseUtil.addUnderlinedTitle(document, getName("稽查轨迹"), 10, true); + TemplateBaseUtil.addJcgj(document, studyFormFillJcgjList,language); + } + logger.info("生成成功:{}", filePath); + } catch (Exception e) { + logger.error("生成失败", e); + throw new RuntimeException("生成失败: " + e.getMessage()); + } finally { + if (document != null) { + document.close(); + } + if (fos != null) { + try { + fos.close(); + } catch (IOException e) { + logger.error("关闭文件流失败", e); + } + } + } + return filePath; + } + + + /** + * 获取名称 + * + * @param name + * @return + */ + public String getName(String name) { + return TemplateBaseUtil.getNameByLanguage(name,language); + } + +} diff --git a/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyFormFillMapper.xml b/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyFormFillMapper.xml index 325caaa..40c7fec 100644 --- a/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyFormFillMapper.xml +++ b/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyFormFillMapper.xml @@ -17,8 +17,8 @@