Browse Source

合并后端

hnsdlyy
lzp 2 days ago
parent
commit
80104a77bf
  1. 13
      ruisi_java/ruisi-cc-common/src/main/java/com/ccsens/common/core/domain/entity/SysUser.java
  2. 2
      ruisi_java/ruisi-cc-common/src/main/java/com/ccsens/common/enums/DataSourceType.java
  3. 9
      ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/config/DruidConfig.java
  4. 4
      ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/datasource/DataSourceManager.java
  5. 30
      ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/web/service/SysLoginService.java
  6. 2
      ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/web/service/SysPermissionService.java
  7. 7
      ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/web/service/UserDetailsServiceImpl.java
  8. 4
      ruisi_java/ruisi-cc-generator/src/main/resources/mbg.xml
  9. 5
      ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/dto/PmsPatientDto.java
  10. 51
      ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/dto/RmsDto.java
  11. 22
      ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/po/DockEmpl.java
  12. 140
      ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/po/DockEmplExample.java
  13. 11
      ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/po/RmsReport.java
  14. 70
      ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/po/RmsReportExample.java
  15. 304
      ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/vo/DockVo.java
  16. 47
      ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/vo/PmsPatientVo.java
  17. 39
      ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/vo/RmsVo.java
  18. 64
      ruisi_java/ruisi-system/src/main/java/com/ccsens/system/persist/dao/OracleViewDao.java
  19. 3
      ruisi_java/ruisi-system/src/main/java/com/ccsens/system/persist/dao/StatisticsDao.java
  20. 5
      ruisi_java/ruisi-system/src/main/java/com/ccsens/system/persist/mapper/SysDeptMapper.java
  21. 5
      ruisi_java/ruisi-system/src/main/java/com/ccsens/system/persist/mapper/SysRoleMapper.java
  22. 2
      ruisi_java/ruisi-system/src/main/java/com/ccsens/system/persist/mapper/SysUserMapper.java
  23. 19
      ruisi_java/ruisi-system/src/main/java/com/ccsens/system/service/DockService.java
  24. 263
      ruisi_java/ruisi-system/src/main/java/com/ccsens/system/service/impl/DockServiceImpl.java
  25. 16
      ruisi_java/ruisi-system/src/main/java/com/ccsens/system/service/impl/StatisticsServiceImpl.java
  26. 62
      ruisi_java/ruisi-system/src/main/resources/mapper/dao/StatisticsDao.xml
  27. 42
      ruisi_java/ruisi-system/src/main/resources/mapper/system/DockEmplMapper.xml
  28. 165
      ruisi_java/ruisi-system/src/main/resources/mapper/system/OracleViewDao.xml
  29. 41
      ruisi_java/ruisi-system/src/main/resources/mapper/system/RmsReportMapper.xml
  30. 13
      ruisi_java/ruisi-system/src/main/resources/mapper/system/SysDeptMapper.xml
  31. 7
      ruisi_java/ruisi-system/src/main/resources/mapper/system/SysRoleMapper.xml
  32. 13
      ruisi_java/ruisi-system/src/main/resources/mapper/system/SysUserMapper.xml
  33. 1
      ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/PmsController.java
  34. 25
      ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/ReportController.java
  35. 140
      ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/StatisticsController.java
  36. 30
      ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/TjfxController.java
  37. 21
      ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/persist/dao/RmsDao.java
  38. 2
      ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/AmsReportService.java
  39. 2
      ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/IPmsPatientService.java
  40. 6
      ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/IRmsService.java
  41. 384
      ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/impl/AmsReportServiceImpl.java
  42. 72
      ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/impl/PmsPatientServiceImpl.java
  43. 430
      ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/impl/RmsServiceImpl.java
  44. 2
      ruisi_java/ruisi-web-admin/src/main/resources/application-dev.yml
  45. 2
      ruisi_java/ruisi-web-admin/src/main/resources/application-prod.yml
  46. 98
      ruisi_java/ruisi-web-admin/src/main/resources/mapper/dao/PmsPatientDao.xml
  47. 220
      ruisi_java/ruisi-web-admin/src/main/resources/mapper/dao/RmsDao.xml
  48. 36
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/AmsReportTemplateController.java
  49. 35
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/DockController.java
  50. 22
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/PmsController.java
  51. 98
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/scheduled/SyncHospitalViwe.java
  52. 1
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/persist/dao/RmsDao.java
  53. 4
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/AmsReportService.java
  54. 2
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/IPmsPatientService.java
  55. 826
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/AmsReportServiceImpl.java
  56. 4
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/IEmsServiceImpl.java
  57. 161
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/PmsPatientServiceImpl.java
  58. 85
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/RmsServiceImpl.java
  59. 88
      ruisi_java/ruisi-web-client/src/main/resources/all_report_template.docx
  60. 19
      ruisi_java/ruisi-web-client/src/main/resources/application-dev.yml
  61. 16
      ruisi_java/ruisi-web-client/src/main/resources/application-prod.yml
  62. 2
      ruisi_java/ruisi-web-client/src/main/resources/application-stage.yml
  63. 65
      ruisi_java/ruisi-web-client/src/main/resources/mapper/dao/PmsPatientDao.xml
  64. 51
      ruisi_java/ruisi-web-client/src/main/resources/mapper/dao/RmsDao.xml
  65. 10
      ruisi_java/ruisi-web-examine/src/main/resources/application-prod.yml
  66. 2
      ruisi_java/ruisi-web-examine/src/main/resources/logback.xml
  67. BIN
      web_admin/adminapi-2.zip
  68. 189
      web_admin/adminapi/index.html
  69. BIN
      web_admin/adminapi/index.html.gz
  70. 2
      web_admin/src/App.vue
  71. 7
      web_admin/src/api/report.js
  72. 1
      web_admin/src/views/largeScreen.vue
  73. 4
      web_admin/src/views/report/view copy.vue
  74. 10
      web_admin/src/views/report/view.vue
  75. 1
      web_admin/vue.config.js
  76. BIN
      web_client/clientapi-2.zip
  77. 4
      web_client/src/App.vue
  78. 8
      web_client/src/api/ams.js
  79. 18
      web_client/src/views/Patient/chooseSetMeal/index.vue
  80. 18
      web_client/src/views/history/components/scaleInfor.vue
  81. 19
      web_client/src/views/history/components/scaleInforCopy.vue

13
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;
}

2
ruisi_java/ruisi-cc-common/src/main/java/com/ccsens/common/enums/DataSourceType.java

@ -19,5 +19,5 @@ public enum DataSourceType {
/**
* 柳铁
*/
LTSZXYY
ORACLE
}

9
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<Object, Object> 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);
}

4
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();
}
}

30
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;
}
}

2
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<SysRole> roles = user.getRoles();
if (!roles.isEmpty() && roles.size() > 1) {
if (!roles.isEmpty()) {
// 多角色设置permissions属性,以便数据权限匹配权限
for (SysRole role : roles) {
Set<String> rolePerms = menuService.selectMenuPermsByRoleId(role.getRoleId(), clientType);

7
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;
}
}

4
ruisi_java/ruisi-cc-generator/src/main/resources/mbg.xml

@ -20,7 +20,7 @@
</commentGenerator>
<jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3306/ruisi_cga_whszxyjhyy?useUnicode=true&amp;characterEncoding=UTF-8&amp;serverTimezone=GMT%2B8&amp;tinyInt1isBit=false"
connectionURL="jdbc:mysql://localhost:3306/ruisi_cga_yf1?useUnicode=true&amp;characterEncoding=UTF-8&amp;serverTimezone=GMT%2B8&amp;tinyInt1isBit=false"
userId="root"
password="q7510327">
<!--仅仅查询当前库的表,不查询其他库-->
@ -121,7 +121,7 @@
<!-- <table tableName="ams_patient_question_record" domainObjectName="AmsPatientQuestionRecord"/>-->
<!-- <table tableName="ams_patient_question_record_desc" domainObjectName="AmsPatientQuestionRecordDesc"/>-->
<!-- <table tableName="rms_report" domainObjectName="RmsReport"/>-->
<table tableName="rms_report" domainObjectName="RmsReport"/>
<!-- <table tableName="rms_report_basics_record" domainObjectName="RmsReportBasicsRecord"/>-->
<!-- <table tableName="rms_report_range" domainObjectName="RmsReportRange"/>-->
<!-- <table tableName="rms_report_scale_score" domainObjectName="RmsReportScaleScore"/>-->

5
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;

51
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";
}
}
}
}

22
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();
}

140
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<String> values) {
addCriterion("role_power in", values, "rolePower");
return (Criteria) this;
}
public Criteria andRolePowerNotIn(List<String> 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<String> values) {
addCriterion("data_power in", values, "dataPower");
return (Criteria) this;
}
public Criteria andDataPowerNotIn(List<String> 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 {

11
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);

70
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<String> values) {
addCriterion("all_url in", values, "allUrl");
return (Criteria) this;
}
public Criteria andAllUrlNotIn(List<String> 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;

304
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;
}
}

47
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<String,List<Map<String, Object>>> otherMsg;

39
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<PdfUtil.Row> toPdfRow() {
List<PdfUtil.Row> 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;
}
}

64
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<DockVo.DeptInfo> getDeptView(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
/**
* 查询员工信息视图
* @param startTime 开始时间
* @param endTime 结束时间
* @return 员工信息列表
*/
List<DockVo.EmplInfo> getEmplView(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
/**
* 查询患者基本信息视图
* @param startTime 开始时间
* @param endTime 结束时间
* @return 患者基本信息列表
*/
List<DockVo.PatientBasicInfo> getPatientBasicView(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
/**
* 查询患者就诊信息视图
* @param startTime 开始时间
* @param endTime 结束时间
* @return 患者就诊信息列表
*/
List<DockVo.PatientVisitInfo> getPatientVisitView(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
/**
* 查询诊断信息视图
* @param startTime 开始时间
* @param endTime 结束时间
* @return 诊断信息列表
*/
List<DockVo.DiagnosisInfo> getDiagnosisView(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
/**
* 查询用药信息视图
* @param startTime 开始时间
* @param endTime 结束时间
* @return 用药信息列表
*/
List<DockVo.MedicationInfo> getMedicationView(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
}

3
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

5
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<SysDept> queryDeptByIdList(@Param("deptIdList") List<Long> deptIdList);
/**
* 同步根据部门code查找部门信息(逗号分隔的多个部门code)
*/
List<SysDept> queryDeptByDeptCode(@Param("deptCode") String deptCode);
}

5
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);
}

2
ruisi_java/ruisi-system/src/main/java/com/ccsens/system/persist/mapper/SysUserMapper.java

@ -154,4 +154,6 @@ public interface SysUserMapper {
List<SysUser> selectUserByRoleKey(@Param("roleKey") String roleKey);
List<SysUser> getZcpsByHospitalId(@Param("hospitalId")Long hospitalId);
SysUser selectUserByEmplCode(@Param("emplCode")String emplCode);
}

19
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<SysDept> sysDepts);
List<SysUser> syncUmsUserSlave();
void syncUmsUserMaster(List<SysUser> sysUsers);
List<DockVo.DeptInfo> getDeptView();
void syncDeptView(List<DockVo.DeptInfo> sysDepts);
List<DockVo.EmplInfo> getEmplView();
void syncEmplView(List<DockVo.EmplInfo> sysEmpls);
List<DockVo.PatientBasicInfo> getPatientBasicView();
void syncPatientBasicView(List<DockVo.PatientBasicInfo> sysPatients);
List<DockVo.PatientVisitInfo> getPatientVisitView();
void syncPatientVisitView(List<DockVo.PatientVisitInfo> sysVisits);
List<DockVo.DiagnosisInfo> getDiagnosisView();
void syncDiagnosisView(List<DockVo.DiagnosisInfo> sysDiagnosis);
List<DockVo.MedicationInfo> getMedicationView();
void syncMedicationView(List<DockVo.MedicationInfo> sysMedications);
}

263
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<SysUser> 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<SysUser> syncUmsUserSlave() {
List<SysUser> 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<SysDept> 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<SysUser> 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<SysDept> syncUmsDeptSlave() {
List<SysDept> 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<SysDept> sysDepts) {
@ -429,7 +487,6 @@ public class DockServiceImpl implements DockService {
}
}
private void syncPmsPatient() {
//查找医院下第一个总测评师
List<SysUser> sysUserList = sysUserMapper.getZcpsByHospitalId(hospitalId);
@ -866,4 +923,190 @@ public class DockServiceImpl implements DockService {
}
@Override
public List<DockVo.DeptInfo> getDeptView() {
// 当前时间
Date endTime = new Date();
// 一小时前的时间
Date startTime = new Date(System.currentTimeMillis() - 60 * 60 * 1000);
return oracleViewDao.getDeptView(startTime, endTime);
}
@Override
public void syncDeptView(List<DockVo.DeptInfo> 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<DockVo.EmplInfo> getEmplView() {
Date endTime = new Date();
Date startTime = new Date(System.currentTimeMillis() - 60 * 60 * 1000);
return oracleViewDao.getEmplView(startTime, endTime);
}
@Override
public void syncEmplView(List<DockVo.EmplInfo> 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<DockVo.PatientBasicInfo> getPatientBasicView() {
Date endTime = new Date();
Date startTime = new Date(System.currentTimeMillis() - 60 * 60 * 1000);
return oracleViewDao.getPatientBasicView(startTime, endTime);
}
@Override
public void syncPatientBasicView(List<DockVo.PatientBasicInfo> 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<DockVo.PatientVisitInfo> getPatientVisitView() {
Date endTime = new Date();
Date startTime = new Date(System.currentTimeMillis() - 60 * 60 * 1000);
return oracleViewDao.getPatientVisitView(startTime, endTime);
}
@Override
public void syncPatientVisitView(List<DockVo.PatientVisitInfo> 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<DockVo.DiagnosisInfo> getDiagnosisView() {
Date endTime = new Date();
Date startTime = new Date(System.currentTimeMillis() - 60 * 60 * 1000);
return oracleViewDao.getDiagnosisView(startTime, endTime);
}
@Override
public void syncDiagnosisView(List<DockVo.DiagnosisInfo> 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<DockVo.MedicationInfo> getMedicationView() {
Date endTime = new Date();
Date startTime = new Date(System.currentTimeMillis() - 60 * 60 * 1000);
return oracleViewDao.getMedicationView(startTime, endTime);
}
@Override
public void syncMedicationView(List<DockVo.MedicationInfo> 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);
}
}
}
}

16
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

62
ruisi_java/ruisi-system/src/main/resources/mapper/dao/StatisticsDao.xml

@ -25,6 +25,26 @@
</if>
</select>
<select id="getPatientNum" resultType="java.lang.Integer">
SELECT
COUNT(DISTINCT p.id) AS total
FROM
pms_patient p
where p.del_flag = 0
<if test="dto.deptId != null">
AND p.hospital_id = #{dto.deptId}
</if>
<if test="dto.beginTime != null">
AND p.create_time >= #{dto.beginTime}
</if>
<if test="dto.endTime != null">
AND p.create_time &lt;= #{dto.endTime}
</if>
<if test="sex != null">
and p.sex = #{sex}
</if>
</select>
<select id="nnbmihjxy" resultType="com.ccsens.system.domain.vo.HomeDpVo$Bmi">
SELECT
SUM(CASE WHEN (pb.weight/(pb.height*pb.height/10000)) &lt; 18.5 THEN 1 ELSE 0 END) AS bmi1,
@ -119,18 +139,18 @@
<select id="nnicd" resultType="com.ccsens.system.domain.vo.HomeDpVo$Jbph">
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
<if test="dto.deptId != null">
AND u.dept_id = #{dto.deptId}
AND p.hospital_id = #{dto.deptId}
</if>
<if test="dto.beginTime != null">
AND b.create_time >= #{dto.beginTime}
@ -139,9 +159,9 @@
AND b.create_time &lt;= #{dto.endTime}
</if>
GROUP BY
diagnosis_name
diagnosis_name
ORDER BY
value DESC
value DESC
</select>
<select id="nnage" resultType="com.ccsens.system.domain.vo.HomeDpVo$Nlfb">
@ -158,7 +178,7 @@
FROM pms_patient
WHERE del_flag = 0
<if test="dto.deptId != null">
AND dept_id = #{dto.deptId}
AND hospital_id = #{dto.deptId}
</if>
<if test="dto.beginTime != null">
AND create_time >= #{dto.beginTime}
@ -199,6 +219,7 @@
LEFT JOIN rms_report rr ON rr.evaluation_id = e.id
LEFT JOIN rms_report_scale_score rs ON rs.report_id = rr.id and r.scale_code = rs.scale_code
LEFT JOIN ums_user u ON r.create_by = u.user_name
LEFT JOIN pms_patient p ON e.patient_id = p.id
where e.del_flag = 0
and r.scale_code in (
"DCYY-TP",
@ -215,7 +236,7 @@
"CAM"
)
<if test="dto.deptId != null">
AND u.dept_id = #{dto.deptId}
AND p.hospital_id = #{dto.deptId}
</if>
<if test="dto.beginTime != null">
AND r.create_time >= #{dto.beginTime}
@ -228,16 +249,14 @@
<select id="qualificationStatistics" resultType="com.ccsens.system.domain.vo.HomeDpVo$QualificationStatistics">
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
<if test="dto.deptId != null">
AND u.dept_id = #{dto.deptId}
AND p.hospital_id = #{dto.deptId}
</if>
<if test="dto.beginTime != null">
AND p.create_time >= #{dto.beginTime}
@ -246,7 +265,7 @@
AND p.create_time &lt;= #{dto.endTime}
</if>
GROUP BY
p.educational_status
p.educational_status
ORDER BY
qualification desc
</select>
@ -274,7 +293,7 @@
and b.diagnosis_date between #{param.beginTime} and #{param.endTime}
</if>
<if test="param.deptId != null">
and p.dept_id = #{param.deptId}
and p.hospital_id = #{param.deptId}
</if>
</where>
@ -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
<if test="dto.deptId != null">
AND u.dept_id = #{dto.deptId}
AND p.hospital_id = #{dto.deptId}
</if>
<if test="dto.beginTime != null">
AND ees.create_time >= #{dto.beginTime}

42
ruisi_java/ruisi-system/src/main/resources/mapper/system/DockEmplMapper.xml

@ -13,6 +13,8 @@
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="sync" jdbcType="VARCHAR" property="sync" />
<result column="role_power" jdbcType="VARCHAR" property="rolePower" />
<result column="data_power" jdbcType="VARCHAR" property="dataPower" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -74,7 +76,7 @@
</sql>
<sql id="Base_Column_List">
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
</sql>
<select id="selectByExample" parameterType="com.ccsens.system.domain.po.DockEmplExample" resultMap="BaseResultMap">
select
@ -110,11 +112,13 @@
insert into dock_empl (id, empl_name, empl_code,
empl_type, dept_code, del_flag,
create_by, create_time, update_by,
update_time, sync)
update_time, sync, role_power,
data_power)
values (#{id,jdbcType=BIGINT}, #{emplName,jdbcType=VARCHAR}, #{emplCode,jdbcType=VARCHAR},
#{emplType,jdbcType=VARCHAR}, #{deptCode,jdbcType=VARCHAR}, #{delFlag,jdbcType=CHAR},
#{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR},
#{updateTime,jdbcType=TIMESTAMP}, #{sync,jdbcType=VARCHAR})
#{updateTime,jdbcType=TIMESTAMP}, #{sync,jdbcType=VARCHAR}, #{rolePower,jdbcType=VARCHAR},
#{dataPower,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.ccsens.system.domain.po.DockEmpl">
insert into dock_empl
@ -152,6 +156,12 @@
<if test="sync != null">
sync,
</if>
<if test="rolePower != null">
role_power,
</if>
<if test="dataPower != null">
data_power,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -187,6 +197,12 @@
<if test="sync != null">
#{sync,jdbcType=VARCHAR},
</if>
<if test="rolePower != null">
#{rolePower,jdbcType=VARCHAR},
</if>
<if test="dataPower != null">
#{dataPower,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.ccsens.system.domain.po.DockEmplExample" resultType="java.lang.Long">
@ -231,6 +247,12 @@
<if test="record.sync != null">
sync = #{record.sync,jdbcType=VARCHAR},
</if>
<if test="record.rolePower != null">
role_power = #{record.rolePower,jdbcType=VARCHAR},
</if>
<if test="record.dataPower != null">
data_power = #{record.dataPower,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -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}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -286,6 +310,12 @@
<if test="sync != null">
sync = #{sync,jdbcType=VARCHAR},
</if>
<if test="rolePower != null">
role_power = #{rolePower,jdbcType=VARCHAR},
</if>
<if test="dataPower != null">
data_power = #{dataPower,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
@ -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}
</update>
</mapper>

165
ruisi_java/ruisi-system/src/main/resources/mapper/system/OracleViewDao.xml

@ -0,0 +1,165 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.ccsens.system.persist.dao.OracleViewDao">
<!-- 部门信息查询 -->
<select id="getDeptView" resultType="com.ccsens.system.domain.vo.DockVo$DeptInfo">
select
dept_name as deptName,
dept_code as deptCode,
update_time as updateTime
from bs_his.V_LNPG_KSXX
<where>
<if test="startTime != null and endTime != null">
and update_time >= #{startTime}
and update_time &lt;= #{endTime}
</if>
</where>
order by update_time desc
</select>
<!-- 员工信息查询 -->
<select id="getEmplView" resultType="com.ccsens.system.domain.vo.DockVo$EmplInfo">
select
empl_name as emplName,
empl_code as emplCode,
empl_type as emplType,
dept_code as deptCode,
role_power as rolePower,
data_power as dataPower,
update_time as updateTime
from bs_his.V_LNPG_YGXX
<where>
<if test="startTime != null and endTime != null">
and update_time >= #{startTime}
and update_time &lt;= #{endTime}
</if>
</where>
order by update_time desc
</select>
<!-- 患者基本信息查询 -->
<select id="getPatientBasicView" resultType="com.ccsens.system.domain.vo.DockVo$PatientBasicInfo">
select
name,
patient_no as patientNo,
id_card as idCard,
phone,
sex,
birthday,
educational_status as educationalStatus,
career,
marital_status as maritalStatus,
nation,
native_place as nativePlace,
address,
dwelling_state as dwellingState,
contact_name as contactName,
contact_mobile as contactMobile,
contact_relation as contactRelation,
abo_blood_type as aboBloodType,
rh_blood_type as rhBloodType,
belief,
hobby,
update_time as updateTime
from bs_his.V_LNPG_BASICINFORMATION
<where>
<if test="startTime != null and endTime != null">
and update_time >= #{startTime}
and update_time &lt;= #{endTime}
</if>
</where>
order by update_time desc
</select>
<!-- 患者就诊信息查询 -->
<select id="getPatientVisitView" resultType="com.ccsens.system.domain.vo.DockVo$PatientVisitInfo">
select
visit_no as visitNo,
patient_no as patientNo,
id_card as idCard,
visit_type as visitType,
age,
department,
doctor,
admission_date as admissionDate,
admission_count as admissionCount,
bed_number as bedNumber,
discharge_date as dischargeDate,
admission_method as admissionMethod,
discharge_method as dischargeMethod,
height,
weight,
tz,
temperature,
blood_pressure_shrink as bloodPressureShrink,
blood_pressure_diastole as bloodPressureDiastole,
pulse,
creatinine,
oxygen_saturation as oxygenSaturation,
albumin,
total_protein as totalProtein,
vitamin_d3 as vitaminD3,
hematocrit,
dimer,
smoking_history as smokingHistory,
smoking_year as smokingYear,
smoking_quit as smokingQuit,
smoking_quit_year as smokingQuitYear,
drink_history as drinkHistory,
drink_year as drinkYear,
drink_quit as drinkQuit,
drink_quit_year as drinkQuitYear,
has_allergy as hasAllergy,
allergy_drug as allergyDrug,
update_time as updateTime
from bs_his.V_LNPG_HZJZXX
<where>
<if test="startTime != null and endTime != null">
and update_time >= #{startTime}
and update_time &lt;= #{endTime}
</if>
</where>
order by update_time desc
</select>
<!-- 诊断信息查询 -->
<select id="getDiagnosisView" resultType="com.ccsens.system.domain.vo.DockVo$DiagnosisInfo">
select
visit_no as visitNo,
diagnosis_type as diagnosisType,
is_main_diagnosis as isMainDiagnosis,
diagnosis_name as diagnosisName,
diagnosis_code as diagnosisCode,
diagnosis_date as diagnosisDate,
update_time as updateTime
from bs_his.V_LNPG_ZDXX
<where>
<if test="startTime != null and endTime != null">
and update_time >= #{startTime}
and update_time &lt;= #{endTime}
</if>
</where>
order by update_time desc
</select>
<!-- 用药信息查询 -->
<select id="getMedicationView" resultType="com.ccsens.system.domain.vo.DockVo$MedicationInfo">
select
visit_no as visitNo,
drug_name as drugName,
dose,
unit,
frequency,
update_time as updateTime
from bs_his.V_LNPG_YYXX
<where>
<if test="startTime != null and endTime != null">
and update_time >= #{startTime}
and update_time &lt;= #{endTime}
</if>
</where>
order by update_time desc
</select>
</mapper>

41
ruisi_java/ruisi-system/src/main/resources/mapper/system/RmsReportMapper.xml

@ -16,6 +16,7 @@
<result column="url" jdbcType="VARCHAR" property="url" />
<result column="persion_url" jdbcType="VARCHAR" property="persionUrl" />
<result column="positive_url" jdbcType="VARCHAR" property="positiveUrl" />
<result column="all_url" jdbcType="VARCHAR" property="allUrl" />
<result column="qr_code_url" jdbcType="VARCHAR" property="qrCodeUrl" />
<result column="sign_url" jdbcType="VARCHAR" property="signUrl" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
@ -90,8 +91,8 @@
<sql id="Base_Column_List">
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
</sql>
<select id="selectByExample" parameterType="com.ccsens.system.domain.po.RmsReportExample" resultMap="BaseResultMap">
select
@ -128,20 +129,22 @@
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)
persion_url, positive_url, 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
)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{evaluationId,jdbcType=BIGINT},
#{initialImpression,jdbcType=VARCHAR}, #{clinicalDiagnosis,jdbcType=VARCHAR}, #{pasi,jdbcType=TINYINT},
#{patientAge,jdbcType=INTEGER}, #{department,jdbcType=VARCHAR}, #{bedNumber,jdbcType=VARCHAR},
#{reportTime,jdbcType=BIGINT}, #{evaluationCode,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR},
#{persionUrl,jdbcType=VARCHAR}, #{positiveUrl,jdbcType=VARCHAR}, #{qrCodeUrl,jdbcType=VARCHAR},
#{signUrl,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{showStatus,jdbcType=TINYINT},
#{hospital,jdbcType=VARCHAR}, #{workingScore,jdbcType=INTEGER}, #{createBy,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
#{delFlag,jdbcType=TINYINT}, #{visitNo,jdbcType=VARCHAR})
#{persionUrl,jdbcType=VARCHAR}, #{positiveUrl,jdbcType=VARCHAR}, #{allUrl,jdbcType=VARCHAR},
#{qrCodeUrl,jdbcType=VARCHAR}, #{signUrl,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
#{showStatus,jdbcType=TINYINT}, #{hospital,jdbcType=VARCHAR}, #{workingScore,jdbcType=INTEGER},
#{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR},
#{updateTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=TINYINT}, #{visitNo,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.ccsens.system.domain.po.RmsReport">
insert into rms_report
@ -188,6 +191,9 @@
<if test="positiveUrl != null">
positive_url,
</if>
<if test="allUrl != null">
all_url,
</if>
<if test="qrCodeUrl != null">
qr_code_url,
</if>
@ -268,6 +274,9 @@
<if test="positiveUrl != null">
#{positiveUrl,jdbcType=VARCHAR},
</if>
<if test="allUrl != null">
#{allUrl,jdbcType=VARCHAR},
</if>
<if test="qrCodeUrl != null">
#{qrCodeUrl,jdbcType=VARCHAR},
</if>
@ -357,6 +366,9 @@
<if test="record.positiveUrl != null">
positive_url = #{record.positiveUrl,jdbcType=VARCHAR},
</if>
<if test="record.allUrl != null">
all_url = #{record.allUrl,jdbcType=VARCHAR},
</if>
<if test="record.qrCodeUrl != null">
qr_code_url = #{record.qrCodeUrl,jdbcType=VARCHAR},
</if>
@ -414,6 +426,7 @@
url = #{record.url,jdbcType=VARCHAR},
persion_url = #{record.persionUrl,jdbcType=VARCHAR},
positive_url = #{record.positiveUrl,jdbcType=VARCHAR},
all_url = #{record.allUrl,jdbcType=VARCHAR},
qr_code_url = #{record.qrCodeUrl,jdbcType=VARCHAR},
sign_url = #{record.signUrl,jdbcType=VARCHAR},
remark = #{record.remark,jdbcType=VARCHAR},
@ -472,6 +485,9 @@
<if test="positiveUrl != null">
positive_url = #{positiveUrl,jdbcType=VARCHAR},
</if>
<if test="allUrl != null">
all_url = #{allUrl,jdbcType=VARCHAR},
</if>
<if test="qrCodeUrl != null">
qr_code_url = #{qrCodeUrl,jdbcType=VARCHAR},
</if>
@ -526,6 +542,7 @@
url = #{url,jdbcType=VARCHAR},
persion_url = #{persionUrl,jdbcType=VARCHAR},
positive_url = #{positiveUrl,jdbcType=VARCHAR},
all_url = #{allUrl,jdbcType=VARCHAR},
qr_code_url = #{qrCodeUrl,jdbcType=VARCHAR},
sign_url = #{signUrl,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},

13
ruisi_java/ruisi-system/src/main/resources/mapper/system/SysDeptMapper.xml

@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="parentId" column="parent_id" />
<result property="ancestors" column="ancestors" />
<result property="deptName" column="dept_name" />
<result property="deptCode" column="dept_code" />
<result property="orderNum" column="order_num" />
<result property="leader" column="leader" />
<result property="phone" column="phone" />
@ -23,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectDeptVo">
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
select d.dept_id, d.parent_id, d.ancestors, d.dept_name,d.dept_code, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
from ums_dept d
</sql>
@ -171,4 +172,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
and parent_id = 0
</select>
<select id="queryDeptByDeptCode" resultType="com.ccsens.common.core.domain.entity.SysDept">
SELECT
*
FROM
ums_dept
WHERE
del_flag = '0'
AND FIND_IN_SET(dept_id, #{deptCode})
</select>
</mapper>

7
ruisi_java/ruisi-system/src/main/resources/mapper/system/SysRoleMapper.xml

@ -105,8 +105,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectRoleVo"/>
where r.role_key=#{roleKey} and r.del_flag = '0' limit 1
</select>
<insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId">
<select id="queryRoleByRoleKey" resultType="com.ccsens.common.core.domain.entity.SysRole">
select * from ums_role where role_key=#{roleKey} limit 1
</select>
<insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId">
insert into ums_role(
<if test="roleId != null and roleId != 0">role_id,</if>
<if test="roleName != null and roleName != ''">role_name,</if>

13
ruisi_java/ruisi-system/src/main/resources/mapper/system/SysUserMapper.xml

@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="titleId" column="title_id" />
<result property="userName" column="user_name" />
<result property="nickName" column="nick_name" />
<result property="emplCode" column="empl_code" />
<result property="email" column="email" />
<result property="phonenumber" column="phonenumber" />
<result property="sex" column="sex" />
@ -90,7 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.post_id, u.title_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
d.dept_name, d.leader, d1.dept_name as parent_name, d1.dept_id as parent_id,
p.post_name, p.post_code,
p.post_name, p.post_code, u.empl_code, u.valid_date,
t.title_name, u.skip_check_device, t.title_code
from ums_user u
left join ums_dept d on u.dept_id = d.dept_id
@ -243,8 +244,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and r.del_flag = 0
and u.dept_id = #{hospitalId}
</select>
<select id="selectUserByEmplCode" resultType="com.ccsens.common.core.domain.entity.SysUser">
<include refid="selectUserVo"/>
where u.empl_code = #{emplCode} and u.del_flag = '0'
group by u.user_id order by u.create_time desc limit 1
</select>
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
insert into ums_user(
<if test="userId != null and userId != 0">user_id,</if>
<if test="deptId != null and deptId != 0">dept_id,</if>
@ -263,6 +269,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null and remark != ''">remark,</if>
<if test="validDate != null">valid_date,</if>
<if test="skipCheckDevice != null and skipCheckDevice != ''">skip_check_device,</if>
<if test="dataPower != null and dataPower != ''">data_power,</if>
create_time
)values(
<if test="userId != null and userId != ''">#{userId},</if>
@ -282,6 +289,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null and remark != ''">#{remark},</if>
<if test="validDate != null">#{validDate},</if>
<if test="skipCheckDevice != null and skipCheckDevice != ''">#{skipCheckDevice},</if>
<if test="dataPower != null and dataPower != ''">#{dataPower},</if>
sysdate()
)
</insert>
@ -305,6 +313,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="skipCheckDevice != null and skipCheckDevice != ''">skip_check_device = #{skipCheckDevice},</if>
<if test="dataPower != null and dataPower != ''">data_power = #{dataPower},</if>
<if test="validDate != null">valid_date = #{validDate},</if>
update_time = sysdate()
</set>

1
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())));
}

25
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<AmsReportVo.Result> 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<AmsReportVo.Result> 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<AmsReportVo.Result> 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<AmsReportVo.Result> export(@RequestBody @Validated RmsDto.Export dto){
return JsonResponse.ok(amsReportService.export(dto));
}
}

140
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<HomeDpVo.Zhsjgl> 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<HomeDpVo.Bmi> 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<List<HomeDpVo.Pgqk>> 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<HomeDpVo.Nlfb> 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<HomeDpVo.Tz> 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<List<HomeDpVo.Jbph>> 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<List<HomeDpVo.Dt>> 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<List<HomeDpVo.Pgjg>> 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<List<HomeDpVo.QualificationStatistics>> 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<HomeDpVo.JzStatistics> 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<List<HomeDpVo.ScaleStatistics>> 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<List<HomeDpVo.VersionStatistics>> 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<List<HomeDpVo.UserStatistics>> 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<HomeDpVo.SexStatistics> 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<HomeDpVo.XyYjStatistics> 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));
}
}

30
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<List<HomeDpVo.Dt>> nnmap(@RequestBody StatisticsDto.Query dto) {
public JsonResponse<List<HomeDpVo.Dt>> nnmap(@RequestBody StatisticsDto.Query dto) {
return JsonResponse.ok(statisticsService.nnmap(dto));
}
@ -99,42 +104,51 @@ public class TjfxController {
@Anonymous
@ApiOperation("就诊数量统计")
@PostMapping("/jzStatistics")
public JsonResponse<HomeDpVo.JzStatistics> jzStatistics(@RequestBody StatisticsDto.Query dto){
public JsonResponse<HomeDpVo.JzStatistics> jzStatistics(@RequestBody StatisticsDto.Query dto) {
return JsonResponse.ok(statisticsService.jzStatistics(dto));
}
@Anonymous
@ApiOperation("测评量表统计")
@PostMapping("/scaleStatistics")
public JsonResponse<List<HomeDpVo.ScaleStatistics>> scaleStatistics(@RequestBody StatisticsDto.Query dto){
public JsonResponse<List<HomeDpVo.ScaleStatistics>> scaleStatistics(@RequestBody StatisticsDto.Query dto) {
return JsonResponse.ok(statisticsService.scaleStatistics(dto));
}
@Anonymous
@ApiOperation("测评版本统计")
@PostMapping("/versionStatistics")
public JsonResponse<List<HomeDpVo.VersionStatistics>> versionStatistics(@RequestBody StatisticsDto.Query dto){
public JsonResponse<List<HomeDpVo.VersionStatistics>> versionStatistics(@RequestBody StatisticsDto.Query dto) {
return JsonResponse.ok(statisticsService.versionStatistics(dto));
}
@Anonymous
@ApiOperation("测评师测评统计")
@PostMapping("/userStatistics")
public JsonResponse<List<HomeDpVo.UserStatistics>> userStatistics(@RequestBody StatisticsDto.Query dto){
public JsonResponse<List<HomeDpVo.UserStatistics>> userStatistics(@RequestBody StatisticsDto.Query dto) {
return JsonResponse.ok(statisticsService.userStatistics(dto));
}
@Anonymous
@ApiOperation("性别统计统计")
@PostMapping("/sexStatistics")
public JsonResponse<HomeDpVo.SexStatistics> sexStatistics(@RequestBody StatisticsDto.Query dto){
public JsonResponse<HomeDpVo.SexStatistics> sexStatistics(@RequestBody StatisticsDto.Query dto) {
return JsonResponse.ok(statisticsService.sexStatistics(dto));
}
@Anonymous
@ApiOperation("吸烟饮酒统计")
@PostMapping("/xyYjStatistics")
public JsonResponse<HomeDpVo.XyYjStatistics> xyYjStatistics(@RequestBody StatisticsDto.Query dto){
public JsonResponse<HomeDpVo.XyYjStatistics> 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));
}
}

21
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<ReportVo.EvaResult> countReportResult(@Param("evaId") Long evaId,
@Param("code") String scaleCode);
List<RmsVo.Report> queryReport(@Param("dto") RmsDto.ReportQuery dto);
List<RmsVo.Report> queryReport(@Param("dto") RmsDto.ReportQuery dto,
@Param("userId") Long userId);
List<RmsVo.ReportScore> queryEmsScaleScore(@Param("evaId") Long evaId,
@Param("scaleCodeList") List<String> scaleCodeList);
@ -142,4 +144,21 @@ public interface RmsDao {
List<RmsVo.ReportPDF> viewReportPdfByVisitNo(@Param("visitNo")String visitNo);
List<RmsVo.ReportPDF> viewReportPdfByPatientNo(@Param("patientNo")String patientNo);
List<RmsVo.ExportInfo> queryReportExportInfo(@Param("evaluationId") Long evaluationId);
List<String> queryAdas14QuestionRecordValueByReportId(@Param("reportId")Long reportId);
Byte querySexByEvaluationId(@Param("evaluationId")Long evaluationId);
List<RmsVo.ReportDetailAnswer> queryReportAnswer1(@Param("evaluationId") Long evaluationId,
@Param("evaluationCode") String evaluationCode,
@Param("sex") Byte sex);
List<RmsVo.ReportDetailAnswer> queryZytzbsScaleAnswer(@Param("evaluationId") Long evaluationId,
@Param("scaleCode") String scaleCode,
@Param("sex") Byte sex);
}

2
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);
}

2
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);

6
ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/IRmsService.java

@ -31,6 +31,8 @@ public interface IRmsService {
List<RmsVo.ReportDetailAnswer> queryReportAnswer(RmsDto.QueryReportAnswer dto, Long userId);
List<RmsVo.ReportDetailAnswer> 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<RmsVo.ReportScore> buildReportScoreTree(List<RmsVo.ReportScore> allReportScores, Long rootParentId);
RmsVo.ReportDetail queryReport(RmsDto.QueryDetail dto);
}

384
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<String, Object> generateParams(Map<String, Object> params, List<RmsVo.ReportScore> 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<HmsVo.QuerySign> 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<String, List<Map<String, Object>>> otherMsg = patientInfoById.getOtherMsg();
//诊断
List<Map<String, Object>> 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<Map<String, Object>> pmsPatientBodyList = otherMsg.get("pmsPatientBody");
Map<String, Object> pmsPatientBodyMap = new HashMap<>();
if (CollUtil.isNotEmpty(pmsPatientBodyList)) {
pmsPatientBodyMap = pmsPatientBodyList.get(0);
}
//用药
List<Map<String, Object>> 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<RmsVo.ExportInfo> 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<Map<String, Object>> 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<RmsVo.ReportDetailAnswer> reportDetailAnswerList = rmsService.queryReportAnswer(queryReportAnswer);
MergeCellRule detailMerge = null;
if (CollUtil.isNotEmpty(reportDetailAnswerList)) {
RmsVo.ReportDetailAnswer reportDetailAnswer = reportDetailAnswerList.get(0);
List<List<RmsVo.QuestionInfo>> collect = reportDetailAnswerList.stream().map(reportDetailAnswer1 -> reportDetailAnswer1.getQuestionList()).collect(Collectors.toList());
List<RmsVo.QuestionInfo> list = new ArrayList<>();
for (int j = 0; j < collect.size(); j++) {
list.addAll(collect.get(j));
}
Map<String, Object> map = new HashMap<>();
List<RmsVo.QuestionTable> 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<AmsPatientAnswerScore> 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<RmsVo.ReportScore> 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<String, Object> 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;
}
}

72
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<String, List<Map<String, Object>>> patientOtherMsg = new HashMap<>();
//先查询就诊信息(PmsPatientBody)
//根据就诊号和患者id查询就诊信息是否存在
PmsPatientBodyExample patientBodyExample = new PmsPatientBodyExample();
patientBodyExample.createCriteria().andPatientIdEqualTo(pmsPatient.getId())
.andDelFlagEqualTo((byte) 0);
patientBodyExample.setOrderByClause("id desc");
List<PmsPatientBody> pmsPatientBodies = pmsPatientBodyMapper.selectByExample(patientBodyExample);
if (CollUtil.isNotEmpty(pmsPatientBodies)) {
PmsPatientBody body = pmsPatientBodies.get(0);
List<Map<String, Object>> 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<PmsPatientPersonal> pmsPatientPersonals = pmsPatientPersonalMapper.selectByExample(patientPersonalExample);
if (CollUtil.isNotEmpty(pmsPatientPersonals)) {
String jsonStr = JSON.toJSONString(pmsPatientPersonals);
List<Map<String, Object>> allList = JSON.parseObject(jsonStr, List.class);
List<Map<String, Object>> 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<PmsPatientParentIllness> 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<PmsPatientDiagnosis> 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<PmsPatientVo.QueryPatientJz> queryPatientJzList(PmsPatientDto.QueryPatientJz param, String dataScope, Long userId, String userName) {
List<PmsPatientVo.QueryPatientJz> queryPatientJzs = patientDao.queryPatientJzList(param, dataScope, userId, userName);
List<PmsPatientVo.QueryPatientJz> queryPatientJzs = patientDao.queryPatientJzList(param, dataScope, SecurityUtils.isAdmin(userId) ? null : userId, userName);
if (CollUtil.isNotEmpty(queryPatientJzs)) {
for (PmsPatientVo.QueryPatientJz queryPatientJz : queryPatientJzs) {
//查询就诊

430
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<RmsVo.QueryReportHistoryPatient> 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<RmsVo.ReportDetailAnswer> queryReportAnswer(RmsDto.QueryReportAnswer dto) {
//根据报告单id查看报告单信息
RmsReport report = rmsReportMapper.selectByPrimaryKey(dto.getId());
if (ObjectUtil.isNull(report)) {
throw new BaseException(ErrorConstant.REPORT_ID_ERROR);
}
// List<RmsVo.ReportDetailAnswer> r = rmsDao.queryReportAnswer(report.getEvaluationId(), dto.getEvaluationCode());
//查询患者性别
Byte aByte = rmsDao.querySexByEvaluationId(report.getEvaluationId());
List<RmsVo.ReportDetailAnswer> 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<RmsVo.Report> 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<RmsVo.Report> reports = queryReportList(param, null);
List<RmsVo.Report> 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<RmsVo.ReportScore> buildReportScoreTree(List<RmsVo.ReportScore> allReportScores, Long rootParentId) {
// 1. 预处理:将所有节点放入Map,key=scaleId,方便快速查找
Map<String, RmsVo.ReportScore> 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<RmsVo.ReportScore> 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 所有节点的Mapkey=scaleId
*/
private static void buildChildren(RmsVo.ReportScore parentNode, Map<String, RmsVo.ReportScore> 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<RmsVo.ReportScore> 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<RmsReport> 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<RmsVo.ReportScore> scores = rmsDao.queryEmsScaleScore(dto.getEvaluationId(), CollectionUtil.newArrayList());
if (CollUtil.isNotEmpty(scores)) {
//组装成父子级关系
scores = buildReportScoreTree(scores, 0L);
}
Map<String, RmsReportScaleScore> 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<TzbsRmsReportResult> reportResultList = score.getReportResultList();
if (CollUtil.isNotEmpty(reportResultList)) {
reportResultList.forEach(reportResult -> {
reportResult.setReportId(report.getId());
});
// clientEvaDao.batchInsertReportResult(reportResultList);
}
//添加体质辨识养生建议
List<TzbsRmsReportYsjy> 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<QmsQuestion> 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<EmsEvaluationQuestionDuration> emsEvaluationQuestionDurations = emsEvaluationQuestionDurationMapper.selectByExample(questionDurationExample);
if (CollUtil.isNotEmpty(emsEvaluationQuestionDurations)) {
score.setQuestionDuration(emsEvaluationQuestionDurations.stream().mapToLong(EmsEvaluationQuestionDuration::getDuration).sum());
}
}
//查询量表的总分趋势信息
List<RmsVo.ScoreTrend> 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<RmsVo.EvaluationScoreDistribution> scoreDistributions = rmsDao.getScoreDistributions(emsEvaluation.getPatientId());
if (CollUtil.isNotEmpty(scoreDistributions)) {
//处理认知域
List<RmsVo.EvaluationScoreDistribution> 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<QmsScale> 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<RmsVo.ReportScore> scores) {
List<RmsVo.ReportScore> wczl = scores.stream().filter(
score -> score.getCode().equals("5CZLSY")
).collect(Collectors.toList());
List<RmsVo.ReportScore> szggj = scores.stream().filter(
score -> score.getCode().equals("SZGGJ")
).collect(Collectors.toList());
List<RmsVo.ReportScore> wlcd = scores.stream().filter(
score -> score.getCode().equals("WLCD")
).collect(Collectors.toList());
List<RmsVo.ReportScore> 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<RmsReport> 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<RmsVo.ReportScore> scores = rmsDao.queryEmsScaleScore(dto.getEvaluationId(), CollectionUtil.newArrayList());
if (CollUtil.isNotEmpty(scores)) {
//组装成父子级关系
scores = buildReportScoreTree(scores, 0L);
}
detail.setPatient(reportPatient);
detail.setScores(scores);
return detail;
}
}

2
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

2
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

98
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 @@
</when>
</choose>
</if>
<choose>
<when test="dataScope == 5">
and (pp.create_by = #{userName} or ae.tester_id = #{userId})
</when>
<!-- 当前医院不区分多级,所以本部门及以下权限和本部门数据权限使用相同的查询语句 -->
<when test="dataScope == 3 or dataScope == 4">
and uu.dept_id = (SELECT dept_id FROM ums_user WHERE user_id = #{userId})
</when>
<when test="dataScope == 2">
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}
)
</when>
</choose>
<if test="userId != null">
<!-- 权限 总测评师和测评师都是本部门及以下 -->
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}
)
</if>
<!-- <choose>-->
<!-- <when test="dataScope == 5">-->
<!-- and (pp.create_by = #{userName} or ae.tester_id = #{userId})-->
<!-- </when>-->
<!-- &lt;!&ndash; 当前医院不区分多级,所以本部门及以下权限和本部门数据权限使用相同的查询语句 &ndash;&gt;-->
<!-- <when test="dataScope == 3 or dataScope == 4">-->
<!-- and uu.dept_id = (SELECT dept_id FROM ums_user WHERE user_id = #{userId})-->
<!-- </when>-->
<!-- <when test="dataScope == 2">-->
<!-- 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}-->
<!-- )-->
<!-- </when>-->
<!-- </choose>-->
GROUP BY pp.id
order by pp.create_time desc
</select>
@ -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
<where>
b.del_flag = 0 and p.del_flag = 0
<if test="param.visitType != null">
@ -276,11 +320,19 @@
and b.diagnosis_date between #{param.beginTime} and #{param.endTime}
</if>
<if test="param.deptId != null">
and p.dept_id = #{param.deptId}
and p.hospital_id = #{param.deptId}
</if>
<if test="param.diagnosisCode != null and param.diagnosisCode != ''">
and b.diagnosis_code like concat('%',#{param.diagnosisCode},'%')
</if>
<if test="userId != null">
<!-- 权限 总测评师和测评师都是本部门及以下 -->
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}
)
</if>
</where>
order by b.id desc
</select>

220
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
<if test="dto.completeStatus != null">
@ -1057,24 +1060,14 @@ d.dept_name as hospitalName
pp.name_full like CONCAT('%',LOWER(#{dto.searchValue}),'%')
)
</if>
<choose>
<when test="dataScope == 5">
and (pp.create_by = #{userName} or ee.tester_id = #{userId})
</when>
<when test="dataScope == 3 or dataScope == 4">
and uu.dept_id = (SELECT dept_id FROM ums_user WHERE user_id = #{userId})
</when>
<when test="dataScope == 2">
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}
)
</when>
</choose>
<if test="userId != null">
<!-- 权限 总测评师和测评师都是本部门及以下 -->
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}
)
</if>
group by rr.id
order by rr.create_time desc
</select>
@ -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},'%')
)
</if>
<if test="userId != null">
<!-- 权限 总测评师和测评师都是本部门及以下 -->
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}
)
</if>
group by r.id
order by r.id desc
</select>
<!-- <resultMap id="ResultMap" type="com.ccsens.system.domain.vo.RmsVo$ReportScore">-->
@ -1608,4 +1609,177 @@ d.dept_name as hospitalName
</select>
<select id="queryReportExportInfo" resultType="com.ccsens.system.domain.vo.RmsVo$ExportInfo">
SELECT
r.report_id as reportId,
r.scale_code as scaleCode,
r.score as score,
r.combo_id as comboId,
r.impression as impression,
r.need_plan as needPlan,
r.plan as plan,
r.sort as sort,
r.result as result,
r.scale_ass_conf as scaleAssConf,
q.name as scaleName,
h.`name` as comboName,
h1.name as comboParentName
FROM
rms_report rr
LEFT JOIN rms_report_scale_score r on rr.id = r.report_id and r.del_flag = 0
LEFT JOIN qms_scale q on r.scale_code = q.`code`
LEFT JOIN hms_combo h on h.id = r.combo_id
LEFT JOIN hms_combo h1 on h.parent_id = h1.id
WHERE
rr.del_flag = 0 and rr.evaluation_id = #{evaluationId}
</select>
<select id="queryAdas14QuestionRecordValueByReportId" resultType="java.lang.String">
SELECT
qr.record_value
FROM
rms_report rr
JOIN ems_evaluation ev ON rr.evaluation_id = ev.id
JOIN ams_patient_question_record qr ON ev.id = qr.evaluation_id
WHERE
ev.del_flag = 0
AND qr.del_flag = 0
AND rr.id = #{reportId}
-- ORDER BY
-- qr.id DESC
-- LIMIT 1
</select>
<select id="querySexByEvaluationId" resultType="java.lang.Byte">
select
p.sex
FROM
ems_evaluation e
LEFT JOIN pms_patient p on e.patient_id = p.id
where
e.id = #{evaluationId}
</select>
<select id="queryReportAnswer1" resultMap="queryReportAnswer">
SELECT a.parentCode,
a.questionId,
a.questionName,
a.qsort,
a.type,
a.operateType,
a.optionName,
t.answer,
epr.path as recordingPath,
t.optionId,
r.record_value as otherValue,
rd.id as rdId,
rd.show_title as rdTitle,
rd.answer as rdAnswer
FROM (
SELECT
qq.id as questionId,
qq.scale_code,
qq.sort as qsort,
if(qcd.id is null, qs.`name`, qcd.`name`) as parentCode,
qq.question as questionName,
qq.type as type,
qq.operate_type as operateType
,qo.`name` as optionName
,qo.id as optionId
,qo.sort
,GROUP_CONCAT(sq.id SEPARATOR ',') as subList
FROM
qms_question qq
LEFT JOIN (
SELECT
eqv.id as qvId,
Max(vq.version) as maxVersion,
q.id,
q.scale_code
FROM
qms_question q
LEFT JOIN qms_question vq on q.scale_code = vq.scale_code and q.sort = vq.sort and vq.del_flag = 0
LEFT JOIN ems_evaluation_question_version eqv on eqv.scale_code = q.scale_code and eqv.sort = q.sort and eqv.version = q.version and eqv.evaluation_id = #{evaluationId}
GROUP BY
q.id
)vq on qq.id = vq.id
LEFT JOIN qms_cognitive_domain qcd on qq.cognitive_code = qcd.code and qcd.del_flag = 0
LEFT JOIN qms_scale qs on qq.scale_code = qs.code and qs.del_flag = 0
LEFT JOIN qms_question_option qo on qq.id = qo.question_id and qo.del_flag = 0
LEFT JOIN qms_question sq on sq.relation_id = qq.id and sq.del_flag = 0
WHERE
qq.scale_code = #{evaluationCode}
<if test="sex != null">
and (qq.sex = #{sex} or qq.sex is null)
</if>
and qq.del_flag = 0
and qq.relation_id = 0
and ((vq.maxVersion = 1 and vq.qvId is null) or (vq.maxVersion > 1 and vq.qvId is not null))
GROUP BY qq.id, qo.`name`
) a
LEFT JOIN
(SELECT * FROM ams_patient_question_record WHERE evaluation_id = #{evaluationId} and del_flag = 0) r
on r.question_id = a.questionId
LEFT JOIN
(SELECT s.id,
s.question_id,
o.id as optionId,
o.`name` as optionName,
IF ( o.type = 'hidden', s.score, if(o.type in ('numberScore','numberTime'), CONCAT(o.display,':',s.score), o.display) ) AS answer
FROM
ams_patient_answer_score s
LEFT JOIN qms_question_option o on s.option_id = o.id
WHERE
s.evaluation_id = #{evaluationId}
and s.del_flag = 0
and o.del_flag = 0 ) t on a.optionName = t.optionName and (a.questionId = t.question_id or FIND_IN_SET(t.question_id, a.subList))
LEFT JOIN (
SELECT
r.id,
r.question_id,
r.show_title,
rd.answer
FROM
qms_question_record r
LEFT JOIN ams_patient_question_record_desc rd ON r.id = rd.record_id
LEFT JOIN qms_question_option qo on r.question_id = qo.question_id and qo.del_flag = 0
WHERE
rd.evaluation_id = #{evaluationId}
AND
r.del_flag = 0
AND rd.del_flag = 0
AND qo.id IS NULL
) rd ON rd.question_id = a.questionId
LEFT JOIN ems_patient_recording epr on epr.question_id = a.questionId and epr.evaluation_id =#{evaluationId}
ORDER BY a.qsort,a.sort
</select>
<select id="queryZytzbsScaleAnswer" resultMap="queryReportAnswer">
SELECT
cst.consti_name AS parentCode,
q.type,
q.operate_type AS operateType,
q.question AS questionName,
o.display AS answer,
a.option_id AS optionId,
q.id as questionId,
a.score,
(select path from ems_patient_recording where question_id = q.id and evaluation_id = #{evaluationId}) AS recordingPath
FROM
qms_scale s
LEFT JOIN tzbs_qms_scale_consti cst ON s.CODE = cst.scale_code
LEFT JOIN tzbs_qms_scale_cognitive rel ON cst.consti_code = rel.consti_code
LEFT JOIN qms_question q ON rel.ques_code = q.question_code
LEFT JOIN (select * from ams_patient_answer_score where evaluation_id = #{evaluationId}) a ON a.question_id = q.id
LEFT JOIN qms_question_option o ON a.option_id = o.id
WHERE
s.del_flag = 0
AND s.`code` = #{scaleCode}
AND (q.sex = #{sex} OR q.sex IS NULL)
ORDER BY
cst.consti_code
</select>
</mapper>

36
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<AmsReportVo.Result> 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<AmsReportVo.Result> 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<AmsReportVo.Result> 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<AmsReportVo.Result> 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<AmsReportVo.Result> export(@RequestBody @Validated RmsDto.Export dto){
return JsonResponse.ok(amsReportService.export(dto));
}
}

35
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("接收院内推送的待评估患者")

22
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<PageInfo<PmsPatientVo.PatientList>> queryPatientList(@RequestBody @Validated BaseDto<PmsPatientDto.QueryPatient> dto) {
List<PmsPatientVo.PatientList> list = new ArrayList<>();
// List<PmsPatientVo.PatientList> 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<PmsPatientVo.PatientList> 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<PmsPatientVo.PatientList> uniqueSet = new TreeSet<>(
Comparator.comparing(PmsPatientVo.PatientList::getPatientId)
);
uniqueSet.addAll(list);
List<PmsPatientVo.PatientList> uniqueList = new ArrayList<>(uniqueSet);
// // 创建一个 TreeSet,通过 Comparator 根据 patientId 去重
// Set<PmsPatientVo.PatientList> uniqueSet = new TreeSet<>(
// Comparator.comparing(PmsPatientVo.PatientList::getPatientId)
// );
// uniqueSet.addAll(list);
// List<PmsPatientVo.PatientList> uniqueList = new ArrayList<>(uniqueSet);
return JsonResponse.ok(new PageInfo<>(uniqueList));
return JsonResponse.ok(new PageInfo<>(serverList));
}
@ApiOperation("通过身份证号查询患者信息,方便页面展示返回和列表一样的格式")

98
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<DockVo.DeptInfo> sysDepts = dockService.getDeptView();
syncDeptView(sysDepts);
}
@DataSource(value = DataSourceType.ORACLE)
// @Scheduled(cron = "0 */10 * * * ?")
public void getEmplView() {
List<DockVo.EmplInfo> sysEmpls = dockService.getEmplView();
syncEmplView(sysEmpls);
}
@DataSource(value = DataSourceType.ORACLE)
// @Scheduled(cron = "0 */10 * * * ?")
public void getPatientBasicView() {
List<DockVo.PatientBasicInfo> sysPatients = dockService.getPatientBasicView();
syncPatientBasicView(sysPatients);
}
@DataSource(value = DataSourceType.ORACLE)
// @Scheduled(cron = "0 */10 * * * ?")
public void getPatientVisitView() {
List<DockVo.PatientVisitInfo> sysVisits = dockService.getPatientVisitView();
syncPatientVisitView(sysVisits);
}
@DataSource(value = DataSourceType.ORACLE)
// @Scheduled(cron = "0 */10 * * * ?")
public void getDiagnosisView() {
List<DockVo.DiagnosisInfo> sysDiagnosis = dockService.getDiagnosisView();
syncDiagnosisView(sysDiagnosis);
}
@DataSource(value = DataSourceType.ORACLE)
// @Scheduled(cron = "0 */10 * * * ?")
public void getMedicationView() {
List<DockVo.MedicationInfo> sysMedications = dockService.getMedicationView();
syncMedicationView(sysMedications);
}
@DataSource(value = DataSourceType.SLAVE)
public void syncDeptView(List<DockVo.DeptInfo> sysDepts) {
dockService.syncDeptView(sysDepts);
}
@DataSource(value = DataSourceType.SLAVE)
public void syncEmplView(List<DockVo.EmplInfo> sysEmpls) {
dockService.syncEmplView(sysEmpls);
}
@DataSource(value = DataSourceType.SLAVE)
public void syncPatientBasicView(List<DockVo.PatientBasicInfo> sysPatients) {
dockService.syncPatientBasicView(sysPatients);
}
@DataSource(value = DataSourceType.SLAVE)
public void syncPatientVisitView(List<DockVo.PatientVisitInfo> sysVisits) {
dockService.syncPatientVisitView(sysVisits);
}
@DataSource(value = DataSourceType.SLAVE)
public void syncDiagnosisView(List<DockVo.DiagnosisInfo> sysDiagnosis) {
dockService.syncDiagnosisView(sysDiagnosis);
}
@DataSource(value = DataSourceType.SLAVE)
public void syncMedicationView(List<DockVo.MedicationInfo> sysMedications) {
dockService.syncMedicationView(sysMedications);
}
}

1
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<String> scaleCodeList);
List<RmsVo.ExportInfo> queryReportExportInfo(@Param("evaluationId") Long evaluationId);
}

4
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);
}

2
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);

826
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<String, Object> 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<Map<String, Object>> 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<RmsVo.ReportScore> 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<String, Object> getParams(RmsDto.ExportReport1Dto dto) {
Map<String, Object> 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<RmsVo.ReportScore> 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<String, Object> 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<HmsVo.QuerySign> 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<String, List<Map<String, Object>>> otherMsg = patientInfoById.getOtherMsg();
//诊断
List<Map<String, Object>> 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<Map<String, Object>> pmsPatientBodyList = otherMsg.get("pmsPatientBody");
Map<String, Object> pmsPatientBodyMap = new HashMap<>();
if (CollUtil.isNotEmpty(pmsPatientBodyList)) {
pmsPatientBodyMap = pmsPatientBodyList.get(0);
}
//用药
List<Map<String, Object>> 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<RmsVo.ExportInfo> 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<Map<String, Object>> 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<RmsVo.ReportDetailAnswer> reportDetailAnswerList = rmsService.queryReportAnswer(queryReportAnswer);
MergeCellRule detailMerge = null;
if (CollUtil.isNotEmpty(reportDetailAnswerList)) {
RmsVo.ReportDetailAnswer reportDetailAnswer = reportDetailAnswerList.get(0);
List<List<RmsVo.QuestionInfo>> collect = reportDetailAnswerList.stream().map(reportDetailAnswer1 -> reportDetailAnswer1.getQuestionList()).collect(Collectors.toList());
List<RmsVo.QuestionInfo> list = new ArrayList<>();
for (int j = 0; j < collect.size(); j++) {
list.addAll(collect.get(j));
}
Map<String, Object> map = new HashMap<>();
List<RmsVo.QuestionTable> 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<AmsPatientAnswerScore> 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<String, Object> generateParams(Map<String, Object> params, List<RmsVo.ReportScore> 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<HmsVo.QuerySign> 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<String, List<Map<String, Object>>> otherMsg = patientInfoById.getOtherMsg();
//诊断
List<Map<String, Object>> 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<Map<String, Object>> pmsPatientBodyList = otherMsg.get("pmsPatientBody");
Map<String, Object> pmsPatientBodyMap = new HashMap<>();
if (CollUtil.isNotEmpty(pmsPatientBodyList)) {
pmsPatientBodyMap = pmsPatientBodyList.get(0);
}
//用药
List<Map<String, Object>> 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<RmsVo.ExportInfo> 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<Map<String, Object>> 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<RmsVo.ReportDetailAnswer> reportDetailAnswerList = rmsService.queryReportAnswer(queryReportAnswer);
MergeCellRule detailMerge = null;
if (CollUtil.isNotEmpty(reportDetailAnswerList)) {
RmsVo.ReportDetailAnswer reportDetailAnswer = reportDetailAnswerList.get(0);
List<List<RmsVo.QuestionInfo>> collect = reportDetailAnswerList.stream().map(reportDetailAnswer1 -> reportDetailAnswer1.getQuestionList()).collect(Collectors.toList());
List<RmsVo.QuestionInfo> list = new ArrayList<>();
for (int j = 0; j < collect.size(); j++) {
list.addAll(collect.get(j));
}
Map<String, Object> map = new HashMap<>();
List<RmsVo.QuestionTable> 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<AmsPatientAnswerScore> 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<String, Object> params, List<RmsVo.ExportInfo> 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<RmsVo.ReportScore> 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<String, Object> 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;
}
}

4
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<PmsPatientBody> 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;
}

161
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<PmsPatientBody> pmsPatientBodies = pmsPatientBodyMapper.selectByExample(patientBodyExample);
if (CollUtil.isNotEmpty(pmsPatientBodies)) {
PmsPatientBody body = pmsPatientBodies.get(0);
@ -229,7 +230,7 @@ public class PmsPatientServiceImpl implements IPmsPatientService {
List<Map<String, Object>> 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<String, List<Map<String, Object>>> patientOtherMsg = new HashMap<>();
//先查询就诊信息(PmsPatientBody)
//根据就诊号和患者id查询就诊信息是否存在
PmsPatientBodyExample patientBodyExample = new PmsPatientBodyExample();
patientBodyExample.createCriteria().andPatientIdEqualTo(pmsPatient.getId())
.andDelFlagEqualTo((byte) 0);
patientBodyExample.setOrderByClause("id desc");
List<PmsPatientBody> pmsPatientBodies = pmsPatientBodyMapper.selectByExample(patientBodyExample);
if (CollUtil.isNotEmpty(pmsPatientBodies)) {
PmsPatientBody body = pmsPatientBodies.get(0);
List<Map<String, Object>> 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<PmsPatientPersonal> pmsPatientPersonals = pmsPatientPersonalMapper.selectByExample(patientPersonalExample);
if (CollUtil.isNotEmpty(pmsPatientPersonals)) {
String jsonStr = JSON.toJSONString(pmsPatientPersonals);
List<Map<String, Object>> allList = JSON.parseObject(jsonStr, List.class);
List<Map<String, Object>> 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<PmsPatientParentIllness> 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<PmsPatientDiagnosis> 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<PmsPatientBody> 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<PmsPatientBody> 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<PmsPatientPersonal> 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<PmsPatientPersonal> 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);
}

85
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<RmsVo.ScoreTrend> 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<RmsVo.EvaluationScoreDistribution> scoreDistributions = rmsDao.getScoreDistributions(reportPatient.getPatientId());
if (CollUtil.isNotEmpty(scoreDistributions)) {
//处理认知域
List<RmsVo.EvaluationScoreDistribution> 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<RmsVo.QueryReportHistoryPatient> 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<RmsReport> rmsReports = rmsReportMapper.selectByExample(reportExample);
if (CollUtil.isEmpty(rmsReports)) {
patient.setReport(false);
} else {
patient.setReport(true);
}
//每次查询报告单 都重新生成分数
//查询报告单分数
List<RmsVo.ReportScore> reportScore = rmsDao.queryReportScore(patient.getEvaluationId(), null);
//重新封装报告单信息
List<RmsVo.ReportScore> 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<RmsReport> rmsReports = rmsReportMapper.selectByExample(reportExample);
// if (CollUtil.isEmpty(rmsReports)) {
// patient.setReport(false);
// } else {
// patient.setReport(true);
// }
// //每次查询报告单 都重新生成分数
// //查询报告单分数
// List<RmsVo.ReportScore> reportScore = rmsDao.queryReportScore(patient.getEvaluationId(), null);
// //重新封装报告单信息
// List<RmsVo.ReportScore> 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("");
// }
});
}

88
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}}

19
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#
hospitalId: 106
generalPassword: cga123#
redirectPath: http://localhost:8080/cga/v2/client/#/sickList

16
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#

2
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

65
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
<if test="searchValue != null and searchValue != ''">
@ -65,43 +65,42 @@
or
pp.idcard like CONCAT('%',#{searchValue},'%')
or
pp.id = #{searchValue}
pb.outpatient_no like CONCAT('%',#{searchValue},'%')
)
</if>
<if test="idcard != null and idcard != ''">
and (pp.idcard = #{idcard} or pp.idcard = #{idcardEncrypt})
</if>
<choose>
<when test="dataScope == 5">
and (pp.create_by = #{userName} or ae.tester_id = #{userId})
</when>
<!-- 当前医院不区分多级,所以本部门及以下权限和本部门数据权限使用相同的查询语句 -->
<when test="dataScope == 3 or dataScope == 4">
and uu.dept_id = (SELECT dept_id FROM ums_user WHERE user_id = #{userId})
</when>
<when test="dataScope == 2">
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}
)
</when>
</choose>
<!-- <if test="dataScope = '5'">-->
<!-- and (pp.create_by = #{userName} or ae.tester_id = #{userId})-->
<!-- </if>-->
<!-- &lt;!&ndash; 当前医院不区分多级,所以本部门及以下权限和本部门数据权限使用相同的查询语句 &ndash;&gt;-->
<!-- <if test="dataScope = '3' and dataScope = '4'">-->
<!-- and uu.dept_id = (SELECT dept_id FROM ums_user WHERE user_id = #{userId})-->
<!-- </if>-->
<!-- <if test="dataScope = '2'">-->
<!-- and uu.dept_id in (-->
<!-- SELECT rd.dept_id FROM ums_user u LEFT JOIN ums_user_role ur on u.user_id = ur.user_id LEFT JOIN ums_role_dept rd on rd.role_id = ur.role_id WHERE u.user_id = #{userId}-->
<!-- )-->
<!-- </if>-->
<!-- 权限 总测评师和测评师都是本部门及以下 -->
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}
)
<!-- <choose>-->
<!-- &lt;!&ndash; 测评师查看自己的患者 &ndash;&gt;-->
<!-- <when test="dataScope == 5">-->
<!-- and (pp.create_by = #{userName} or ae.tester_id = #{userId})-->
<!-- </when>-->
<!-- &lt;!&ndash; 总测评师查看自己部门的患者 &ndash;&gt;-->
<!-- <when test="dataScope == 3 or dataScope == 4">-->
<!-- and(-->
<!-- (EXISTS ( SELECT 1 FROM ums_user WHERE user_id = #{userId} AND data_power = 'ALL' ))-->
<!-- OR-->
<!-- (uu.dept_id IN ( SELECT CONCAT(dept_id, ',', data_power) FROM ums_user WHERE user_id = #{userId} ))-->
<!-- )-->
<!-- </when>-->
<!-- &lt;!&ndash; 目前没有2的权限 &ndash;&gt;-->
<!-- <when test="dataScope == 2">-->
<!-- 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}-->
<!-- )-->
<!-- </when>-->
<!-- </choose>-->
GROUP BY pp.id
order by pp.create_time desc
</select>

51
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,
<!--qq.scale_code,
qq.sort AS num,
qs.`name` AS scaleName,-->
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
<!--LEFT JOIN (
SELECT
pas.id,
pas.evaluation_id,
pas.create_time,
pas.question_id,
row_number() over w AS row_num
FROM
ams_patient_answer_score pas
WINDOW w AS (
PARTITION BY pas.evaluation_id
ORDER BY
pas.create_time DESC
)
) pas on ee.id = pas.evaluation_id
LEFT JOIN qms_question qq ON pas.question_id = qq.id
LEFT JOIN qms_scale qs ON qq.scale_code = qs.`code`-->
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},'%')
)
</if>
<choose>
<when test="dataScope == 5">
and (pp.create_by = #{userName} or ee.tester_id = #{userId})
</when>
<when test="dataScope == 3 or dataScope == 4">
and uu.dept_id = (SELECT dept_id FROM ums_user WHERE user_id = #{userId})
</when>
<when test="dataScope == 2">
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}
)
</when>
</choose>
<!-- 权限 总测评师和测评师都是本部门及以下 -->
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
</select>

10
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

2
ruisi_java/ruisi-web-examine/src/main/resources/logback.xml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 日志存放路径 -->
<property name="log.path" value="/data/cgav2/logs" />
<property name="log.path" value="/data/cgav2/logs/examine" />
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />

BIN
web_admin/adminapi-2.zip

Binary file not shown.

189
web_admin/adminapi/index.html

File diff suppressed because one or more lines are too long

BIN
web_admin/adminapi/index.html.gz

Binary file not shown.

2
web_admin/src/App.vue

@ -11,7 +11,7 @@ export default {
name: "App",
components: { ThemePicker },
created() {
console.log("部署111`");
console.log("部署2");
},
metaInfo() {

7
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,
});
}

1
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(); //

4
web_admin/src/views/report/view copy.vue

@ -9,7 +9,7 @@
<script>
import { exportPdf } from "@/api/report.js";
import pdf from "./components/pdf.vue";
import pdf from "./pdf.vue";
export default {
components: {
pdf,
@ -69,7 +69,7 @@ export default {
align-items: center;
height: 100vh;
padding: 16px;
background: url("./back.png");
background: url("back.png");
background-size: cover;
background-repeat: no-repeat;
}

10
web_admin/src/views/report/view.vue

@ -1,6 +1,10 @@
<template>
<div class="app-container">
<div class="patient-info">
<!-- 透明度 -->
<div
class="patient-info"
:style="{ opacity: patientInfo.patientName ? 1 : 0 }"
>
<span> {{ patientInfo.patientName || "未知" }}</span>
<span class="fg">/</span>
<span>
@ -99,8 +103,8 @@ export default {
localStorage.setItem("hospitalId", deptId);
//
this.queryParams.param = {
patientNo: this.$route.query.patient_no,
visitNo: this.$route.query.visit_no,
patientNo: this.$route.query.patientNo,
visitNo: this.$route.query.visitNo,
};
this.getList();

1
web_admin/vue.config.js

@ -37,7 +37,6 @@ module.exports = {
// detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: {
// target: `http://localhost:8080`,
// target: `http://192.168.1.116:19330`,
// target: "https://nnzjpt.ylinno.com/ruisiCgaAdmin/",
// target: "https://www.ylinno.com/cga/v2/api/admin/",
target: "http://113.45.159.249:59001/cga/v2/api/admin/",

BIN
web_client/clientapi-2.zip

Binary file not shown.

4
web_client/src/App.vue

@ -131,9 +131,7 @@ export default {
...mapState("ht", ["canvas"]),
},
created() {
console.log("报告单接口替换");
},
created() {},
mounted() {
if (
["/reportH5", "/reportScaleDetail", "/service"].includes(this.$route.path)

8
web_client/src/api/ams.js

@ -63,11 +63,6 @@ export const queryReportList = (params) =>
// 查询患者报告单详情
export const queryReportDetail = (param) =>
axios.post(`${rms}/queryReportDetail`, { ...param });
// 查询患者报告单详情
export const queryReport = (param) =>
axios.post(`${rms}/queryReport`, { ...param });
// 查询患者报告单详情
export const updateScaleInitialImpression = (param) =>
axios.post(`${rms}/updateScaleInitialImpression`, { ...param });
@ -221,4 +216,5 @@ export const furtherEvaluation = (params) =>
export const deletePatient = (params) =>
axios.post(`${proxyUrl}/ems/delete`, params);
// 撤回评估
export const revok = (params) => axios.post(`${proxyUrl}/ems/revoke`, params);
export const revok = (params) =>
axios.post(`${proxyUrl}/ems/revok`, params);

18
web_client/src/views/Patient/chooseSetMeal/index.vue

@ -102,10 +102,11 @@
class="checkbox-group2-item"
>
<el-checkbox :label="item2.scaleCode" border>
<h3
@click="handleCheckAll1(item1, item2, false)"
></h3>
<h2>
<h2
@click.stop="
handleCheckAll1(item1, item2, false)
"
>
{{ item2.scaleName }}{{
item2.questionNum || 0
}}
@ -426,7 +427,7 @@ export default {
if (row1.scaleList) {
// console.log(row1.scaleList);
let scaleCodeList = row1.scaleList.map(
(item) => item.scaleCode,
(item) => item.scaleCode
);
this.checkboxGroup2 = [
...this.checkboxGroup2,
@ -524,8 +525,6 @@ export default {
evaluationId: this.createId,
scaleList,
};
console.log("param", param);
let res = await bindScale(param);
const { code, msg, data } = res;
if (code === 200) {
@ -948,7 +947,7 @@ export default {
right: 0;
margin: 0 auto;
bottom: 20px;
z-index: 66;
z-index: 9999;
}
.divul {
display: flex;
@ -1048,7 +1047,6 @@ export default {
border: 2px solid #5cc0be;
margin: 5px;
height: 58px;
position: relative;
}
.checkbox-group2 h2 {
font-size: 22px;
@ -1062,7 +1060,7 @@ export default {
left: 0px;
right: 0px;
height: 58px;
z-index: 9999;
z-index: 8888;
}
.div-scale-box {
// border-top: 1px solid #e1e9f1;

18
web_client/src/views/history/components/scaleInfor.vue

@ -19,6 +19,21 @@
<i class="el-icon-document-checked"></i>
保存修改
</div>
<!-- <div
class="div-derive cardRig-but"
style="width: 130px; margin-right: 10px"
@click="handleExport('合并版', true)"
>
<i class="el-icon-upload2"></i>导出合并版
</div>
<div
v-if="!isAPP"
class="div-print cardRig-but"
@click="handlePrinting('合并版')"
style="width: 130px; margin-right: 10px"
>
<i class="el-icon-printer"></i>打印合并版
</div> -->
<div
class="div-derive cardRig-but"
style="width: 130px; margin-right: 10px"
@ -327,6 +342,7 @@ import {
queryReportInfo,
positiveExport,
icdQuery,
reportExportAll,
} from "api/ams";
import {
pasis as pasisConfig,
@ -423,6 +439,8 @@ export default {
res = await personalExport(params);
} else if (_type === "阳性版") {
res = await positiveExport(params);
} else if (_type === "合并版") {
res = await reportExportAll(params);
}
const { code, msg, data } = res;

19
web_client/src/views/history/components/scaleInforCopy.vue

@ -17,7 +17,21 @@
<i class="el-icon-document-checked"></i>
保存修改
</div>
<!-- <div
class="div-derive cardRig-but"
style="width: 130px; margin-right: 10px"
@click="handleExport('合并版', true)"
>
<i class="el-icon-upload2"></i>导出合并版
</div>
<div
v-if="!isAPP"
class="div-print cardRig-but"
@click="handlePrinting('合并版')"
style="width: 130px; margin-right: 10px"
>
<i class="el-icon-printer"></i>打印合并版
</div> -->
<div
class="div-derive cardRig-but"
style="width: 130px; margin-right: 10px"
@ -325,6 +339,7 @@ import {
queryReport,
queryReportInfo,
positiveExport,
reportExportAll,
icdQuery,
} from "api/ams";
import {
@ -427,6 +442,8 @@ export default {
res = await personalExport(params);
} else if (_type === "阳性版") {
res = await positiveExport(params);
}else if (_type === "合并版") {
res = await reportExportAll(params);
}
const { code, msg, data } = res;

Loading…
Cancel
Save