diff --git a/ruisi_java/ruisi-cc-common/src/main/java/com/ccsens/common/core/domain/entity/SysUser.java b/ruisi_java/ruisi-cc-common/src/main/java/com/ccsens/common/core/domain/entity/SysUser.java index eed53fd..1b96f55 100644 --- a/ruisi_java/ruisi-cc-common/src/main/java/com/ccsens/common/core/domain/entity/SysUser.java +++ b/ruisi_java/ruisi-cc-common/src/main/java/com/ccsens/common/core/domain/entity/SysUser.java @@ -208,6 +208,11 @@ public class SysUser extends BaseEntity { */ private String versions; + /** + * 部门权限字段 + */ + private String dataPower; + public SysUser() { } @@ -490,6 +495,14 @@ public class SysUser extends BaseEntity { return timeRemaining; } + public String getDataPower() { + return dataPower; + } + + public void setDataPower(String dataPower) { + this.dataPower = dataPower; + } + public void setTimeRemaining(Long timeRemaining) { this.timeRemaining = timeRemaining; } diff --git a/ruisi_java/ruisi-cc-common/src/main/java/com/ccsens/common/enums/DataSourceType.java b/ruisi_java/ruisi-cc-common/src/main/java/com/ccsens/common/enums/DataSourceType.java index 927d847..35d5949 100644 --- a/ruisi_java/ruisi-cc-common/src/main/java/com/ccsens/common/enums/DataSourceType.java +++ b/ruisi_java/ruisi-cc-common/src/main/java/com/ccsens/common/enums/DataSourceType.java @@ -19,5 +19,5 @@ public enum DataSourceType { /** * 柳铁 */ - LTSZXYY + ORACLE } diff --git a/ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/config/DruidConfig.java b/ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/config/DruidConfig.java index 7c7ab3b..8659c62 100644 --- a/ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/config/DruidConfig.java +++ b/ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/config/DruidConfig.java @@ -53,12 +53,21 @@ public class DruidConfig { return druidProperties.dataSource(dataSource); } + @Bean + @ConfigurationProperties("spring.datasource.druid.oracle") + @ConditionalOnProperty(prefix = "spring.datasource.druid.oracle", name = "enabled", havingValue = "true") + public DataSource oracleDataSource(DruidProperties druidProperties) { + DruidDataSource dataSource = DruidDataSourceBuilder.create().build(); + return druidProperties.dataSource(dataSource); + } + @Bean(name = "dynamicDataSource") @Primary public DynamicDataSource dataSource(DataSource masterDataSource) { Map targetDataSources = new HashMap<>(); targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource); setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource"); + setDataSource(targetDataSources, DataSourceType.ORACLE.name(), "oracleDataSource"); // 添加这一行 return new DynamicDataSource(masterDataSource, targetDataSources); } diff --git a/ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/datasource/DataSourceManager.java b/ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/datasource/DataSourceManager.java index 1e80c29..cc2df0a 100644 --- a/ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/datasource/DataSourceManager.java +++ b/ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/datasource/DataSourceManager.java @@ -48,4 +48,8 @@ public class DataSourceManager { public static void setDataSourceKey(String key) { DynamicDataSourceContextHolder.setDataSourceType(key); } + + public static void clearDataSourceKey() { + DynamicDataSourceContextHolder.clearDataSourceType(); + } } diff --git a/ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/web/service/SysLoginService.java b/ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/web/service/SysLoginService.java index e03b410..2e52fe5 100644 --- a/ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/web/service/SysLoginService.java +++ b/ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/web/service/SysLoginService.java @@ -3,10 +3,13 @@ package com.ccsens.framework.web.service; import javax.annotation.Resource; import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.ObjectUtil; import com.ccsens.common.constant.ErrorConstant; import com.ccsens.common.exception.base.BaseException; +import com.ccsens.common.utils.SecurityUtils; import com.ccsens.framework.security.context.AuthenticationContextHolder; import com.ccsens.framework.security.token.PhoneAuthenticationToken; +import com.ccsens.system.persist.mapper.SysUserMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.BadCredentialsException; @@ -45,7 +48,6 @@ import java.util.stream.Collectors; public class SysLoginService { @Autowired private TokenService tokenService; - @Resource private AuthenticationManager authenticationManager; @@ -58,6 +60,8 @@ public class SysLoginService { @Autowired private ISysConfigService configService; + @Autowired + private SysPermissionService permissionService; /** * 登录验证 * @@ -90,6 +94,10 @@ public class SysLoginService { } AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"), null)); LoginUser loginUser = (LoginUser) authentication.getPrincipal(); + //非总测评师不能登录 + if (!loginUser.getUser().isAdmin() || CollectionUtil.isEmpty(loginUser.getUser().getRoles()) || !loginUser.getUser().getRoles().stream().map(e -> e.getRoleKey()).collect(Collectors.toList()).contains("yy_zcps")) { + throw new BaseException(ErrorConstant.USER_NO_PERMISSION); + } recordLoginInfo(loginUser.getUserId()); // 生成token return tokenService.createToken(loginUser); @@ -129,6 +137,10 @@ public class SysLoginService { } AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"),null)); LoginUser loginUser = (LoginUser) authentication.getPrincipal(); + //非总测评师不能登录 + if (!SecurityUtils.isAdmin(loginUser.getUserId()) && (CollectionUtil.isEmpty(loginUser.getUser().getRoles()) || !loginUser.getUser().getRoles().stream().map(e -> e.getRoleKey()).collect(Collectors.toList()).contains("yy_zcps"))) { + throw new BaseException(ErrorConstant.USER_NO_PERMISSION); + } recordLoginInfo(loginUser.getUserId()); // 生成token return tokenService.createToken(loginUser); @@ -313,4 +325,20 @@ public class SysLoginService { // 生成token return tokenService.createToken(loginUser); } + + /** + * 通过工号获取登录信息 + */ + public String getLoginByEmplCode(String emplCode) { + String token = null; + //根据emplCode查询用户信息 + SysUser user = userService.selectUserByUserName(emplCode); + if (ObjectUtil.isNotNull(user)) { + LoginUser loginUser = new LoginUser(user.getUserId(), user.getDeptId(), user.getHospitalId(), user, permissionService.getMenuPermission(user)); + recordLoginInfo(loginUser.getUserId()); + // 生成token + token = tokenService.createToken(loginUser); + } + return token; + } } diff --git a/ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/web/service/SysPermissionService.java b/ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/web/service/SysPermissionService.java index aac1cee..e88a573 100644 --- a/ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/web/service/SysPermissionService.java +++ b/ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/web/service/SysPermissionService.java @@ -55,7 +55,7 @@ public class SysPermissionService { perms.add("*:*:*"); } else { List roles = user.getRoles(); - if (!roles.isEmpty() && roles.size() > 1) { + if (!roles.isEmpty()) { // 多角色设置permissions属性,以便数据权限匹配权限 for (SysRole role : roles) { Set rolePerms = menuService.selectMenuPermsByRoleId(role.getRoleId(), clientType); diff --git a/ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/web/service/UserDetailsServiceImpl.java b/ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/web/service/UserDetailsServiceImpl.java index 5b28046..b920393 100644 --- a/ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/web/service/UserDetailsServiceImpl.java +++ b/ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/web/service/UserDetailsServiceImpl.java @@ -7,6 +7,8 @@ import com.ccsens.common.enums.UserStatus; import com.ccsens.common.exception.ServiceException; import com.ccsens.common.utils.ServletUtils; import com.ccsens.common.utils.StringUtils; +import com.ccsens.framework.datasource.DataSourceManager; +import com.ccsens.framework.datasource.DynamicDataSource; import com.ccsens.system.service.ISysUserService; import com.ccsens.system.service.IUmsDeviceService; import org.slf4j.Logger; @@ -101,6 +103,9 @@ public class UserDetailsServiceImpl implements UserDetailsService { } public UserDetails createLoginUser(SysUser user) { - return new LoginUser(user.getUserId(), user.getDeptId(), user.getHospitalId(), user, permissionService.getMenuPermission(user)); + DataSourceManager.setDataSourceKey(user.getDataSourceKey()); + LoginUser loginUser = new LoginUser(user.getUserId(), user.getDeptId(), user.getHospitalId(), user, permissionService.getMenuPermission(user)); + DataSourceManager.clearDataSourceKey(); + return loginUser; } } diff --git a/ruisi_java/ruisi-cc-generator/src/main/resources/mbg.xml b/ruisi_java/ruisi-cc-generator/src/main/resources/mbg.xml index 25fbf34..3125ed2 100644 --- a/ruisi_java/ruisi-cc-generator/src/main/resources/mbg.xml +++ b/ruisi_java/ruisi-cc-generator/src/main/resources/mbg.xml @@ -20,7 +20,7 @@ @@ -121,7 +121,7 @@ - + diff --git a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/dto/PmsPatientDto.java b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/dto/PmsPatientDto.java index db55c34..76162d9 100644 --- a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/dto/PmsPatientDto.java +++ b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/dto/PmsPatientDto.java @@ -285,6 +285,11 @@ public class PmsPatientDto { @ApiModelProperty("病人其他信息") @NotNull(message = "病人其他信息不能为空") private Object model; + + @ApiModelProperty("就诊号") + private String visitNo; + @ApiModelProperty("病人id") + private Long patientId; @ApiModelProperty("类型") @NotNull(message = "病人类型不能为空") private String editType; diff --git a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/dto/RmsDto.java b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/dto/RmsDto.java index 8944f6f..a5b2b8f 100644 --- a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/dto/RmsDto.java +++ b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/dto/RmsDto.java @@ -17,7 +17,7 @@ public class RmsDto { @ApiModel("PatientReportDtoGenerate") @Data - public static class Generate{ + public static class Generate { @ApiModelProperty("病人ID") @NotNull(message = "病人ID不能为空") private Long patientId; @@ -31,7 +31,7 @@ public class RmsDto { @ApiModel("PatientReportDtoQueryDetail") @Data - public static class QueryDetail{ + public static class QueryDetail { @NotNull(message = "测评ID不能为空") @ApiModelProperty("测评ID") private Long evaluationId; @@ -266,7 +266,7 @@ public class RmsDto { @ApiModel("导出历史报告单-DTO") @Data - public static class ReportPDF{ + public static class ReportPDF { @ApiModelProperty("患者唯一标识") private String patientNo; @ApiModelProperty("就诊流水号") @@ -275,7 +275,7 @@ public class RmsDto { @ApiModel("导出历史报告单(查看详细的报告单文件)-DTO") @Data - public static class queryPdfUrl{ + public static class queryPdfUrl { @ApiModelProperty("报告单ID") private Long reportId; @ApiModelProperty("测评ID") @@ -323,4 +323,47 @@ public class RmsDto { @ApiModelProperty("部门id") private Long deptId; } + + @ApiModel("导出报告单-VO") + @Data + public static class Export { + @NotNull(message = "报告单ID不能为空") + @ApiModelProperty("报告单ID") + private Long reportId; + @ApiModelProperty("签名Id") + private Long signId; + @ApiModelProperty("测评ID") + private Long evaluationId; + + @ApiModelProperty("MoCA雷达图路径") + private String ldt; + + + @ApiModelProperty("测评医生(userID)") + private Long testerId; + + private Long deptId; + + @ApiModelProperty("测评版本 0全部 1医生 2个人 3阳性") + private Byte version; + + public String getVersionCode() { + if (version == null) { + return "ALL"; + } + switch (version) { + case 0: + return "ALL"; + case 1: + return "DOCTOR"; + case 2: + return "PERSION"; + case 3: + return "POSITIVE"; + default: + return "ALL"; + } + } + } + } diff --git a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/po/DockEmpl.java b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/po/DockEmpl.java index 8b78ad0..44720a7 100644 --- a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/po/DockEmpl.java +++ b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/po/DockEmpl.java @@ -26,6 +26,10 @@ public class DockEmpl implements Serializable { private String sync; + private String rolePower; + + private String dataPower; + private static final long serialVersionUID = 1L; public Long getId() { @@ -116,6 +120,22 @@ public class DockEmpl implements Serializable { this.sync = sync == null ? null : sync.trim(); } + public String getRolePower() { + return rolePower; + } + + public void setRolePower(String rolePower) { + this.rolePower = rolePower == null ? null : rolePower.trim(); + } + + public String getDataPower() { + return dataPower; + } + + public void setDataPower(String dataPower) { + this.dataPower = dataPower == null ? null : dataPower.trim(); + } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -133,6 +153,8 @@ public class DockEmpl implements Serializable { sb.append(", updateBy=").append(updateBy); sb.append(", updateTime=").append(updateTime); sb.append(", sync=").append(sync); + sb.append(", rolePower=").append(rolePower); + sb.append(", dataPower=").append(dataPower); sb.append("]"); return sb.toString(); } diff --git a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/po/DockEmplExample.java b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/po/DockEmplExample.java index 37a6528..5d692a7 100644 --- a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/po/DockEmplExample.java +++ b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/po/DockEmplExample.java @@ -844,6 +844,146 @@ public class DockEmplExample { addCriterion("sync not between", value1, value2, "sync"); return (Criteria) this; } + + public Criteria andRolePowerIsNull() { + addCriterion("role_power is null"); + return (Criteria) this; + } + + public Criteria andRolePowerIsNotNull() { + addCriterion("role_power is not null"); + return (Criteria) this; + } + + public Criteria andRolePowerEqualTo(String value) { + addCriterion("role_power =", value, "rolePower"); + return (Criteria) this; + } + + public Criteria andRolePowerNotEqualTo(String value) { + addCriterion("role_power <>", value, "rolePower"); + return (Criteria) this; + } + + public Criteria andRolePowerGreaterThan(String value) { + addCriterion("role_power >", value, "rolePower"); + return (Criteria) this; + } + + public Criteria andRolePowerGreaterThanOrEqualTo(String value) { + addCriterion("role_power >=", value, "rolePower"); + return (Criteria) this; + } + + public Criteria andRolePowerLessThan(String value) { + addCriterion("role_power <", value, "rolePower"); + return (Criteria) this; + } + + public Criteria andRolePowerLessThanOrEqualTo(String value) { + addCriterion("role_power <=", value, "rolePower"); + return (Criteria) this; + } + + public Criteria andRolePowerLike(String value) { + addCriterion("role_power like", value, "rolePower"); + return (Criteria) this; + } + + public Criteria andRolePowerNotLike(String value) { + addCriterion("role_power not like", value, "rolePower"); + return (Criteria) this; + } + + public Criteria andRolePowerIn(List values) { + addCriterion("role_power in", values, "rolePower"); + return (Criteria) this; + } + + public Criteria andRolePowerNotIn(List values) { + addCriterion("role_power not in", values, "rolePower"); + return (Criteria) this; + } + + public Criteria andRolePowerBetween(String value1, String value2) { + addCriterion("role_power between", value1, value2, "rolePower"); + return (Criteria) this; + } + + public Criteria andRolePowerNotBetween(String value1, String value2) { + addCriterion("role_power not between", value1, value2, "rolePower"); + return (Criteria) this; + } + + public Criteria andDataPowerIsNull() { + addCriterion("data_power is null"); + return (Criteria) this; + } + + public Criteria andDataPowerIsNotNull() { + addCriterion("data_power is not null"); + return (Criteria) this; + } + + public Criteria andDataPowerEqualTo(String value) { + addCriterion("data_power =", value, "dataPower"); + return (Criteria) this; + } + + public Criteria andDataPowerNotEqualTo(String value) { + addCriterion("data_power <>", value, "dataPower"); + return (Criteria) this; + } + + public Criteria andDataPowerGreaterThan(String value) { + addCriterion("data_power >", value, "dataPower"); + return (Criteria) this; + } + + public Criteria andDataPowerGreaterThanOrEqualTo(String value) { + addCriterion("data_power >=", value, "dataPower"); + return (Criteria) this; + } + + public Criteria andDataPowerLessThan(String value) { + addCriterion("data_power <", value, "dataPower"); + return (Criteria) this; + } + + public Criteria andDataPowerLessThanOrEqualTo(String value) { + addCriterion("data_power <=", value, "dataPower"); + return (Criteria) this; + } + + public Criteria andDataPowerLike(String value) { + addCriterion("data_power like", value, "dataPower"); + return (Criteria) this; + } + + public Criteria andDataPowerNotLike(String value) { + addCriterion("data_power not like", value, "dataPower"); + return (Criteria) this; + } + + public Criteria andDataPowerIn(List values) { + addCriterion("data_power in", values, "dataPower"); + return (Criteria) this; + } + + public Criteria andDataPowerNotIn(List values) { + addCriterion("data_power not in", values, "dataPower"); + return (Criteria) this; + } + + public Criteria andDataPowerBetween(String value1, String value2) { + addCriterion("data_power between", value1, value2, "dataPower"); + return (Criteria) this; + } + + public Criteria andDataPowerNotBetween(String value1, String value2) { + addCriterion("data_power not between", value1, value2, "dataPower"); + return (Criteria) this; + } } public static class Criteria extends GeneratedCriteria { diff --git a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/po/RmsReport.java b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/po/RmsReport.java index 0949fdc..b07fe67 100644 --- a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/po/RmsReport.java +++ b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/po/RmsReport.java @@ -32,6 +32,8 @@ public class RmsReport implements Serializable { private String positiveUrl; + private String allUrl; + private String qrCodeUrl; private String signUrl; @@ -170,6 +172,14 @@ public class RmsReport implements Serializable { this.positiveUrl = positiveUrl == null ? null : positiveUrl.trim(); } + public String getAllUrl() { + return allUrl; + } + + public void setAllUrl(String allUrl) { + this.allUrl = allUrl == null ? null : allUrl.trim(); + } + public String getQrCodeUrl() { return qrCodeUrl; } @@ -286,6 +296,7 @@ public class RmsReport implements Serializable { sb.append(", url=").append(url); sb.append(", persionUrl=").append(persionUrl); sb.append(", positiveUrl=").append(positiveUrl); + sb.append(", allUrl=").append(allUrl); sb.append(", qrCodeUrl=").append(qrCodeUrl); sb.append(", signUrl=").append(signUrl); sb.append(", remark=").append(remark); diff --git a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/po/RmsReportExample.java b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/po/RmsReportExample.java index 04d9fda..4d86cf6 100644 --- a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/po/RmsReportExample.java +++ b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/po/RmsReportExample.java @@ -1035,6 +1035,76 @@ public class RmsReportExample { return (Criteria) this; } + public Criteria andAllUrlIsNull() { + addCriterion("all_url is null"); + return (Criteria) this; + } + + public Criteria andAllUrlIsNotNull() { + addCriterion("all_url is not null"); + return (Criteria) this; + } + + public Criteria andAllUrlEqualTo(String value) { + addCriterion("all_url =", value, "allUrl"); + return (Criteria) this; + } + + public Criteria andAllUrlNotEqualTo(String value) { + addCriterion("all_url <>", value, "allUrl"); + return (Criteria) this; + } + + public Criteria andAllUrlGreaterThan(String value) { + addCriterion("all_url >", value, "allUrl"); + return (Criteria) this; + } + + public Criteria andAllUrlGreaterThanOrEqualTo(String value) { + addCriterion("all_url >=", value, "allUrl"); + return (Criteria) this; + } + + public Criteria andAllUrlLessThan(String value) { + addCriterion("all_url <", value, "allUrl"); + return (Criteria) this; + } + + public Criteria andAllUrlLessThanOrEqualTo(String value) { + addCriterion("all_url <=", value, "allUrl"); + return (Criteria) this; + } + + public Criteria andAllUrlLike(String value) { + addCriterion("all_url like", value, "allUrl"); + return (Criteria) this; + } + + public Criteria andAllUrlNotLike(String value) { + addCriterion("all_url not like", value, "allUrl"); + return (Criteria) this; + } + + public Criteria andAllUrlIn(List values) { + addCriterion("all_url in", values, "allUrl"); + return (Criteria) this; + } + + public Criteria andAllUrlNotIn(List values) { + addCriterion("all_url not in", values, "allUrl"); + return (Criteria) this; + } + + public Criteria andAllUrlBetween(String value1, String value2) { + addCriterion("all_url between", value1, value2, "allUrl"); + return (Criteria) this; + } + + public Criteria andAllUrlNotBetween(String value1, String value2) { + addCriterion("all_url not between", value1, value2, "allUrl"); + return (Criteria) this; + } + public Criteria andQrCodeUrlIsNull() { addCriterion("qr_code_url is null"); return (Criteria) this; diff --git a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/vo/DockVo.java b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/vo/DockVo.java new file mode 100644 index 0000000..9eb0641 --- /dev/null +++ b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/vo/DockVo.java @@ -0,0 +1,304 @@ +package com.ccsens.system.domain.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * @author zy + * @date 2026/3/11 9:06 + */ +@Data +public class DockVo { + /** + * 部门信息 + */ + @Data + @ApiModel("部门信息-DeptInfo") + public static class DeptInfo { + @ApiModelProperty(value = "科室名称", required = true) + private String deptName; + + @ApiModelProperty(value = "科室编码", required = true) + private String deptCode; + + @ApiModelProperty(value = "更新时间(视图内此数据的创建/更新时间)", required = true) + private Date updateTime; + } + + /** + * 员工信息 + */ + @Data + @ApiModel("员工信息-EmplInfo") + public static class EmplInfo { + @ApiModelProperty(value = "姓名", required = true) + private String emplName; + + @ApiModelProperty(value = "工号或者账号", required = true) + private String emplCode; + + @ApiModelProperty(value = "医生或者护士身份判断标识(0医生;1护士)", required = true) + private String emplType; + + @ApiModelProperty(value = "所属科室编码", required = true) + private String deptCode; + + @ApiModelProperty(value = "功能权限(0:评估师;1:总评估师;空:默认是评估师)") + private String rolePower; + + @ApiModelProperty(value = "数据权限(空:所在科室;ALL:所有科室;A,B,C,D:指定科室编码)") + private String dataPower; + + @ApiModelProperty(value = "更新时间(视图内此数据的创建/更新时间)", required = true) + private Date updateTime; + } + + /** + * 患者基本信息 + */ + @Data + @ApiModel("患者基本信息-PatientBasicInfo") + public static class PatientBasicInfo { + @ApiModelProperty(value = "姓名", required = true) + private String name; + + @ApiModelProperty(value = "患者编号(院内唯一标识)", required = true) + private String patientNo; + + @ApiModelProperty(value = "证件号码", required = true) + private String idCard; + + @ApiModelProperty(value = "联系电话", required = true) + private String phone; + + @ApiModelProperty(value = "性别(0女、1男)") + private String sex; + + @ApiModelProperty(value = "出生日期") + private Date birthday; + + @ApiModelProperty(value = "受教育程度(0文盲、1小学、2初中、3高中/技校/中专、4大学/专科及以上)", required = true) + private String educationalStatus; + + @ApiModelProperty(value = "职业类型(1农林牧渔水利生产人员 2教师 3医务工作者 4专业技术人员 5生产、运输设备操作人员 6商业、服务业人员 7国家机关、事业单位、企业负责人 8办事人员和有关人员 9军人 10媒体、文体类工作人员 11在校学生 12未就业 13家务 14其他)") + private String career; + + @ApiModelProperty(value = "婚姻状况(0已婚、1未婚、2离婚、3丧偶、4未知)") + private String maritalStatus; + + @ApiModelProperty(value = "民族(中文,例如:汉族)") + private String nation; + + @ApiModelProperty(value = "籍贯(中文,例如:山西省太原市)") + private String nativePlace; + + @ApiModelProperty(value = "现住址") + private String address; + + @ApiModelProperty(value = "居住状态(0独居、1夫妻同住、2多代加入同住、3养老院、4其他)") + private String dwellingState; + + @ApiModelProperty(value = "联系人姓名") + private String contactName; + + @ApiModelProperty(value = "联系人电话") + private String contactMobile; + + @ApiModelProperty(value = "与联系人关系") + private String contactRelation; + + @ApiModelProperty(value = "ABO血型") + private String aboBloodType; + + @ApiModelProperty(value = "Rh血型") + private String rhBloodType; + + @ApiModelProperty(value = "信仰") + private String belief; + + @ApiModelProperty(value = "爱好") + private String hobby; + + @ApiModelProperty(value = "更新时间(视图内此数据的创建/更新时间)", required = true) + private Date updateTime; + } + + /** + * 患者就诊信息 + */ + @Data + @ApiModel("患者就诊信息-PatientVisitInfo") + public static class PatientVisitInfo { + @ApiModelProperty(value = "就诊流水号", required = true) + private String visitNo; + + @ApiModelProperty(value = "患者编号", required = true) + private String patientNo; + + @ApiModelProperty(value = "证件号码", required = true) + private String idCard; + + @ApiModelProperty(value = "就诊类型(0门诊 1住院)", required = true) + private String visitType; + + @ApiModelProperty(value = "年龄") + private Integer age; + + @ApiModelProperty(value = "就诊/住院科室") + private String department; + + @ApiModelProperty(value = "就诊/主治医师") + private String doctor; + + @ApiModelProperty(value = "就诊/入院日期") + private Date admissionDate; + + @ApiModelProperty(value = "住院次数") + private Integer admissionCount; + + @ApiModelProperty(value = "床位号") + private String bedNumber; + + @ApiModelProperty(value = "出院日期") + private Date dischargeDate; + + @ApiModelProperty(value = "入院途径") + private String admissionMethod; + + @ApiModelProperty(value = "离院方式") + private String dischargeMethod; + + @ApiModelProperty(value = "身高(单位:厘米)") + private BigDecimal height; + + @ApiModelProperty(value = "体重(单位:千克)") + private BigDecimal weight; + + @ApiModelProperty(value = "T值") + private BigDecimal tz; + + @ApiModelProperty(value = "体温(单位:摄氏度)") + private BigDecimal temperature; + + @ApiModelProperty(value = "收缩压") + private Integer bloodPressureShrink; + + @ApiModelProperty(value = "舒张压") + private Integer bloodPressureDiastole; + + @ApiModelProperty(value = "脉搏") + private Integer pulse; + + @ApiModelProperty(value = "肌酐") + private BigDecimal creatinine; + + @ApiModelProperty(value = "血氧饱和度") + private BigDecimal oxygenSaturation; + + @ApiModelProperty(value = "白蛋白") + private BigDecimal albumin; + + @ApiModelProperty(value = "总蛋白") + private BigDecimal totalProtein; + + @ApiModelProperty(value = "维生素D3测定") + private BigDecimal vitaminD3; + + @ApiModelProperty(value = "凝血酶原时间") + private BigDecimal hematocrit; + + @ApiModelProperty(value = "D-二聚体") + private BigDecimal dimer; + + @ApiModelProperty(value = "是否吸烟(0=否,1=是)") + private Byte smokingHistory; + + @ApiModelProperty(value = "吸烟年限") + private Integer smokingYear; + + @ApiModelProperty(value = "是否戒烟(0=否,1=是)") + private Byte smokingQuit; + + @ApiModelProperty(value = "戒烟年限") + private Integer smokingQuitYear; + + @ApiModelProperty(value = "是否饮酒(0=否,1=是)") + private Byte drinkHistory; + + @ApiModelProperty(value = "饮酒年限") + private Integer drinkYear; + + @ApiModelProperty(value = "是否戒酒(0=否,1=是)") + private Byte drinkQuit; + + @ApiModelProperty(value = "戒酒年限") + private Integer drinkQuitYear; + + @ApiModelProperty(value = "是否过敏(0=否,1=是)") + private Byte hasAllergy; + + @ApiModelProperty(value = "过敏药") + private String allergyDrug; + + @ApiModelProperty(value = "更新时间(视图内此数据的创建/更新时间)", required = true) + private Date updateTime; + } + + /** + * 诊断信息 + */ + @Data + @ApiModel("诊断信息-DiagnosisInfo") + public static class DiagnosisInfo { + @ApiModelProperty(value = "门诊/住院号(关联就诊信息内的就诊号)", required = true) + private String visitNo; + + @ApiModelProperty(value = "诊断类型") + private String diagnosisType; + + @ApiModelProperty(value = "是否主要诊断(0=否,1=是)") + private Byte isMainDiagnosis; + + @ApiModelProperty(value = "诊断名称") + private String diagnosisName; + + @ApiModelProperty(value = "诊断编码") + private String diagnosisCode; + + @ApiModelProperty(value = "诊断日期") + private Date diagnosisDate; + + @ApiModelProperty(value = "更新时间(视图内此数据的创建/更新时间)", required = true) + private Date updateTime; + } + + /** + * 用药信息 + */ + @Data + @ApiModel("用药信息-MedicationInfo") + public static class MedicationInfo { + @ApiModelProperty(value = "门诊/住院号(关联就诊信息内的就诊号)", required = true) + private String visitNo; + + @ApiModelProperty(value = "药物名称") + private String drugName; + + @ApiModelProperty(value = "剂量") + private BigDecimal dose; + + @ApiModelProperty(value = "单位") + private String unit; + + @ApiModelProperty(value = "频率") + private String frequency; + + @ApiModelProperty(value = "更新时间(视图内此数据的创建/更新时间)", required = true) + private Date updateTime; + } + +} diff --git a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/vo/PmsPatientVo.java b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/vo/PmsPatientVo.java index a0bbf21..65d7c11 100644 --- a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/vo/PmsPatientVo.java +++ b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/vo/PmsPatientVo.java @@ -98,6 +98,7 @@ public class PmsPatientVo { */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date createTime; + private String createBy; @ApiModelProperty("医院名称") private String hospitalName; @@ -892,6 +893,52 @@ public class PmsPatientVo { private String hospitalName; private Integer birthYear; + @ApiModelProperty("病人名字") + private String name; + @ApiModelProperty("名称首字母") + private String nameInitial; + @ApiModelProperty("名称全全拼") + private String nameFull; + @ApiModelProperty("病人门诊号") + private String patientNumber; + @ApiModelProperty("病人住院号") + private String hospitalNumber; + @ApiModelProperty("婚姻状况(1:未婚2:已婚 3:离异 4:分居 5:丧偶 6:同居 7:其他 )") + private Byte maritalStatus; + @ApiModelProperty("教育程度(1:文盲 2:小学 3:初中 4:高中 5:大学 6:大学以上 7:其他)") + private Byte educationalStatus; + @ApiModelProperty("受教育时间(年或月)") + private String educationalStatusUnit; + @ApiModelProperty("民族") + private String nation; + @ApiModelProperty("籍贯") + private String nativePlace; + @ApiModelProperty("职业(1:农林牧渔水利生产人员 2:教师 3:医务工作者 4:专业技术人员 5:生产、运输设备操作人员及有关人员6:商业、服务业人员7:国家机关、事业单位、企业负责人8:国家机关、事业单位、企业办事人员和有关人员9:军人 10:媒体、文体类工作人员 11:在校学生 12:未就业 13:家务 14:其他") + private Byte career; + @ApiModelProperty("生育数量") + private Integer birthNumber; + @ApiModelProperty("绝经年龄(女)") + private Integer menopauseAge; + @ApiModelProperty("联系人") + private String contact; + @ApiModelProperty("手机") + private String mobile; + @ApiModelProperty("电话") + private String phone; + @ApiModelProperty("省份") + private String province; + @ApiModelProperty("城市") + private String city; + @ApiModelProperty("住址") + private String address; + @ApiModelProperty("住所(1:自己家中 2:养老院 3:其他)") + private Byte domicile; + @ApiModelProperty("独立生活能力(1:能够独立生活 2:需要他人帮助完成复杂活动 3:需要他人帮助完成基本活动 4:完全依赖他人生活 5:未知 6:其他)") + private Byte independentLivingSkills; + @ApiModelProperty("居住状态(1:独居 2:与配偶或对象或子女 3:与亲戚或朋友居住)") + private Byte dwellingState; + private String birthday; + private String contactName; @ApiModelProperty("其他病史信息") private Map>> otherMsg; diff --git a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/vo/RmsVo.java b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/vo/RmsVo.java index ac1f7ab..b79e74a 100644 --- a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/vo/RmsVo.java +++ b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/vo/RmsVo.java @@ -6,6 +6,7 @@ import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; import com.ccsens.common.constant.CultureEnum; import com.ccsens.common.constant.GenConstants; +import com.ccsens.common.constant.JobEnum; import com.ccsens.common.enums.BaseEnum; import com.ccsens.common.utils.PdfUtil; import com.ccsens.system.domain.po.TzbsRmsReportResult; @@ -144,6 +145,8 @@ public class RmsVo { @ApiModelProperty("测评ID") private Long evaluationId; private String testerName; + @ApiModelProperty("患者姓名") + private String name; private Long patientId; @@ -169,7 +172,7 @@ public class RmsVo { private String createBy; - private Date createTime; + private Date evaluationTime; private String updateBy; @@ -183,9 +186,10 @@ public class RmsVo { private String visitNo; private String scaleName; - private Byte needPlan; + private Integer needPlan; private String deptName; + private Byte evaluationStatus = 1; } @@ -278,7 +282,23 @@ public class RmsVo { @ApiModelProperty("出生日期") private String birthday; + @ApiModelProperty("患者联系电话") + private String mobile; + + @ApiModelProperty("婚姻状况1:未婚2:已婚 3:离异 4:丧偶 5:未知 ") + private Byte maritalStatus; + @ApiModelProperty("居住状态(1:独居 2:夫妻同住 3:多代加入同住; 4养老院; 5其他)") + private Byte dwellingState; + @ApiModelProperty("信仰") + private String belief; + + public String getMarial(){ + return maritalStatus == null ? "" : maritalStatus == 1 ? "未婚" : maritalStatus == 2 ? "已婚" : maritalStatus == 3 ? "离异" : maritalStatus == 4 ? "丧偶" : "未知"; + } + public String getDwelling(){ + return dwellingState == null ? "" : dwellingState == 1 ? "独居" : dwellingState == 2 ? "夫妻同住" : dwellingState == 3 ? "多代加入同住" : dwellingState == 4 ? "养老院" : "其他"; + } public List toPdfRow() { List rows = getInitRows(); //第四栏 @@ -1318,4 +1338,19 @@ public class RmsVo { } } } + + @Data + public static class Pgjl{ + private String title; + private String scaleName; + private BigDecimal score; + private String result; + } + + @Data + public static class QuestionTable{ + private String question; + private String result; + private String score; + } } diff --git a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/persist/dao/OracleViewDao.java b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/persist/dao/OracleViewDao.java new file mode 100644 index 0000000..87c44d1 --- /dev/null +++ b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/persist/dao/OracleViewDao.java @@ -0,0 +1,64 @@ +package com.ccsens.system.persist.dao; + +import com.ccsens.system.domain.vo.DockVo; +import org.apache.ibatis.annotations.Param; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * @author zy + * @date 2026/3/10 18:13 + */ +public interface OracleViewDao { + + /** + * 查询部门信息视图 + * @param startTime 开始时间 + * @param endTime 结束时间 + * @return 部门信息列表 + */ + List getDeptView(@Param("startTime") Date startTime, @Param("endTime") Date endTime); + + /** + * 查询员工信息视图 + * @param startTime 开始时间 + * @param endTime 结束时间 + * @return 员工信息列表 + */ + List getEmplView(@Param("startTime") Date startTime, @Param("endTime") Date endTime); + + /** + * 查询患者基本信息视图 + * @param startTime 开始时间 + * @param endTime 结束时间 + * @return 患者基本信息列表 + */ + List getPatientBasicView(@Param("startTime") Date startTime, @Param("endTime") Date endTime); + + /** + * 查询患者就诊信息视图 + * @param startTime 开始时间 + * @param endTime 结束时间 + * @return 患者就诊信息列表 + */ + List getPatientVisitView(@Param("startTime") Date startTime, @Param("endTime") Date endTime); + + /** + * 查询诊断信息视图 + * @param startTime 开始时间 + * @param endTime 结束时间 + * @return 诊断信息列表 + */ + List getDiagnosisView(@Param("startTime") Date startTime, @Param("endTime") Date endTime); + + /** + * 查询用药信息视图 + * @param startTime 开始时间 + * @param endTime 结束时间 + * @return 用药信息列表 + */ + List getMedicationView(@Param("startTime") Date startTime, @Param("endTime") Date endTime); + +} diff --git a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/persist/dao/StatisticsDao.java b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/persist/dao/StatisticsDao.java index c7bbbf1..dc92dcd 100644 --- a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/persist/dao/StatisticsDao.java +++ b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/persist/dao/StatisticsDao.java @@ -21,6 +21,9 @@ public interface StatisticsDao { */ HomeDpVo.Zhsjgl nntotal(@Param("dto") StatisticsDto.Query dto); + Integer getPatientNum(@Param("dto") StatisticsDto.Query dto, + @Param("sex") Byte sex); + /** * BMI * @param dto diff --git a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/persist/mapper/SysDeptMapper.java b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/persist/mapper/SysDeptMapper.java index dcd5745..7d94155 100644 --- a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/persist/mapper/SysDeptMapper.java +++ b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/persist/mapper/SysDeptMapper.java @@ -117,4 +117,9 @@ public interface SysDeptMapper { public int deleteDeptById(Long deptId); List queryDeptByIdList(@Param("deptIdList") List deptIdList); + + /** + * 同步——根据部门code查找部门信息(逗号分隔的多个部门code) + */ + List queryDeptByDeptCode(@Param("deptCode") String deptCode); } diff --git a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/persist/mapper/SysRoleMapper.java b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/persist/mapper/SysRoleMapper.java index b8575aa..d39d3b5 100644 --- a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/persist/mapper/SysRoleMapper.java +++ b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/persist/mapper/SysRoleMapper.java @@ -107,4 +107,9 @@ public interface SysRoleMapper { * @return 结果 */ public int deleteRoleByIds(Long[] roleIds); + + /** + * 通过权限key查找角色 + */ + public SysRole queryRoleByRoleKey(@Param("roleKey") String roleKey); } diff --git a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/persist/mapper/SysUserMapper.java b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/persist/mapper/SysUserMapper.java index b193b24..f8a5e4d 100644 --- a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/persist/mapper/SysUserMapper.java +++ b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/persist/mapper/SysUserMapper.java @@ -154,4 +154,6 @@ public interface SysUserMapper { List selectUserByRoleKey(@Param("roleKey") String roleKey); List getZcpsByHospitalId(@Param("hospitalId")Long hospitalId); + + SysUser selectUserByEmplCode(@Param("emplCode")String emplCode); } diff --git a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/service/DockService.java b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/service/DockService.java index 31f5d54..877b787 100644 --- a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/service/DockService.java +++ b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/service/DockService.java @@ -3,6 +3,7 @@ package com.ccsens.system.service; import com.ccsens.common.core.domain.entity.SysDept; import com.ccsens.common.core.domain.entity.SysUser; import com.ccsens.system.domain.dto.DockDto; +import com.ccsens.system.domain.vo.DockVo; import java.util.Date; import java.util.List; @@ -32,4 +33,22 @@ public interface DockService { void syncUmsDeptMaster(List sysDepts); List syncUmsUserSlave(); void syncUmsUserMaster(List sysUsers); + + List getDeptView(); + void syncDeptView(List sysDepts); + + List getEmplView(); + void syncEmplView(List sysEmpls); + + List getPatientBasicView(); + void syncPatientBasicView(List sysPatients); + + List getPatientVisitView(); + void syncPatientVisitView(List sysVisits); + + List getDiagnosisView(); + void syncDiagnosisView(List sysDiagnosis); + + List getMedicationView(); + void syncMedicationView(List sysMedications); } diff --git a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/service/impl/DockServiceImpl.java b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/service/impl/DockServiceImpl.java index 066acd5..ff25403 100644 --- a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/service/impl/DockServiceImpl.java +++ b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/service/impl/DockServiceImpl.java @@ -11,7 +11,9 @@ import cn.hutool.extra.pinyin.PinyinUtil; import com.ccsens.common.annotation.DataSource; import com.ccsens.common.constant.ErrorConstant; import com.ccsens.common.core.domain.entity.SysDept; +import com.ccsens.common.core.domain.entity.SysRole; import com.ccsens.common.core.domain.entity.SysUser; +import com.ccsens.common.core.domain.model.LoginUser; import com.ccsens.common.enums.DataSourceType; import com.ccsens.common.exception.base.BaseException; import com.ccsens.common.utils.DateUtils; @@ -20,11 +22,14 @@ import com.ccsens.common.utils.StringUtils; import com.ccsens.system.domain.SysUserRole; import com.ccsens.system.domain.dto.DockDto; import com.ccsens.system.domain.po.*; +import com.ccsens.system.domain.vo.DockVo; import com.ccsens.system.persist.dao.DockDao; +import com.ccsens.system.persist.dao.OracleViewDao; import com.ccsens.system.persist.mapper.*; import com.ccsens.system.service.DmsDataValueService; import com.ccsens.system.service.DockService; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; @@ -78,6 +83,11 @@ public class DockServiceImpl implements DockService { private SysUserMapper sysUserMapper; @Resource private SysUserRoleMapper userRoleMapper; + @Resource + private SysRoleMapper sysRoleMapper; + @Resource + private OracleViewDao oracleViewDao; + @Value("${hospitalId:}") private Long hospitalId; @@ -279,6 +289,7 @@ public class DockServiceImpl implements DockService { } } + @Override public void syncHospitalData() { //患者信息 try { @@ -307,6 +318,7 @@ public class DockServiceImpl implements DockService { } + @Override @DataSource(value = DataSourceType.MASTER) @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) public void syncUmsUserMaster(List sysUsers) { @@ -319,13 +331,18 @@ public class DockServiceImpl implements DockService { if (CollUtil.isEmpty(users)) { sysUser.setDeptId(hospitalId); sysUserMapper.insertUser(sysUser); + }else { + sysUser.setUserId(users.get(0).getUserId()); + sysUserMapper.updateUser(sysUser); } } } } - // @DataSource(value = DataSourceType.SLAVE) -// @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) + + + + @Override public List syncUmsUserSlave() { List returnUsers = new ArrayList<>(); DockEmplExample dockEmplExample = new DockEmplExample(); @@ -344,6 +361,26 @@ public class DockServiceImpl implements DockService { } else { sysDept = sysDepts.get(0); } + //处理用户的部门权限 + String dataPower = ""; + if(StrUtil.isNotEmpty(dockEmpl.getDataPower())){ + if("All".equals(dockEmpl.getDataPower())){ + dataPower = "All"; + }else { + List depts = sysDeptMapper.queryDeptByDeptCode(dockEmpl.getDataPower()); + dataPower = depts.stream().map(SysDept::getDeptId).map(String::valueOf).collect(Collectors.joining(",")); + } + } + //处理角色权限 + SysRole role = null; + if(StrUtil.isNotEmpty(dockEmpl.getRolePower()) && "1".equals(dockEmpl.getRolePower())){ + //总评估师 + role = sysRoleMapper.queryRoleByRoleKey("yy_zcps"); + }else { + //评估师 + role = sysRoleMapper.queryRoleByRoleKey("yy_cps"); + } + SysUser sysUser = new SysUser(); sysUser.setEmplCode(dockEmpl.getEmplCode()); List sysUsers = sysUserMapper.selectUserList(sysUser); @@ -355,24 +392,44 @@ public class DockServiceImpl implements DockService { sysUser.setPassword(SecurityUtils.encryptPassword(generalPassword)); //获取一年后的日期 sysUser.setValidDate(DateUtil.offset(new Date(), DateField.YEAR, 1)); + sysUser.setDataPower(dataPower); sysUserMapper.insertUser(sysUser); // 新增用户与角色管理 - SysUserRole ur = new SysUserRole(); - ur.setUserId(sysUser.getUserId()); - ur.setRoleId(104L); - userRoleMapper.batchUserRole(CollUtil.newArrayList(ur)); - + if(role != null) { + SysUserRole ur = new SysUserRole(); + ur.setUserId(sysUser.getUserId()); + ur.setRoleId(role.getRoleId()); + userRoleMapper.batchUserRole(CollUtil.newArrayList(ur)); + } returnUsers.add(sysUser); dockEmpl.setSync("1"); dockEmplMapper.updateByPrimaryKeySelective(dockEmpl); + }else { + //存在则更新 + SysUser user = sysUsers.get(0); + user.setDeptId(sysDept.getDeptId()); + user.setNickName(dockEmpl.getEmplName()); + user.setDataPower(dataPower); + sysUserMapper.updateUser(user); + //删除旧的用户角色关联 + userRoleMapper.deleteUserRoleByUserId(user.getUserId()); + // 新增用户与角色管理 + if(role != null) { + SysUserRole ur = new SysUserRole(); + ur.setUserId(user.getUserId()); + ur.setRoleId(role.getRoleId()); + userRoleMapper.batchUserRole(CollUtil.newArrayList(ur)); + } + returnUsers.add(user); + dockEmpl.setSync("1"); + dockEmplMapper.updateByPrimaryKeySelective(dockEmpl); } } return returnUsers; } - // @DataSource(value = DataSourceType.SLAVE) -// @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) + @Override public List syncUmsDeptSlave() { List returnDepts = new ArrayList<>(); //查找同步表中的部门信息 @@ -409,6 +466,7 @@ public class DockServiceImpl implements DockService { return returnDepts; } + @Override @DataSource(value = DataSourceType.MASTER) @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) public void syncUmsDeptMaster(List sysDepts) { @@ -429,7 +487,6 @@ public class DockServiceImpl implements DockService { } } - private void syncPmsPatient() { //查找医院下第一个总测评师 List sysUserList = sysUserMapper.getZcpsByHospitalId(hospitalId); @@ -866,4 +923,190 @@ public class DockServiceImpl implements DockService { } + @Override + public List getDeptView() { + // 当前时间 + Date endTime = new Date(); + // 一小时前的时间 + Date startTime = new Date(System.currentTimeMillis() - 60 * 60 * 1000); + return oracleViewDao.getDeptView(startTime, endTime); + } + + @Override + public void syncDeptView(List sysDepts) { + if(CollUtil.isNotEmpty(sysDepts)){ + for (DockVo.DeptInfo sysDept : sysDepts) { + DockDept dockDept = new DockDept(); + dockDept.setDeptName(sysDept.getDeptName()); + dockDept.setDeptCode(sysDept.getDeptCode()); + dockDept.setSync(String.valueOf(0)); + dockDeptMapper.insertSelective(dockDept); + } + } + } + + @Override + public List getEmplView() { + Date endTime = new Date(); + Date startTime = new Date(System.currentTimeMillis() - 60 * 60 * 1000); + return oracleViewDao.getEmplView(startTime, endTime); + } + + @Override + public void syncEmplView(List sysEmpls) { + if(CollUtil.isNotEmpty(sysEmpls)){ + for (DockVo.EmplInfo sysEmpl : sysEmpls) { + DockEmpl dockEmpl = new DockEmpl(); + dockEmpl.setEmplName(sysEmpl.getEmplName()); + dockEmpl.setEmplCode(sysEmpl.getEmplCode()); + dockEmpl.setEmplType(sysEmpl.getEmplType()); + dockEmpl.setDeptCode(sysEmpl.getDeptCode()); + dockEmpl.setRolePower(sysEmpl.getRolePower()); + dockEmpl.setDataPower(sysEmpl.getDataPower()); + dockEmpl.setSync(String.valueOf(0)); + dockEmplMapper.insertSelective(dockEmpl); + } + } + } + + @Override + public List getPatientBasicView() { + Date endTime = new Date(); + Date startTime = new Date(System.currentTimeMillis() - 60 * 60 * 1000); + return oracleViewDao.getPatientBasicView(startTime, endTime); + } + + @Override + public void syncPatientBasicView(List sysPatients) { + if(CollUtil.isNotEmpty(sysPatients)){ + for (DockVo.PatientBasicInfo sysPatient : sysPatients) { + DockPatientBaseInfo dockPatientBase = new DockPatientBaseInfo(); + dockPatientBase.setName(sysPatient.getName()); + dockPatientBase.setPatientNo(sysPatient.getPatientNo()); + dockPatientBase.setIdCard(sysPatient.getIdCard()); + dockPatientBase.setPhone(sysPatient.getPhone()); + dockPatientBase.setSex(sysPatient.getSex()); + dockPatientBase.setBirthday(sysPatient.getBirthday()); + dockPatientBase.setEducationalStatus(sysPatient.getEducationalStatus()); + dockPatientBase.setCareer(sysPatient.getCareer()); + dockPatientBase.setMaritalStatus(sysPatient.getMaritalStatus()); + dockPatientBase.setNation(sysPatient.getNation()); + dockPatientBase.setNativePlace(sysPatient.getNativePlace()); + dockPatientBase.setAddress(sysPatient.getAddress()); + dockPatientBase.setDwellingState(sysPatient.getDwellingState()); + dockPatientBase.setContactName(sysPatient.getContactName()); + dockPatientBase.setContactMobile(sysPatient.getContactMobile()); + dockPatientBase.setContactRelation(sysPatient.getContactRelation()); + dockPatientBase.setAboBloodType(sysPatient.getAboBloodType()); + dockPatientBase.setRhBloodType(sysPatient.getRhBloodType()); + dockPatientBase.setBelief(sysPatient.getBelief()); + dockPatientBase.setHobby(sysPatient.getHobby()); + dockPatientBase.setSync(String.valueOf(0)); + dockPatientBaseInfoMapper.insertSelective(dockPatientBase); + } + } + } + + @Override + public List getPatientVisitView() { + Date endTime = new Date(); + Date startTime = new Date(System.currentTimeMillis() - 60 * 60 * 1000); + return oracleViewDao.getPatientVisitView(startTime, endTime); + } + + @Override + public void syncPatientVisitView(List sysVisits) { + if(CollUtil.isNotEmpty(sysVisits)){ + for (DockVo.PatientVisitInfo sysVisit : sysVisits) { + DockPatientVisitInfo dockPatientVisit = new DockPatientVisitInfo(); + dockPatientVisit.setVisitNo(sysVisit.getVisitNo()); + dockPatientVisit.setPatientNo(sysVisit.getPatientNo()); + dockPatientVisit.setIdCard(sysVisit.getIdCard()); + dockPatientVisit.setVisitType(sysVisit.getVisitType()); + dockPatientVisit.setAge(sysVisit.getAge()); + dockPatientVisit.setDepartment(sysVisit.getDepartment()); + dockPatientVisit.setDoctor(sysVisit.getDoctor()); + dockPatientVisit.setAdmissionDate(sysVisit.getAdmissionDate()); + dockPatientVisit.setAdmissionCount(sysVisit.getAdmissionCount()); + dockPatientVisit.setBedNumber(sysVisit.getBedNumber()); + dockPatientVisit.setDischargeDate(sysVisit.getDischargeDate()); + dockPatientVisit.setAdmissionMethod(sysVisit.getAdmissionMethod()); + dockPatientVisit.setDischargeMethod(sysVisit.getDischargeMethod()); + dockPatientVisit.setHeight(sysVisit.getHeight()); + dockPatientVisit.setWeight(sysVisit.getWeight()); + dockPatientVisit.setTz(sysVisit.getTz()); + dockPatientVisit.setTemperature(sysVisit.getTemperature()); + dockPatientVisit.setBloodPressureShrink(sysVisit.getBloodPressureShrink()); + dockPatientVisit.setBloodPressureDiastole(sysVisit.getBloodPressureDiastole()); + dockPatientVisit.setPulse(sysVisit.getPulse()); + dockPatientVisit.setCreatinine(sysVisit.getCreatinine()); + dockPatientVisit.setOxygenSaturation(sysVisit.getOxygenSaturation()); + dockPatientVisit.setAlbumin(sysVisit.getAlbumin()); + dockPatientVisit.setTotalProtein(sysVisit.getTotalProtein()); + dockPatientVisit.setVitaminD3(sysVisit.getVitaminD3()); + dockPatientVisit.setHematocrit(sysVisit.getHematocrit()); + dockPatientVisit.setDimer(sysVisit.getDimer()); + dockPatientVisit.setSmokingHistory(sysVisit.getSmokingHistory()); + dockPatientVisit.setSmokingYear(sysVisit.getSmokingYear()); + dockPatientVisit.setSmokingQuit(sysVisit.getSmokingQuit()); + dockPatientVisit.setSmokingQuitYear(sysVisit.getSmokingQuitYear()); + dockPatientVisit.setDrinkHistory(sysVisit.getDrinkHistory()); + dockPatientVisit.setDrinkYear(sysVisit.getDrinkYear()); + dockPatientVisit.setDrinkQuit(sysVisit.getDrinkQuit()); + dockPatientVisit.setDrinkQuitYear(sysVisit.getDrinkQuitYear()); + dockPatientVisit.setHasAllergy(sysVisit.getHasAllergy()); + dockPatientVisit.setAllergyDrug(sysVisit.getAllergyDrug()); + dockPatientVisit.setSync(String.valueOf(0)); + dockPatientVisitInfoMapper.insertSelective(dockPatientVisit); + } + } + } + + @Override + public List getDiagnosisView() { + Date endTime = new Date(); + Date startTime = new Date(System.currentTimeMillis() - 60 * 60 * 1000); + return oracleViewDao.getDiagnosisView(startTime, endTime); + } + + @Override + public void syncDiagnosisView(List sysDiagnosis) { + if(CollUtil.isNotEmpty(sysDiagnosis)){ + for (DockVo.DiagnosisInfo sysDiagnosi : sysDiagnosis) { + DockPatientDiagnosis dockDiagnosis = new DockPatientDiagnosis(); + dockDiagnosis.setVisitNo(sysDiagnosi.getVisitNo()); + dockDiagnosis.setDiagnosisType(sysDiagnosi.getDiagnosisType()); + dockDiagnosis.setIsMainDiagnosis(sysDiagnosi.getIsMainDiagnosis()); + dockDiagnosis.setDiagnosisName(sysDiagnosi.getDiagnosisName()); + dockDiagnosis.setDiagnosisCode(sysDiagnosi.getDiagnosisCode()); + dockDiagnosis.setDiagnosisDate(sysDiagnosi.getDiagnosisDate()); + dockDiagnosis.setSync(String.valueOf(0)); + dockPatientDiagnosisMapper.insertSelective(dockDiagnosis); + } + } + } + + @Override + public List getMedicationView() { + Date endTime = new Date(); + Date startTime = new Date(System.currentTimeMillis() - 60 * 60 * 1000); + return oracleViewDao.getMedicationView(startTime, endTime); + } + + @Override + public void syncMedicationView(List sysMedications) { + if(CollUtil.isNotEmpty(sysMedications)){ + for (DockVo.MedicationInfo sysMedication : sysMedications) { + DockPatientMedicationInfo dockMedication = new DockPatientMedicationInfo(); + dockMedication.setVisitNo(sysMedication.getVisitNo()); + dockMedication.setDrugName(sysMedication.getDrugName()); + dockMedication.setDose(sysMedication.getDose()); + dockMedication.setUnit(sysMedication.getUnit()); + dockMedication.setFrequency(sysMedication.getFrequency()); + dockMedication.setSync(String.valueOf(0)); + dockPatientMedicationInfoMapper.insertSelective(dockMedication); + } + } + } + } diff --git a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/service/impl/StatisticsServiceImpl.java b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/service/impl/StatisticsServiceImpl.java index efb2973..e84aed1 100644 --- a/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/service/impl/StatisticsServiceImpl.java +++ b/ruisi_java/ruisi-system/src/main/java/com/ccsens/system/service/impl/StatisticsServiceImpl.java @@ -32,7 +32,14 @@ public class StatisticsServiceImpl implements StatisticsService { dto.setBeginTime(dateByType.get(0)); dto.setEndTime(dateByType.get(1)); } - return statisticsDao.nntotal(dto); + HomeDpVo.Zhsjgl nntotal = statisticsDao.nntotal(dto); + if (nntotal == null) { + nntotal = new HomeDpVo.Zhsjgl(); + } + nntotal.setPtotal(statisticsDao.getPatientNum(dto, null)); + nntotal.setMtotal(statisticsDao.getPatientNum(dto, (byte) 0)); + nntotal.setFtotal(statisticsDao.getPatientNum(dto, (byte) 1)); + return nntotal; } @Override @@ -168,7 +175,12 @@ public class StatisticsServiceImpl implements StatisticsService { dto.setBeginTime(dateByType.get(0)); dto.setEndTime(dateByType.get(1)); } - return statisticsDao.sexStatistics(dto); + HomeDpVo.SexStatistics sexStatistics = new HomeDpVo.SexStatistics(); + + sexStatistics.setBoy(statisticsDao.getPatientNum(dto, (byte) 0)); + sexStatistics.setGirl(statisticsDao.getPatientNum(dto, (byte) 1)); + + return sexStatistics; } @Override diff --git a/ruisi_java/ruisi-system/src/main/resources/mapper/dao/StatisticsDao.xml b/ruisi_java/ruisi-system/src/main/resources/mapper/dao/StatisticsDao.xml index 47ba00e..382b074 100644 --- a/ruisi_java/ruisi-system/src/main/resources/mapper/dao/StatisticsDao.xml +++ b/ruisi_java/ruisi-system/src/main/resources/mapper/dao/StatisticsDao.xml @@ -25,6 +25,26 @@ + + SELECT - b.diagnosis_name AS name, - b.diagnosis_code as code, - COUNT(b.id) AS value + b.diagnosis_name AS name, + b.diagnosis_code as code, + COUNT(b.id) AS value FROM - pms_patient_body b - LEFT JOIN ums_user u ON b.create_by = u.user_name + pms_patient_diagnosis b + LEFT JOIN pms_patient p ON b.patient_id = p.id WHERE b.diagnosis_name IS NOT NULL - and diagnosis_name != '' - and b.del_flag = 0 + and diagnosis_name != '' + and b.del_flag = 0 - AND u.dept_id = #{dto.deptId} + AND p.hospital_id = #{dto.deptId} AND b.create_time >= #{dto.beginTime} @@ -139,9 +159,9 @@ AND b.create_time <= #{dto.endTime} GROUP BY - diagnosis_name + diagnosis_name ORDER BY - value DESC + value DESC SELECT - s.dict_value AS qualification, + p.educational_status AS qualification, COUNT( p.id ) AS num FROM - sys_dict_data s - LEFT JOIN pms_patient p ON p.educational_status = s.dict_value AND p.del_flag = 0 - LEFT JOIN ums_user u ON p.create_by = u.user_name + pms_patient p where - s.dict_type = 'sys_qualification' + p.del_flag = 0 - AND u.dept_id = #{dto.deptId} + AND p.hospital_id = #{dto.deptId} AND p.create_time >= #{dto.beginTime} @@ -246,7 +265,7 @@ AND p.create_time <= #{dto.endTime} GROUP BY - p.educational_status + p.educational_status ORDER BY qualification desc @@ -274,7 +293,7 @@ and b.diagnosis_date between #{param.beginTime} and #{param.endTime} - and p.dept_id = #{param.deptId} + and p.hospital_id = #{param.deptId} @@ -340,10 +359,11 @@ LEFT JOIN ems_evaluation_scale_relevance ees on e.id = ees.evaluation_id AND ees.del_flag = 0 LEFT JOIN qms_scale qs ON qs.code = ees.scale_code LEFT JOIN ums_user u ON e.create_by = u.user_name AND u.del_flag = 0 + LEFT JOIN pms_patient p ON e.patient_id = p.id WHERE e.del_flag = 0 - AND u.dept_id = #{dto.deptId} + AND p.hospital_id = #{dto.deptId} AND ees.create_time >= #{dto.beginTime} diff --git a/ruisi_java/ruisi-system/src/main/resources/mapper/system/DockEmplMapper.xml b/ruisi_java/ruisi-system/src/main/resources/mapper/system/DockEmplMapper.xml index ece5edb..995bfda 100644 --- a/ruisi_java/ruisi-system/src/main/resources/mapper/system/DockEmplMapper.xml +++ b/ruisi_java/ruisi-system/src/main/resources/mapper/system/DockEmplMapper.xml @@ -13,6 +13,8 @@ + + @@ -74,7 +76,7 @@ id, empl_name, empl_code, empl_type, dept_code, del_flag, create_by, create_time, - update_by, update_time, sync + update_by, update_time, sync, role_power, data_power @@ -231,6 +247,12 @@ sync = #{record.sync,jdbcType=VARCHAR}, + + role_power = #{record.rolePower,jdbcType=VARCHAR}, + + + data_power = #{record.dataPower,jdbcType=VARCHAR}, + @@ -248,7 +270,9 @@ create_time = #{record.createTime,jdbcType=TIMESTAMP}, update_by = #{record.updateBy,jdbcType=VARCHAR}, update_time = #{record.updateTime,jdbcType=TIMESTAMP}, - sync = #{record.sync,jdbcType=VARCHAR} + sync = #{record.sync,jdbcType=VARCHAR}, + role_power = #{record.rolePower,jdbcType=VARCHAR}, + data_power = #{record.dataPower,jdbcType=VARCHAR} @@ -286,6 +310,12 @@ sync = #{sync,jdbcType=VARCHAR}, + + role_power = #{rolePower,jdbcType=VARCHAR}, + + + data_power = #{dataPower,jdbcType=VARCHAR}, + where id = #{id,jdbcType=BIGINT} @@ -300,7 +330,9 @@ create_time = #{createTime,jdbcType=TIMESTAMP}, update_by = #{updateBy,jdbcType=VARCHAR}, update_time = #{updateTime,jdbcType=TIMESTAMP}, - sync = #{sync,jdbcType=VARCHAR} + sync = #{sync,jdbcType=VARCHAR}, + role_power = #{rolePower,jdbcType=VARCHAR}, + data_power = #{dataPower,jdbcType=VARCHAR} where id = #{id,jdbcType=BIGINT} \ No newline at end of file diff --git a/ruisi_java/ruisi-system/src/main/resources/mapper/system/OracleViewDao.xml b/ruisi_java/ruisi-system/src/main/resources/mapper/system/OracleViewDao.xml new file mode 100644 index 0000000..e3f4e5a --- /dev/null +++ b/ruisi_java/ruisi-system/src/main/resources/mapper/system/OracleViewDao.xml @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ruisi_java/ruisi-system/src/main/resources/mapper/system/RmsReportMapper.xml b/ruisi_java/ruisi-system/src/main/resources/mapper/system/RmsReportMapper.xml index 3b4f4d6..9633074 100644 --- a/ruisi_java/ruisi-system/src/main/resources/mapper/system/RmsReportMapper.xml +++ b/ruisi_java/ruisi-system/src/main/resources/mapper/system/RmsReportMapper.xml @@ -16,6 +16,7 @@ + @@ -90,8 +91,8 @@ id, name, evaluation_id, initial_impression, clinical_diagnosis, pasi, patient_age, department, bed_number, report_time, evaluation_code, url, persion_url, positive_url, - qr_code_url, sign_url, remark, show_status, hospital, working_score, create_by, create_time, - update_by, update_time, del_flag, visit_no + all_url, qr_code_url, sign_url, remark, show_status, hospital, working_score, create_by, + create_time, update_by, update_time, del_flag, visit_no + + \ No newline at end of file diff --git a/ruisi_java/ruisi-system/src/main/resources/mapper/system/SysRoleMapper.xml b/ruisi_java/ruisi-system/src/main/resources/mapper/system/SysRoleMapper.xml index 13f3d48..a7e7e35 100644 --- a/ruisi_java/ruisi-system/src/main/resources/mapper/system/SysRoleMapper.xml +++ b/ruisi_java/ruisi-system/src/main/resources/mapper/system/SysRoleMapper.xml @@ -105,8 +105,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where r.role_key=#{roleKey} and r.del_flag = '0' limit 1 - - + + + insert into ums_role( role_id, role_name, diff --git a/ruisi_java/ruisi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruisi_java/ruisi-system/src/main/resources/mapper/system/SysUserMapper.xml index 98efb30..0c39226 100644 --- a/ruisi_java/ruisi-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/ruisi_java/ruisi-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -90,7 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + - + insert into ums_user( user_id, dept_id, @@ -263,6 +269,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" remark, valid_date, skip_check_device, + data_power, create_time )values( #{userId}, @@ -282,6 +289,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{remark}, #{validDate}, #{skipCheckDevice}, + #{dataPower}, sysdate() ) @@ -305,6 +313,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_by = #{updateBy}, remark = #{remark}, skip_check_device = #{skipCheckDevice}, + data_power = #{dataPower}, valid_date = #{validDate}, update_time = sysdate() diff --git a/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/PmsController.java b/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/PmsController.java index 8dd9d87..9d9239e 100644 --- a/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/PmsController.java +++ b/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/PmsController.java @@ -231,6 +231,7 @@ public class PmsController extends BaseController { if(CollUtil.isNotEmpty(loginUser.getUser().getRoles())){ dataScope = loginUser.getUser().getRoles().get(0).getDataScope(); } + dto.getParam().setDeptId(loginUser.getDeptId()); startPage(dto); return JsonResponse.ok(new PageInfo<>(patientService.queryPatientJzList(dto.getParam(), dataScope, loginUser.getUserId(),loginUser.getUsername()))); } diff --git a/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/ReportController.java b/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/ReportController.java index 17f3bb8..0c8bd8c 100644 --- a/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/ReportController.java +++ b/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/ReportController.java @@ -36,20 +36,39 @@ public class ReportController { @ApiOperation("导出个人报告") @PostMapping("/exportGr") public JsonResponse exportGr(@RequestBody @Validated RmsDto.ExportReport1Dto dto) throws IOException { - return JsonResponse.ok(amsReportService.exportGr(dto)); + RmsDto.Export export = new RmsDto.Export(); + export.setEvaluationId(dto.getEvaluationId()); + export.setReportId(dto.getReportId()); + export.setVersion((byte) 2); + return JsonResponse.ok(amsReportService.export(export)); } @Anonymous @ApiOperation("导出医生版报告") @PostMapping("/exportYs") public JsonResponse exportYs(@RequestBody @Validated RmsDto.ExportReport1Dto dto){ - return JsonResponse.ok(amsReportService.exportYs(dto)); + RmsDto.Export export = new RmsDto.Export(); + export.setEvaluationId(dto.getEvaluationId()); + export.setReportId(dto.getReportId()); + export.setVersion((byte) 1); + return JsonResponse.ok(amsReportService.export(export)); } @Anonymous @ApiOperation("导出阳性版报告") @PostMapping("/exportYx") public JsonResponse exportYx(@RequestBody @Validated RmsDto.ExportReport1Dto dto){ - return JsonResponse.ok(amsReportService.exportYx(dto)); + RmsDto.Export export = new RmsDto.Export(); + export.setEvaluationId(dto.getEvaluationId()); + export.setReportId(dto.getReportId()); + export.setVersion((byte) 3); + return JsonResponse.ok(amsReportService.export(export)); + } + + @Anonymous + @ApiOperation("导出报告") + @PostMapping("/export") + public JsonResponse export(@RequestBody @Validated RmsDto.Export dto){ + return JsonResponse.ok(amsReportService.export(dto)); } } diff --git a/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/StatisticsController.java b/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/StatisticsController.java index 770f7e9..980479c 100644 --- a/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/StatisticsController.java +++ b/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/StatisticsController.java @@ -1,6 +1,8 @@ package com.ccsens.admin.controller; +import cn.hutool.core.util.StrUtil; import com.ccsens.common.annotation.Anonymous; +import com.ccsens.common.constant.WebConstant; import com.ccsens.common.core.domain.JsonResponse; import com.ccsens.system.domain.dto.StatisticsDto; import com.ccsens.system.domain.vo.HomeDpVo; @@ -13,8 +15,11 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; import java.util.List; /** @@ -37,6 +42,15 @@ public class StatisticsController { @ApiOperation("获取疾病统计信息") @PostMapping("/nntotal") public JsonResponse nntotal(@RequestBody StatisticsDto.Query dto) { + if (dto.getDeptId() == null) { + // 获取请求携带的令牌 + HttpServletRequest request = ((ServletRequestAttributes) + RequestContextHolder.getRequestAttributes()).getRequest(); + String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); + if (StrUtil.isNotEmpty(deptId)) { + dto.setDeptId(Long.parseLong(deptId)); + } + } return JsonResponse.ok(statisticsService.nntotal(dto)); } @@ -44,6 +58,15 @@ public class StatisticsController { @ApiOperation("BMI") @PostMapping("/nnbmihjxy") public JsonResponse nnbmihjxy(@RequestBody StatisticsDto.Query dto) { + if (dto.getDeptId() == null) { + // 获取请求携带的令牌 + HttpServletRequest request = ((ServletRequestAttributes) + RequestContextHolder.getRequestAttributes()).getRequest(); + String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); + if (StrUtil.isNotEmpty(deptId)) { + dto.setDeptId(Long.parseLong(deptId)); + } + } return JsonResponse.ok(statisticsService.nnbmihjxy(dto)); } @@ -51,6 +74,15 @@ public class StatisticsController { @ApiOperation("评估情况") @PostMapping("/nnlast") public JsonResponse> nnlast(@RequestBody StatisticsDto.Query dto) { + if (dto.getDeptId() == null) { + // 获取请求携带的令牌 + HttpServletRequest request = ((ServletRequestAttributes) + RequestContextHolder.getRequestAttributes()).getRequest(); + String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); + if (StrUtil.isNotEmpty(deptId)) { + dto.setDeptId(Long.parseLong(deptId)); + } + } return JsonResponse.ok(statisticsService.nnlast(dto)); } @@ -58,6 +90,15 @@ public class StatisticsController { @ApiOperation("年龄") @PostMapping("/nnage") public JsonResponse nnage(@RequestBody StatisticsDto.Query dto) { + if (dto.getDeptId() == null) { + // 获取请求携带的令牌 + HttpServletRequest request = ((ServletRequestAttributes) + RequestContextHolder.getRequestAttributes()).getRequest(); + String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); + if (StrUtil.isNotEmpty(deptId)) { + dto.setDeptId(Long.parseLong(deptId)); + } + } return JsonResponse.ok(statisticsService.nnage(dto)); } @@ -65,6 +106,15 @@ public class StatisticsController { @ApiOperation("T值") @PostMapping("/nntgb") public JsonResponse nntgb(@RequestBody StatisticsDto.Query dto) { + if (dto.getDeptId() == null) { + // 获取请求携带的令牌 + HttpServletRequest request = ((ServletRequestAttributes) + RequestContextHolder.getRequestAttributes()).getRequest(); + String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); + if (StrUtil.isNotEmpty(deptId)) { + dto.setDeptId(Long.parseLong(deptId)); + } + } return JsonResponse.ok(statisticsService.nntgb(dto)); } @@ -72,6 +122,15 @@ public class StatisticsController { @ApiOperation("疾病排行") @PostMapping("/nnicd") public JsonResponse> nnicd(@RequestBody StatisticsDto.Query dto) { + if (dto.getDeptId() == null) { + // 获取请求携带的令牌 + HttpServletRequest request = ((ServletRequestAttributes) + RequestContextHolder.getRequestAttributes()).getRequest(); + String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); + if (StrUtil.isNotEmpty(deptId)) { + dto.setDeptId(Long.parseLong(deptId)); + } + } return JsonResponse.ok(statisticsService.nnicd(dto)); } @@ -79,6 +138,15 @@ public class StatisticsController { @ApiOperation("地图") @PostMapping("/nnmap") public JsonResponse> nnmap(@RequestBody StatisticsDto.Query dto) { + if (dto.getDeptId() == null) { + // 获取请求携带的令牌 + HttpServletRequest request = ((ServletRequestAttributes) + RequestContextHolder.getRequestAttributes()).getRequest(); + String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); + if (StrUtil.isNotEmpty(deptId)) { + dto.setDeptId(Long.parseLong(deptId)); + } + } return JsonResponse.ok(statisticsService.nnmap(dto)); } @@ -86,6 +154,15 @@ public class StatisticsController { @ApiOperation("评估结果") @PostMapping("/nnscale") public JsonResponse> nnscale(@RequestBody StatisticsDto.Query dto) { + if (dto.getDeptId() == null) { + // 获取请求携带的令牌 + HttpServletRequest request = ((ServletRequestAttributes) + RequestContextHolder.getRequestAttributes()).getRequest(); + String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); + if (StrUtil.isNotEmpty(deptId)) { + dto.setDeptId(Long.parseLong(deptId)); + } + } return JsonResponse.ok(statisticsService.nnscale(dto)); } @@ -93,6 +170,15 @@ public class StatisticsController { @ApiOperation("学历统计") @PostMapping("/qualificationStatistics") public JsonResponse> qualificationStatistics(@RequestBody StatisticsDto.Query dto) { + if (dto.getDeptId() == null) { + // 获取请求携带的令牌 + HttpServletRequest request = ((ServletRequestAttributes) + RequestContextHolder.getRequestAttributes()).getRequest(); + String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); + if (StrUtil.isNotEmpty(deptId)) { + dto.setDeptId(Long.parseLong(deptId)); + } + } return JsonResponse.ok(statisticsService.qualificationStatistics(dto)); } @@ -100,6 +186,15 @@ public class StatisticsController { @ApiOperation("就诊数量统计") @PostMapping("/jzStatistics") public JsonResponse jzStatistics(@RequestBody StatisticsDto.Query dto){ + if (dto.getDeptId() == null) { + // 获取请求携带的令牌 + HttpServletRequest request = ((ServletRequestAttributes) + RequestContextHolder.getRequestAttributes()).getRequest(); + String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); + if (StrUtil.isNotEmpty(deptId)) { + dto.setDeptId(Long.parseLong(deptId)); + } + } return JsonResponse.ok(statisticsService.jzStatistics(dto)); } @@ -107,6 +202,15 @@ public class StatisticsController { @ApiOperation("测评量表统计") @PostMapping("/scaleStatistics") public JsonResponse> scaleStatistics(@RequestBody StatisticsDto.Query dto){ + if (dto.getDeptId() == null) { + // 获取请求携带的令牌 + HttpServletRequest request = ((ServletRequestAttributes) + RequestContextHolder.getRequestAttributes()).getRequest(); + String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); + if (StrUtil.isNotEmpty(deptId)) { + dto.setDeptId(Long.parseLong(deptId)); + } + } return JsonResponse.ok(statisticsService.scaleStatistics(dto)); } @@ -114,6 +218,15 @@ public class StatisticsController { @ApiOperation("测评版本统计") @PostMapping("/versionStatistics") public JsonResponse> versionStatistics(@RequestBody StatisticsDto.Query dto){ + if (dto.getDeptId() == null) { + // 获取请求携带的令牌 + HttpServletRequest request = ((ServletRequestAttributes) + RequestContextHolder.getRequestAttributes()).getRequest(); + String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); + if (StrUtil.isNotEmpty(deptId)) { + dto.setDeptId(Long.parseLong(deptId)); + } + } return JsonResponse.ok(statisticsService.versionStatistics(dto)); } @@ -121,6 +234,15 @@ public class StatisticsController { @ApiOperation("测评师测评统计") @PostMapping("/userStatistics") public JsonResponse> userStatistics(@RequestBody StatisticsDto.Query dto){ + if (dto.getDeptId() == null) { + // 获取请求携带的令牌 + HttpServletRequest request = ((ServletRequestAttributes) + RequestContextHolder.getRequestAttributes()).getRequest(); + String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); + if (StrUtil.isNotEmpty(deptId)) { + dto.setDeptId(Long.parseLong(deptId)); + } + } return JsonResponse.ok(statisticsService.userStatistics(dto)); } @@ -128,6 +250,15 @@ public class StatisticsController { @ApiOperation("性别统计") @PostMapping("/sexStatistics") public JsonResponse sexStatistics(@RequestBody StatisticsDto.Query dto){ + if (dto.getDeptId() == null) { + // 获取请求携带的令牌 + HttpServletRequest request = ((ServletRequestAttributes) + RequestContextHolder.getRequestAttributes()).getRequest(); + String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); + if (StrUtil.isNotEmpty(deptId)) { + dto.setDeptId(Long.parseLong(deptId)); + } + } return JsonResponse.ok(statisticsService.sexStatistics(dto)); } @@ -135,6 +266,15 @@ public class StatisticsController { @ApiOperation("吸烟饮酒统计") @PostMapping("/xyYjStatistics") public JsonResponse xyYjStatistics(@RequestBody StatisticsDto.Query dto){ + if (dto.getDeptId() == null) { + // 获取请求携带的令牌 + HttpServletRequest request = ((ServletRequestAttributes) + RequestContextHolder.getRequestAttributes()).getRequest(); + String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); + if (StrUtil.isNotEmpty(deptId)) { + dto.setDeptId(Long.parseLong(deptId)); + } + } return JsonResponse.ok(statisticsService.xyYjStatistics(dto)); } } diff --git a/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/TjfxController.java b/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/TjfxController.java index 34c4e43..54bae84 100644 --- a/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/TjfxController.java +++ b/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/TjfxController.java @@ -1,6 +1,8 @@ package com.ccsens.admin.controller; +import cn.hutool.core.util.StrUtil; import com.ccsens.common.annotation.Anonymous; +import com.ccsens.common.constant.WebConstant; import com.ccsens.common.core.domain.JsonResponse; import com.ccsens.system.domain.dto.StatisticsDto; import com.ccsens.system.domain.vo.HomeDpVo; @@ -8,16 +10,19 @@ import com.ccsens.system.service.StatisticsService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import org.springframework.web.HttpRequestHandler; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; import java.util.List; /** - * * @Author zzc * @Package com.ccsens.admin.controller * @Date 2025/9/6 9:47 @@ -78,7 +83,7 @@ public class TjfxController { @Anonymous @ApiOperation("地图") @PostMapping("/nnmap") - public JsonResponse> nnmap(@RequestBody StatisticsDto.Query dto) { + public JsonResponse> nnmap(@RequestBody StatisticsDto.Query dto) { return JsonResponse.ok(statisticsService.nnmap(dto)); } @@ -99,42 +104,51 @@ public class TjfxController { @Anonymous @ApiOperation("就诊数量统计") @PostMapping("/jzStatistics") - public JsonResponse jzStatistics(@RequestBody StatisticsDto.Query dto){ + public JsonResponse jzStatistics(@RequestBody StatisticsDto.Query dto) { return JsonResponse.ok(statisticsService.jzStatistics(dto)); } @Anonymous @ApiOperation("测评量表统计") @PostMapping("/scaleStatistics") - public JsonResponse> scaleStatistics(@RequestBody StatisticsDto.Query dto){ + public JsonResponse> scaleStatistics(@RequestBody StatisticsDto.Query dto) { return JsonResponse.ok(statisticsService.scaleStatistics(dto)); } @Anonymous @ApiOperation("测评版本统计") @PostMapping("/versionStatistics") - public JsonResponse> versionStatistics(@RequestBody StatisticsDto.Query dto){ + public JsonResponse> versionStatistics(@RequestBody StatisticsDto.Query dto) { return JsonResponse.ok(statisticsService.versionStatistics(dto)); } @Anonymous @ApiOperation("测评师测评统计") @PostMapping("/userStatistics") - public JsonResponse> userStatistics(@RequestBody StatisticsDto.Query dto){ + public JsonResponse> userStatistics(@RequestBody StatisticsDto.Query dto) { return JsonResponse.ok(statisticsService.userStatistics(dto)); } @Anonymous @ApiOperation("性别统计统计") @PostMapping("/sexStatistics") - public JsonResponse sexStatistics(@RequestBody StatisticsDto.Query dto){ + public JsonResponse sexStatistics(@RequestBody StatisticsDto.Query dto) { return JsonResponse.ok(statisticsService.sexStatistics(dto)); } @Anonymous @ApiOperation("吸烟饮酒统计") @PostMapping("/xyYjStatistics") - public JsonResponse xyYjStatistics(@RequestBody StatisticsDto.Query dto){ + public JsonResponse xyYjStatistics(@RequestBody StatisticsDto.Query dto) { + if (dto.getDeptId() == null) { + // 获取请求携带的令牌 + HttpServletRequest request = ((ServletRequestAttributes) + RequestContextHolder.getRequestAttributes()).getRequest(); + String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); + if (StrUtil.isNotEmpty(deptId)) { + dto.setDeptId(Long.parseLong(deptId)); + } + } return JsonResponse.ok(statisticsService.xyYjStatistics(dto)); } } diff --git a/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/persist/dao/RmsDao.java b/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/persist/dao/RmsDao.java index 24646b5..5a783c4 100644 --- a/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/persist/dao/RmsDao.java +++ b/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/persist/dao/RmsDao.java @@ -4,6 +4,7 @@ import com.ccsens.system.domain.dto.RmsDto; import com.ccsens.system.domain.po.AmsPatientQuestionRecordDesc; import com.ccsens.system.domain.po.LdPatientRecord; import com.ccsens.system.domain.po.QmsScaleAssConf; +import com.ccsens.system.domain.po.RmsReportScaleScore; import com.ccsens.system.domain.vo.*; import org.apache.ibatis.annotations.Param; @@ -134,7 +135,8 @@ public interface RmsDao { List countReportResult(@Param("evaId") Long evaId, @Param("code") String scaleCode); - List queryReport(@Param("dto") RmsDto.ReportQuery dto); + List queryReport(@Param("dto") RmsDto.ReportQuery dto, + @Param("userId") Long userId); List queryEmsScaleScore(@Param("evaId") Long evaId, @Param("scaleCodeList") List scaleCodeList); @@ -142,4 +144,21 @@ public interface RmsDao { List viewReportPdfByVisitNo(@Param("visitNo")String visitNo); List viewReportPdfByPatientNo(@Param("patientNo")String patientNo); + + List queryReportExportInfo(@Param("evaluationId") Long evaluationId); + + List queryAdas14QuestionRecordValueByReportId(@Param("reportId")Long reportId); + + Byte querySexByEvaluationId(@Param("evaluationId")Long evaluationId); + + List queryReportAnswer1(@Param("evaluationId") Long evaluationId, + @Param("evaluationCode") String evaluationCode, + @Param("sex") Byte sex); + + List queryZytzbsScaleAnswer(@Param("evaluationId") Long evaluationId, + @Param("scaleCode") String scaleCode, + @Param("sex") Byte sex); + + + } diff --git a/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/AmsReportService.java b/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/AmsReportService.java index 30f64be..8e66b9c 100644 --- a/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/AmsReportService.java +++ b/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/AmsReportService.java @@ -33,4 +33,6 @@ public interface AmsReportService { * @return */ AmsReportVo.Result exportYx(RmsDto.ExportReport1Dto dto); + + AmsReportVo.Result export(RmsDto.Export dto); } diff --git a/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/IPmsPatientService.java b/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/IPmsPatientService.java index 9ff1ecc..cd5cd11 100644 --- a/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/IPmsPatientService.java +++ b/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/IPmsPatientService.java @@ -24,6 +24,8 @@ public interface IPmsPatientService { PmsPatientVo.PatientInfo getPatientInfoById(Long id); + PmsPatientVo.PatientInfo getPatientInfoById(Long id, String visitNo); + PmsPatientVo.PatientInfo editPatient(PmsPatient pmsPatient); Long editPatientOtherMsg(PmsPatientDto.EditOtherMsg param); diff --git a/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/IRmsService.java b/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/IRmsService.java index 7c4d406..dd5891d 100644 --- a/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/IRmsService.java +++ b/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/IRmsService.java @@ -31,6 +31,8 @@ public interface IRmsService { List queryReportAnswer(RmsDto.QueryReportAnswer dto, Long userId); + List queryReportAnswer(RmsDto.QueryReportAnswer dto); + String exportReport(RmsDto.ExportReportDto dto, Long userId) throws IOException; String export(RmsDto.ExportReportDto dto, Long userId, String deptId) throws IOException; @@ -46,4 +48,8 @@ public interface IRmsService { String queryPdfUrl(RmsDto.queryPdfUrl param); void exportEvaluation(RmsDto.ReportQuery param, HttpServletResponse response) throws IOException; + + List buildReportScoreTree(List allReportScores, Long rootParentId); + + RmsVo.ReportDetail queryReport(RmsDto.QueryDetail dto); } diff --git a/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/impl/AmsReportServiceImpl.java b/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/impl/AmsReportServiceImpl.java index e317eb5..e79c7e0 100644 --- a/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/impl/AmsReportServiceImpl.java +++ b/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/impl/AmsReportServiceImpl.java @@ -9,7 +9,9 @@ import cn.hutool.core.util.StrUtil; import cn.hutool.http.HtmlUtil; import com.ccsens.admin.persist.dao.AmsDao; import com.ccsens.admin.persist.dao.HmsDao; +import com.ccsens.admin.persist.dao.RmsDao; import com.ccsens.admin.service.AmsReportService; +import com.ccsens.admin.service.IPmsPatientService; import com.ccsens.admin.service.IReportInfoService; import com.ccsens.admin.service.IRmsService; import com.ccsens.common.constant.CultureEnum; @@ -23,7 +25,9 @@ import com.ccsens.system.domain.po.*; import com.ccsens.system.domain.vo.*; import com.ccsens.system.persist.mapper.*; import com.deepoove.poi.XWPFTemplate; +import com.deepoove.poi.config.Configure; import com.deepoove.poi.data.*; +import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -51,19 +55,12 @@ public class AmsReportServiceImpl implements AmsReportService { private AmsDao amsDao; @Value("${informed.prefixWord}") private String prefixWord; - - @Value("${file.reportPath}") - private String reportPath; - @Resource - private HmsReportConfigMapper hmsReportConfigMapper; @Resource private IRmsService rmsService; @Resource - private RmsReportMapper rmsReportMapper; - @Resource - private QmsScaleMapper qmsScaleMapper; + private IPmsPatientService pmsPatientService; @Resource - private QmsScaleTypeMapper qmsScaleTypeMapper; + private RmsReportMapper rmsReportMapper; @Resource private EmsEvaluationMapper emsEvaluationMapper; @Resource @@ -78,6 +75,8 @@ public class AmsReportServiceImpl implements AmsReportService { private String grPath; @Value("${file.ysPath}") private String ysPath; + @Resource + private RmsDao rmsDao; @Override public AmsReportVo.Result exportGr(RmsDto.ExportReport1Dto dto) throws IOException { @@ -871,5 +870,372 @@ public class AmsReportServiceImpl implements AmsReportService { Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$"); return pattern.matcher(str).matches(); } + public Map generateParams(Map params, List scores, PmsPatientVo.PatientInfo patientInfoById, RmsVo.ReportDetail detail, RmsDto.Export dto, EmsEvaluation emsEvaluation) { + RmsVo.ReportPatient patientInfo = detail.getPatient(); + params.put("h_name", patientInfo.getHospitalName()); +// params.put("qrcode_img_url", Pictures.ofLocal(reportPath + patientInfo.getQrCodeUrl()).size(130, 130).create()); + params.put("p_name", patientInfo.getPatientName()); + params.put("p_sex", patientInfo.getSex() == 0 ? "男" : "女"); + params.put("p_age", patientInfo.getPatientAge()); + CultureEnum cultureEnum = null; + if (dto.getSignId() != null) { + HmsDoctorSign emsEvaluationInformedConsent = hmsDoctorSignMapper.selectByPrimaryKey(dto.getSignId()); + if (emsEvaluationInformedConsent != null) { + params.put("cpy_img_url", Pictures.ofLocal(prefixWord + emsEvaluationInformedConsent.getPath()).size(80, 40).create()); + } + } else { + //签名信息 + Long userId = SecurityUtils.getUserId(); + List querySigns = hmsDoctorDao.querySign(userId); + if (CollUtil.isNotEmpty(querySigns)) { + HmsVo.QuerySign querySign = querySigns.get(0); + if (ObjectUtil.isNotNull(querySign) && StrUtil.isNotEmpty(querySign.getSignUrl())) { + params.put("cpy_img_url", Pictures.ofLocal(prefixWord + querySign.getSignUrl()).size(80, 40).create()); + } + } + } + if (patientInfoById != null) { + params.put("contactPhone", patientInfoById.getContactMobile()); + params.put("contactRelation", patientInfoById.getContactRelation()); + params.put("contact", patientInfoById.getContactName()); + Map>> otherMsg = patientInfoById.getOtherMsg(); + //诊断 + List> pmsPatientDiagnosis = otherMsg.get("pmsPatientDiagnosis"); + if (CollUtil.isNotEmpty(pmsPatientDiagnosis)) { + pmsPatientDiagnosis.forEach(item -> { + Object diagnosisDate = item.get("diagnosisDate"); + if (ObjectUtil.isNotNull(diagnosisDate)) { + item.put("diagnosisDate", DateUtil.format(DateUtil.parse(diagnosisDate.toString()), "yyyy-MM-dd")); + } + }); + params.put("zdList", pmsPatientDiagnosis); + } + + //就诊信息 + List> pmsPatientBodyList = otherMsg.get("pmsPatientBody"); + Map pmsPatientBodyMap = new HashMap<>(); + if (CollUtil.isNotEmpty(pmsPatientBodyList)) { + pmsPatientBodyMap = pmsPatientBodyList.get(0); + } + + //用药 + List> pmsPatientParentIllness = otherMsg.get("pmsPatientParentIllness"); + params.put("yyList", pmsPatientParentIllness); + + params.put("birthDate", patientInfoById.getBirthday()); + params.put("place", patientInfoById.getNativePlace()); + params.put("address", patientInfoById.getAddress()); + params.put("hobby", patientInfoById.getHobby()); + params.put("aboBlood", patientInfoById.getAboBloodType()); + params.put("rhBlood", patientInfoById.getRhBloodType()); + params.put("visit_type", pmsPatientBodyMap.get("visit_type")); + params.put("visitNo", pmsPatientBodyMap.get("outpatient_no")); + params.put("age", pmsPatientBodyMap.get("age")); + params.put("dept", pmsPatientBodyMap.get("department")); + params.put("doctor", pmsPatientBodyMap.get("doctor")); + params.put("admissionDate", pmsPatientBodyMap.get("admission_date")); + params.put("num", pmsPatientBodyMap.get("admission_count")); + params.put("admissionMethod", pmsPatientBodyMap.get("admission_method")); + params.put("bedNumber", pmsPatientBodyMap.get("bed_number")); + params.put("dischargeDate", pmsPatientBodyMap.get("")); + params.put("dischargeMethod", pmsPatientBodyMap.get("discharge_date")); + params.put("height", pmsPatientBodyMap.get("height")); + params.put("weight", pmsPatientBodyMap.get("weight")); + params.put("bmi", pmsPatientBodyMap.get("bmi")); + params.put("tz", pmsPatientBodyMap.get("tz")); + params.put("temperature", pmsPatientBodyMap.get("temperature")); + params.put("systolic_pressure", pmsPatientBodyMap.get("systolic_pressure")); + params.put("diastolic_pressure", pmsPatientBodyMap.get("diastolic_pressure")); + params.put("pulse", pmsPatientBodyMap.get("pulse")); + params.put("creatinine", pmsPatientBodyMap.get("creatinine")); + params.put("oxygen_saturation", pmsPatientBodyMap.get("oxygen_saturation")); + params.put("albumin", pmsPatientBodyMap.get("albumin")); + params.put("total_protein", pmsPatientBodyMap.get("total_protein")); + params.put("vitamin_d3", pmsPatientBodyMap.get("vitamin_d3")); + params.put("hematocrit", pmsPatientBodyMap.get("hematocrit")); + params.put("dimer", pmsPatientBodyMap.get("dimer")); + } + + try { + cultureEnum = BaseEnum.codeOf(CultureEnum.class, patientInfo.getEducationalStatus().intValue()); + } catch (Exception e) { + //处理educationStatus为null的情况,后台导入的数据educationStatus为null + //默认为初中 + cultureEnum = CultureEnum.YW; + } + if (cultureEnum != null) { + params.put("p_grade", cultureEnum.getDesc()); + } + if (patientInfo.getCareer() != null) { + JobEnum jobEnum = BaseEnum.codeOf(JobEnum.class, patientInfo.getCareer().intValue()); +// params.put("p_no", patientInfo.getSerialNumber()); + if (jobEnum != null) { + params.put("p_Career", jobEnum.getDesc()); + } + } + params.put("p_dept", patientInfo.getDepartment()); + params.put("p_bedno", patientInfo.getBedNumber()); + params.put("p_Patient_number", patientInfo.getHospitalNumber()); + params.put("p_Clinical_diagnosis", patientInfo.getClinicalDiagnosis()); + params.put("p_Inspection_date", DateUtil.format(new Date(patientInfo.getReportTime()), "yyyy-MM-dd")); +// params.put("score", detail.getScore()); + //AD8 + +// params.put("cpy_img_url", patientInfo.getName()); + params.put("report_date", DateUtil.date(patientInfo.getReportTime())); + + //生成表格 + // 创建带有样式的文本 + TextRenderData text1 = Texts.of("评估结论").bold().fontSize(12).create(); + TextRenderData text2 = Texts.of("评估结论").bold().fontSize(12).create(); + TextRenderData text3 = Texts.of("评估结论").bold().fontSize(12).create(); + TextRenderData text4 = Texts.of("评估结论").bold().fontSize(12).create(); +// TextRenderData text5 = Texts.of("评估结论").bold().fontSize(12).create(); + + RowRenderData headerRow = Rows.of(text1, text2, text3, text4).create(); + + //查询 + List exportInfos = rmsDao.queryReportExportInfo(dto.getEvaluationId()); + if (CollUtil.isEmpty(exportInfos)) { + return null; + } + RowRenderData titleRow = Rows.of("一级指标/二级指标", "量表名称", "得分", "结论").create(); + Tables.TableBuilder of = Tables.of(headerRow, titleRow); + for (int i = 0; i < exportInfos.size(); i++) { + RmsVo.Pgjl pgjl = new RmsVo.Pgjl(); + params.put("yjzb", exportInfos.get(i).getComboParentName()); + params.put("ejzb", exportInfos.get(i).getComboName()); + if (exportInfos.get(i).getNeedPlan() != null && exportInfos.get(i).getNeedPlan() == 1) { + TextRenderData textStr = Texts.of(StrUtil.isEmpty(exportInfos.get(i).getComboParentName()) ? "" : exportInfos.get(i).getComboParentName() + "/" + exportInfos.get(i).getComboName()).bold().color("FF0000").create(); + TextRenderData textName = Texts.of(exportInfos.get(i).getScaleName()).bold().color("FF0000").create(); + TextRenderData textScore = Texts.of(exportInfos.get(i).getScore() == null ? "" : exportInfos.get(i).getScore() + "").bold().color("FF0000").create(); + TextRenderData textImpression = Texts.of(StrUtil.isEmpty(exportInfos.get(i).getImpression()) ? exportInfos.get(i).getResult() : exportInfos.get(i).getImpression()).bold().color("FF0000").create(); + pgjl.setTitle(StrUtil.isEmpty(exportInfos.get(i).getComboParentName()) ? "" : exportInfos.get(i).getComboParentName() + "/" + exportInfos.get(i).getComboName()); + + //查询一二级套餐 + RowRenderData row1 = Rows.of( + textStr, + textName, + textScore, + textImpression + ).create(); +// if (StrUtil.isNotEmpty(exportInfos.get(i).getComboName() + "/" + exportInfos.get(i).getComboParentName())) { +// of.mergeRule(MergeCellRule.builder().map(MergeCellRule.Grid.of(i + 1, i + 1), MergeCellRule.Grid.of(0, 1)).build()); +// } + of.addRow(row1); + } else { + if (!"JI_SHAO".equals(exportInfos.get(i).getScaleCode())) { + TextRenderData textStr = Texts.of(StrUtil.isEmpty(exportInfos.get(i).getComboParentName()) ? "" : exportInfos.get(i).getComboParentName() + "/" + exportInfos.get(i).getComboName()).bold().create(); + TextRenderData textName = Texts.of("JI_SHAO".equals(exportInfos.get(i).getScaleCode()) ? "肌少总结论" : exportInfos.get(i).getScaleName()).bold().create(); + TextRenderData textScore = Texts.of(exportInfos.get(i).getScore() == null ? "" : exportInfos.get(i).getScore() + "").bold().create(); + //中医体质辨识添加结论 结论为初步印象 + TextRenderData textImpression = Texts.of( + StrUtil.isEmpty(exportInfos.get(i).getImpression()) ? exportInfos.get(i).getResult() : exportInfos.get(i).getImpression()).bold().create(); + //查询一二级套餐 + RowRenderData row1 = Rows.of( + textStr, + textName, + textScore, + textImpression + ).create(); + of.addRow(row1); + } else { + TextRenderData textStr = Texts.of(exportInfos.get(i).getImpression().contains("\n") ? "量表结论" + "\n" + "肌少总结论" : "肌少总结论").bold().create(); + TextRenderData textName = Texts.of("").bold().create(); + TextRenderData textScore = Texts.of(exportInfos.get(i).getScore() == null ? "" : exportInfos.get(i).getScore() + "").bold().create(); + //中医体质辨识添加结论 结论为初步印象 + TextRenderData textImpression = Texts.of( + exportInfos.get(i).getImpression() == null ? exportInfos.get(i).getResult() : exportInfos.get(i).getImpression()).bold().create(); + //查询一二级套餐 + RowRenderData row1 = Rows.of( + textStr, + textName, + textImpression, + textScore + ).create(); + if (StrUtil.isNotEmpty(exportInfos.get(i).getComboName() + "/" + exportInfos.get(i).getComboParentName())) { + of.mergeRule( + MergeCellRule.builder().map( + MergeCellRule.Grid.of(i + 2, 0), MergeCellRule.Grid.of(i + 2, 1)) + .map(MergeCellRule.Grid.of(i + 2, 2), MergeCellRule.Grid.of(i + 2, 3) + ).build() + ); + + } + of.addRow(row1); + } + } + } + if (emsEvaluation.getVersion() != null) { + HmsVersion hmsVersion = hmsVersionMapper.selectByPrimaryKey(Long.parseLong(emsEvaluation.getVersion())); + if (hmsVersion != null) { + params.put("type", hmsVersion.getVersion() + "评估报告"); + } + } + + List> listMap = new ArrayList<>(); + for (int i = 0; i < exportInfos.size(); i++) { + //遍历问题 + //生成问题表格 + + TextRenderData text5 = Texts.of("问题描述").bold().fontSize(12).create(); + TextRenderData text6 = Texts.of("问题结果").bold().fontSize(12).create(); + TextRenderData text7 = Texts.of("得 分").bold().fontSize(12).create(); +// TextRenderData text8 = Texts.of("总 分").bold().fontSize(12).create(); + RowRenderData detailHeaderRow = Rows.of(text5, text6, text7).create(); + Tables.TableBuilder of1 = Tables.of(detailHeaderRow); + RmsDto.QueryReportAnswer queryReportAnswer = new RmsDto.QueryReportAnswer(); + queryReportAnswer.setEvaluationCode(exportInfos.get(i).getScaleCode()); + queryReportAnswer.setId(dto.getReportId()); + List reportDetailAnswerList = rmsService.queryReportAnswer(queryReportAnswer); + MergeCellRule detailMerge = null; + if (CollUtil.isNotEmpty(reportDetailAnswerList)) { + RmsVo.ReportDetailAnswer reportDetailAnswer = reportDetailAnswerList.get(0); + List> collect = reportDetailAnswerList.stream().map(reportDetailAnswer1 -> reportDetailAnswer1.getQuestionList()).collect(Collectors.toList()); + List list = new ArrayList<>(); + for (int j = 0; j < collect.size(); j++) { + list.addAll(collect.get(j)); + } + Map map = new HashMap<>(); + List questionTableList = new ArrayList<>(); + for (RmsVo.QuestionInfo questionInfo : list) { + RmsVo.QuestionTable questionTable = new RmsVo.QuestionTable(); + questionTable.setQuestion(questionInfo.getQuestionName()); + //查询患者答题得分 + BigDecimal score = new BigDecimal("0"); + AmsPatientAnswerScoreExample amsPatientAnswerScoreExample = new AmsPatientAnswerScoreExample(); + amsPatientAnswerScoreExample.createCriteria() +// .andPatientIdEqualTo(patientInfo.getId()) + .andQuestionIdEqualTo(questionInfo.getQuestionId()) + .andEvaluationIdEqualTo(dto.getEvaluationId()); + amsPatientAnswerScoreExample.setOrderByClause("id desc"); + List amsPatientAnswerScores = amsPatientAnswerScoreMapper.selectByExample(amsPatientAnswerScoreExample); + if (CollUtil.isNotEmpty(amsPatientAnswerScores)) { + score = BigDecimal.valueOf(amsPatientAnswerScores.stream().filter(e -> e.getOptionId() != null && e.getOptionId() != 0).map(AmsPatientAnswerScore::getScore).mapToDouble(BigDecimal::doubleValue).sum()); + } + questionTable.setScore(score + ""); + //处理答案 + String answers = ""; + for (RmsVo.Answer answer : questionInfo.getAnswers()) { + if (StrUtil.isNotEmpty(answer.getAnswer())) { + answers += answer.getAnswer() + ","; + } + } + if (StrUtil.isNotEmpty(answers)) { + answers = answers.substring(0, answers.length() - 1); + } + questionTable.setResult(StrUtil.isEmpty(answers) || "null".equals(answers) ? "" : answers); + questionTableList.add(questionTable); + } + map.put("questionList", questionTableList); + map.put("title", exportInfos.get(i).getScaleName()); + if (StrUtil.isNotEmpty(exportInfos.get(i).getPlan())) { + map.put("fzjy", exportInfos.get(i).getPlan()); + map.put("fzjyFlag", true); + } + listMap.add(map); + } + } + + params.put("questionTables", listMap); + + + TableRenderData tableData = of + .create(); + params.put("table", tableData); + return params; + } + + @Override + public AmsReportVo.Result export(RmsDto.Export dto) { + //1. 查询是否已生成对应版本的报告单 + RmsReport report = rmsReportMapper.selectByPrimaryKey(dto.getReportId()); + if (ObjectUtil.isNotNull(report)) { + if (dto.getVersion() != null && dto.getVersion() == 0 && report.getAllUrl() != null) { + AmsReportVo.Result result = new AmsReportVo.Result(); + result.setPath(report.getAllUrl()); + return result; + } + if (dto.getVersion() != null && dto.getVersion() == 1 && report.getUrl() != null) { + AmsReportVo.Result result = new AmsReportVo.Result(); + result.setPath(report.getUrl()); + return result; + } + if (dto.getVersion() != null && dto.getVersion() == 2 && report.getPersionUrl() != null) { + AmsReportVo.Result result = new AmsReportVo.Result(); + result.setPath(report.getPersionUrl()); + return result; + } + if (dto.getVersion() != null && dto.getVersion() == 3 && report.getPositiveUrl() != null) { + AmsReportVo.Result result = new AmsReportVo.Result(); + result.setPath(report.getPositiveUrl()); + return result; + } + } + + //2. 查询对应版本的模板 + String url = amsDao.queryTemplate(dto.getVersionCode()); + //3. 查询数据 + RmsDto.QueryDetail queryDetail = new RmsDto.QueryDetail(); + queryDetail.setEvaluationId(dto.getEvaluationId()); + RmsVo.ReportDetail detail = rmsService.queryReport(queryDetail); + //查询分数 + List scores = rmsDao.queryReportScore(dto.getReportId(), null); + if (CollUtil.isNotEmpty(scores)) { + //组装成父子级关系 + scores = rmsService.buildReportScoreTree(scores, 0L); + } + EmsEvaluation emsEvaluation = emsEvaluationMapper.selectByPrimaryKey(dto.getEvaluationId()); + if (emsEvaluation == null) { + return null; + } + //查询就诊、诊断信息 + PmsPatientVo.PatientInfo patientInfoById; + if (StrUtil.isNotEmpty(report.getVisitNo())) { + patientInfoById = pmsPatientService.getPatientInfoById(emsEvaluation.getPatientId(), report.getVisitNo()); + } else { + patientInfoById = pmsPatientService.getPatientInfoById(emsEvaluation.getPatientId()); + } + //4. 生成MAP + Map params = new HashMap<>(); + params = generateParams(params, scores, patientInfoById, detail, dto, emsEvaluation); + // 或使用 RenderData 和 MiniTableRenderData 更高级表格渲染(后面介绍) + LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy(); + + Configure config = Configure.builder() + .bind("zdList", policy) + .bind("yyList", policy) + .bind("questionTables", policy) + .bind("questionList", policy).build(); + XWPFTemplate template = XWPFTemplate.compile(url, config); + //5. 渲染报告单并返回 +// XWPFTemplate template = XWPFTemplate.compile(url); + try { + template.render(params); + } catch (Exception e) { + e.printStackTrace(); // 输出详细的异常信息 + } + String s = IdUtil.randomUUID(); + String filePath = "/profile/" + "/report/" + "老年综合评估_" + s + ".docx"; + String pdfPath = "/profile/" + "/report/" + "老年综合评估_" + s + ".pdf"; + String aPath = path + "/" + "/report/" + "老年综合评估_" + s + ".docx"; + String pPath = path + "/" + "/report/" + "老年综合评估_" + s + ".pdf"; + + try { + template.writeAndClose(Files.newOutputStream(Paths.get(reportDomain + "/" + "/report/" + "老年综合评估_" + s + ".docx"))); + AsposeUtils.doc2pdf(aPath, pPath); + } catch (Exception e) { + e.printStackTrace(); + } + //将生成的文件路径保存到报告单内 + if (ObjectUtil.isNotNull(report)) { + report.setPositiveUrl(pdfPath); + rmsReportMapper.updateByPrimaryKeySelective(report); + } + AmsReportVo.Result result = new AmsReportVo.Result(); + result.setWord(filePath); + result.setPath(pdfPath); + return result; + } } diff --git a/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/impl/PmsPatientServiceImpl.java b/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/impl/PmsPatientServiceImpl.java index 49a6feb..ee5c442 100644 --- a/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/impl/PmsPatientServiceImpl.java +++ b/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/impl/PmsPatientServiceImpl.java @@ -107,7 +107,7 @@ public class PmsPatientServiceImpl implements IPmsPatientService { String hash = Md5Utils.hash(param.getIdCard().substring(2, 14)); param.setIdCard(param.getIdCard().substring(0, 2) + hash + param.getIdCard().substring(14, 18)); } - return patientDao.queryPatientList(param, dataScope, userId, userName); + return patientDao.queryPatientList(param, dataScope, SecurityUtils.isAdmin(userId) ? null : userId, userName); } @Override @@ -156,6 +156,74 @@ public class PmsPatientServiceImpl implements IPmsPatientService { return patientInfo; } + @Override + public PmsPatientVo.PatientInfo getPatientInfoById(Long id, String visitNo) { + PmsPatient pmsPatient = patientDao.selectByPrimaryKey(id); + if (ObjectUtil.isNull(pmsPatient)) { + return null; + } + PmsPatientVo.PatientInfo patientInfo = new PmsPatientVo.PatientInfo(); + BeanUtils.copyProperties(pmsPatient, patientInfo); + + if (pmsPatient.getBirthYear() != null) { + patientInfo.setAge(Calendar.getInstance().get(Calendar.YEAR) - pmsPatient.getBirthYear()); + } + + //查询其他疾病史信息 + Map>> patientOtherMsg = new HashMap<>(); + + //先查询就诊信息(PmsPatientBody) + //根据就诊号和患者id查询就诊信息是否存在 + PmsPatientBodyExample patientBodyExample = new PmsPatientBodyExample(); + patientBodyExample.createCriteria().andPatientIdEqualTo(pmsPatient.getId()) + .andDelFlagEqualTo((byte) 0); + patientBodyExample.setOrderByClause("id desc"); + List pmsPatientBodies = pmsPatientBodyMapper.selectByExample(patientBodyExample); + if (CollUtil.isNotEmpty(pmsPatientBodies)) { + PmsPatientBody body = pmsPatientBodies.get(0); + List> pmsPatientBodyReturn = new ArrayList<>(); + pmsPatientBodyReturn.add(JSON.parseObject(JSON.toJSONString(body), Map.class)); + patientOtherMsg.put("pmsPatientBody", pmsPatientBodyReturn); + if (visitNo != null) { + //烟酒史 + PmsPatientPersonalExample patientPersonalExample = new PmsPatientPersonalExample(); + patientPersonalExample.createCriteria().andVisitNoEqualTo(visitNo).andPatientIdEqualTo(pmsPatient.getId()) + .andDelFlagEqualTo((byte) 0); + List pmsPatientPersonals = pmsPatientPersonalMapper.selectByExample(patientPersonalExample); + if (CollUtil.isNotEmpty(pmsPatientPersonals)) { + String jsonStr = JSON.toJSONString(pmsPatientPersonals); + List> allList = JSON.parseObject(jsonStr, List.class); + List> singleItemList = new ArrayList<>(); + if (!allList.isEmpty()) { + singleItemList.add(allList.get(0)); + } + patientOtherMsg.put("pmsPatientPersonal", singleItemList); + } + //用药信息 + PmsPatientParentIllnessExample patientParentIllnessExample = new PmsPatientParentIllnessExample(); + patientParentIllnessExample.createCriteria().andVisitNoEqualTo(visitNo).andPatientIdEqualTo(pmsPatient.getId()) + .andDelFlagEqualTo((byte) 0); + List pmsPatientParentIllnesses = pmsPatientParentIllnessMapper.selectByExample(patientParentIllnessExample); + if (CollUtil.isNotEmpty(pmsPatientParentIllnesses)) { + String jsonStr = JSON.toJSONString(pmsPatientParentIllnesses); + patientOtherMsg.put("pmsPatientParentIllness", JSON.parseObject(jsonStr, List.class)); + } + + //诊断信息 + PmsPatientDiagnosisExample patientDiagnosisExample = new PmsPatientDiagnosisExample(); + patientDiagnosisExample.createCriteria().andVisitNoEqualTo(visitNo).andPatientIdEqualTo(pmsPatient.getId()) + .andDelFlagEqualTo((byte) 0); + List pmsPatientDiagnoses = pmsPatientDiagnosisMapper.selectByExample(patientDiagnosisExample); + if (CollUtil.isNotEmpty(pmsPatientDiagnoses)) { + String jsonStr = JSON.toJSONString(pmsPatientDiagnoses); + patientOtherMsg.put("pmsPatientDiagnosis", JSON.parseObject(jsonStr, List.class)); + } + } + } + patientInfo.setOtherMsg(patientOtherMsg); + return patientInfo; + } + @Override public PmsPatientVo.PatientInfo editPatient(PmsPatient pmsPatient) { log.info("编辑病人信息:{}", pmsPatient); @@ -2150,7 +2218,7 @@ public class PmsPatientServiceImpl implements IPmsPatientService { @Override public List queryPatientJzList(PmsPatientDto.QueryPatientJz param, String dataScope, Long userId, String userName) { - List queryPatientJzs = patientDao.queryPatientJzList(param, dataScope, userId, userName); + List queryPatientJzs = patientDao.queryPatientJzList(param, dataScope, SecurityUtils.isAdmin(userId) ? null : userId, userName); if (CollUtil.isNotEmpty(queryPatientJzs)) { for (PmsPatientVo.QueryPatientJz queryPatientJz : queryPatientJzs) { //查询就诊 diff --git a/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/impl/RmsServiceImpl.java b/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/impl/RmsServiceImpl.java index ff1af34..ef1bdd1 100644 --- a/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/impl/RmsServiceImpl.java +++ b/ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/impl/RmsServiceImpl.java @@ -11,6 +11,7 @@ import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HtmlUtil; import cn.hutool.poi.excel.BigExcelWriter; +import com.ccsens.admin.persist.dao.AmsDao; import com.ccsens.admin.persist.dao.HmsDao; import com.ccsens.admin.persist.dao.RmsDao; import com.ccsens.admin.service.AmsReportService; @@ -59,7 +60,9 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.text.DecimalFormat; import java.time.Duration; +import java.time.LocalDate; import java.time.LocalTime; +import java.time.Period; import java.time.format.DateTimeFormatter; import java.util.*; import java.util.concurrent.atomic.AtomicBoolean; @@ -109,6 +112,10 @@ public class RmsServiceImpl implements IRmsService { private QmsScaleMapper qmsScaleMapper; @Resource private HmsDao hmsDoctorDao; + @Resource + private AmsDao amsDao; + @Resource + private TzbsRmsReportYsjyMapper rmsReportYsjyMapper; @Value("${informed.prefixWord}") private String prefixWord; @@ -1298,7 +1305,7 @@ public class RmsServiceImpl implements IRmsService { @Override public List queryReportListCopyClient(RmsDto.QueryReportList dto, Long userId, String dataScope) { - return rmsDao.queryReportListCopyClient(dto, userId, SecurityUtils.getUsername(), dataScope); + return rmsDao.queryReportListCopyClient(dto, SecurityUtils.isAdmin(userId) ? null : userId, SecurityUtils.getUsername(), dataScope); } @Override @@ -1362,6 +1369,48 @@ public class RmsServiceImpl implements IRmsService { return rmsDao.queryReportAnswer(report.getEvaluationId(), dto.getEvaluationCode()); } + @Override + public List queryReportAnswer(RmsDto.QueryReportAnswer dto) { + //根据报告单id查看报告单信息 + RmsReport report = rmsReportMapper.selectByPrimaryKey(dto.getId()); + if (ObjectUtil.isNull(report)) { + throw new BaseException(ErrorConstant.REPORT_ID_ERROR); + } +// List r = rmsDao.queryReportAnswer(report.getEvaluationId(), dto.getEvaluationCode()); + //查询患者性别 + Byte aByte = rmsDao.querySexByEvaluationId(report.getEvaluationId()); + List r = rmsDao.queryReportAnswer1(report.getEvaluationId(), dto.getEvaluationCode(), aByte); + //特殊处理ADAS-Cog 14 第27题,数字划销 + //前端优先使用otherValueList,如果为空则使用otherValue + for (RmsVo.ReportDetailAnswer rda : r) { + for (RmsVo.QuestionInfo questionInfo : rda.getQuestionList()) { + if (questionInfo.getQuestionId().equals(1818165891737718784L)) { + questionInfo.setOtherValueList(rmsDao.queryAdas14QuestionRecordValueByReportId(dto.getId())); + break; + } + } + } + + //特殊处理ZBI + //特殊处理,不按照认知域返回,直接根据题号顺序铺下来 + if ("ZBI".equalsIgnoreCase(dto.getEvaluationCode())) { + RmsVo.ReportDetailAnswer zbi = new RmsVo.ReportDetailAnswer(); + zbi.setParentCode("ZBI"); + zbi.setQuestionList(r.stream().flatMap(e -> e.getQuestionList().stream()).sorted(Comparator.comparing(RmsVo.QuestionInfo::getQuestionSort)) + .collect(Collectors.toList())); + r = CollectionUtil.newArrayList(zbi); + } + + //特殊处理中医体质辨识 多对多关系 tzbs_qms_scale_cognitive + if ("TZBS_BZ".equalsIgnoreCase(dto.getEvaluationCode()) || "TZBS_LN".equalsIgnoreCase(dto.getEvaluationCode())) { + //查询量表关联认知域及认知域关联题目信息 + r = rmsDao.queryZytzbsScaleAnswer(report.getEvaluationId(), dto.getEvaluationCode(), aByte); + } + + return r; + } + + @Override public String exportReport(RmsDto.ExportReportDto dto, Long userId) throws IOException { // log.info("导出报告单:{}, 操作用户:{}", dto, userId); @@ -1726,12 +1775,12 @@ public class RmsServiceImpl implements IRmsService { @Override public List queryReportList(RmsDto.ReportQuery param, Long userId) { - return rmsDao.queryReport(param); + return rmsDao.queryReport(param, SecurityUtils.isAdmin(userId) ? null : userId); } @Override public void exportEvaluation(RmsDto.ReportQuery param, HttpServletResponse response) throws IOException { - List reports = queryReportList(param, null); + List reports = queryReportList(param, SecurityUtils.isAdmin(SecurityUtils.getUserId()) ? null : SecurityUtils.getUserId()); if (CollUtil.isEmpty(reports)) { return; } @@ -2528,4 +2577,379 @@ public class RmsServiceImpl implements IRmsService { public String pxToSquare(double length, Integer height) { return new BigDecimal(144 * 144).multiply(new BigDecimal(length)).divide(new BigDecimal(height * height), 2, BigDecimal.ROUND_HALF_UP).toString(); } + + @Override + public List buildReportScoreTree(List allReportScores, Long rootParentId) { + // 1. 预处理:将所有节点放入Map,key=scaleId,方便快速查找 + Map scoreMap = new HashMap<>(); + for (RmsVo.ReportScore score : allReportScores) { + scoreMap.put(score.getScaleId(), score); + // 初始化子列表(避免空指针) + if (score.getSubReport() == null) { + score.setSubReport(new ArrayList<>()); + } + } + + // 2. 筛选根节点(parentId等于rootParentId的节点) + List rootNodes = new ArrayList<>(); + for (RmsVo.ReportScore score : allReportScores) { + Long parentId = score.getParentId(); + // 判断是否为根节点(适配parentId=null或0的情况) + boolean isRoot = (rootParentId == null && parentId == null) + || (rootParentId != null && rootParentId.equals(parentId)); + if (isRoot) { + rootNodes.add(score); + // 递归组装子节点 + buildChildren(score, scoreMap); + } + } + + // 3. 按sort/ecrSort排序(可选,根据业务需求) + sortReportScoreTree(rootNodes); + + return rootNodes; + } + + /** + * 递归为单个节点组装子节点 + * + * @param parentNode 父节点 + * @param scoreMap 所有节点的Map(key=scaleId) + */ + private static void buildChildren(RmsVo.ReportScore parentNode, Map scoreMap) { + // 遍历所有节点,找到当前父节点的子节点(子节点的parentId=父节点的scaleId转Long) + for (RmsVo.ReportScore childNode : scoreMap.values()) { + Long childParentId = childNode.getParentId(); + String parentScaleId = parentNode.getScaleId(); + + // 避免空指针,先判断parentScaleId是否能转Long(根据业务,scaleId应为数字字符串) + if (childParentId == null || parentScaleId == null) { + continue; + } + + // 匹配子节点:子节点的parentId = 父节点的scaleId(转Long) + try { + Long parentIdLong = Long.parseLong(parentScaleId); + if (childParentId.equals(parentIdLong)) { + // 加入子列表 + parentNode.getSubReport().add(childNode); + // 递归组装子节点的子节点 + buildChildren(childNode, scoreMap); + } + } catch (NumberFormatException e) { + // 若scaleId非数字,根据业务处理(此处打印日志,跳过) + System.err.println("scaleId转换Long失败:" + parentScaleId + ",原因:" + e.getMessage()); + continue; + } + } + + // 子节点排序(可选) + if (CollectionUtil.isNotEmpty(parentNode.getSubReport())) { + sortReportScoreTree(parentNode.getSubReport()); + } + } + + /** + * 对ReportScore列表按排序字段排序(优先sort,其次ecrSort) + * + * @param reportScores 待排序的列表 + */ + private static void sortReportScoreTree(List reportScores) { + reportScores.sort((o1, o2) -> { + // 先按sort排序 + if (o1.getSort() != null && o2.getSort() != null) { + return o1.getSort().compareTo(o2.getSort()); + } + // sort为空则按ecrSort排序 + if (o1.getEcrSort() != null && o2.getEcrSort() != null) { + return o1.getEcrSort().compareTo(o2.getEcrSort()); + } + // 都为空则按scaleId排序 + return o1.getScaleId().compareTo(o2.getScaleId()); + }); + } + + public RmsVo.ReportDetail queryReportDetail(RmsDto.QueryDetail dto) { + //查找测评信息 + EmsEvaluation emsEvaluation = emsEvaluationMapper.selectByPrimaryKey(dto.getEvaluationId()); + if(ObjectUtil.isNull(emsEvaluation)){ + throw new RuntimeException("未找到测评信息"); + } + //查找患者信息 + PmsPatient pmsPatient = pmsPatientMapper.selectByPrimaryKey(emsEvaluation.getPatientId()); + if(ObjectUtil.isNull(pmsPatient)){ + throw new RuntimeException("未找到患者信息"); + } + + //根据测评id查找报告单 + RmsReportExample reportExample = new RmsReportExample(); + reportExample.createCriteria().andEvaluationIdEqualTo(dto.getEvaluationId()).andDelFlagEqualTo((byte) 0); + List rmsReports = rmsReportMapper.selectByExample(reportExample); + if (CollUtil.isNotEmpty(rmsReports)) { + RmsReport rmsReport = new RmsReport(); + rmsReport.setDelFlag((byte) 1); + rmsReportMapper.updateByExampleSelective(rmsReport, reportExample); + //删除报告单分数 + RmsReportScaleScore reportScaleScore = new RmsReportScaleScore(); + reportScaleScore.setDelFlag((byte) 1); + RmsReportScaleScoreExample reportScaleScoreExample = new RmsReportScaleScoreExample(); + reportScaleScoreExample.createCriteria().andReportIdEqualTo(dto.getEvaluationId()); + rmsReportScaleScoreMapper.updateByExampleSelective(reportScaleScore, reportScaleScoreExample); + } + //查询测评量表及分数 + List scores = rmsDao.queryEmsScaleScore(dto.getEvaluationId(), CollectionUtil.newArrayList()); + if (CollUtil.isNotEmpty(scores)) { + //组装成父子级关系 + scores = buildReportScoreTree(scores, 0L); + } + Map reportScaleScoreMap = new HashMap<>(); +// RmsReportScaleScoreExample rmsReportScaleScoreExample = new RmsReportScaleScoreExample(); +// rmsReportScaleScoreExample.createCriteria().andReportIdEqualTo(dto.getEvaluationId()); + + //生成报告单 + RmsReport report = new RmsReport(); + report.setId(IDGenerator.nextSnowflakeId()); + report.setName(GenConstants.Ht.Report.PARENT_NAME + DateUtil.today()); + report.setEvaluationId(dto.getEvaluationId()); + report.setReportTime(System.currentTimeMillis()); + report.setPatientAge(getAge(pmsPatient.getBirthday())); + //修改测评的状态 + if (dto.getComplateStatus() != null) { + emsEvaluation.setCompleteStatus(dto.getComplateStatus()); + } + emsEvaluationMapper.updateByPrimaryKeySelective(emsEvaluation); + report.setVisitNo(emsEvaluation.getVisitNo()); + rmsReportMapper.insertSelective(report); + + if (CollUtil.isNotEmpty(scores)) { + scores.forEach(score -> { + if ("TZBS_LN".equals(score.getCode()) || "TZBS_BZ".equals(score.getCode())) { +// 添加体质辨识结论 + List reportResultList = score.getReportResultList(); + if (CollUtil.isNotEmpty(reportResultList)) { + reportResultList.forEach(reportResult -> { + reportResult.setReportId(report.getId()); + }); +// clientEvaDao.batchInsertReportResult(reportResultList); + } + + //添加体质辨识养生建议 + List reportYsjyList = score.getReportYsjyList(); + if (CollUtil.isNotEmpty(reportYsjyList)) { + reportYsjyList.forEach(reportResult -> { + reportResult.setReportId(report.getId()); + rmsReportYsjyMapper.insertSelective(reportResult); + }); + } + } + //添加量表分数统计 + RmsReportScaleScore reportScaleScore = new RmsReportScaleScore(); + reportScaleScore.setId(IDGenerator.nextSnowflakeId()); + reportScaleScore.setReportId(report.getId()); + reportScaleScore.setScaleCode(score.getCode()); + reportScaleScore.setResult(score.getImpression()); + reportScaleScore.setScore(score.getScore()); + reportScaleScore.setIsShow((byte) 1); + reportScaleScore.setComboId(score.getComboId()); + reportScaleScore.setSort(score.getSort()); + rmsReportScaleScoreMapper.insertSelective(reportScaleScore); + reportScaleScoreMap.put(score.getCode(), reportScaleScore); + }); + } + //肌少结论生成 + //处理肌少 + String jishaoResult = addJs(scores); + if (StrUtil.isNotEmpty(jishaoResult)) { + RmsReportScaleScore reportScaleScore = new RmsReportScaleScore(); + reportScaleScore.setId(IDGenerator.nextSnowflakeId()); + reportScaleScore.setReportId(report.getId()); + reportScaleScore.setScaleCode("JI_SHAO"); + reportScaleScore.setImpression(jishaoResult); + reportScaleScore.setSort(scores.size() + 1); + reportScaleScore.setIsShow((byte) 0); + rmsReportScaleScoreMapper.insertSelective(reportScaleScore); + } + + + RmsVo.ReportDetail detail = new RmsVo.ReportDetail(); + + //查找患者做过的测评的最早和最晚的时间 + RmsVo.PatientEvaluationTime time = new RmsVo.PatientEvaluationTime(); + time = rmsDao.getTimeByPatientId(pmsPatient.getId()); + if (ObjectUtil.isNull(time)) { + time = new RmsVo.PatientEvaluationTime(); + time.setMinTime(new Date()); + time.setMaxTime(new Date()); + } + +// PmsPatient pmsPatient = pmsPatientMapper.selectByPrimaryKey(emsEvaluation.getPatientId()); + if (ObjectUtil.isNotNull(emsEvaluation) && CollUtil.isNotEmpty(scores)) { + for (RmsVo.ReportScore score : scores) { + //查询量表试题 + QmsQuestionExample qmsQuestionExample = new QmsQuestionExample(); + qmsQuestionExample.createCriteria().andScaleCodeEqualTo(score.getCode()).andDelFlagEqualTo((byte) 0); + List qmsQuestions = qmsQuestionMapper.selectByExample(qmsQuestionExample); + if (CollUtil.isNotEmpty(qmsQuestions)) { + //查询量表试题时长 + EmsEvaluationQuestionDurationExample questionDurationExample = new EmsEvaluationQuestionDurationExample(); + questionDurationExample.createCriteria().andEvaluationIdEqualTo(dto.getEvaluationId()).andDelFlagEqualTo((byte) 0) + .andQuestionIdIn(qmsQuestions.stream().map(QmsQuestion::getId).collect(Collectors.toList())); + List emsEvaluationQuestionDurations = emsEvaluationQuestionDurationMapper.selectByExample(questionDurationExample); + if (CollUtil.isNotEmpty(emsEvaluationQuestionDurations)) { + score.setQuestionDuration(emsEvaluationQuestionDurations.stream().mapToLong(EmsEvaluationQuestionDuration::getDuration).sum()); + } + } + //查询量表的总分趋势信息 + List scoreTrend = rmsDao.getScoreTrend(emsEvaluation.getPatientId(), score.getCode(), time.getMinTime(), time.getMaxTime()); + //折线图上只显示近5条记录 + if (CollectionUtil.isNotEmpty(scoreTrend) && scoreTrend.size() > 5) { + scoreTrend = scoreTrend.subList(scoreTrend.size() - 5, scoreTrend.size()); + } + score.setScoreTrend(scoreTrend); + //给moca添加雷达图信息 + if (GenConstants.Ht.Report.MOCA.equals(score.getCode())) { + List scoreDistributions = rmsDao.getScoreDistributions(emsEvaluation.getPatientId()); + if (CollUtil.isNotEmpty(scoreDistributions)) { + //处理认知域 + List distributions = disposeDistribution(scoreDistributions); + //根据日期倒序排序 + distributions.sort(Comparator.comparing(RmsVo.EvaluationScoreDistribution::getDay).reversed()); + score.setScoreDistributions(distributions); + } + } + if (StrUtil.isEmpty(score.getImpression()) && ObjectUtil.isNotNull(pmsPatient)) { + //如果没有初步印象,则自动生成初步印象 + String impression = generateImpression(score, pmsPatient.getEducationalStatus()); + score.setImpression(impression); + } + //查询防治计划 + QmsScaleAssConf qmsScaleAssConf = amsDao.queryScaleAssConf(score.getCode(), score.getScore()); + if (qmsScaleAssConf != null) { + score.setResult(qmsScaleAssConf.getResult()); + score.setNeedPlan(qmsScaleAssConf.getNeedPlan()); + RmsReportScaleScore rmsReportScaleScore = reportScaleScoreMap.get(score.getCode()); + if (rmsReportScaleScore != null) { + rmsReportScaleScore.setPlan(qmsScaleAssConf.getPlan()); + rmsReportScaleScore.setNeedPlan(qmsScaleAssConf.getNeedPlan()); + rmsReportScaleScore.setResult(qmsScaleAssConf.getResult()); + rmsReportScaleScore.setScaleAssConf(qmsScaleAssConf.getId()); + rmsReportScaleScoreMapper.updateByPrimaryKeySelective(rmsReportScaleScore); + } + } + //查询排序 + QmsScaleExample qmsScaleExample = new QmsScaleExample(); + qmsScaleExample.createCriteria().andCodeEqualTo(score.getCode()); + List qmsScales = qmsScaleMapper.selectByExample(qmsScaleExample); + if (CollUtil.isNotEmpty(qmsScales)) { + score.setSort(qmsScales.get(0).getSort()); + } + } + } + + //查询报告单信息和病人信息 + RmsVo.ReportPatient reportPatient = rmsDao.queryReportResult(report.getId()); + detail.setPatient(reportPatient); + detail.setScores(scores); + return detail; + } + + /** + * 判断是否添加肌少总结论 + * 如果四项测试有一项没做,则跳过 + * + * @param scores + * @return + */ + // + // + private String addJs(List scores) { + List wczl = scores.stream().filter( + score -> score.getCode().equals("5CZLSY") + ).collect(Collectors.toList()); + List szggj = scores.stream().filter( + score -> score.getCode().equals("SZGGJ") + ).collect(Collectors.toList()); + List wlcd = scores.stream().filter( + score -> score.getCode().equals("WLCD") + ).collect(Collectors.toList()); + List lmbs = scores.stream().filter( + score -> score.getCode().equals("LMBS") + ).collect(Collectors.toList()); + if (CollUtil.isEmpty(wczl) || CollUtil.isEmpty(szggj) || CollUtil.isEmpty(wlcd) || CollUtil.isEmpty(lmbs)) { + return null; + } + QmsScaleAssConf wczlConf = amsDao.queryScaleAssConf1(wczl.get(0).getCode(), wczl.get(0).getScore(), null); + QmsScaleAssConf szggjConf = amsDao.queryScaleAssConf1(szggj.get(0).getCode(), szggj.get(0).getScore(), null); + QmsScaleAssConf wlcdConf = amsDao.queryScaleAssConf1(wlcd.get(0).getCode(), wlcd.get(0).getScore(), null); + QmsScaleAssConf lmbsConf = amsDao.queryScaleAssConf1(lmbs.get(0).getCode(), lmbs.get(0).getScore(), null); + if (wczlConf != null && szggjConf != null && wlcdConf != null && lmbsConf != null) { + // *四项测试结果都正常,说明没有肌少症风险 + // *如果四肢骨骼肌身高质量指数(ASMI)正常,肌肉力量或(及)躯体功能下降,则有肌少症风险; + // *如果四项测试值全部低于标准值,则诊断为严重肌少症。 + // *如果四肢骨骼肌身高质量指数(ASMI)低于标准值,肌肉力量或躯体功能其中有一项低于标准值,则诊断为肌少症; + // *否则有肌少症风险 + if (!"1".equals(wczlConf.getNeedPlan()) && !"1".equals(szggjConf.getNeedPlan()) && !"1".equals(wlcdConf.getNeedPlan()) && !"1".equals(lmbsConf.getNeedPlan())) { + //没有肌少症风险 + return "没有肌少症风险"; + } else if (!"1".equals(szggjConf.getNeedPlan()) && "1".equals(wlcdConf.getNeedPlan()) && "1".equals(lmbsConf.getNeedPlan()) && "1".equals(wczlConf.getNeedPlan())) { + return "有肌少症风险"; + } else if ("1".equals(wczlConf.getNeedPlan()) && "1".equals(wlcdConf.getNeedPlan()) && "1".equals(lmbsConf.getNeedPlan()) && "1".equals(szggjConf.getNeedPlan())) { + return "严重肌少症"; + } else if ("1".equals(szggjConf.getNeedPlan()) && ("1".equals(wlcdConf.getNeedPlan()) || "1".equals(lmbsConf.getNeedPlan()) || "1".equals(wczlConf.getNeedPlan()))) { + return "肌少症"; + } else { + return "有肌少症风险"; + } + } + return null; + } + + public int getAge(String birthday) { + if (birthday == null || birthday.trim().isEmpty()) { + return 0; + } + try { + LocalDate birthDate = LocalDate.parse(birthday); + return Period.between(birthDate, LocalDate.now()).getYears(); + } catch (Exception e) { + log.error("计算年龄失败", e); + return 0; + } + } + + @Override + public RmsVo.ReportDetail queryReport(RmsDto.QueryDetail dto) { + //根据测评id查找报告单 + RmsReportExample reportExample = new RmsReportExample(); + reportExample.createCriteria().andEvaluationIdEqualTo(dto.getEvaluationId()).andDelFlagEqualTo((byte) 0); + List rmsReports = rmsReportMapper.selectByExample(reportExample); + if (CollUtil.isEmpty(rmsReports)) { + return queryReportDetail(dto); + } + RmsReport report = rmsReports.get(0); + RmsVo.ReportDetail detail = new RmsVo.ReportDetail(); + //查询报告单信息和病人信息 + RmsVo.ReportPatient reportPatient = rmsDao.queryReportResult(report.getId()); + + //查找患者做过的测评的最早和最晚的时间 + RmsVo.PatientEvaluationTime time = new RmsVo.PatientEvaluationTime(); + if (ObjectUtil.isNotNull(reportPatient)) { + time = rmsDao.getTimeByPatientId(reportPatient.getPatientId()); + if (ObjectUtil.isNull(time)) { + time = new RmsVo.PatientEvaluationTime(); + time.setMinTime(new Date()); + time.setMaxTime(new Date()); + } + } + //查询测评量表 + List scores = rmsDao.queryEmsScaleScore(dto.getEvaluationId(), CollectionUtil.newArrayList()); + if (CollUtil.isNotEmpty(scores)) { + //组装成父子级关系 + scores = buildReportScoreTree(scores, 0L); + } + detail.setPatient(reportPatient); + detail.setScores(scores); + return detail; + } + } diff --git a/ruisi_java/ruisi-web-admin/src/main/resources/application-dev.yml b/ruisi_java/ruisi-web-admin/src/main/resources/application-dev.yml index 32e93ff..4f6fd34 100644 --- a/ruisi_java/ruisi-web-admin/src/main/resources/application-dev.yml +++ b/ruisi_java/ruisi-web-admin/src/main/resources/application-dev.yml @@ -8,7 +8,7 @@ spring: master: url: jdbc:mysql://localhost:3306/ruisi_cga?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root - password: 123456 + password: q7510327 # url: jdbc:mysql://localhost:3306/htage2023?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 # username: root # password: 123456 diff --git a/ruisi_java/ruisi-web-admin/src/main/resources/application-prod.yml b/ruisi_java/ruisi-web-admin/src/main/resources/application-prod.yml index a6bf5d0..570d9c2 100644 --- a/ruisi_java/ruisi-web-admin/src/main/resources/application-prod.yml +++ b/ruisi_java/ruisi-web-admin/src/main/resources/application-prod.yml @@ -99,7 +99,7 @@ ht: patientUrl: https://api.tall.wiki/ruisi/client/# name: 认知功能评测云平台系统 file: - path: /data/cgav2/server/profile/ + path: /data/cgav2/profile/ #domain: https://api.ccsens.com/test/ domain: http://116.204.40.58/ruisiClient imgDomain: http://116.204.40.58/ruisiClient/profile diff --git a/ruisi_java/ruisi-web-admin/src/main/resources/mapper/dao/PmsPatientDao.xml b/ruisi_java/ruisi-web-admin/src/main/resources/mapper/dao/PmsPatientDao.xml index df9dac9..2944e34 100644 --- a/ruisi_java/ruisi-web-admin/src/main/resources/mapper/dao/PmsPatientDao.xml +++ b/ruisi_java/ruisi-web-admin/src/main/resources/mapper/dao/PmsPatientDao.xml @@ -92,9 +92,23 @@ MAX(ee.create_time) as lastEvaluationTime, uu.nick_name as lastTesterName, COUNT(ee.id) as evaluationCount, - (select nick_name from ums_user where user_name = pp.create_by and del_flag = 0) as creatorName, + (select nick_name from ums_user where user_name = pp.create_by and del_flag = 0) as createBy, pp.create_time as createTime, - ud.dept_name as hospitalName + ud.dept_name as hospitalName, + pp.birthday, + pp.career, + pp.marital_status as maritalStatus, + pp.domicile, + pp.nation, + pp.native_place as nativePlace, + pp.contact_name as contactName, + pp.contact_relation as contactRelation, + pp.contact_mobile as contactMobile, + pp.address, + pp.belief, + pp.hobby, + pp.abo_blood_type as aboBloodType, + pp.rh_blood_type as rhBloodType FROM pms_patient pp LEFT JOIN ems_evaluation ee ON pp.id = ee.patient_id and ee.del_flag = 0 @@ -155,25 +169,33 @@ - - - and (pp.create_by = #{userName} or ae.tester_id = #{userId}) - - - - and uu.dept_id = (SELECT dept_id FROM ums_user WHERE user_id = #{userId}) - - - and uu.dept_id in ( - SELECT pud.dept_id FROM ums_user u - LEFT JOIN ums_dept ud ON ud.dept_id = u.dept_id - LEFT JOIN ums_dept pud ON pud.dept_id = ud.parent_id - WHERE u.user_id = #{userId} - UNION ALL - SELECT u.dept_id FROM ums_user u WHERE u.user_id = #{userId} - ) - - + + + and uu.dept_id IN ( + SELECT d.dept_id FROM ums_user u LEFT JOIN ums_dept d on (d.dept_id = u.dept_id or + FIND_IN_SET(u.dept_id,ancestors)) + WHERE user_id = #{userId} + ) + + + + + + + + + + + + + + + + + + + + GROUP BY pp.id order by pp.create_time desc @@ -259,11 +281,33 @@ b.is_main_diagnosis as isMainDiagnosis, b.diagnosis_code as diagnosisCode, b.diagnosis_name as diagnosisName, - b.diagnosis_date as diagnosisDate + b.diagnosis_date as diagnosisDate, + b.create_time as createTime, + b.create_by as createBy, + p.hospital_id as hospitalId, + p.hospital_number as hospitalNumber, + p.patient_number as patientNumber, + p.native_place as nativePlace, + p.nation, + p.phone, + p.mobile, + p.birth_year as birthYear, + p.birth_number as birthNumber, + p.menopause_age as menopauseAge, + p.educational_status as educationalStatus, + p.educational_status_unit as educationalStatusUnit, + p.marital_status as maritalStatus, + p.dwelling_state as dwellingState, + p.birthday, + p.career, + p.address, + p.native_place as nativePlace, + p.contact_name as contactName from pms_patient_body b left join pms_patient p on b.patient_id = p.id + left join ums_user uu on p.create_by = uu.user_name b.del_flag = 0 and p.del_flag = 0 @@ -276,11 +320,19 @@ and b.diagnosis_date between #{param.beginTime} and #{param.endTime} - and p.dept_id = #{param.deptId} + and p.hospital_id = #{param.deptId} and b.diagnosis_code like concat('%',#{param.diagnosisCode},'%') + + + and uu.dept_id IN ( + SELECT d.dept_id FROM ums_user u LEFT JOIN ums_dept d on (d.dept_id = u.dept_id or + FIND_IN_SET(u.dept_id,ancestors)) + WHERE user_id = #{userId} + ) + order by b.id desc diff --git a/ruisi_java/ruisi-web-admin/src/main/resources/mapper/dao/RmsDao.xml b/ruisi_java/ruisi-web-admin/src/main/resources/mapper/dao/RmsDao.xml index 3e32ccc..ab3923b 100644 --- a/ruisi_java/ruisi-web-admin/src/main/resources/mapper/dao/RmsDao.xml +++ b/ruisi_java/ruisi-web-admin/src/main/resources/mapper/dao/RmsDao.xml @@ -1019,14 +1019,17 @@ d.dept_name as hospitalName hv.version as versionName, uu.nick_name as testerName, FROM_UNIXTIME(rr.report_time / 1000, '%Y-%m-%d') as evaluationTime, - ee.complete_status as completeStatus + ee.complete_status as completeStatus, + IFNULL(GROUP_CONCAT(DISTINCT q.name SEPARATOR ','), '') AS scaleNames FROM rms_report rr - Left Join pms_patient_body pb on rr.visit_no = pb.outpatient_no + Left Join pms_patient_body pb on rr.visit_no = pb.outpatient_no and pb.del_flag = 0 LEFT JOIN pms_patient pp on pb.patient_id = pp.id left join ems_evaluation ee on rr.evaluation_id = ee.id LEFT JOIN hms_version hv on ee.version = hv.id LEFT JOIN ums_user uu on ee.tester_id = uu.user_id + LEFT JOIN ems_evaluation_scale_relevance e on e.evaluation_id = ee.id and e.del_flag = 0 + LEFT join qms_scale q on q.code = e.scale_code and q.del_flag = 0 WHERE ee.del_flag = 0 @@ -1057,24 +1060,14 @@ d.dept_name as hospitalName pp.name_full like CONCAT('%',LOWER(#{dto.searchValue}),'%') ) - - - and (pp.create_by = #{userName} or ee.tester_id = #{userId}) - - - and uu.dept_id = (SELECT dept_id FROM ums_user WHERE user_id = #{userId}) - - - and uu.dept_id in ( - SELECT pud.dept_id FROM ums_user u - LEFT JOIN ums_dept ud ON ud.dept_id = u.dept_id - LEFT JOIN ums_dept pud ON pud.dept_id = ud.parent_id - WHERE u.user_id = #{userId} - UNION ALL - SELECT u.dept_id FROM ums_user u WHERE u.user_id = #{userId} - ) - - + + + and uu.dept_id IN ( + SELECT d.dept_id FROM ums_user u LEFT JOIN ums_dept d on (d.dept_id = u.dept_id or + FIND_IN_SET(u.dept_id,ancestors)) + WHERE user_id = #{userId} + ) + group by rr.id order by rr.create_time desc @@ -1430,21 +1423,20 @@ d.dept_name as hospitalName select e.id, e.id as evaluationId, - e.doctor_name as testerName, + u.nick_name as testerName, e.patient_id as patientId, pp.name as name, e.patient_idcard as patientIdcard, e.patient_age as patientAge, e.tester_id as testerId, e.serial_number as serialNumber, - e.check_time as evaluationTime, e.remark, e.hospital, e.complete_status as completeStatus, e.recording, e.duration, e.create_by as createBy, - e.create_time as createTime, + e.create_time as evaluationTime, e.status, e.version, e.visit_no as visitNo , @@ -1489,7 +1481,16 @@ d.dept_name as hospitalName pp.idcard like CONCAT('%',#{dto.searchValue},'%') ) + + + and u.dept_id IN ( + SELECT d.dept_id FROM ums_user u LEFT JOIN ums_dept d on (d.dept_id = u.dept_id or + FIND_IN_SET(u.dept_id,ancestors)) + WHERE user_id = #{userId} + ) + group by r.id + order by r.id desc @@ -1608,4 +1609,177 @@ d.dept_name as hospitalName + + + + + + + + + \ No newline at end of file diff --git a/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/AmsReportTemplateController.java b/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/AmsReportTemplateController.java index 1b03ad7..da26506 100644 --- a/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/AmsReportTemplateController.java +++ b/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/AmsReportTemplateController.java @@ -51,7 +51,11 @@ public class AmsReportTemplateController { @ApiOperation("导出个人报告") @PostMapping("/exportGr") public JsonResponse exportGr(@RequestBody @Validated RmsDto.ExportReport1Dto dto) throws IOException { - return JsonResponse.ok(amsReportService.exportGr(dto)); + RmsDto.Export export = new RmsDto.Export(); + export.setEvaluationId(dto.getEvaluationId()); + export.setReportId(dto.getReportId()); + export.setVersion((byte) 2); + return JsonResponse.ok(amsReportService.export(export)); } @Anonymous @@ -65,13 +69,39 @@ public class AmsReportTemplateController { @ApiOperation("导出医生版报告") @PostMapping("/exportYs") public JsonResponse exportYs1(@RequestBody @Validated RmsDto.ExportReport1Dto dto){ - return JsonResponse.ok(amsReportService.exportYs1(dto)); + RmsDto.Export export = new RmsDto.Export(); + export.setEvaluationId(dto.getEvaluationId()); + export.setReportId(dto.getReportId()); + export.setVersion((byte) 1); + return JsonResponse.ok(amsReportService.export(export)); } @Anonymous @ApiOperation("导出阳性版报告") @PostMapping("/exportYx") public JsonResponse exportYx(@RequestBody @Validated RmsDto.ExportReport1Dto dto){ - return JsonResponse.ok(amsReportService.exportYx(dto)); + RmsDto.Export export = new RmsDto.Export(); + export.setEvaluationId(dto.getEvaluationId()); + export.setReportId(dto.getReportId()); + export.setVersion((byte) 3); + return JsonResponse.ok(amsReportService.export(export)); + } + + @Anonymous + @ApiOperation("导出所有报告") + @PostMapping("/exportAll") + public JsonResponse exportAll(@RequestBody @Validated RmsDto.ExportReport1Dto dto){ + RmsDto.Export export = new RmsDto.Export(); + export.setEvaluationId(dto.getEvaluationId()); + export.setReportId(dto.getReportId()); + export.setVersion((byte) 0); + return JsonResponse.ok(amsReportService.export(export)); + } + + @Anonymous + @ApiOperation("导出所有报告") + @PostMapping("/exportAll1") + public JsonResponse export(@RequestBody @Validated RmsDto.Export dto){ + return JsonResponse.ok(amsReportService.export(dto)); } } diff --git a/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/DockController.java b/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/DockController.java index b4bdd1a..1c79948 100644 --- a/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/DockController.java +++ b/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/DockController.java @@ -2,18 +2,22 @@ package com.ccsens.client.controller; import com.ccsens.common.annotation.Anonymous; import com.ccsens.common.core.domain.JsonResponse; +import com.ccsens.framework.web.service.SysLoginService; import com.ccsens.system.domain.dto.DockDto; import com.ccsens.system.service.DockService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.PrintWriter; /** * @Author zzc @@ -31,6 +35,29 @@ import javax.annotation.Resource; public class DockController { @Resource private DockService dockService; + @Autowired + private SysLoginService loginService; + + @Value("${redirectPath:}") + private String redirectPath; + /** + * 院内调用接口,重定向至患者列表页面 + * @param visitNo 患者就诊流水号 + * @param emplCode 登录用户工号 + * @return 重定向至本系统 + */ + @Anonymous + @ApiOperation("对接院内登录重定向至本系统") + @GetMapping("/redirect") + public void loginRedirect(String visitNo, String emplCode, HttpServletResponse response) throws IOException { + //根据emplCode获取token + String token = loginService.getLoginByEmplCode(emplCode); + // 3. 构建前端URL + String frontendUrl = redirectPath + "?idCard=" + visitNo + "&token=Bearer " + token; + // 4. 重定向 + response.sendRedirect(frontendUrl); + } + @Anonymous @ApiOperation("接收院内推送的待评估患者") diff --git a/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/PmsController.java b/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/PmsController.java index 6aef319..7e34628 100644 --- a/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/PmsController.java +++ b/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/PmsController.java @@ -61,7 +61,7 @@ public class PmsController extends BaseController { @ApiOperation("获取患者信息列表") @PostMapping("/queryList") public JsonResponse> queryPatientList(@RequestBody @Validated BaseDto dto) { - List list = new ArrayList<>(); +// List list = new ArrayList<>(); // PmsPatientDto.QueryPatient param = dto.getParam(); // if (StrUtil.isNotEmpty(param.getSearchValue()) && param.getSearchValue().length() == 10) { @@ -86,18 +86,18 @@ public class PmsController extends BaseController { startPageOvertop(dto); List serverList = patientService.queryPatientList(dto.getParam(), dataScope, loginUser.getUserId(), loginUser.getUsername()); - if (CollUtil.isNotEmpty(serverList)) { - list.addAll(serverList); - } +// if (CollUtil.isNotEmpty(serverList)) { +// list.addAll(serverList); +// } - // 创建一个 TreeSet,通过 Comparator 根据 patientId 去重 - Set uniqueSet = new TreeSet<>( - Comparator.comparing(PmsPatientVo.PatientList::getPatientId) - ); - uniqueSet.addAll(list); - List uniqueList = new ArrayList<>(uniqueSet); +// // 创建一个 TreeSet,通过 Comparator 根据 patientId 去重 +// Set uniqueSet = new TreeSet<>( +// Comparator.comparing(PmsPatientVo.PatientList::getPatientId) +// ); +// uniqueSet.addAll(list); +// List uniqueList = new ArrayList<>(uniqueSet); - return JsonResponse.ok(new PageInfo<>(uniqueList)); + return JsonResponse.ok(new PageInfo<>(serverList)); } @ApiOperation("通过身份证号查询患者信息,方便页面展示返回和列表一样的格式") diff --git a/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/scheduled/SyncHospitalViwe.java b/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/scheduled/SyncHospitalViwe.java new file mode 100644 index 0000000..5d133a1 --- /dev/null +++ b/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/scheduled/SyncHospitalViwe.java @@ -0,0 +1,98 @@ +package com.ccsens.client.controller.scheduled; + +import com.ccsens.common.annotation.DataSource; +import com.ccsens.common.core.domain.entity.SysDept; +import com.ccsens.common.core.domain.entity.SysUser; +import com.ccsens.common.enums.DataSourceType; +import com.ccsens.system.domain.vo.DockVo; +import com.ccsens.system.service.DockService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.List; + +/** + * @author zy + * @date 2026/3/10 17:58 + */ +@Slf4j +@Component +public class SyncHospitalViwe { + + @Resource + private DockService dockService; + + @DataSource(value = DataSourceType.ORACLE) +// @Scheduled(cron = "0 */10 * * * ?") + public void getDeptView() { + List sysDepts = dockService.getDeptView(); + syncDeptView(sysDepts); + } + + @DataSource(value = DataSourceType.ORACLE) +// @Scheduled(cron = "0 */10 * * * ?") + public void getEmplView() { + List sysEmpls = dockService.getEmplView(); + syncEmplView(sysEmpls); + } + + @DataSource(value = DataSourceType.ORACLE) +// @Scheduled(cron = "0 */10 * * * ?") + public void getPatientBasicView() { + List sysPatients = dockService.getPatientBasicView(); + syncPatientBasicView(sysPatients); + } + + @DataSource(value = DataSourceType.ORACLE) +// @Scheduled(cron = "0 */10 * * * ?") + public void getPatientVisitView() { + List sysVisits = dockService.getPatientVisitView(); + syncPatientVisitView(sysVisits); + } + + @DataSource(value = DataSourceType.ORACLE) +// @Scheduled(cron = "0 */10 * * * ?") + public void getDiagnosisView() { + List sysDiagnosis = dockService.getDiagnosisView(); + syncDiagnosisView(sysDiagnosis); + } + + @DataSource(value = DataSourceType.ORACLE) +// @Scheduled(cron = "0 */10 * * * ?") + public void getMedicationView() { + List sysMedications = dockService.getMedicationView(); + syncMedicationView(sysMedications); + } + + @DataSource(value = DataSourceType.SLAVE) + public void syncDeptView(List sysDepts) { + dockService.syncDeptView(sysDepts); + } + + @DataSource(value = DataSourceType.SLAVE) + public void syncEmplView(List sysEmpls) { + dockService.syncEmplView(sysEmpls); + } + + @DataSource(value = DataSourceType.SLAVE) + public void syncPatientBasicView(List sysPatients) { + dockService.syncPatientBasicView(sysPatients); + } + + @DataSource(value = DataSourceType.SLAVE) + public void syncPatientVisitView(List sysVisits) { + dockService.syncPatientVisitView(sysVisits); + } + + @DataSource(value = DataSourceType.SLAVE) + public void syncDiagnosisView(List sysDiagnosis) { + dockService.syncDiagnosisView(sysDiagnosis); + } + + @DataSource(value = DataSourceType.SLAVE) + public void syncMedicationView(List sysMedications) { + dockService.syncMedicationView(sysMedications); + } +} diff --git a/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/persist/dao/RmsDao.java b/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/persist/dao/RmsDao.java index 959945f..f68f516 100644 --- a/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/persist/dao/RmsDao.java +++ b/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/persist/dao/RmsDao.java @@ -137,4 +137,5 @@ public interface RmsDao { @Param("scaleCodeList") List scaleCodeList); List queryReportExportInfo(@Param("evaluationId") Long evaluationId); + } diff --git a/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/AmsReportService.java b/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/AmsReportService.java index 82a829e..9e79268 100644 --- a/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/AmsReportService.java +++ b/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/AmsReportService.java @@ -36,4 +36,8 @@ public interface AmsReportService { * @return */ AmsReportVo.Result exportYx(RmsDto.ExportReport1Dto dto); + + AmsReportVo.Result exportAll(RmsDto.ExportReport1Dto dto); + + AmsReportVo.Result export(RmsDto.Export dto); } diff --git a/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/IPmsPatientService.java b/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/IPmsPatientService.java index 7d9a6ee..bd8ac92 100644 --- a/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/IPmsPatientService.java +++ b/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/IPmsPatientService.java @@ -31,6 +31,8 @@ public interface IPmsPatientService { PmsPatientVo.PatientInfo getPatientInfoById(Long id); + PmsPatientVo.PatientInfo getPatientInfoById(Long id, String visitNo); + PmsPatientVo.PatientInfo editPatient(PmsPatient pmsPatient); Long editPatientOtherMsg(PmsPatientDto.EditOtherMsg param); diff --git a/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/AmsReportServiceImpl.java b/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/AmsReportServiceImpl.java index 07a7cc1..02cd229 100644 --- a/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/AmsReportServiceImpl.java +++ b/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/AmsReportServiceImpl.java @@ -12,6 +12,7 @@ import com.ccsens.client.persist.dao.ClientEvaDao; import com.ccsens.client.persist.dao.HmsDoctorDao; import com.ccsens.client.persist.dao.RmsDao; import com.ccsens.client.service.AmsReportService; +import com.ccsens.client.service.IPmsPatientService; import com.ccsens.client.service.IReportInfoService; import com.ccsens.client.service.IRmsService; import com.ccsens.common.constant.CultureEnum; @@ -27,8 +28,11 @@ import com.ccsens.system.domain.po.*; import com.ccsens.system.domain.vo.*; import com.ccsens.system.persist.mapper.*; import com.deepoove.poi.XWPFTemplate; +import com.deepoove.poi.config.Configure; import com.deepoove.poi.data.*; import com.deepoove.poi.data.style.BorderStyle; +import com.deepoove.poi.data.style.TableStyle; +import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy; import com.deepoove.poi.xwpf.BodyContainer; import com.deepoove.poi.xwpf.BodyContainerFactory; import org.springframework.beans.factory.annotation.Value; @@ -64,6 +68,8 @@ public class AmsReportServiceImpl implements AmsReportService { @Resource private IRmsService rmsService; @Resource + private IPmsPatientService pmsPatientService; + @Resource private RmsDao rmsDao; @Resource private RmsReportMapper rmsReportMapper; @@ -87,6 +93,8 @@ public class AmsReportServiceImpl implements AmsReportService { private String grPath; @Value("${file.ysPath}") private String ysPath; + @Value("${file.allPath}") + private String allPath; @Override public AmsReportVo.Result export(RmsDto.ExportReportDto dto) throws IOException { @@ -627,7 +635,7 @@ public class AmsReportServiceImpl implements AmsReportService { HashMap params = new HashMap<>(); - XWPFTemplate template = XWPFTemplate.compile(grPath); +// XWPFTemplate template = XWPFTemplate.compile(grPath); params.put("h_name", patientInfo.getHospitalName()); // params.put("qrcode_img_url", Pictures.ofLocal(reportPath + patientInfo.getQrCodeUrl()).size(130, 130).create()); params.put("p_name", patientInfo.getPatientName()); @@ -879,6 +887,8 @@ public class AmsReportServiceImpl implements AmsReportService { params.put("title" + i, scores.get(i).getName()); + + List> listMap = new ArrayList<>(); } if (emsEvaluation.getVersion() != null) { @@ -896,9 +906,22 @@ public class AmsReportServiceImpl implements AmsReportService { .create(); params.put("table", tableData); +// params.put("questionTables", listMap); + -// Long hospitalId = SecurityUtils.getDeptId(); String s = IdUtil.randomUUID(); + + // 或使用 RenderData 和 MiniTableRenderData 更高级表格渲染(后面介绍) + LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy(); + + Configure config = Configure.builder() + .bind("zdList", policy) + .bind("yyList", policy) + .bind("questionTables", policy) + .bind("questionList", policy).build(); + XWPFTemplate template = XWPFTemplate.compile(allPath, config); + +// Long hospitalId = SecurityUtils.getDeptId(); // 将表格数据放入参数中 // params.put("table", tableDataList); try { @@ -990,7 +1013,7 @@ public class AmsReportServiceImpl implements AmsReportService { RmsDto.QueryDetail queryDetail = new RmsDto.QueryDetail(); queryDetail.setEvaluationId(dto.getEvaluationId()); - RmsVo.ReportDetail detail = rmsService.queryReportDetail(queryDetail); + RmsVo.ReportDetail detail = rmsService.queryReport(queryDetail); //查询测评量表 List scores = rmsDao.queryEmsScaleScore(dto.getEvaluationId(), CollectionUtil.newArrayList()); if (CollUtil.isNotEmpty(scores)) { @@ -1625,4 +1648,801 @@ public class AmsReportServiceImpl implements AmsReportService { return pattern.matcher(str).matches(); } + public static Map getParams(RmsDto.ExportReport1Dto dto) { + Map params = new HashMap<>(); + + + return params; + } + + @Override + public AmsReportVo.Result exportAll(RmsDto.ExportReport1Dto dto) { + RmsReport report = rmsReportMapper.selectByPrimaryKey(dto.getReportId()); + if (ObjectUtil.isNotNull(report) && StrUtil.isNotBlank(report.getUrl())) { + AmsReportVo.Result result = new AmsReportVo.Result(); + result.setPath(report.getUrl()); +// return result; + } + + RmsDto.QueryDetail queryDetail = new RmsDto.QueryDetail(); + queryDetail.setEvaluationId(dto.getEvaluationId()); + RmsVo.ReportDetail detail = rmsService.queryReport(queryDetail); + //查询测评量表 + List scores = rmsDao.queryEmsScaleScore(dto.getEvaluationId(), CollectionUtil.newArrayList()); + if (CollUtil.isNotEmpty(scores)) { + //组装成父子级关系 + scores = rmsService.buildReportScoreTree(scores, 0L); + } + if (detail == null) { + return null; + } + EmsEvaluation emsEvaluation = emsEvaluationMapper.selectByPrimaryKey(dto.getEvaluationId()); + if (emsEvaluation == null) { + return null; + } + //查询就诊、诊断信息 + PmsPatientVo.PatientInfo patientInfoById; + if (StrUtil.isNotEmpty(report.getVisitNo())) { + patientInfoById = pmsPatientService.getPatientInfoById(emsEvaluation.getPatientId(), report.getVisitNo()); + } else { + patientInfoById = pmsPatientService.getPatientInfoById(emsEvaluation.getPatientId()); + } + + //查询 + RmsVo.ReportPatient patientInfo = detail.getPatient(); + + HashMap params = new HashMap<>(); + + + params.put("h_name", patientInfo.getHospitalName()); +// params.put("qrcode_img_url", Pictures.ofLocal(reportPath + patientInfo.getQrCodeUrl()).size(130, 130).create()); + params.put("p_name", patientInfo.getPatientName()); + params.put("p_sex", patientInfo.getSex() == 0 ? "男" : "女"); + params.put("p_age", patientInfo.getPatientAge()); + CultureEnum cultureEnum = null; + if (dto.getSignId() != null) { + HmsDoctorSign emsEvaluationInformedConsent = hmsDoctorSignMapper.selectByPrimaryKey(dto.getSignId()); + if (emsEvaluationInformedConsent != null) { + params.put("cpy_img_url", Pictures.ofLocal(prefixWord + emsEvaluationInformedConsent.getPath()).size(80, 40).create()); + } + } else { + //签名信息 + Long userId = SecurityUtils.getUserId(); + List querySigns = hmsDoctorDao.querySign(userId); + if (CollUtil.isNotEmpty(querySigns)) { + HmsVo.QuerySign querySign = querySigns.get(0); + if (ObjectUtil.isNotNull(querySign) && StrUtil.isNotEmpty(querySign.getSignUrl())) { + params.put("cpy_img_url", Pictures.ofLocal(prefixWord + querySign.getSignUrl()).size(80, 40).create()); + } + } + } + if (patientInfoById != null) { + params.put("contactPhone", patientInfoById.getContactMobile()); + params.put("contactRelation", patientInfoById.getContactRelation()); + params.put("contact", patientInfoById.getContactName()); + Map>> otherMsg = patientInfoById.getOtherMsg(); + //诊断 + List> pmsPatientDiagnosis = otherMsg.get("pmsPatientDiagnosis"); + if (CollUtil.isNotEmpty(pmsPatientDiagnosis)) { + pmsPatientDiagnosis.forEach(item -> { + Object diagnosisDate = item.get("diagnosisDate"); + if (ObjectUtil.isNotNull(diagnosisDate)) { + item.put("diagnosisDate", DateUtil.format(DateUtil.parse(diagnosisDate.toString()), "yyyy-MM-dd")); + } + }); + params.put("zdList", pmsPatientDiagnosis); + } + + //就诊信息 + List> pmsPatientBodyList = otherMsg.get("pmsPatientBody"); + Map pmsPatientBodyMap = new HashMap<>(); + if (CollUtil.isNotEmpty(pmsPatientBodyList)) { + pmsPatientBodyMap = pmsPatientBodyList.get(0); + } + + //用药 + List> pmsPatientParentIllness = otherMsg.get("pmsPatientParentIllness"); + params.put("yyList", pmsPatientParentIllness); + + params.put("birthDate", patientInfoById.getBirthday()); + params.put("place", patientInfoById.getNativePlace()); + params.put("address", patientInfoById.getAddress()); + params.put("hobby", patientInfoById.getHobby()); + params.put("aboBlood", patientInfoById.getAboBloodType()); + params.put("rhBlood", patientInfoById.getRhBloodType()); + params.put("visit_type", pmsPatientBodyMap.get("visit_type")); + params.put("visitNo", pmsPatientBodyMap.get("outpatient_no")); + params.put("age", pmsPatientBodyMap.get("age")); + params.put("dept", pmsPatientBodyMap.get("department")); + params.put("doctor", pmsPatientBodyMap.get("doctor")); + params.put("admissionDate", pmsPatientBodyMap.get("admission_date")); + params.put("num", pmsPatientBodyMap.get("admission_count")); + params.put("admissionMethod", ObjectUtil.isNull(pmsPatientBodyMap.get("admission_method")) ? "" : ObjectUtil.equals(pmsPatientBodyMap.get("admission_method"), "1") ? "急诊": ObjectUtil.equals(pmsPatientBodyMap.get("admission_method"), "2") ? "门诊": ObjectUtil.equals(pmsPatientBodyMap.get("admission_method"), "3") ? "其他医疗机构转入": "其他"); + params.put("bedNumber", pmsPatientBodyMap.get("bed_number")); + params.put("dischargeDate", ObjectUtil.isNull(pmsPatientBodyMap.get("dischargeDate")) ? "" : DateUtil.format(DateUtil.parse(pmsPatientBodyMap.get("dischargeDate").toString()), "yyyy-MM-dd")); + params.put("dischargeMethod", pmsPatientBodyMap.get("dischargeMethod")); + params.put("height", pmsPatientBodyMap.get("height")); + params.put("weight", pmsPatientBodyMap.get("weight")); + params.put("bmi", pmsPatientBodyMap.get("bmi")); + params.put("tz", pmsPatientBodyMap.get("tz")); + params.put("temperature", pmsPatientBodyMap.get("temperature")); + params.put("systolic_pressure", pmsPatientBodyMap.get("systolicPressure")); + params.put("diastolic_pressure", pmsPatientBodyMap.get("diastolicPressure")); + params.put("pulse", pmsPatientBodyMap.get("pulse")); + params.put("creatinine", pmsPatientBodyMap.get("creatinine")); + params.put("oxygen_saturation", pmsPatientBodyMap.get("oxygen_saturation")); + params.put("albumin", pmsPatientBodyMap.get("albumin")); + params.put("total_protein", pmsPatientBodyMap.get("total_protein")); + params.put("vitamin_d3", pmsPatientBodyMap.get("vitamin_d3")); + params.put("hematocrit", pmsPatientBodyMap.get("hematocrit")); + params.put("dimer", pmsPatientBodyMap.get("dimer")); + } + + try { + cultureEnum = BaseEnum.codeOf(CultureEnum.class, patientInfo.getEducationalStatus().intValue()); + } catch (Exception e) { + //处理educationStatus为null的情况,后台导入的数据educationStatus为null + //默认为初中 + cultureEnum = CultureEnum.YW; + } + if (cultureEnum != null) { + params.put("p_grade", cultureEnum.getDesc()); + } + if (patientInfo.getCareer() != null) { + JobEnum jobEnum = BaseEnum.codeOf(JobEnum.class, patientInfo.getCareer().intValue()); +// params.put("p_no", patientInfo.getSerialNumber()); + if (jobEnum != null) { + params.put("p_Career", jobEnum.getDesc()); + } + } + params.put("p_dept", patientInfo.getDepartment()); + params.put("p_bedno", patientInfo.getBedNumber()); + params.put("p_Patient_number", patientInfo.getHospitalNumber()); + params.put("p_Clinical_diagnosis", patientInfo.getClinicalDiagnosis()); + params.put("p_Inspection_date", DateUtil.format(new Date(patientInfo.getReportTime()), "yyyy-MM-dd")); +// params.put("score", detail.getScore()); + //AD8 + +// params.put("cpy_img_url", patientInfo.getName()); + params.put("report_date", DateUtil.date(patientInfo.getReportTime())); + + //生成表格 + // 创建带有样式的文本 + TextRenderData text1 = Texts.of("评估结论").bold().fontSize(12).create(); + TextRenderData text2 = Texts.of("评估结论").bold().fontSize(12).create(); + TextRenderData text3 = Texts.of("评估结论").bold().fontSize(12).create(); + TextRenderData text4 = Texts.of("评估结论").bold().fontSize(12).create(); +// TextRenderData text5 = Texts.of("评估结论").bold().fontSize(12).create(); + + RowRenderData headerRow = Rows.of(text1, text2, text3, text4).create(); + + //查询 + List exportInfos = rmsDao.queryReportExportInfo(dto.getEvaluationId()); + if (CollUtil.isEmpty(exportInfos)) { + return null; + } + RowRenderData titleRow = Rows.of("一级指标/二级指标", "量表名称", "得分", "结论").create(); + Tables.TableBuilder of = Tables.of(headerRow, titleRow); + for (int i = 0; i < exportInfos.size(); i++) { + RmsVo.Pgjl pgjl = new RmsVo.Pgjl(); + params.put("yjzb", exportInfos.get(i).getComboParentName()); + params.put("ejzb", exportInfos.get(i).getComboName()); + if (exportInfos.get(i).getNeedPlan() != null && exportInfos.get(i).getNeedPlan() == 1) { + TextRenderData textStr = Texts.of(StrUtil.isEmpty(exportInfos.get(i).getComboParentName()) ? "" : exportInfos.get(i).getComboParentName() + "/" + exportInfos.get(i).getComboName()).bold().color("FF0000").create(); + TextRenderData textName = Texts.of(scores.get(i).getName()).bold().color("FF0000").create(); + TextRenderData textScore = Texts.of(scores.get(i).getScore() == null ? "" : scores.get(i).getScore() + "").bold().color("FF0000").create(); + TextRenderData textImpression = Texts.of(StrUtil.isEmpty(exportInfos.get(i).getImpression()) ? exportInfos.get(i).getResult() : exportInfos.get(i).getImpression()).bold().color("FF0000").create(); + pgjl.setTitle(StrUtil.isEmpty(exportInfos.get(i).getComboParentName()) ? "" : exportInfos.get(i).getComboParentName() + "/" + exportInfos.get(i).getComboName()); + + //查询一二级套餐 + RowRenderData row1 = Rows.of( + textStr, + textName, + textScore, + textImpression + ).create(); +// if (StrUtil.isNotEmpty(exportInfos.get(i).getComboName() + "/" + exportInfos.get(i).getComboParentName())) { +// of.mergeRule(MergeCellRule.builder().map(MergeCellRule.Grid.of(i + 1, i + 1), MergeCellRule.Grid.of(0, 1)).build()); +// } + of.addRow(row1); + } else { + if (!"JI_SHAO".equals(exportInfos.get(i).getScaleCode())) { + TextRenderData textStr = Texts.of(StrUtil.isEmpty(exportInfos.get(i).getComboParentName()) ? "" : exportInfos.get(i).getComboParentName() + "/" + exportInfos.get(i).getComboName()).bold().create(); + TextRenderData textName = Texts.of("JI_SHAO".equals(exportInfos.get(i).getScaleCode()) ? "肌少总结论" : exportInfos.get(i).getScaleName()).bold().create(); + TextRenderData textScore = Texts.of(exportInfos.get(i).getScore() == null ? "" : exportInfos.get(i).getScore() + "").bold().create(); + //中医体质辨识添加结论 结论为初步印象 + TextRenderData textImpression = Texts.of( + StrUtil.isEmpty(exportInfos.get(i).getImpression()) ? exportInfos.get(i).getResult() : exportInfos.get(i).getImpression()).bold().create(); + //查询一二级套餐 + RowRenderData row1 = Rows.of( + textStr, + textName, + textScore, + textImpression + ).create(); + of.addRow(row1); + } else { + TextRenderData textStr = Texts.of(exportInfos.get(i).getImpression().contains("\n") ? "量表结论" + "\n" + "肌少总结论" : "肌少总结论").bold().create(); + TextRenderData textName = Texts.of("").bold().create(); + TextRenderData textScore = Texts.of(exportInfos.get(i).getScore() == null ? "" : exportInfos.get(i).getScore() + "").bold().create(); + //中医体质辨识添加结论 结论为初步印象 + TextRenderData textImpression = Texts.of( + exportInfos.get(i).getImpression() == null ? exportInfos.get(i).getResult() : exportInfos.get(i).getImpression()).bold().create(); + //查询一二级套餐 + RowRenderData row1 = Rows.of( + textStr, + textName, + textImpression, + textScore + ).create(); + if (StrUtil.isNotEmpty(exportInfos.get(i).getComboName() + "/" + exportInfos.get(i).getComboParentName())) { + of.mergeRule( + MergeCellRule.builder().map( + MergeCellRule.Grid.of(i + 2, 0), MergeCellRule.Grid.of(i + 2, 1)) + .map(MergeCellRule.Grid.of(i + 2, 2), MergeCellRule.Grid.of(i + 2, 3) + ).build() + ); + + } + of.addRow(row1); + } + } + } + if (emsEvaluation.getVersion() != null) { + HmsVersion hmsVersion = hmsVersionMapper.selectByPrimaryKey(Long.parseLong(emsEvaluation.getVersion())); + if (hmsVersion != null) { + params.put("type", hmsVersion.getVersion() + "评估报告"); + } + } + + List> listMap = new ArrayList<>(); + for (int i = 0; i < exportInfos.size(); i++) { + //遍历问题 + //生成问题表格 + + TextRenderData text5 = Texts.of("问题描述").bold().fontSize(12).create(); + TextRenderData text6 = Texts.of("问题结果").bold().fontSize(12).create(); + TextRenderData text7 = Texts.of("得 分").bold().fontSize(12).create(); +// TextRenderData text8 = Texts.of("总 分").bold().fontSize(12).create(); + RowRenderData detailHeaderRow = Rows.of(text5, text6, text7).create(); + Tables.TableBuilder of1 = Tables.of(detailHeaderRow); + RmsDto.QueryReportAnswer queryReportAnswer = new RmsDto.QueryReportAnswer(); + queryReportAnswer.setEvaluationCode(exportInfos.get(i).getScaleCode()); + queryReportAnswer.setId(dto.getReportId()); + List reportDetailAnswerList = rmsService.queryReportAnswer(queryReportAnswer); + MergeCellRule detailMerge = null; + if (CollUtil.isNotEmpty(reportDetailAnswerList)) { + RmsVo.ReportDetailAnswer reportDetailAnswer = reportDetailAnswerList.get(0); + List> collect = reportDetailAnswerList.stream().map(reportDetailAnswer1 -> reportDetailAnswer1.getQuestionList()).collect(Collectors.toList()); + List list = new ArrayList<>(); + for (int j = 0; j < collect.size(); j++) { + list.addAll(collect.get(j)); + } + Map map = new HashMap<>(); + List questionTableList = new ArrayList<>(); + for (RmsVo.QuestionInfo questionInfo : list) { + RmsVo.QuestionTable questionTable = new RmsVo.QuestionTable(); + questionTable.setQuestion(questionInfo.getQuestionName()); + //查询患者答题得分 + BigDecimal score = new BigDecimal("0"); + AmsPatientAnswerScoreExample amsPatientAnswerScoreExample = new AmsPatientAnswerScoreExample(); + amsPatientAnswerScoreExample.createCriteria() +// .andPatientIdEqualTo(patientInfo.getId()) + .andQuestionIdEqualTo(questionInfo.getQuestionId()) + .andEvaluationIdEqualTo(dto.getEvaluationId()); + amsPatientAnswerScoreExample.setOrderByClause("id desc"); + List amsPatientAnswerScores = amsPatientAnswerScoreMapper.selectByExample(amsPatientAnswerScoreExample); + if (CollUtil.isNotEmpty(amsPatientAnswerScores)) { + score = BigDecimal.valueOf(amsPatientAnswerScores.stream().filter(e -> e.getOptionId() != null && e.getOptionId() != 0).map(AmsPatientAnswerScore::getScore).mapToDouble(BigDecimal::doubleValue).sum()); + } + questionTable.setScore(score + ""); + //处理答案 + String answers = ""; + for (RmsVo.Answer answer : questionInfo.getAnswers()) { + if (StrUtil.isNotEmpty(answer.getAnswer())) { + answers += answer.getAnswer() + ","; + } + } + if (StrUtil.isNotEmpty(answers)) { + answers = answers.substring(0, answers.length() - 1); + } + questionTable.setResult(StrUtil.isEmpty(answers) || "null".equals(answers) ? "" : answers); + questionTableList.add(questionTable); + } + map.put("questionList", questionTableList); + map.put("title", exportInfos.get(i).getScaleName()); + if (StrUtil.isNotEmpty(exportInfos.get(i).getPlan())) { + map.put("fzjy", exportInfos.get(i).getPlan()); + map.put("fzjyFlag", true); + } + listMap.add(map); + } + } + + params.put("questionTables", listMap); + + + TableRenderData tableData = of + .create(); + params.put("table", tableData); + + String s = IdUtil.randomUUID(); + + // 或使用 RenderData 和 MiniTableRenderData 更高级表格渲染(后面介绍) + LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy(); + + Configure config = Configure.builder() + .bind("zdList", policy) + .bind("yyList", policy) + .bind("questionTables", policy) + .bind("questionList", policy).build(); + XWPFTemplate template = XWPFTemplate.compile(allPath, config); + + try { + template.render(params); + } catch ( + Exception e) { + e.printStackTrace(); // 输出详细的异常信息 + } + + String filePath = "/profile/" + "/report/" + "老年综合评估_" + s + ".docx"; + String pdfPath = "/profile/" + "/report/" + "老年综合评估_" + s + ".pdf"; + String aPath = path + "/" + "/report/" + "老年综合评估_" + s + ".docx"; + String pPath = path + "/" + "/report/" + "老年综合评估_" + s + ".pdf"; + + try { + template.writeAndClose(Files.newOutputStream(Paths.get(reportDomain + "/" + "/report/" + "老年综合评估_" + s + ".docx"))); + AsposeUtils.doc2pdf(aPath, pPath); + } catch ( + Exception e) { + e.printStackTrace(); + } + + AmsReportVo.Result result = new AmsReportVo.Result(); + result.setWord(filePath); + result.setPath(pdfPath); + //将生成的文件路径保存到报告单内 + if (ObjectUtil.isNotNull(report)) { + report.setUrl(pdfPath); + rmsReportMapper.updateByPrimaryKeySelective(report); + } + return result; + + } + + + public Map generateParams(Map params, List scores, PmsPatientVo.PatientInfo patientInfoById, RmsVo.ReportDetail detail, RmsDto.Export dto, EmsEvaluation emsEvaluation) { + RmsVo.ReportPatient patientInfo = detail.getPatient(); + params.put("h_name", patientInfo.getHospitalName()); +// params.put("qrcode_img_url", Pictures.ofLocal(reportPath + patientInfo.getQrCodeUrl()).size(130, 130).create()); + params.put("p_name", patientInfo.getPatientName()); + params.put("p_sex", patientInfo.getSex() == 0 ? "男" : "女"); + params.put("p_age", patientInfo.getPatientAge()); + params.put("phone", patientInfo.getMobile()); + if (dto.getVersion() != null) { + if(dto.getVersion() == 0) { + params.put("versionName", "完整版"); + } + if(dto.getVersion() == 1) { + params.put("versionName", "医生版"); + } + if(dto.getVersion() == 2) { + params.put("versionName", "个人版"); + } + if(dto.getVersion() == 3) { + params.put("versionName", "阳性版"); + } + } + if (patientInfo.getCareer() != null) { + JobEnum jobEnum = BaseEnum.codeOf(JobEnum.class, patientInfo.getCareer().intValue()); + if (jobEnum != null) { + params.put("job", jobEnum.getDesc()); + } + } + params.put("marital", patientInfo.getMarial()); + params.put("dwelling", patientInfo.getDwelling()); + params.put("nation", patientInfo.getNation()); + params.put("belief", patientInfo.getBelief()); + params.put("testerName", patientInfo.getTesterName()); + CultureEnum cultureEnum = null; + if (dto.getSignId() != null) { + HmsDoctorSign emsEvaluationInformedConsent = hmsDoctorSignMapper.selectByPrimaryKey(dto.getSignId()); + if (emsEvaluationInformedConsent != null) { + params.put("cpy_img_url", Pictures.ofLocal(prefixWord + emsEvaluationInformedConsent.getPath()).size(80, 40).create()); + } + } else { + //签名信息 + Long userId = SecurityUtils.getUserId(); + List querySigns = hmsDoctorDao.querySign(userId); + if (CollUtil.isNotEmpty(querySigns)) { + HmsVo.QuerySign querySign = querySigns.get(0); + if (ObjectUtil.isNotNull(querySign) && StrUtil.isNotEmpty(querySign.getSignUrl())) { + params.put("cpy_img_url", Pictures.ofLocal(prefixWord + querySign.getSignUrl()).size(80, 40).create()); + } + } + } + if (patientInfoById != null) { + params.put("contactPhone", patientInfoById.getContactMobile()); + params.put("contactRelation", patientInfoById.getContactRelation()); + params.put("contact", patientInfoById.getContactName()); + Map>> otherMsg = patientInfoById.getOtherMsg(); + //诊断 + List> pmsPatientDiagnosis = otherMsg.get("pmsPatientDiagnosis"); + if (CollUtil.isNotEmpty(pmsPatientDiagnosis)) { + pmsPatientDiagnosis.forEach(item -> { + Object diagnosisDate = item.get("diagnosisDate"); + if (ObjectUtil.isNotNull(diagnosisDate)) { + item.put("diagnosisDate", DateUtil.format(DateUtil.parse(diagnosisDate.toString()), "yyyy-MM-dd")); + } + }); + params.put("zdList", pmsPatientDiagnosis); + } + + //就诊信息 + List> pmsPatientBodyList = otherMsg.get("pmsPatientBody"); + Map pmsPatientBodyMap = new HashMap<>(); + if (CollUtil.isNotEmpty(pmsPatientBodyList)) { + pmsPatientBodyMap = pmsPatientBodyList.get(0); + } + + //用药 + List> pmsPatientParentIllness = otherMsg.get("pmsPatientParentIllness"); + params.put("yyList", pmsPatientParentIllness); + + params.put("birthDate", patientInfoById.getBirthday()); + params.put("place", patientInfoById.getNativePlace()); + params.put("address", patientInfoById.getAddress()); + params.put("hobby", patientInfoById.getHobby()); + params.put("aboBlood", ObjectUtil.isEmpty(patientInfoById.getAboBloodType()) ? "" : ObjectUtil.equals(patientInfoById.getAboBloodType(), "1") ? "A" : ObjectUtil.equals(patientInfoById.getAboBloodType(), "2") ? "B" : ObjectUtil.equals(patientInfoById.getAboBloodType(), "3") ? "O" : ObjectUtil.equals(patientInfoById.getAboBloodType(), "4") ? "AB" : ObjectUtil.equals(patientInfoById.getAboBloodType(), "5") ? "不详" : "未查"); + params.put("rhBlood", ObjectUtil.isEmpty(patientInfoById.getRhBloodType()) ? "" : ObjectUtil.equals(patientInfoById.getRhBloodType(), "1") ? "阳性" : ObjectUtil.equals(patientInfoById.getRhBloodType(), "2") ? "阴性" :ObjectUtil.equals(patientInfoById.getRhBloodType(), "3") ? "不详" : "未查"); + params.put("visit_type", ObjectUtil.isEmpty(pmsPatientBodyMap.get("visitType")) ? "" : ObjectUtil.equals(pmsPatientBodyMap.get("visitType"), "1") ? "门诊" : "住院"); + params.put("visitNo", pmsPatientBodyMap.get("outpatientNo")); + params.put("age", pmsPatientBodyMap.get("age")); + params.put("dept", pmsPatientBodyMap.get("department")); + params.put("doctor", pmsPatientBodyMap.get("doctor")); + params.put("admissionDate", ObjectUtil.isEmpty(pmsPatientBodyMap.get("admissionDate")) ? "": DateUtil.format(DateUtil.parse(pmsPatientBodyMap.get("admissionDate").toString()), "yyyy-MM-dd")); + params.put("num", pmsPatientBodyMap.get("admissionCount")); + params.put("admissionMethod", ObjectUtil.isNull(pmsPatientBodyMap.get("admissionMethod")) ? "" : ObjectUtil.equals(pmsPatientBodyMap.get("admissionMethod"), "1") ? "急诊": ObjectUtil.equals(pmsPatientBodyMap.get("admissionMethod"), "2") ? "门诊": ObjectUtil.equals(pmsPatientBodyMap.get("admissionMethod"), "3") ? "其他医疗机构转入": "其他"); + params.put("bedNumber", pmsPatientBodyMap.get("bedNumber")); + params.put("dischargeDate", ObjectUtil.isEmpty(pmsPatientBodyMap.get("dischargeDate")) ? "": DateUtil.format(DateUtil.parse(pmsPatientBodyMap.get("dischargeDate").toString()), "yyyy-MM-dd")); + params.put("dischargeMethod", ObjectUtil.isNull(pmsPatientBodyMap.get("dischargeMethod")) ? "": ObjectUtil.equals(pmsPatientBodyMap.get("dischargeMethod"), "1") ? "医嘱离院" : ObjectUtil.equals(pmsPatientBodyMap.get("dischargeMethod"), "2") ? "医嘱转院" :ObjectUtil.equals(pmsPatientBodyMap.get("dischargeMethod"), "3") ? "医嘱转社区卫生服务机构/乡镇卫生院":ObjectUtil.equals(pmsPatientBodyMap.get("dischargeMethod"), "4") ? "非医嘱离院":ObjectUtil.equals(pmsPatientBodyMap.get("dischargeMethod"), "5") ? "死亡": "其他"); + params.put("height", ObjectUtil.isEmpty(pmsPatientBodyMap.get("height")) ? "" : pmsPatientBodyMap.get("height") + "cm"); + params.put("weight", ObjectUtil.isEmpty(pmsPatientBodyMap.get("weight")) ? "" : pmsPatientBodyMap.get("weight") + "kg"); + params.put("bmi", pmsPatientBodyMap.get("bmi")); + params.put("tz", pmsPatientBodyMap.get("tz")); + params.put("temperature", pmsPatientBodyMap.get("temperature")); + params.put("systolic_pressure", pmsPatientBodyMap.get("systolicPressure")); + params.put("diastolic_pressure", pmsPatientBodyMap.get("diastolicPressure")); + params.put("pulse", pmsPatientBodyMap.get("pulse")); + params.put("creatinine", pmsPatientBodyMap.get("creatinine")); + params.put("oxygen_saturation", pmsPatientBodyMap.get("oxygenSaturation")); + params.put("albumin", pmsPatientBodyMap.get("albumin")); + params.put("total_protein", pmsPatientBodyMap.get("totalProtein")); + params.put("vitamin_d3", pmsPatientBodyMap.get("vitaminD3")); + params.put("hematocrit", pmsPatientBodyMap.get("hematocrit")); + params.put("dimer", pmsPatientBodyMap.get("dimer")); + } + + try { + cultureEnum = BaseEnum.codeOf(CultureEnum.class, patientInfo.getEducationalStatus().intValue()); + } catch (Exception e) { + //处理educationStatus为null的情况,后台导入的数据educationStatus为null + //默认为初中 + cultureEnum = CultureEnum.YW; + } + if (cultureEnum != null) { + params.put("p_grade", cultureEnum.getDesc()); + } + if (patientInfo.getCareer() != null) { + JobEnum jobEnum = BaseEnum.codeOf(JobEnum.class, patientInfo.getCareer().intValue()); +// params.put("p_no", patientInfo.getSerialNumber()); + if (jobEnum != null) { + params.put("p_Career", jobEnum.getDesc()); + } + } + params.put("p_dept", patientInfo.getDepartment()); + params.put("p_bedno", patientInfo.getBedNumber()); + params.put("p_Patient_number", patientInfo.getHospitalNumber()); + params.put("p_Clinical_diagnosis", patientInfo.getClinicalDiagnosis()); + params.put("p_Inspection_date", DateUtil.format(new Date(patientInfo.getReportTime()), "yyyy-MM-dd")); +// params.put("score", detail.getScore()); + //AD8 + +// params.put("cpy_img_url", patientInfo.getName()); + params.put("report_date", DateUtil.date(patientInfo.getReportTime())); + params.put("reportDate", DateUtil.format(DateUtil.date(patientInfo.getReportTime()), "yyyy-MM-dd")); + + //生成表格 + //查询报告数据 + List exportInfos = rmsDao.queryReportExportInfo(dto.getEvaluationId()); + if (CollUtil.isEmpty(exportInfos)) { + return null; + } + + RowRenderData titleRow = Rows.of("一级指标/二级指标", "量表名称", "得分", "结论").center() + .create(); + Tables.TableBuilder of = Tables.of(titleRow); + for (int i = 0; i < exportInfos.size(); i++) { + RmsVo.Pgjl pgjl = new RmsVo.Pgjl(); + params.put("yjzb", exportInfos.get(i).getComboParentName()); + params.put("ejzb", exportInfos.get(i).getComboName()); + if (exportInfos.get(i).getNeedPlan() != null && exportInfos.get(i).getNeedPlan() == 1) { + TextRenderData textStr = Texts.of(StrUtil.isEmpty(exportInfos.get(i).getComboParentName()) ? "" : exportInfos.get(i).getComboParentName() + "/" + exportInfos.get(i).getComboName()).bold().color("FF0000").create(); + TextRenderData textName = Texts.of(exportInfos.get(i).getScaleName()).bold().color("FF0000").create(); + TextRenderData textScore = Texts.of(exportInfos.get(i).getScore() == null ? "" : exportInfos.get(i).getScore() + "").bold().color("FF0000").create(); + TextRenderData textImpression = Texts.of(StrUtil.isEmpty(exportInfos.get(i).getImpression()) ? exportInfos.get(i).getResult() : exportInfos.get(i).getImpression()).bold().color("FF0000").create(); + pgjl.setTitle(StrUtil.isEmpty(exportInfos.get(i).getComboParentName()) ? "" : exportInfos.get(i).getComboParentName() + "/" + exportInfos.get(i).getComboName()); + + //查询一二级套餐 + RowRenderData row1 = Rows.of( + textStr, + textName, + textScore, + textImpression + ).center().create(); +// if (StrUtil.isNotEmpty(exportInfos.get(i).getComboName() + "/" + exportInfos.get(i).getComboParentName())) { +// of.mergeRule(MergeCellRule.builder().map(MergeCellRule.Grid.of(i + 1, i + 1), MergeCellRule.Grid.of(0, 1)).build()); +// } + of.addRow(row1); + } else { + if (!"JI_SHAO".equals(exportInfos.get(i).getScaleCode())) { + TextRenderData textStr = Texts.of(StrUtil.isEmpty(exportInfos.get(i).getComboParentName()) ? "" : exportInfos.get(i).getComboParentName() + "/" + exportInfos.get(i).getComboName()).bold().create(); + TextRenderData textName = Texts.of("JI_SHAO".equals(exportInfos.get(i).getScaleCode()) ? "肌少总结论" : exportInfos.get(i).getScaleName()).bold().create(); + TextRenderData textScore = Texts.of(exportInfos.get(i).getScore() == null ? "" : exportInfos.get(i).getScore() + "").bold().create(); + //中医体质辨识添加结论 结论为初步印象 + TextRenderData textImpression = Texts.of( + StrUtil.isEmpty(exportInfos.get(i).getImpression()) ? exportInfos.get(i).getResult() : exportInfos.get(i).getImpression()).bold().create(); + //查询一二级套餐 + RowRenderData row1 = Rows.of( + textStr, + textName, + textScore, + textImpression + ).center().create(); + of.addRow(row1); + } else { + TextRenderData textStr = Texts.of(exportInfos.get(i).getImpression().contains("\n") ? "量表结论" + "\n" + "肌少总结论" : "肌少总结论").bold().create(); + TextRenderData textName = Texts.of("").bold().create(); + TextRenderData textScore = Texts.of(exportInfos.get(i).getScore() == null ? "" : exportInfos.get(i).getScore() + "").bold().create(); + //中医体质辨识添加结论 结论为初步印象 + TextRenderData textImpression = Texts.of( + exportInfos.get(i).getImpression() == null ? exportInfos.get(i).getResult() : exportInfos.get(i).getImpression()).bold().create(); + //查询一二级套餐 + RowRenderData row1 = Rows.of( + textStr, + textName, + textImpression, + textScore + ).center().create(); + if (StrUtil.isNotEmpty(exportInfos.get(i).getComboName() + "/" + exportInfos.get(i).getComboParentName())) { + of.mergeRule( + MergeCellRule.builder().map( + MergeCellRule.Grid.of(i + 1, 0), MergeCellRule.Grid.of(i + 1, 1)) + .map(MergeCellRule.Grid.of(i + 1, 2), MergeCellRule.Grid.of(i + 1, 3) + ).build() + ); + + } + of.addRow(row1); + } + } + } + if (emsEvaluation.getVersion() != null) { + HmsVersion hmsVersion = hmsVersionMapper.selectByPrimaryKey(Long.parseLong(emsEvaluation.getVersion())); + if (hmsVersion != null) { + params.put("type", hmsVersion.getVersion() + "评估报告"); + } + } + + List> listMap = new ArrayList<>(); + for (int i = 0; i < exportInfos.size(); i++) { + //遍历问题 + //生成问题表格 + + TextRenderData text5 = Texts.of("问题描述").bold().fontSize(12).create(); + TextRenderData text6 = Texts.of("问题结果").bold().fontSize(12).create(); + TextRenderData text7 = Texts.of("得 分").bold().fontSize(12).create(); +// TextRenderData text8 = Texts.of("总 分").bold().fontSize(12).create(); + RowRenderData detailHeaderRow = Rows.of(text5, text6, text7).create(); + Tables.TableBuilder of1 = Tables.of(detailHeaderRow); + RmsDto.QueryReportAnswer queryReportAnswer = new RmsDto.QueryReportAnswer(); + queryReportAnswer.setEvaluationCode(exportInfos.get(i).getScaleCode()); + queryReportAnswer.setId(dto.getReportId()); + List reportDetailAnswerList = rmsService.queryReportAnswer(queryReportAnswer); + MergeCellRule detailMerge = null; + if (CollUtil.isNotEmpty(reportDetailAnswerList)) { + RmsVo.ReportDetailAnswer reportDetailAnswer = reportDetailAnswerList.get(0); + List> collect = reportDetailAnswerList.stream().map(reportDetailAnswer1 -> reportDetailAnswer1.getQuestionList()).collect(Collectors.toList()); + List list = new ArrayList<>(); + for (int j = 0; j < collect.size(); j++) { + list.addAll(collect.get(j)); + } + Map map = new HashMap<>(); + List questionTableList = new ArrayList<>(); + for (RmsVo.QuestionInfo questionInfo : list) { + RmsVo.QuestionTable questionTable = new RmsVo.QuestionTable(); + questionTable.setQuestion(questionInfo.getQuestionName()); + //查询患者答题得分 + BigDecimal score = new BigDecimal("0"); + AmsPatientAnswerScoreExample amsPatientAnswerScoreExample = new AmsPatientAnswerScoreExample(); + amsPatientAnswerScoreExample.createCriteria() +// .andPatientIdEqualTo(patientInfo.getId()) + .andQuestionIdEqualTo(questionInfo.getQuestionId()) + .andEvaluationIdEqualTo(dto.getEvaluationId()); + amsPatientAnswerScoreExample.setOrderByClause("id desc"); + List amsPatientAnswerScores = amsPatientAnswerScoreMapper.selectByExample(amsPatientAnswerScoreExample); + if (CollUtil.isNotEmpty(amsPatientAnswerScores)) { + score = BigDecimal.valueOf(amsPatientAnswerScores.stream().filter(e -> e.getOptionId() != null && e.getOptionId() != 0).map(AmsPatientAnswerScore::getScore).mapToDouble(BigDecimal::doubleValue).sum()); + } + questionTable.setScore(score + ""); + //处理答案 + String answers = ""; + for (RmsVo.Answer answer : questionInfo.getAnswers()) { + if (StrUtil.isNotEmpty(answer.getAnswer())) { + answers += answer.getAnswer() + ","; + } + } + if (StrUtil.isNotEmpty(answers)) { + answers = answers.substring(0, answers.length() - 1); + } + questionTable.setResult(StrUtil.isEmpty(answers) || "null".equals(answers) ? "" : answers); + questionTableList.add(questionTable); + } + map.put("questionList", questionTableList); + map.put("title", exportInfos.get(i).getScaleName()); + if (StrUtil.isNotEmpty(exportInfos.get(i).getPlan())) { + map.put("fzjy", exportInfos.get(i).getPlan()); + map.put("fzjyFlag", true); + } + listMap.add(map); + } + } + //阳性报告单 + generateYx(params, exportInfos); + + params.put("questionTables", listMap); + + TableRenderData tableData = of + .center() + .create(); + params.put("table", tableData); + return params; + } + + public void generateYx(Map params, List exportInfos) { + RowRenderData titleRow = Rows.of("一级指标/二级指标", "量表名称", "得分", "结论").center() + .create(); + Tables.TableBuilder of = Tables.of(titleRow); + for (int i = 0; i < exportInfos.size(); i++) { + RmsVo.Pgjl pgjl = new RmsVo.Pgjl(); + params.put("yjzb", exportInfos.get(i).getComboParentName()); + params.put("ejzb", exportInfos.get(i).getComboName()); + if (exportInfos.get(i).getNeedPlan() != null && exportInfos.get(i).getNeedPlan() == 1) { + TextRenderData textStr = Texts.of(StrUtil.isEmpty(exportInfos.get(i).getComboParentName()) ? "" : exportInfos.get(i).getComboParentName() + "/" + exportInfos.get(i).getComboName()).bold().color("FF0000").create(); + TextRenderData textName = Texts.of(exportInfos.get(i).getScaleName()).bold().color("FF0000").create(); + TextRenderData textScore = Texts.of(exportInfos.get(i).getScore() == null ? "" : exportInfos.get(i).getScore() + "").bold().color("FF0000").create(); + TextRenderData textImpression = Texts.of(StrUtil.isEmpty(exportInfos.get(i).getImpression()) ? exportInfos.get(i).getResult() : exportInfos.get(i).getImpression()).bold().color("FF0000").create(); + pgjl.setTitle(StrUtil.isEmpty(exportInfos.get(i).getComboParentName()) ? "" : exportInfos.get(i).getComboParentName() + "/" + exportInfos.get(i).getComboName()); + + //查询一二级套餐 + RowRenderData row1 = Rows.of( + textStr, + textName, + textScore, + textImpression + ).center().create(); +// if (StrUtil.isNotEmpty(exportInfos.get(i).getComboName() + "/" + exportInfos.get(i).getComboParentName())) { +// of.mergeRule(MergeCellRule.builder().map(MergeCellRule.Grid.of(i + 1, i + 1), MergeCellRule.Grid.of(0, 1)).build()); +// } + of.addRow(row1); + } + } + TableRenderData tableData = of + .center() + .create(); + params.put("yxTable", tableData); + } + + @Override + public AmsReportVo.Result export(RmsDto.Export dto) { + //1. 查询是否已生成对应版本的报告单 + RmsReport report = rmsReportMapper.selectByPrimaryKey(dto.getReportId()); + if (ObjectUtil.isNotNull(report)) { + if (dto.getVersion() != null && dto.getVersion() == 0 && StrUtil.isNotEmpty(report.getAllUrl())) { + AmsReportVo.Result result = new AmsReportVo.Result(); + result.setPath(report.getAllUrl()); + return result; + } + if (dto.getVersion() != null && dto.getVersion() == 1 && StrUtil.isNotEmpty(report.getUrl())) { + AmsReportVo.Result result = new AmsReportVo.Result(); + result.setPath(report.getUrl()); + return result; + } + if (dto.getVersion() != null && dto.getVersion() == 2 && StrUtil.isNotEmpty(report.getPersionUrl())) { + AmsReportVo.Result result = new AmsReportVo.Result(); + result.setPath(report.getPersionUrl()); + return result; + } + if (dto.getVersion() != null && dto.getVersion() == 3 && StrUtil.isNotEmpty(report.getPositiveUrl())) { + AmsReportVo.Result result = new AmsReportVo.Result(); + result.setPath(report.getPositiveUrl()); + return result; + } + } + + //2. 查询对应版本的模板 + String url = amsDao.queryTemplate(dto.getVersionCode()); + //3. 查询数据 + RmsDto.QueryDetail queryDetail = new RmsDto.QueryDetail(); + queryDetail.setEvaluationId(dto.getEvaluationId()); + RmsVo.ReportDetail detail = rmsService.queryReport(queryDetail); + //查询分数 + List scores = rmsDao.queryReportScore(dto.getReportId(), null); + if (CollUtil.isNotEmpty(scores)) { + //组装成父子级关系 + scores = rmsService.buildReportScoreTree(scores, 0L); + } + EmsEvaluation emsEvaluation = emsEvaluationMapper.selectByPrimaryKey(dto.getEvaluationId()); + if (emsEvaluation == null) { + return null; + } + //查询就诊、诊断信息 + PmsPatientVo.PatientInfo patientInfoById; + if (StrUtil.isNotEmpty(report.getVisitNo())) { + patientInfoById = pmsPatientService.getPatientInfoById(emsEvaluation.getPatientId(), report.getVisitNo()); + } else { + patientInfoById = pmsPatientService.getPatientInfoById(emsEvaluation.getPatientId()); + } + //4. 生成MAP + Map params = new HashMap<>(); + params = generateParams(params, scores, patientInfoById, detail, dto, emsEvaluation); + // 或使用 RenderData 和 MiniTableRenderData 更高级表格渲染(后面介绍) + LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy(); + + Configure config = Configure.builder() + .bind("zdList", policy) + .bind("yyList", policy) + .bind("questionTables", policy) + .bind("questionList", policy).build(); + XWPFTemplate template = XWPFTemplate.compile(url, config); + //5. 渲染报告单并返回 +// XWPFTemplate template = XWPFTemplate.compile(url); + try { + template.render(params); + } catch (Exception e) { + e.printStackTrace(); // 输出详细的异常信息 + } + String s = IdUtil.randomUUID(); + String filePath = "/profile/" + "/report/" + "老年综合评估_" + s + ".docx"; + String pdfPath = "/profile/" + "/report/" + "老年综合评估_" + s + ".pdf"; + String aPath = path + "/" + "/report/" + "老年综合评估_" + s + ".docx"; + String pPath = path + "/" + "/report/" + "老年综合评估_" + s + ".pdf"; + + try { + template.writeAndClose(Files.newOutputStream(Paths.get(reportDomain + "/" + "/report/" + "老年综合评估_" + s + ".docx"))); + AsposeUtils.doc2pdf(aPath, pPath); + } catch (Exception e) { + e.printStackTrace(); + } + //将生成的文件路径保存到报告单内 + if (ObjectUtil.isNotNull(report)) { + if (dto.getVersion() == 0) { + report.setAllUrl(pdfPath); + } + if (dto.getVersion() == 1) { + report.setUrl(pdfPath); + } + if (dto.getVersion() == 2) { + report.setPersionUrl(pdfPath); + } + if (dto.getVersion() == 3) { + report.setPositiveUrl(pdfPath); + } + rmsReportMapper.updateByPrimaryKeySelective(report); + } + AmsReportVo.Result result = new AmsReportVo.Result(); + result.setWord(filePath); + result.setPath(pdfPath); + return result; + } } diff --git a/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/IEmsServiceImpl.java b/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/IEmsServiceImpl.java index 4b251ae..6e8a969 100644 --- a/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/IEmsServiceImpl.java +++ b/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/IEmsServiceImpl.java @@ -261,6 +261,7 @@ public class IEmsServiceImpl implements IEmsService { PmsPatientBody patientBody = null; PmsPatientBodyExample patientBodyExample = new PmsPatientBodyExample(); patientBodyExample.createCriteria().andPatientIdEqualTo(dto.getPatientId()); + patientBodyExample.setOrderByClause("update_time desc"); List pmsPatientBodies = patientBodyMapper.selectByExample(patientBodyExample); if (CollectionUtil.isNotEmpty(pmsPatientBodies)) { patientBody = pmsPatientBodies.get(0); @@ -445,6 +446,9 @@ public class IEmsServiceImpl implements IEmsService { @Override public Integer ignoreComplete(EmsDto.Ignore dto) { + if (dto.getEvaluationId() == null) { + return 0; + } Integer num = evaluationDao.ignoreComplete(dto.getEvaluationId()); return num; } diff --git a/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/PmsPatientServiceImpl.java b/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/PmsPatientServiceImpl.java index 18f8aab..f84715a 100644 --- a/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/PmsPatientServiceImpl.java +++ b/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/PmsPatientServiceImpl.java @@ -222,6 +222,7 @@ public class PmsPatientServiceImpl implements IPmsPatientService { PmsPatientBodyExample patientBodyExample = new PmsPatientBodyExample(); patientBodyExample.createCriteria().andPatientIdEqualTo(pmsPatient.getId()) .andDelFlagEqualTo((byte) 0); + patientBodyExample.setOrderByClause("create_time desc"); List pmsPatientBodies = pmsPatientBodyMapper.selectByExample(patientBodyExample); if (CollUtil.isNotEmpty(pmsPatientBodies)) { PmsPatientBody body = pmsPatientBodies.get(0); @@ -229,7 +230,7 @@ public class PmsPatientServiceImpl implements IPmsPatientService { List> pmsPatientBodyReturn = new ArrayList<>(); pmsPatientBodyReturn.add(JSON.parseObject(JSON.toJSONString(body), Map.class)); patientOtherMsg.put("pmsPatientBody", pmsPatientBodyReturn); - if(visitNo != null) { + if (visitNo != null) { //烟酒史 PmsPatientPersonalExample patientPersonalExample = new PmsPatientPersonalExample(); patientPersonalExample.createCriteria().andVisitNoEqualTo(visitNo).andPatientIdEqualTo(pmsPatient.getId()) @@ -296,6 +297,74 @@ public class PmsPatientServiceImpl implements IPmsPatientService { return patientInfo; } + @Override + public PmsPatientVo.PatientInfo getPatientInfoById(Long id, String visitNo) { + PmsPatient pmsPatient = patientDao.selectByPrimaryKey(id); + if (ObjectUtil.isNull(pmsPatient)) { + return null; + } + PmsPatientVo.PatientInfo patientInfo = new PmsPatientVo.PatientInfo(); + BeanUtils.copyProperties(pmsPatient, patientInfo); + + if (pmsPatient.getBirthYear() != null) { + patientInfo.setAge(Calendar.getInstance().get(Calendar.YEAR) - pmsPatient.getBirthYear()); + } + + //查询其他疾病史信息 + Map>> patientOtherMsg = new HashMap<>(); + + //先查询就诊信息(PmsPatientBody) + //根据就诊号和患者id查询就诊信息是否存在 + PmsPatientBodyExample patientBodyExample = new PmsPatientBodyExample(); + patientBodyExample.createCriteria().andPatientIdEqualTo(pmsPatient.getId()) + .andDelFlagEqualTo((byte) 0); + patientBodyExample.setOrderByClause("id desc"); + List pmsPatientBodies = pmsPatientBodyMapper.selectByExample(patientBodyExample); + if (CollUtil.isNotEmpty(pmsPatientBodies)) { + PmsPatientBody body = pmsPatientBodies.get(0); + List> pmsPatientBodyReturn = new ArrayList<>(); + pmsPatientBodyReturn.add(JSON.parseObject(JSON.toJSONString(body), Map.class)); + patientOtherMsg.put("pmsPatientBody", pmsPatientBodyReturn); + if (visitNo != null) { + //烟酒史 + PmsPatientPersonalExample patientPersonalExample = new PmsPatientPersonalExample(); + patientPersonalExample.createCriteria().andVisitNoEqualTo(visitNo).andPatientIdEqualTo(pmsPatient.getId()) + .andDelFlagEqualTo((byte) 0); + List pmsPatientPersonals = pmsPatientPersonalMapper.selectByExample(patientPersonalExample); + if (CollUtil.isNotEmpty(pmsPatientPersonals)) { + String jsonStr = JSON.toJSONString(pmsPatientPersonals); + List> allList = JSON.parseObject(jsonStr, List.class); + List> singleItemList = new ArrayList<>(); + if (!allList.isEmpty()) { + singleItemList.add(allList.get(0)); + } + patientOtherMsg.put("pmsPatientPersonal", singleItemList); + } + //用药信息 + PmsPatientParentIllnessExample patientParentIllnessExample = new PmsPatientParentIllnessExample(); + patientParentIllnessExample.createCriteria().andVisitNoEqualTo(visitNo).andPatientIdEqualTo(pmsPatient.getId()) + .andDelFlagEqualTo((byte) 0); + List pmsPatientParentIllnesses = pmsPatientParentIllnessMapper.selectByExample(patientParentIllnessExample); + if (CollUtil.isNotEmpty(pmsPatientParentIllnesses)) { + String jsonStr = JSON.toJSONString(pmsPatientParentIllnesses); + patientOtherMsg.put("pmsPatientParentIllness", JSON.parseObject(jsonStr, List.class)); + } + + //诊断信息 + PmsPatientDiagnosisExample patientDiagnosisExample = new PmsPatientDiagnosisExample(); + patientDiagnosisExample.createCriteria().andVisitNoEqualTo(visitNo).andPatientIdEqualTo(pmsPatient.getId()) + .andDelFlagEqualTo((byte) 0); + List pmsPatientDiagnoses = pmsPatientDiagnosisMapper.selectByExample(patientDiagnosisExample); + if (CollUtil.isNotEmpty(pmsPatientDiagnoses)) { + String jsonStr = JSON.toJSONString(pmsPatientDiagnoses); + patientOtherMsg.put("pmsPatientDiagnosis", JSON.parseObject(jsonStr, List.class)); + } + } + } + patientInfo.setOtherMsg(patientOtherMsg); + return patientInfo; + } + @Override public PmsPatientVo.PatientInfo editPatient(PmsPatient pmsPatient) { @@ -352,19 +421,15 @@ public class PmsPatientServiceImpl implements IPmsPatientService { @Override public Long editPatientOtherMsg(PmsPatientDto.EditOtherMsg param) { - JSONObject jsonObject = null; + JSONObject jsonObject = new JSONObject(); Object model = param.getModel(); - if(ObjectUtil.isNull(model)){ - return null; - } // 处理model参数 if (model instanceof List) { // List转JSONArray JSONArray array = (JSONArray) JSON.toJSON(model); - if(CollUtil.isEmpty(array)){ - return null; + if (CollUtil.isNotEmpty(array)) { + jsonObject = array.getJSONObject(0); } - jsonObject = array.getJSONObject(0); } else if (model instanceof Map) { // Map转JSONObject jsonObject = (JSONObject) JSON.toJSON(model); @@ -378,40 +443,51 @@ public class PmsPatientServiceImpl implements IPmsPatientService { // jsonObject = (JSONObject) param.getModel(); // } //验证就诊号是否为空 - String visitNo = jsonObject.getString("outpatientNo"); + String visitNo = param.getVisitNo(); if (StrUtil.isEmpty(visitNo)) { visitNo = jsonObject.getString("visitNo"); + if ("PmsPatientBody".equals(param.getEditType())) { + visitNo = jsonObject.getString("outpatientNo"); + } if (StrUtil.isEmpty(visitNo)) { throw new ServiceException("就诊号不能为空"); } } //验证患者id是否为空 - Long patientId = jsonObject.getLong("patientId"); + Long patientId = param.getPatientId(); if (patientId == null) { - throw new ServiceException("患者id不能为空"); + patientId = jsonObject.getLong("patientId"); + if (patientId == null) { + throw new ServiceException("患者id不能为空"); + } } //如果是就诊信息(PmsPatientBody) - if ("PmsPatientBody".equals(param.getEditType())) { - //就诊信息默认是单个信息,直接用jsonObject - PmsPatientBody pmsPatientBody = JSONObject.parseObject(jsonObject.toJSONString(), PmsPatientBody.class); - //根据就诊号和患者id查询就诊信息是否存在 + if ("PmsPatientBody".equals(param.getEditType()) || "pmsPatientBody".equals(param.getEditType())) { + //删除后新增 PmsPatientBodyExample patientBodyExample = new PmsPatientBodyExample(); patientBodyExample.createCriteria().andOutpatientNoEqualTo(visitNo).andPatientIdEqualTo(patientId) .andDelFlagEqualTo((byte) 0); - List pmsPatientBodies = pmsPatientBodyMapper.selectByExample(patientBodyExample); - if (CollUtil.isNotEmpty(pmsPatientBodies)) { - //存在则修改 - PmsPatientBody oldPatientBody = pmsPatientBodies.get(0); - pmsPatientBody.setId(oldPatientBody.getId()); - pmsPatientBodyMapper.updateByPrimaryKeySelective(pmsPatientBody); - } else { - //不存在则添加 - pmsPatientBody.setId(IDGenerator.nextSnowflakeId()); - pmsPatientBodyMapper.insertSelective(pmsPatientBody); - } - } else if ("PmsPatientPersonal".equals(param.getEditType())) { + PmsPatientBody pmsPatientBody1 = new PmsPatientBody(); + pmsPatientBody1.setDelFlag((byte) 1); + pmsPatientBodyMapper.updateByExampleSelective(pmsPatientBody1, patientBodyExample); + + //就诊信息默认是单个信息,直接用jsonObject + PmsPatientBody pmsPatientBody = JSONObject.parseObject(jsonObject.toJSONString(), PmsPatientBody.class); + //根据就诊号和患者id查询就诊信息是否存在 +// List pmsPatientBodies = pmsPatientBodyMapper.selectByExample(patientBodyExample); +// if (CollUtil.isNotEmpty(pmsPatientBodies)) { +// //存在则修改 +// PmsPatientBody oldPatientBody = pmsPatientBodies.get(0); +// pmsPatientBody.setId(oldPatientBody.getId()); +// pmsPatientBodyMapper.updateByPrimaryKeySelective(pmsPatientBody); +// } else { + //不存在则添加 + pmsPatientBody.setId(IDGenerator.nextSnowflakeId()); + pmsPatientBodyMapper.insertSelective(pmsPatientBody); +// } + } else if ("PmsPatientPersonal".equals(param.getEditType()) || "pmsPatientPersonal".equals(param.getEditType())) { //烟酒史默认是单个信息,直接用jsonObject //烟酒史 PmsPatientPersonal pmsPatientPersonal = JSONObject.parseObject(jsonObject.toJSONString(), PmsPatientPersonal.class); @@ -419,18 +495,23 @@ public class PmsPatientServiceImpl implements IPmsPatientService { PmsPatientPersonalExample patientPersonalExample = new PmsPatientPersonalExample(); patientPersonalExample.createCriteria().andVisitNoEqualTo(visitNo).andPatientIdEqualTo(patientId) .andDelFlagEqualTo((byte) 0); - List pmsPatientPersonals = pmsPatientPersonalMapper.selectByExample(patientPersonalExample); - if (CollUtil.isNotEmpty(pmsPatientPersonals)) { - //存在则修改 - PmsPatientPersonal oldPatientPersonal = pmsPatientPersonals.get(0); - pmsPatientPersonal.setId(oldPatientPersonal.getId()); - pmsPatientPersonalMapper.updateByPrimaryKeySelective(pmsPatientPersonal); - } else { + + PmsPatientPersonal pmsPatientPersonal1 = new PmsPatientPersonal(); + pmsPatientPersonal1.setDelFlag((byte) 1); + pmsPatientPersonalMapper.updateByExampleSelective(pmsPatientPersonal1, patientPersonalExample); +// +// List pmsPatientPersonals = pmsPatientPersonalMapper.selectByExample(patientPersonalExample); +// if (CollUtil.isNotEmpty(pmsPatientPersonals)) { +// //存在则修改 +// PmsPatientPersonal oldPatientPersonal = pmsPatientPersonals.get(0); +// pmsPatientPersonal.setId(oldPatientPersonal.getId()); +// pmsPatientPersonalMapper.updateByPrimaryKeySelective(pmsPatientPersonal); +// } else { //不存在则添加 pmsPatientPersonal.setId(IDGenerator.nextSnowflakeId()); pmsPatientPersonalMapper.insertSelective(pmsPatientPersonal); - } - }else if ("PmsPatientParentIllness".equals(param.getEditType())) { +// } + } else if ("PmsPatientParentIllness".equals(param.getEditType()) || "pmsPatientParentIllness".equals(param.getEditType())) { //根据就诊号和患者id删除旧的用药信息(修改删除状态) PmsPatientParentIllnessExample patientParentIllnessExample = new PmsPatientParentIllnessExample(); patientParentIllnessExample.createCriteria().andVisitNoEqualTo(visitNo).andPatientIdEqualTo(patientId) @@ -440,14 +521,14 @@ public class PmsPatientServiceImpl implements IPmsPatientService { pmsPatientParentIllnessMapper.updateByExampleSelective(illness, patientParentIllnessExample); //诊断用药为多个 JSONArray array = (JSONArray) JSON.toJSON(model); - if(CollUtil.isNotEmpty(array)) { + if (CollUtil.isNotEmpty(array)) { for (int i = 0; i < array.size(); i++) { PmsPatientParentIllness pmsPatientParentIllness = JSONObject.parseObject(array.getJSONObject(i).toJSONString(), PmsPatientParentIllness.class); pmsPatientParentIllness.setId(IDGenerator.nextSnowflakeId()); pmsPatientParentIllnessMapper.insertSelective(pmsPatientParentIllness); } } - }else if ("PmsPatientDiagnosis".equals(param.getEditType())) { + } else if ("PmsPatientDiagnosis".equals(param.getEditType()) || "pmsPatientDiagnosis".equals(param.getEditType())) { //删除旧的诊断信息(修改删除状态) PmsPatientDiagnosisExample patientDiagnosisExample = new PmsPatientDiagnosisExample(); patientDiagnosisExample.createCriteria().andVisitNoEqualTo(visitNo).andPatientIdEqualTo(patientId) @@ -457,7 +538,7 @@ public class PmsPatientServiceImpl implements IPmsPatientService { pmsPatientDiagnosisMapper.updateByExampleSelective(diagnosis, patientDiagnosisExample); //诊断默认是多个信息,用jsonArray JSONArray array = (JSONArray) JSON.toJSON(model); - if(CollUtil.isNotEmpty(array)){ + if (CollUtil.isNotEmpty(array)) { for (int i = 0; i < array.size(); i++) { PmsPatientDiagnosis pmsPatientDiagnosis = JSONObject.parseObject(array.getJSONObject(i).toJSONString(), PmsPatientDiagnosis.class); pmsPatientDiagnosis.setId(IDGenerator.nextSnowflakeId()); @@ -505,7 +586,7 @@ public class PmsPatientServiceImpl implements IPmsPatientService { } @Override - @DataSource(DataSourceType.LTSZXYY) + @DataSource(DataSourceType.SLAVE) public Long editPatientOtherMsgByHis(PmsPatientDto.EditOtherMsg param) { return editPatientOtherMsg(param); } diff --git a/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/RmsServiceImpl.java b/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/RmsServiceImpl.java index 532d950..fad1f11 100644 --- a/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/RmsServiceImpl.java +++ b/ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/RmsServiceImpl.java @@ -433,7 +433,28 @@ public class RmsServiceImpl implements IRmsService { if (CollUtil.isNotEmpty(scores)) { //组装成父子级关系 scores = buildReportScoreTree(scores, 0L); + for (RmsVo.ReportScore score : scores) { + //查询量表的总分趋势信息 + List scoreTrend = rmsDao.getScoreTrend(reportPatient.getPatientId(), score.getCode(), time.getMinTime(), time.getMaxTime()); + //折线图上只显示近5条记录 + if (CollectionUtil.isNotEmpty(scoreTrend) && scoreTrend.size() > 5) { + scoreTrend = scoreTrend.subList(scoreTrend.size() - 5, scoreTrend.size()); + } + score.setScoreTrend(scoreTrend); + //给moca添加雷达图信息 + if (GenConstants.Ht.Report.MOCA.equals(score.getCode())) { + List scoreDistributions = rmsDao.getScoreDistributions(reportPatient.getPatientId()); + if (CollUtil.isNotEmpty(scoreDistributions)) { + //处理认知域 + List distributions = disposeDistribution(scoreDistributions); + //根据日期倒序排序 + distributions.sort(Comparator.comparing(RmsVo.EvaluationScoreDistribution::getDay).reversed()); + score.setScoreDistributions(distributions); + } + } + } } + detail.setPatient(reportPatient); detail.setScores(scores); return detail; @@ -1628,41 +1649,41 @@ public class RmsServiceImpl implements IRmsService { List queryReportHistoryPatients = rmsDao.queryReportList(dto, userId, SecurityUtils.getUsername(), dataScope); if (CollUtil.isNotEmpty(queryReportHistoryPatients)) { queryReportHistoryPatients.forEach(patient -> { - //查找最后一题信息 - RmsVo.QueryReportHistoryPatient lastQuestion = rmsDao.getLastQuestion(patient.getEvaluationId()); - if (ObjectUtil.isNotNull(lastQuestion)) { - patient.setScaleCode(lastQuestion.getScaleCode()); - patient.setScaleName(lastQuestion.getScaleName()); - patient.setNum(lastQuestion.getNum()); - } +// //查找最后一题信息 +// RmsVo.QueryReportHistoryPatient lastQuestion = rmsDao.getLastQuestion(patient.getEvaluationId()); +// if (ObjectUtil.isNotNull(lastQuestion)) { +// patient.setScaleCode(lastQuestion.getScaleCode()); +// patient.setScaleName(lastQuestion.getScaleName()); +// patient.setNum(lastQuestion.getNum()); +// } //查询关联的量表名称 patient.setScaleNames(rmsDao.queryEvaluationScaleNames(patient.getEvaluationId())); - //根据测评id查找报告单 - RmsReportExample reportExample = new RmsReportExample(); - reportExample.createCriteria().andEvaluationIdEqualTo(patient.getEvaluationId()).andDelFlagEqualTo((byte) 0); - List rmsReports = rmsReportMapper.selectByExample(reportExample); - if (CollUtil.isEmpty(rmsReports)) { - patient.setReport(false); - } else { - patient.setReport(true); - } - - //每次查询报告单 都重新生成分数 - //查询报告单分数 - List reportScore = rmsDao.queryReportScore(patient.getEvaluationId(), null); - //重新封装报告单信息 - List reportScores = getReportScores(reportScore, patient.getEvaluationId()); - int i = 0; - for (RmsVo.ReportScore score : reportScores) { - String result = score.getResult(); - if (StrUtil.isNotEmpty(result)) { - i += 1; - } - } - if (i >= 2) { - patient.setResult(""); - } +// //根据测评id查找报告单 +// RmsReportExample reportExample = new RmsReportExample(); +// reportExample.createCriteria().andEvaluationIdEqualTo(patient.getEvaluationId()).andDelFlagEqualTo((byte) 0); +// List rmsReports = rmsReportMapper.selectByExample(reportExample); +// if (CollUtil.isEmpty(rmsReports)) { +// patient.setReport(false); +// } else { +// patient.setReport(true); +// } + +// //每次查询报告单 都重新生成分数 +// //查询报告单分数 +// List reportScore = rmsDao.queryReportScore(patient.getEvaluationId(), null); +// //重新封装报告单信息 +// List reportScores = getReportScores(reportScore, patient.getEvaluationId()); +// int i = 0; +// for (RmsVo.ReportScore score : reportScores) { +// String result = score.getResult(); +// if (StrUtil.isNotEmpty(result)) { +// i += 1; +// } +// } +// if (i >= 2) { +// patient.setResult(""); +// } }); } diff --git a/ruisi_java/ruisi-web-client/src/main/resources/all_report_template.docx b/ruisi_java/ruisi-web-client/src/main/resources/all_report_template.docx new file mode 100644 index 0000000..1f70bc9 --- /dev/null +++ b/ruisi_java/ruisi-web-client/src/main/resources/all_report_template.docx @@ -0,0 +1,88 @@ + 武汉市中西医结合医院 + 老年综合评估(标准版)评估报告 + + 基本信息 +姓名:{{p_name}} +性别:{{p_sex}} +出生日期:{{birthDate}} +联系电话:{{phone}} +文化程度:{{p_grade}} +职业类型:{{job}} +婚姻状况:{{marital}} +居住状态:{{dwelling}} +民族:{{nation}} +籍贯:{{place}} +现住址:{{address}} +联系人姓名:{{contact}} +联系人电话:{{contactPhone}} +与联系人关系:{{contactRelation}} +信仰:{{belief}} +爱好:{{hobby}} +ABO血型:{{aboBlood}} +Rh血型:{{rhBlood}} +就诊类型:{{visit_type}} +就诊号:{{visitNo}} +年龄:{{age}} +就诊科室:{{dept}} +就诊/主治医生:{{doctor}} +就诊/入院日期:{{admissionDate}} +住院次数:{{num}} +入院途径:{{admissionMethod}} +床位号:{{bedNumber}} +出院日期:{{dischargeDate}} +离院方式:{{dischargeMethod}} + +身高:{{height}} +体重:{{weight}} +BMI:{{bmi}} +T值:{{tz}} +体温:{{temperature}} +收缩压:{{systolic_pressure}} +舒张压:{{diastolic_pressure}} +脉搏:{{pulse}} +肌酐:{{creatinine}} +血氧饱和度:{{oxygen_saturation}} +白蛋白:{{albumin}} +总蛋白:{{total_protein}} +维生素D3测定:{{vitamin_d3}} +凝血酶原时间:{{hematocrit}} +D-二聚体{{dimer}} + + + + {{zdList}}诊断信息 +诊断类型:[diagnosisType] +诊断日期:[diagnosisDate] +主要诊断:[isMainDiagnosis] +诊断名称:[diagnosisName] +诊断编码:[diagnosisCode] + {{yyList}}用药信息 +药物名称:[drugName] +剂量:[dose] +药物单位:[unit] +药物频率:[frequency] + + + + +{{#table}} + +{{?questionTables}} +{{title}} + {{questionList}}问题描述 + 结果 + 得分 + [question] + [result] + [score] +{{?fzjyFlag}} +防治建议 +{{fzjy}} +{{/fzjyFlag}} +{{/questionTables}} + + + +评估人:{{@cpy_img_url}} +报告日期:{{report_date}} + diff --git a/ruisi_java/ruisi-web-client/src/main/resources/application-dev.yml b/ruisi_java/ruisi-web-client/src/main/resources/application-dev.yml index facbd3f..8c47058 100644 --- a/ruisi_java/ruisi-web-client/src/main/resources/application-dev.yml +++ b/ruisi_java/ruisi-web-client/src/main/resources/application-dev.yml @@ -11,18 +11,25 @@ spring: # password: po3OynBO[M3579p6L7)o url: jdbc:mysql://127.0.0.1:3306/ruisi_cga?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root - password: q7510327 + password: 123456 # 从库数据源 slave: # 从数据源开关/默认关闭 enabled: true - url: jdbc:mysql://127.0.0.1:3306/ruisi_cga_yf1?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + url: jdbc:mysql://127.0.0.1:3306/ruisi_cga_yf?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root - password: q7510327 + password: 123456 # driverClassName: oracle.jdbc.driver.OracleDriver # url: jdbc:oracle:thin:@200.1.8.115:1521:hisdb # username: interface_lnpg # password: interface_lnpg + oracle: + # 从数据源开关/默认关闭 + enabled: true + driverClassName: oracle.jdbc.driver.OracleDriver + url: jdbc:oracle:thin:@//192.168.1.5:1521/ORCL + username: USER_LNPGXT + password: Lnpgxt.2026 # 初始连接数 initialSize: 5 # 最小连接池数量 @@ -115,6 +122,7 @@ file: reportPath: /home/ruisi/server/profile grPath: C:\Users\zzc16\Desktop\grReportTemplate.docx ysPath: C:\Users\zzc16\Desktop\ysReportTemplate.docx + allPath: C:\Users\zzc16\Desktop\all_report_template.docx informed: studySign: /home/ruisi/server/profile/studySign.png template: /home/ruisi/server/profile/知情同意模板.docx @@ -126,5 +134,6 @@ informed: clientVersion: v1.8.3.0 # 医院id,不同医院部署的时候需要修改 -hospitalId: 174 -generalPassword: cga123# \ No newline at end of file +hospitalId: 106 +generalPassword: cga123# +redirectPath: http://localhost:8080/cga/v2/client/#/sickList \ No newline at end of file diff --git a/ruisi_java/ruisi-web-client/src/main/resources/application-prod.yml b/ruisi_java/ruisi-web-client/src/main/resources/application-prod.yml index fc0aaf1..671fae7 100644 --- a/ruisi_java/ruisi-web-client/src/main/resources/application-prod.yml +++ b/ruisi_java/ruisi-web-client/src/main/resources/application-prod.yml @@ -12,10 +12,17 @@ spring: # 从库数据源 slave: # 从数据源开关/默认关闭 - enabled: true - url: jdbc:mysql://172.16.21.24:23306/ruisi_cga_hnszyyy?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + enabled: false + url: jdbc:mysql://172.28.145.18:23306/ruisi_cga_whszxyjhyy?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root password: xian#2024!!! + oracle: + # 从数据源开关/默认关闭 + enabled: true + driverClassName: oracle.jdbc.driver.OracleDriver + url: jdbc:oracle:thin:@//192.168.1.5:1521/ORCL + username: USER_LNPGXT + password: Lnpgxt.2026 # 初始连接数 initialSize: 5 # 最小连接池数量 @@ -119,17 +126,18 @@ file: reportPath: /data/cgav2/server/profile grPath: /data/cgav2/server/profile/grReportTemplate.docx ysPath: /data/cgav2/server/profile/ysReportTemplate.docx + allPath: /data/cgav2/server/profile/allReportTemplate.docx informed: studySign: /data/cgav2/server/profile/studySign.png template: /data/cgav2/server/profile/知情同意模板.docx wordUrl: /data/cgav2/server/profile/informed/ - prefixWord: /data/cgav2/server + prefixWord: /data/cgav2/server/ #clientVersion: v1.6.8 #clientVersion: v1.8.1.0 #clientVersion: v1.8.2.0 clientVersion: v1.8.3.0 # 医院id,不同医院部署的时候需要修改 -hospitalId: 178 +hospitalId: 106 generalPassword: cga123# \ No newline at end of file diff --git a/ruisi_java/ruisi-web-client/src/main/resources/application-stage.yml b/ruisi_java/ruisi-web-client/src/main/resources/application-stage.yml index ee981ae..7815f04 100644 --- a/ruisi_java/ruisi-web-client/src/main/resources/application-stage.yml +++ b/ruisi_java/ruisi-web-client/src/main/resources/application-stage.yml @@ -108,6 +108,8 @@ file: reportPath: D:/Projects/ruisi_cga/server/profile grPath: D:/Projects/ruisi_cga/server/profile/grReportTemplate.docx ysPath: D:/Projects/ruisi_cga/server/profile/ysReportTemplate.docx + allPath: D:/Projects/ruisi_cga/server/profile/all_report_template.docx + informed: studySign: D:/Projects/ruisi_cga/server/profile/studySign.png template: /home/ruisi/server/profile/知情同意模板.docx diff --git a/ruisi_java/ruisi-web-client/src/main/resources/mapper/dao/PmsPatientDao.xml b/ruisi_java/ruisi-web-client/src/main/resources/mapper/dao/PmsPatientDao.xml index 237ade1..6d28089 100644 --- a/ruisi_java/ruisi-web-client/src/main/resources/mapper/dao/PmsPatientDao.xml +++ b/ruisi_java/ruisi-web-client/src/main/resources/mapper/dao/PmsPatientDao.xml @@ -29,7 +29,6 @@ pp.id as patientId, pp.`name` as patientName, pp.sex, --- pp.age, pp.idcard, pp.mobile as phone, pp.birth_year as birthYear, @@ -53,6 +52,7 @@ pms_patient pp LEFT JOIN ems_evaluation ae on pp.id = ae.patient_id LEFT JOIN ums_user uu on pp.create_by = uu.user_name + left join pms_patient_body pb on pp.id = pb.patient_id WHERE pp.del_flag = 0 @@ -65,43 +65,42 @@ or pp.idcard like CONCAT('%',#{searchValue},'%') or - pp.id = #{searchValue} + pb.outpatient_no like CONCAT('%',#{searchValue},'%') ) and (pp.idcard = #{idcard} or pp.idcard = #{idcardEncrypt}) - - - and (pp.create_by = #{userName} or ae.tester_id = #{userId}) - - - - and uu.dept_id = (SELECT dept_id FROM ums_user WHERE user_id = #{userId}) - - - and uu.dept_id in ( - SELECT pud.dept_id FROM ums_user u - LEFT JOIN ums_dept ud ON ud.dept_id = u.dept_id - LEFT JOIN ums_dept pud ON pud.dept_id = ud.parent_id - WHERE u.user_id = #{userId} - UNION ALL - SELECT u.dept_id FROM ums_user u WHERE u.user_id = #{userId} - ) - - - - - - - - - - - - - - + + and uu.dept_id IN ( SELECT d.dept_id FROM ums_user u LEFT JOIN ums_dept d on (d.dept_id = u.dept_id or FIND_IN_SET(u.dept_id,ancestors)) + WHERE user_id = #{userId} + ) + + + + + + + + + + + + + + + + + + + + + + + + + + GROUP BY pp.id order by pp.create_time desc diff --git a/ruisi_java/ruisi-web-client/src/main/resources/mapper/dao/RmsDao.xml b/ruisi_java/ruisi-web-client/src/main/resources/mapper/dao/RmsDao.xml index 9d50ae6..b5510b2 100644 --- a/ruisi_java/ruisi-web-client/src/main/resources/mapper/dao/RmsDao.xml +++ b/ruisi_java/ruisi-web-client/src/main/resources/mapper/dao/RmsDao.xml @@ -44,7 +44,11 @@ b.doctor, ee.version, h.version AS versionName, - pp.birthday + pp.birthday, + pp.marital_status as maritalStatus, + pp.dwelling_state as dwellingState, + pp.nation, + pp.belief FROM ems_evaluation ee LEFT JOIN rms_report rr on ee.id = rr.evaluation_id @@ -1157,9 +1161,6 @@ group by ee.id pp.idcard as idCard, ee.complete_status as completeStatus, ee.status, - ee.duration, a.update_time as aduitTime, b.outpatient_no as outpatientNo, @@ -1174,25 +1175,9 @@ group by ee.id LEFT JOIN pms_patient pp on ee.patient_id = pp.id LEFT JOIN ums_user uu on ee.tester_id = uu.user_id LEFT JOIN ems_evaluation_aduit a on ee.id = a.evaluation_id and a.del_flag = 0 - left join pms_patient_body b on pp.id = b.patient_id + left join pms_patient_body b on pp.id = b.patient_id and ee.visit_no = b.outpatient_no and b.del_flag = 0 left join hms_version v on v.id = ee.version - + WHERE ee.del_flag = 0 and pp.id is not null @@ -1219,24 +1204,10 @@ group by ee.id pp.idcard like CONCAT('%',#{dto.searchValue},'%') ) - - - and (pp.create_by = #{userName} or ee.tester_id = #{userId}) - - - and uu.dept_id = (SELECT dept_id FROM ums_user WHERE user_id = #{userId}) - - - and uu.dept_id in ( - SELECT pud.dept_id FROM ums_user u - LEFT JOIN ums_dept ud ON ud.dept_id = u.dept_id - LEFT JOIN ums_dept pud ON pud.dept_id = ud.parent_id - WHERE u.user_id = #{userId} - UNION ALL - SELECT u.dept_id FROM ums_user u WHERE u.user_id = #{userId} - ) - - + + and uu.dept_id IN ( SELECT d.dept_id FROM ums_user u LEFT JOIN ums_dept d on (d.dept_id = u.dept_id or FIND_IN_SET(u.dept_id,ancestors)) + WHERE user_id = #{userId} + ) group by ee.id order by ee.create_time desc diff --git a/ruisi_java/ruisi-web-examine/src/main/resources/application-prod.yml b/ruisi_java/ruisi-web-examine/src/main/resources/application-prod.yml index ef740b2..72c254b 100644 --- a/ruisi_java/ruisi-web-examine/src/main/resources/application-prod.yml +++ b/ruisi_java/ruisi-web-examine/src/main/resources/application-prod.yml @@ -6,7 +6,7 @@ spring: druid: # 主库数据源 master: - url: jdbc:mysql://172.20.9.15:23306/ruisi_cga?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + url: jdbc:mysql://172.28.145.18:23306/ruisi_cga?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root password: xian#2024!!! # 从库数据源 @@ -62,7 +62,7 @@ spring: # redis 配置 redis: # 地址 - host: 172.20.9.15 + host: 172.28.147.15 # 端口,默认为6379 port: 26379 # 数据库索引 @@ -98,17 +98,17 @@ ht: patientUrl: https://api.tall.wiki/ruisi/client/# name: 认知功能评测云平台系统 file: - path: /data/ruisi/server/uploads/ + path: /data/ruisi/uploads/ #domain: https://api.ccsens.com/test/ domain: http://localhost:8180/ imgDomain: https://api.tall.wiki/htageClient/profile reportDomain: /data/cgav2/profile/report - reportPath: /data/ruisi/server/profile + reportPath: /data/cgav2/profile informed: studySign: /data/cgav2/profile/studySign.png template: /data/cgav2/profile/知情同意模板.docx wordUrl: /data/cgav2/profile/informed/ - prefixWord: /data/ruisi/server + prefixWord: /data/ruisi #clientVersion: v1.6.8 #clientVersion: v1.8.1.0 #clientVersion: v1.8.2.0 diff --git a/ruisi_java/ruisi-web-examine/src/main/resources/logback.xml b/ruisi_java/ruisi-web-examine/src/main/resources/logback.xml index ced2d7d..3cd7105 100644 --- a/ruisi_java/ruisi-web-examine/src/main/resources/logback.xml +++ b/ruisi_java/ruisi-web-examine/src/main/resources/logback.xml @@ -1,7 +1,7 @@ - + diff --git a/web_admin/adminapi-2.zip b/web_admin/adminapi-2.zip deleted file mode 100644 index 736369f..0000000 Binary files a/web_admin/adminapi-2.zip and /dev/null differ diff --git a/web_admin/adminapi/index.html b/web_admin/adminapi/index.html deleted file mode 100644 index 420d866..0000000 --- a/web_admin/adminapi/index.html +++ /dev/null @@ -1,189 +0,0 @@ -老年综合评估系统
正在加载系统资源,请耐心等待
-======= - }
正在加载系统资源,请耐心等待
->>>>>>> 5575ba2f066afacebceea925fd28fc459bea0fff diff --git a/web_admin/adminapi/index.html.gz b/web_admin/adminapi/index.html.gz deleted file mode 100644 index 30a773b..0000000 Binary files a/web_admin/adminapi/index.html.gz and /dev/null differ diff --git a/web_admin/src/App.vue b/web_admin/src/App.vue index 360c9bb..a4ca1b5 100644 --- a/web_admin/src/App.vue +++ b/web_admin/src/App.vue @@ -11,7 +11,7 @@ export default { name: "App", components: { ThemePicker }, created() { - console.log("部署111`"); + console.log("部署2"); }, metaInfo() { diff --git a/web_admin/src/api/report.js b/web_admin/src/api/report.js index 451f167..55a61ce 100644 --- a/web_admin/src/api/report.js +++ b/web_admin/src/api/report.js @@ -6,10 +6,3 @@ export function exportPdf(data) { data: data, }); } -export function queryPdfUrl(data) { - return request({ - url: "/queryPdfUrl", - method: "post", - data: data, - }); -} diff --git a/web_admin/src/views/largeScreen.vue b/web_admin/src/views/largeScreen.vue index e88694a..747fea5 100644 --- a/web_admin/src/views/largeScreen.vue +++ b/web_admin/src/views/largeScreen.vue @@ -256,7 +256,6 @@ export default { mounted() { // 180 河南省电力医院 // 106 测试医院 - // 178 湖南 let deptId = this.$route.query.deptId || 106; localStorage.setItem("hospitalId", deptId); this.getNnicd(); // 疾病排行 diff --git a/web_admin/src/views/report/view copy.vue b/web_admin/src/views/report/view copy.vue index 7343e91..70c62e3 100644 --- a/web_admin/src/views/report/view copy.vue +++ b/web_admin/src/views/report/view copy.vue @@ -9,7 +9,7 @@