Ver código fonte

修复 用户权限更新时没有在线用户的问题
新增 设备表新增 产品编码字段

18339543638 2 anos atrás
pai
commit
d9a431ad9e

+ 0 - 1
nb-admin/src/main/resources/application-dev.yml

@@ -110,7 +110,6 @@ request:
     # 请求不可重复接收时间 10分钟
     repeat-interval: 600
 
-
 # 阿里云对接配置
 #aliyun:
 #  accessKey: "LTAI4FhB19MgQuviGxwA3aod"

+ 2 - 0
nb-service-api/web-service-api/src/main/java/com/nb/web/api/entity/BusDeviceEntity.java

@@ -59,6 +59,8 @@ public class BusDeviceEntity extends TenantGenericEntity<String,String> {
     @TableField(typeHandler = FastjsonTypeHandler.class,updateStrategy = FieldStrategy.DEFAULT)
     private AliIotConfig config;
 
+    @ApiModelProperty("产品编码")
+    private String productNo;
 
     @ApiModelProperty(value = "sim卡卡号")
     @Length(max = 255,message = "sim卡卡号不得超过255个字符")

+ 14 - 0
nb-service-api/web-service-api/src/main/java/com/nb/web/api/entity/BusEvaluationEntity.java

@@ -1,8 +1,12 @@
 package com.nb.web.api.entity;
+import cn.hutool.core.date.DateUtil;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 
 import java.math.BigDecimal;
 import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.nb.core.entity.TenantGenericEntity;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -169,4 +173,14 @@ public class BusEvaluationEntity extends TenantGenericEntity<String,String> {
     @DecimalMax(value = "10000",message = "血氧饱和度最大值不得超过10000")
     @DecimalMin(value = "-100",message ="血氧饱和度最小值不得低于-100" )
     private BigDecimal bloodOxygenSaturation;
+
+
+    @JsonIgnore
+    @TableField(exist = false)
+    private String analExportEvalTime;
+
+    public void setEvaluateTime(Date evaluateTime) {
+        this.evaluateTime = evaluateTime;
+        analExportEvalTime= DateUtil.formatDateTime(evaluateTime);
+    }
 }

+ 24 - 0
nb-service/web-service/src/main/java/com/nb/web/service/bus/service/dto/ClinicAnalClinicRecord.java

@@ -1,5 +1,8 @@
 package com.nb.web.service.bus.service.dto;
 
+import cn.hutool.core.collection.CollectionUtil;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.nb.web.api.bean.FormulaDrugDetailDomain;
 import com.nb.web.api.bean.FormulaDrugDomain;
 import com.nb.web.api.entity.BusClinicEntity;
 import com.nb.core.enums.SexEnum;
@@ -78,6 +81,13 @@ public class ClinicAnalClinicRecord  implements Serializable {
     @ApiModelProperty(value = "术前访视单")
     private String visitRecord;
 
+    //访视单导出时使用
+    @JsonIgnore
+    private String analExportGender;
+
+    @JsonIgnore
+    private String analExportFormula;
+
     public static ClinicAnalClinicRecord parse(BusClinicEntity clinic){
         ClinicAnalClinicRecord clinicRecord = new ClinicAnalClinicRecord();
         clinicRecord.setId(clinic.getId());
@@ -97,6 +107,20 @@ public class ClinicAnalClinicRecord  implements Serializable {
         clinicRecord.setAnalType(clinic.getAnalType());
         clinicRecord.setSurgeryDoctor(clinic.getSurgeryDoctor());
         clinicRecord.setVisitRecord(clinic.getVisitRecord());
+        if(clinic.getPatientGender()!=null){
+            clinicRecord.setAnalExportGender(clinic.getPatientGender().getText());
+        }
+        if(clinic.getFormula()!=null){
+            FormulaDrugDomain formula = clinic.getFormula();
+            String formulaName = formula.getName()+":\n";
+            String formulaDetail="";
+            if (CollectionUtil.isNotEmpty(formula.getDetail())) {
+                for (FormulaDrugDetailDomain detail : formula.getDetail()) {
+                    formulaDetail=formulaDetail+detail.getName()+" "+ detail.getDose()+detail.getUnit()+";";
+                }
+            }
+            clinicRecord.setAnalExportFormula(formulaName+formulaDetail);
+        }
         return clinicRecord;
     }
 

+ 8 - 0
nb-service/web-service/src/main/java/com/nb/web/service/bus/service/dto/ClinicAnalInfusionModify.java

@@ -1,6 +1,8 @@
 package com.nb.web.service.bus.service.dto;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.date.DateUtil;
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.nb.web.service.bus.entity.BusInfusionModifyEntity;
 import com.nb.web.api.entity.common.DeviceProperties;
 import io.swagger.annotations.ApiModel;
@@ -29,9 +31,15 @@ public class ClinicAnalInfusionModify extends DeviceProperties<String,String> {
     @ApiModelProperty("是否打印")
     private boolean print;
 
+    @JsonIgnore
+    private String analExportModifyTime;
+
     public static ClinicAnalInfusionModify parse(BusInfusionModifyEntity source){
         ClinicAnalInfusionModify result = new ClinicAnalInfusionModify();
         BeanUtil.copyProperties(source,result);
+        if(source.getModifyTime()!=null){
+            result.setAnalExportModifyTime(DateUtil.formatDateTime(source.getModifyTime()));
+        }
         return result;
     }
 }

+ 56 - 0
nb-service/web-service/src/main/java/com/nb/web/service/bus/service/dto/ClinicAnalInfusionRecord.java

@@ -1,6 +1,9 @@
 package com.nb.web.service.bus.service.dto;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.date.DateUnit;
+import cn.hutool.core.date.DateUtil;
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.nb.web.api.entity.BusInfusionHistoryEntity;
 import com.nb.web.api.entity.common.DeviceProperties;
 import io.swagger.annotations.ApiModel;
@@ -36,9 +39,62 @@ public class ClinicAnalInfusionRecord extends DeviceProperties<String,String> {
     @ApiModelProperty(value = "输注开始时间,即本次运行开机时间")
     private Date startTime;
 
+    private String undoBy;
+
+    private Date undoTime;
+
+    //镇痛访视单导出时的撤泵时间
+    @JsonIgnore
+    private String analExportUndoTime;
+
+    //镇痛访视单导出时的输注开始时间
+    @JsonIgnore
+    private String analExportStartTime;
+
+    //镇痛访视单导出时的输注运行时间
+    @JsonIgnore
+    private String analExportRunTime;
+
     public static ClinicAnalInfusionRecord parse(BusInfusionHistoryEntity source){
         ClinicAnalInfusionRecord result = new ClinicAnalInfusionRecord();
         BeanUtil.copyProperties(source,result);
+        if(source.getStartTime()!=null){
+            result.setAnalExportStartTime(DateUtil.formatDateTime(source.getStartTime()));
+        }
+        if(source.getUndoTime()!=null){
+            result.setAnalExportUndoTime(DateUtil.formatDateTime(source.getUndoTime()));
+        }
+        Date now = new Date();
+        if(source.getLastUploadTime()!=null){
+            now=source.getLastUploadTime();
+        }
+        //日
+        int day=0;
+        //小时
+        int hour=0;
+        //分钟
+        int minute=0;
+        //秒
+        int second=0;
+        int subSeconds = Long.valueOf(DateUtil.between(now, source.getStartTime(), DateUnit.SECOND)).intValue();
+        day=subSeconds/60/60/24;
+        hour=subSeconds/60/60;
+        minute=subSeconds/60;
+        second=subSeconds%60;
+        String runTime="";
+        if(day!=0){
+            runTime=runTime+day+"天";
+        }
+        if(hour!=0){
+            runTime=runTime+hour+"小时";
+        }
+        if(minute!=0){
+            runTime=runTime+minute+"分钟";
+        }
+        if(second!=0){
+            runTime=runTime+second+"秒";
+        }
+        result.setAnalExportRunTime(runTime);
         return result;
     }
 }

+ 15 - 92
nb-service/web-service/src/main/java/com/nb/web/service/bus/utils/AnalExportUtils.java

@@ -1,11 +1,9 @@
 package com.nb.web.service.bus.utils;
 
-import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.io.IoUtil;
 import cn.hutool.core.io.resource.ResourceUtil;
 import cn.hutool.core.map.MapUtil;
-import cn.hutool.core.util.StrUtil;
 import com.deepoove.poi.XWPFTemplate;
 import com.deepoove.poi.config.Configure;
 import com.deepoove.poi.data.PictureType;
@@ -13,15 +11,11 @@ import com.deepoove.poi.data.Pictures;
 import com.deepoove.poi.plugin.table.LoopColumnTableRenderPolicy;
 import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
 import com.deepoove.poi.xwpf.NiceXWPFDocument;
-import com.nb.web.api.entity.BusEvaluationEntity;
-import com.nb.web.service.bus.service.dto.ClinicAnalInfusionRecord;
 import com.nb.web.service.bus.service.dto.ClinicAnalRecordResult;
-import org.apache.poi.xwpf.usermodel.BreakType;
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.*;
-import java.util.*;
-import java.util.stream.Collectors;
+import java.util.HashMap;
 
 /**
  * @ClassName : AnalExportUtils
@@ -32,13 +26,7 @@ import java.util.stream.Collectors;
 
 public class AnalExportUtils {
     //临床信息模板路径
-    private static final byte[] clinic_pattern= IoUtil.readBytes(ResourceUtil.getStream("classpath:"+File.separator+"export"+File.separator+"patientTmp.docx"));
-    //输注信息模板路径
-    private static final byte[] infusion_pattern=IoUtil.readBytes(ResourceUtil.getStream("classpath:"+File.separator+"export"+File.separator+"infusionHistoryTmp.docx"));
-    //图片模板路径
-    private static final byte[] image_pattern=IoUtil.readBytes(ResourceUtil.getStream("classpath:"+File.separator+"export"+File.separator+"imageTmp.docx"));
-    //评价模板路径
-    private static final byte[] eval_pattern=IoUtil.readBytes(ResourceUtil.getStream("classpath:"+File.separator+"export"+File.separator+"evalTmp.docx"));
+    private static final byte[] clinic_pattern= IoUtil.readBytes(ResourceUtil.getStream("classpath:"+File.separator+"export"+File.separator+"AnalRecordTemp.docx"));
 
     public static void export(HttpServletResponse response, ClinicAnalRecordResult record,String base64) throws Exception {
         response.addHeader("Content-Disposition","attachment;filename="+record.getClinic().getPatientCode()+".docx");
@@ -48,94 +36,29 @@ public class AnalExportUtils {
     }
 
     private  static void export0(OutputStream outputStream,ClinicAnalRecordResult record,String base64) throws Exception {
-        NiceXWPFDocument document= XWPFTemplate.compile(
-                new ByteArrayInputStream(clinic_pattern))
-                .render(record.getClinic())
+        HashMap<String, Object> params = new HashMap<>();
+        params.put("clinic",record.getClinic());
+        params.put("infusionRecords", CollectionUtil.isEmpty(record.getInfusionRecords())?null:record.getInfusionRecords());
+        params.put("evaluations",MapUtil.of("evals",CollectionUtil.isEmpty(record.getEvaluations())?null:record.getEvaluations()));
+        params.put("image", MapUtil.of("base64",Pictures.ofBase64(base64,PictureType.PNG)
+                .size(687, 500).create()));
+
+        NiceXWPFDocument document= XWPFTemplate.compile(new ByteArrayInputStream(clinic_pattern),Configure.builder()
+                .bind("modifies", new LoopRowTableRenderPolicy())
+                .bind("evals",new LoopColumnTableRenderPolicy())
+                .build())
+                .render(params)
                 .getXWPFDocument();
-        document=exportInfusionInfo(document,record.getInfusionRecords());
-        document=exportEval(document,record.getEvaluations());
-        document=exportImage(document,base64);
         //文件输出流
-        BufferedOutputStream bos = new BufferedOutputStream(outputStream);
         try {
-            document.write(bos);
-            bos.flush();
+            document.write(outputStream);
             outputStream.flush();
         }catch (Exception e){
             throw e;
         }finally {
             IoUtil.close(outputStream);
-            IoUtil.close(bos);
             IoUtil.close(document);
         }
     }
 
-
-    /**
-     * 导出输注记录
-     */
-    private static  NiceXWPFDocument exportInfusionInfo(NiceXWPFDocument xwpfDocument,List<ClinicAnalInfusionRecord> infusions) throws Exception {
-        if(CollUtil.isEmpty(infusions)){
-            return xwpfDocument;
-        }
-        xwpfDocument.createParagraph().createRun().addBreak(BreakType.PAGE);
-        LoopRowTableRenderPolicy policy  = new LoopRowTableRenderPolicy();
-        Configure config = Configure.builder()
-                .bind("modifies", policy)
-                .build();
-        Map<Date, List<NiceXWPFDocument>> document = infusions.stream()
-                .collect(Collectors.groupingBy(ClinicAnalInfusionRecord::getStartTime, Collectors.collectingAndThen(Collectors.toList(), list -> list
-                                .parallelStream()
-                                .map(infusion -> XWPFTemplate.compile(new ByteArrayInputStream(infusion_pattern), config).render(infusion).getXWPFDocument())
-                                .collect(Collectors.toList())
-                        )
-                ));
-        List<Date> dates = new ArrayList<>(document.keySet());
-        CollectionUtil.sort(dates,(o1,o2)->o1.compareTo(o2));
-        for (Date date : dates) {
-            for (NiceXWPFDocument d : document.get(date)) {
-                xwpfDocument=xwpfDocument.merge(d);
-            }
-        }
-        return xwpfDocument;
-    }
-
-
-    /**
-     * 导出评价信息
-     */
-    private  static NiceXWPFDocument exportEval(NiceXWPFDocument xwpfDocument,List<BusEvaluationEntity> evals) throws Exception {
-        if(CollUtil.isEmpty(evals)){
-            return xwpfDocument;
-        }
-        xwpfDocument.createParagraph().createRun().addBreak(BreakType.PAGE);
-        LoopColumnTableRenderPolicy  policy  = new LoopColumnTableRenderPolicy();
-        Configure config = Configure.builder()
-                .bind("evals", policy)
-                .build();
-        xwpfDocument = xwpfDocument.merge(XWPFTemplate.compile(
-                new ByteArrayInputStream(eval_pattern), config).render(MapUtil.builder()
-                .put("evals", evals)
-                .build())
-                .getXWPFDocument());
-        return xwpfDocument;
-    }
-
-    /**
-     * 导出统计图片
-     */
-    private  static NiceXWPFDocument exportImage(NiceXWPFDocument document,String base64) throws Exception {
-        if(StrUtil.isEmpty(base64)){
-            return document;
-        }
-        document.createParagraph().createRun().addBreak(BreakType.PAGE);
-        document=document.merge(XWPFTemplate.compile(
-                new ByteArrayInputStream(image_pattern))
-                .render(MapUtil.builder()
-                        . put("image", Pictures.ofBase64(base64, PictureType.PNG)
-                                .size(687, 500).create())
-                        .build())
-                .getXWPFDocument());
-        return document;
-    }
 }

+ 18 - 14
nb-service/web-service/src/main/java/com/nb/web/service/system/service/impl/SysRoleServiceImpl.java

@@ -169,21 +169,25 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
         StpLogic stpLogic = SecurityUtil.getStpLogic();
         //分配菜单后将对应的在线人员进行更新
         List<SysUserRole> userRoleList = sysUserRoleService.list(new QueryWrapper<SysUserRole>().lambda().eq(SysUserRole::getRoleId, req.getRoleId()));
-        userRoleList
-                .parallelStream()
-                .forEach(sysUserRole -> {
-                    Set<String> permissionsByUserId = sysMenuService.getPermissionsByUserId(sysUserRole.getUserId());
-                    List<String> tokens =stpLogic.getTokenValueListByLoginId(sysUserRole.getUserId());
-                    tokens.
-                            parallelStream().forEach(token->{
-                        SaSession tokenSessionByToken = stpLogic.getTokenSessionByToken(token);
-                        LoginUser user = (LoginUser) tokenSessionByToken.get(Constants.LOGIN_USER_KEY);
-                        if(user!=null){
-                            user.setPermissions(permissionsByUserId);
-                            tokenSessionByToken.set(Constants.LOGIN_USER_KEY,user);
-                        }
+        if (CollUtil.isNotEmpty(userRoleList)) {
+            userRoleList
+                    .parallelStream()
+                    .filter(Objects::nonNull)
+                    .forEach(sysUserRole -> {
+                        Set<String> permissionsByUserId = sysMenuService.getPermissionsByUserId(sysUserRole.getUserId());
+                        List<String> tokens =stpLogic.getTokenValueListByLoginId(sysUserRole.getUserId());
+                        tokens.
+                                parallelStream().forEach(token->{
+                            SaSession tokenSessionByToken = stpLogic.getTokenSessionByToken(token);
+                            LoginUser user = (LoginUser) tokenSessionByToken.get(Constants.LOGIN_USER_KEY);
+                            if(user!=null){
+                                user.setPermissions(permissionsByUserId);
+                                tokenSessionByToken.set(Constants.LOGIN_USER_KEY,user);
+                            }
+                        });
                     });
-                });
+        }
+
     }
 
     @Override

BIN
nb-service/web-service/src/main/resources/export/AnalRecordTemp.docx


Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 0
nb-service/web-service/src/main/resources/export/base64.txt


BIN
nb-service/web-service/src/main/resources/export/evalTmp.docx


BIN
nb-service/web-service/src/main/resources/export/imageTmp.docx


BIN
nb-service/web-service/src/main/resources/export/infusionHistoryTmp.docx


BIN
nb-service/web-service/src/main/resources/export/patientTmp.docx


Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff