From 5e9566430936c569ae62a0c33ac3605be5ab5b02 Mon Sep 17 00:00:00 2001 From: "15881625488@163.com" <15881625488@163.com> Date: Sun, 18 Jan 2026 17:35:23 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A[=E8=B5=84=E6=BA=90=E5=BA=93?= =?UTF-8?q?=E7=AE=A1=E7=90=86]=E9=BA=BB=E7=B2=BE=E8=8D=AF=20=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hxhq/business/controller/MjyController.java | 3 +- .../com/hxhq/business/mapper/StudyGyzjMapper.java | 2 - .../com/hxhq/business/mapper/StudyMjyMapper.java | 1 - .../hxhq/business/service/IStudyGyzjService.java | 6 -- .../hxhq/business/service/IStudyMjyService.java | 7 -- .../business/service/impl/GyzjFfjlServiceImpl.java | 3 - .../business/service/impl/MjyFfjlServiceImpl.java | 34 ++++--- .../hxhq/business/service/impl/MjyServiceImpl.java | 21 +++- .../service/impl/StudyGyzjServiceImpl.java | 10 +- .../business/service/impl/StudyMjyServiceImpl.java | 10 -- .../java/com/hxhq/business/utils/GyzjJcnrUtil.java | 2 +- .../java/com/hxhq/business/utils/MjyJcnrUtil.java | 40 ++++++-- .../com/hxhq/business/utils/pdf/resource/Drug.java | 106 +++++++++++++-------- .../resources/mapper/business/StudyGyzjMapper.xml | 3 - .../resources/mapper/business/StudyMjyMapper.xml | 3 - 15 files changed, 141 insertions(+), 110 deletions(-) diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/MjyController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/MjyController.java index 925526e..6a56694 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/MjyController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/MjyController.java @@ -104,7 +104,7 @@ public class MjyController extends BaseController { */ @RequiresPermissions("business:resource:mjy:xq") @GetMapping(value = "/exportDetail") - public AjaxResult exportDetail(Long id) { + public AjaxResult exportDetail(Long id,String lang) { MjyJcgj mjyJcgj = new MjyJcgj(); mjyJcgj.setMjyId(id); List mjyJcgjList = mjyJcgjService.queryList(mjyJcgj); @@ -117,6 +117,7 @@ public class MjyController extends BaseController { mjyService.queryInfo(id), mjyTzList, mjyJcgjList, + lang, localFilePath)); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyGyzjMapper.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyGyzjMapper.java index 5ad41ed..3e2c55f 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyGyzjMapper.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyGyzjMapper.java @@ -16,6 +16,4 @@ public interface StudyGyzjMapper extends BaseMapper { void insertBatch(@Param("list") List list); - - void returnBatch(@Param("resourceId") Long resourceId); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMjyMapper.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMjyMapper.java index 88ca1d7..006f834 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMjyMapper.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMjyMapper.java @@ -18,6 +18,5 @@ public interface StudyMjyMapper extends BaseMapper void insertBatch(@Param("list") List list); - void returnBatch(@Param("resourceId") Long resourceId); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyGyzjService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyGyzjService.java index 1a4bc2b..282c4b3 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyGyzjService.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyGyzjService.java @@ -21,10 +21,4 @@ public interface IStudyGyzjService extends IService { */ public void insertBatch(List list); - /** - * 批量归还 - * - * @param resourceId - */ - public void returnBatch(Long resourceId); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMjyService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMjyService.java index bcf1a9b..966d728 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMjyService.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMjyService.java @@ -20,11 +20,4 @@ public interface IStudyMjyService extends IService * @param list */ public void insertBatch(List list); - - /** - * 批量归还 - * - * @param resourceId - */ - public void returnBatch(Long resourceId); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GyzjFfjlServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GyzjFfjlServiceImpl.java index 872ba61..6fe4338 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GyzjFfjlServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GyzjFfjlServiceImpl.java @@ -397,9 +397,6 @@ public class GyzjFfjlServiceImpl extends ServiceImpl i gyzjFfjl.setGhbz(form.getRemark()); this.updateById(gyzjFfjl); - // 归还试验物资 - studyGyzjService.returnBatch(gyzj.getId()); - // 稽查轨迹 Map formData = new LinkedHashMap<>(); formData.put("入库位置", form.getRkwz()); diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyFfjlServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyFfjlServiceImpl.java index 6a187bc..91e0b01 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyFfjlServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyFfjlServiceImpl.java @@ -1,6 +1,7 @@ package com.hxhq.business.service.impl; import java.util.*; +import java.util.stream.Collectors; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -11,7 +12,7 @@ import com.hxhq.business.enums.zykgl.*; import com.hxhq.business.enums.zykgl.JlztEnum; import com.hxhq.business.form.mjy.*; import com.hxhq.business.service.IMjyFfjlJcgjService; -import com.hxhq.business.service.IStudyGyzjService; +import com.hxhq.business.service.IStudyMjyService; import com.hxhq.business.service.IStudyMjyService; import com.hxhq.business.utils.JctUtil; import com.hxhq.common.core.exception.ServiceException; @@ -397,10 +398,6 @@ public class MjyFfjlServiceImpl extends ServiceImpl impl this.updateById(mjyFfjl); //endregion - //region 归还试验物资 - studyMjyService.returnBatch(mjy.getId()); - //endregion - //稽查轨迹 Map formData = new LinkedHashMap<>(); formData.put("入库位置", form.getRkwz()); @@ -458,14 +455,27 @@ public class MjyFfjlServiceImpl extends ServiceImpl impl mjyFfjl.setMdOther(form.getMdOther()); // 新增试验物资 - List studyMjies=new ArrayList<>(); if(StringUtils.isNoneBlank(form.getMdIds())){ + QueryWrapper queryWrapper = Wrappers.query(); + queryWrapper.in("study_id", form.getMdIds()); + queryWrapper.in("resource_id", mjy.getId()); + List studyMjysOld = studyMjyService.list(queryWrapper); + List studyMjies=new ArrayList<>(); + String [] tmp=form.getMdIds().split(","); for(String s :tmp){ - StudyMjy studyMjy=new StudyMjy(); - studyMjy.setStudyId(Long.parseLong(s)); - studyMjy.setResourceId(mjy.getId()); - studyMjies.add(studyMjy); + List existList = studyMjysOld.stream() + .filter(p -> p.getStudyId().equals(Long.parseLong(s))) + .collect(Collectors.toList()); + if (existList.size() == 0) { + StudyMjy studyMjy = new StudyMjy(); + studyMjy.setStudyId(Long.parseLong(s)); + studyMjy.setResourceId(mjy.getId()); + studyMjies.add(studyMjy); + } + } + if(studyMjies.size()>0){ + studyMjyService.insertBatch(studyMjies); } } @@ -478,9 +488,7 @@ public class MjyFfjlServiceImpl extends ServiceImpl impl this.save(mjyFfjl); mjyFfjlJcgjService.saveJcgj(mjyFfjl.getId(), JcgjlxEnum.lc.getValue(), "领取发放", JcmcysEnum.green.getValue(), formData, SecurityUtils.getLoginUser().getSysUser(),form.getRemark()); - if(studyMjies.size()>0){ - studyMjyService.insertBatch(studyMjies); - } + } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyServiceImpl.java index 66dfdfc..43c215e 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/MjyServiceImpl.java @@ -669,7 +669,11 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS formData.put("出库量", mjyOld.getKc() + mjyOld.getKcdw()); formData.put("转移条件", form.getZytj()); formData.put("出库毛重", form.getCkmz() + mjyOld.getKcdw()); - formData.put("目的", form.getMdIds()); + formData.put("目的", form.getMdMcs()); + formData.put("领取人", lqr1.getNickName()); + formData.put("领取人2", lqr2.getNickName()); + formData.put("发放人", ffr1.getNickName()); + formData.put("发放人2", ffr2.getNickName()); mjyJcgjService.saveJcgj(mjyOld.getId(), JcgjlxEnum.lc.getValue(), "领取发放", JcmcysEnum.green.getValue(), formData, ffr1,form.getRemark()); //台账 mjyTzService.saveTz(mjyOld.getId(),lqr1,lqr2,null,null,ffr1,ffr2,null,null,null,"领取发放",mjyOld.getKc(),mjyOld.getKcdw(),form.getRemark()); @@ -744,7 +748,11 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS formData.put("出库量", mjy.getKc() + mjy.getKcdw()); formData.put("转移条件", plffItemFilter.get(0).getZytj()); formData.put("出库毛重", plffItemFilter.get(0).getCkmz() + mjy.getKcdw()); - formData.put("目的", plffItemFilter.get(0).getMdIds()); + formData.put("目的", plffItemFilter.get(0).getMdMcs()); + formData.put("领取人", lqr1.getNickName()); + formData.put("领取人2", lqr2.getNickName()); + formData.put("发放人", ffr1.getNickName()); + formData.put("发放人2", ffr2.getNickName()); mjyJcgjList.add(mjyJcgjService.getJcgj(mjy.getId(), JcgjlxEnum.lc.getValue(), "领取发放", JcmcysEnum.green.getValue(), formData, ffr1,plffItemFilter.get(0).getRemark())); //台账 mjyTzList.add(mjyTzService.getTz(mjy.getId(),lqr1,lqr2,null,null,ffr1,ffr2,null,null,null,"领取发放",mjy.getKc(),mjy.getKcdw(),plffItemFilter.get(0).getRemark())); @@ -765,6 +773,7 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS mjy.setFfrq(now); mjy.setFfbz(plffItemFilter.get(0).getRemark()); mjy.setMdIds(plffItemFilter.get(0).getMdIds()); + mjy.setMdOther(plffItemFilter.get(0).getMdOther()); mjy.setZjzt(ZjztEnum.yff.getValue()); } else { throw new ServiceException("麻精药【" + mjy.getMc() + "】不存在或已删除"); @@ -961,7 +970,7 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS mjyJcgjService.saveJcgj(mjyOld.getId(), JcgjlxEnum.lc.getValue(), "拒绝修改库存", JcmcysEnum.red.getValue(), formData, qmr,null); } //台账 - mjyTzService.getTz(mjyOld.getId(),null,null,null,null,null,null,null,null,null,"修改库存",mjyOld.getKcbj(),mjyOld.getKcdw(),mjyOld.getKcbjbz()); + mjyTzService.saveTz(mjyOld.getId(),null,null,null,null,null,null,null,null,qmr,"修改库存",mjyOld.getKcbj(),mjyOld.getKcdw(),mjyOld.getKcbjbz()); mjyOld.setKcbj(null); mjyOld.setKcdwbj(null); @@ -1107,9 +1116,11 @@ public class MjyServiceImpl extends ServiceImpl implements IMjyS Map formData = new LinkedHashMap<>(); formData.put("存储位置", form.getCcwz()); formData.put("存储条件", form.getCctj()); - mjyJcgjService.saveJcgj(mjyOld.getId(), JcgjlxEnum.lc.getValue(), "存储", JcmcysEnum.green.getValue(), formData, qmr, form.getRemark()); + formData.put("签名人1", qmr.getNickName()); + formData.put("签名人2", qmr.getNickName()); + mjyJcgjService.saveJcgj(mjyOld.getId(), JcgjlxEnum.lc.getValue(), "存储", JcmcysEnum.green.getValue(), formData, null, form.getRemark()); //台账 - mjyTzService.saveTz(mjyOld.getId(),null,null,qmr,qmr2,null,null,null,null,qmr,"存储",mjyOld.getKc(),mjyOld.getKcdw(),form.getRemark()); + mjyTzService.saveTz(mjyOld.getId(),null,null,qmr,qmr2,null,null,null,null,null,"存储",mjyOld.getKc(),mjyOld.getKcdw(),form.getRemark()); } /** diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyGyzjServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyGyzjServiceImpl.java index d43e798..648a3a8 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyGyzjServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyGyzjServiceImpl.java @@ -31,13 +31,5 @@ public class StudyGyzjServiceImpl extends ServiceImpl i } - /** - * 批量归还 - * - * @param resourceId - */ - @Override - public void returnBatch(Long resourceId) { - baseMapper.returnBatch(resourceId); - } - } 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/GyzjJcnrUtil.java index a49a9e4..e19d1db 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/GyzjJcnrUtil.java @@ -15,7 +15,7 @@ public class GyzjJcnrUtil { private static HashMap mapLang=new HashMap<>(); static { mapLang.put("入库","In Storage"); - mapLang.put("未入库","'未入库'"); + mapLang.put("未入库","未入库"); mapLang.put("已发放","In Use"); mapLang.put("已锁定","'Locked'"); mapLang.put("待归档","Pending Archiving"); 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/MjyJcnrUtil.java index 0eadf61..db47002 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/MjyJcnrUtil.java @@ -15,7 +15,13 @@ public class MjyJcnrUtil { private static final Logger logger = LoggerFactory.getLogger(MjyJcnrUtil.class.getName()); private static HashMap mapLang=new HashMap<>(); static { - + mapLang.put("入库","In Storage"); + mapLang.put("未入库","未入库"); + mapLang.put("已发放","In Use"); + mapLang.put("已锁定","'Locked'"); + mapLang.put("待归档","Pending Archiving"); + mapLang.put("归档","'Archived'"); + mapLang.put("待解档","Pending De-archiving"); mapLang.put("借阅开始时间","Checkout Start Date"); mapLang.put("借阅结束时间","Checkout End Date"); mapLang.put("处置方式","Dispose Method"); @@ -27,6 +33,7 @@ public class MjyJcnrUtil { mapLang.put("钥匙1领取人","Key 1 User"); mapLang.put("钥匙2领取人","Key 2 User"); mapLang.put("发放人","Issuer"); + mapLang.put("发放人2","Issuer 2"); mapLang.put("出库量","Out Amount"); mapLang.put("转移条件","Transfer Condition"); mapLang.put("出库毛重","Check-out Gross Weight"); @@ -42,11 +49,29 @@ public class MjyJcnrUtil { mapLang.put("审核备注","Approve Comment"); mapLang.put("存储条件","Storage Condition"); mapLang.put("存储位置","Storage Location"); + mapLang.put("使用人","User"); + mapLang.put("领取/归还人","Recipient/Returner"); + mapLang.put("发放/接收人","Issuer/Receiver"); + mapLang.put("操作类型","Action"); + mapLang.put("操作量","Amount"); + mapLang.put("备注/原因","Comment/Reason"); + mapLang.put("操作时间","Datetime"); + mapLang.put("名称","Name"); + mapLang.put("编号","ID"); + mapLang.put("浓度","Concentration"); + mapLang.put("库存量","Amount"); + mapLang.put("失效日期","Expiration"); + mapLang.put("制剂状态","Status"); + mapLang.put("所属表单","In Record"); + mapLang.put("所属试验信息","From Study"); + mapLang.put("表单所属人","By User"); + mapLang.put("基本信息","Information"); + mapLang.put("表单信息","Record Information"); + mapLang.put("稽查轨迹","Track Record"); + mapLang.put("给药制剂台账","Dose Table"); + mapLang.put("备注","Comment"); + mapLang.put("签名人","Signed By"); - mapLang.put("目的","目的"); - mapLang.put("入库位置","入库位置"); - mapLang.put("入库条件","入库条件"); - mapLang.put("减少量","减少量"); mapLang.put("申请解档","Apply for De-archiving"); @@ -71,7 +96,10 @@ public class MjyJcnrUtil { mapLang.put("锁定发放记录","锁定发放记录"); mapLang.put("解锁发放记录","解锁发放记录"); mapLang.put("麻精药入库","麻精药入库"); - + mapLang.put("目的","目的"); + mapLang.put("入库位置","入库位置"); + mapLang.put("入库条件","入库条件"); + mapLang.put("减少量","减少量"); } 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 b79773c..69812e5 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 @@ -3,11 +3,10 @@ package com.hxhq.business.utils.pdf.resource; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import com.hxhq.business.domain.Mjy; -import com.hxhq.business.domain.MjyJcgj; -import com.hxhq.business.domain.MjyTz; -import com.hxhq.business.domain.StudyFormFillJcgj; +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.pdf.PdfBaseUtil; import com.hxhq.common.core.utils.StringUtils; import com.hxhq.common.security.utils.SecurityUtils; @@ -39,20 +38,20 @@ public class Drug { * @param mjy * @return */ - public String exportDetail(DetailDto mjy, List mjyTzList, List mjyJcgjList, String localFilePath) { + public String exportDetail(DetailDto mjy, List mjyTzList, List mjyJcgjList, String lang, String localFilePath) { Document document = null; FileOutputStream fos = null; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String filePath = PdfBaseUtil.getFilePath(localFilePath); try { - String sign="华西海圻"; - LoginUser loginUser=SecurityUtils.getLoginUser(); - if(loginUser!=null){ - sign=loginUser.getSysUser().getNickName(); + String sign = "en".equals(lang) ? "hxhq" : "华西海圻"; + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (loginUser != null) { + sign = loginUser.getSysUser().getNickName(); } - document = PdfBaseUtil.init(document, fos, filePath, sign+sdf.format(new Date()), null); + document = PdfBaseUtil.init(document, fos, filePath, sign + sdf.format(new Date()), null); // 基本信息 - PdfBaseUtil.addUnderlinedTitle(document, "基本信息", 10,true); + PdfBaseUtil.addUnderlinedTitle(document, "en".equals(lang) ? MjyJcnrUtil.getEn("基本信息") : "基本信息", 10, true); Map formData1 = new LinkedHashMap<>(); formData1.put("名称", mjy.getMc()); formData1.put("编号", mjy.getBh()); @@ -61,20 +60,21 @@ public class Drug { formData1.put("失效日期", sdf.format(mjy.getSxrq())); formData1.put("存储条件", mjy.getCctj()); formData1.put("存储位置", mjy.getCcwz()); - PdfBaseUtil.addFormTableColumns(document, formData1, 2); + formData1.put("制剂状态", "en".equals(lang) ? (MjyJcnrUtil.getEn(ZjztEnum.getEnumByValue(mjy.getZjzt()).getText())) : ZjztEnum.getEnumByValue(mjy.getZjzt()).getText()); + PdfBaseUtil.addFormTableColumns(document, "en".equals(lang) ? MjyJcnrUtil.getMapEn(formData1) : formData1, 2); // 表单信息 - PdfBaseUtil.addUnderlinedTitle(document, "表单信息", 10,true); + PdfBaseUtil.addUnderlinedTitle(document, "en".equals(lang) ? MjyJcnrUtil.getEn("表单信息") : "表单信息", 10, true); Map formData3 = new LinkedHashMap<>(); - formData3.put("所属表单", mjy.getBdMc()); formData3.put("所属试验信息", mjy.getStudyMc()); + formData3.put("所属表单", mjy.getBdMc()); formData3.put("表单所属人", mjy.getBdgsrMc()); - PdfBaseUtil.addFormTableColumns(document, formData3, 2); - PdfBaseUtil.addUnderlinedTitle(document, "麻精药台账", 10,true); + PdfBaseUtil.addFormTableColumns(document, "en".equals(lang) ? MjyJcnrUtil.getMapEn(formData3) : formData3, 2); + PdfBaseUtil.addUnderlinedTitle(document, "en".equals(lang) ? MjyJcnrUtil.getEn("给药制剂台账") : "给药制剂台账", 10, true); // 台账 - addTz(document,mjyTzList); - PdfBaseUtil.addUnderlinedTitle(document, "稽查轨迹", 10,true); + addTz(document, mjyTzList, lang); + PdfBaseUtil.addUnderlinedTitle(document, "en".equals(lang) ? MjyJcnrUtil.getEn("稽查轨迹") : "稽查轨迹", 10, true); //稽查轨迹 - addJcgj(document,mjyJcgjList); + addJcgj(document, mjyJcgjList, lang); logger.info("生成成功:{}", filePath); } catch (Exception e) { logger.error("生成失败", e); @@ -96,21 +96,30 @@ public class Drug { /** * 台账 + * * @param document * @param mjyTzList * @throws IOException * @throws DocumentException */ - public void addTz(Document document,List mjyTzList) throws IOException, DocumentException { + public void addTz(Document document, List mjyTzList, String lang) throws IOException, DocumentException { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // 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); + Font headerFont = new Font(bfChinese, 8, Font.NORMAL); + Font contentFont = new Font(bfChinese, 8, Font.NORMAL); // 8. 创建表格 PdfPTable table = new PdfPTable(7); table.setWidthPercentage(100); - String[] headers = {"使用人", "领取/归还人", "发放/接收人", "操作类型", "操作量", "备注/原因", "操作时间"}; + String[] headers = { + "en".equals(lang) ? MjyJcnrUtil.getEn("使用人") : "使用人", + "en".equals(lang) ? MjyJcnrUtil.getEn("领取/归还人") : "领取/归还人", + "en".equals(lang) ? MjyJcnrUtil.getEn("发放/接收人") : "发放/接收人", + "en".equals(lang) ? MjyJcnrUtil.getEn("操作类型") : "操作类型", + "en".equals(lang) ? MjyJcnrUtil.getEn("操作量") : "操作量", + "en".equals(lang) ? MjyJcnrUtil.getEn("备注/原因") : "备注/原因", + "en".equals(lang) ? MjyJcnrUtil.getEn("操作时间") : "操作时间" + }; for (String header : headers) { PdfPCell cell = new PdfPCell(new Phrase(header, headerFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); @@ -127,10 +136,10 @@ public class Drug { table.getDefaultCell().setBackgroundColor(BaseColor.WHITE); } table.addCell(PdfBaseUtil.createCell(mjyTz.getQmrMc(), contentFont)); - table.addCell(PdfBaseUtil.createCell(StringUtils.isNoneBlank(mjyTz.getLqrMc())?mjyTz.getLqrMc():""+(StringUtils.isNoneBlank(mjyTz.getGhrMc())?mjyTz.getGhrMc():""), contentFont)); - table.addCell(PdfBaseUtil.createCell(StringUtils.isNoneBlank(mjyTz.getFfrMc())?mjyTz.getFfrMc():""+(StringUtils.isNoneBlank(mjyTz.getJsrMc())?mjyTz.getJsrMc():""), contentFont)); + table.addCell(PdfBaseUtil.createCell(StringUtils.isNoneBlank(mjyTz.getLqrMc()) ? mjyTz.getLqrMc() : "" + (StringUtils.isNoneBlank(mjyTz.getGhrMc()) ? mjyTz.getGhrMc() : ""), contentFont)); + table.addCell(PdfBaseUtil.createCell(StringUtils.isNoneBlank(mjyTz.getFfrMc()) ? mjyTz.getFfrMc() : "" + (StringUtils.isNoneBlank(mjyTz.getJsrMc()) ? mjyTz.getJsrMc() : ""), contentFont)); table.addCell(PdfBaseUtil.createCell(mjyTz.getQmyy(), contentFont)); - table.addCell(PdfBaseUtil.createCell(mjyTz.getCzl()+mjyTz.getCzldw(), contentFont)); + table.addCell(PdfBaseUtil.createCell(mjyTz.getCzl() + mjyTz.getCzldw(), contentFont)); table.addCell(PdfBaseUtil.createCell(mjyTz.getRemark(), contentFont)); table.addCell(PdfBaseUtil.createCell(sdf.format(mjyTz.getCreateTime()), contentFont)); rowNum++; @@ -140,32 +149,49 @@ public class Drug { /** * 稽查轨迹 + * * @param document * @param mjyJcgjList * @throws IOException * @throws DocumentException */ - public void addJcgj(Document document,List mjyJcgjList) throws IOException, DocumentException { + public void addJcgj(Document document, List mjyJcgjList, String lang) throws IOException, DocumentException { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); for (MjyJcgj jcgj : mjyJcgjList) { - PdfBaseUtil.addUnderlinedTitle(document, sdf.format(jcgj.getCreateTime())+" "+jcgj.getJcmc() , 10,false); + PdfBaseUtil.addUnderlinedTitle(document, sdf.format(jcgj.getCreateTime()) + " " + ("en".equals(lang) ? MjyJcnrUtil.getEn(jcgj.getJcmc()) : 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) { - String name = node.get("name").asText(); - String value = node.get("value").asText(); - result.add(name + ":" + value); + if ("en".equals(lang)) { + 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").asText(); + result.add(name + ":" + value); + } + } + } + } else { + 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").asText(); + result.add(name + ":" + value); + } + } } } - if(StringUtils.isNoneBlank(jcgj.getRemark())){ - result.add("备注:"+jcgj.getRemark()); + if (StringUtils.isNoneBlank(jcgj.getRemark())) { + result.add(("en".equals(lang) ? MjyJcnrUtil.getEn("备注") + ":" : "备注:") + jcgj.getRemark()); } - if(StringUtils.isNoneBlank(jcgj.getRemark())){ - result.add("签名人:"+jcgj.getQmrMc()); + if (StringUtils.isNoneBlank(jcgj.getRemark())) { + result.add(("en".equals(lang) ? MjyJcnrUtil.getEn("签名人") + ":" : "签名人:") + jcgj.getQmrMc()); } - PdfBaseUtil.addUnderlinedTitle(document, result.toString(), 10,false); + PdfBaseUtil.addUnderlinedTitle(document, result.toString(), 10, false); } } diff --git a/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyGyzjMapper.xml b/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyGyzjMapper.xml index 48a8561..756de12 100644 --- a/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyGyzjMapper.xml +++ b/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyGyzjMapper.xml @@ -14,8 +14,5 @@ - - update t_study_gyzj set syghzt=10 where resource_id=#{resourceId}; - \ No newline at end of file diff --git a/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyMjyMapper.xml b/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyMjyMapper.xml index df37af2..95a701d 100644 --- a/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyMjyMapper.xml +++ b/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyMjyMapper.xml @@ -13,7 +13,4 @@ - - update t_study_mjy set syghzt=10 where resource_id=#{resourceId}; - \ No newline at end of file