Browse Source

合并后端

master
lzp 4 days ago
parent
commit
e2773bb8a9
  1. 2
      ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/aspectj/DataScopeAspect.java
  2. 2
      ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/web/service/SysLoginService.java
  3. 2
      ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/dto/ScaleDto.java
  4. 62
      ruisi_java/ruisi-system/src/main/java/com/ccsens/system/persist/dao/StatisticsDao.java
  5. 30
      ruisi_java/ruisi-system/src/main/java/com/ccsens/system/service/StatisticsService.java
  6. 70
      ruisi_java/ruisi-system/src/main/java/com/ccsens/system/service/impl/StatisticsServiceImpl.java
  7. 137
      ruisi_java/ruisi-system/src/main/resources/mapper/dao/StatisticsDao.xml
  8. 56
      ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/PmsController.java
  9. 14
      ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/RmsController.java
  10. 197
      ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/StatisticsController.java
  11. 308
      ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/TjfxController.java
  12. 4
      ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/persist/dao/PmsPatientDao.java
  13. 2
      ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/persist/dao/RmsDao.java
  14. 5
      ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/IPmsPatientService.java
  15. 127
      ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/impl/AmsReportServiceImpl.java
  16. 8
      ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/impl/PmsPatientServiceImpl.java
  17. 23
      ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/impl/RmsServiceImpl.java
  18. 222
      ruisi_java/ruisi-web-admin/src/main/resources/mapper/dao/PmsPatientDao.xml
  19. 66
      ruisi_java/ruisi-web-admin/src/main/resources/mapper/dao/RmsDao.xml
  20. 55
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/PmsController.java
  21. 3
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/persist/dao/PmsPatientDao.java
  22. 3
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/persist/dao/ScaleDao.java
  23. 3
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/IPmsPatientService.java
  24. 4
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/PmsPatientServiceImpl.java
  25. 13
      ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/ScaleServiceImpl.java
  26. 8
      ruisi_java/ruisi-web-client/src/main/resources/application-dev.yml
  27. 193
      ruisi_java/ruisi-web-client/src/main/resources/mapper/dao/PmsPatientDao.xml
  28. 3
      ruisi_java/ruisi-web-client/src/main/resources/mapper/dao/ScaleDao.xml

2
ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/aspectj/DataScopeAspect.java

@ -109,7 +109,7 @@ public class DataScopeAspect {
sqlString.append(StringUtils.format(" OR {}.dept_id = {} ", deptAlias, user.getDeptId())); sqlString.append(StringUtils.format(" OR {}.dept_id = {} ", deptAlias, user.getDeptId()));
} else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope)) { } else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope)) {
sqlString.append(StringUtils.format( sqlString.append(StringUtils.format(
" OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )", " OR {}.dept_id IN ( SELECT dept_id FROM ums_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )",
deptAlias, user.getDeptId(), user.getDeptId())); deptAlias, user.getDeptId(), user.getDeptId()));
} else if (DATA_SCOPE_SELF.equals(dataScope)) { } else if (DATA_SCOPE_SELF.equals(dataScope)) {
if (StringUtils.isNotBlank(userAlias)) { if (StringUtils.isNotBlank(userAlias)) {

2
ruisi_java/ruisi-cc-framework/src/main/java/com/ccsens/framework/web/service/SysLoginService.java

@ -95,7 +95,7 @@ public class SysLoginService {
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"), null)); AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"), null));
LoginUser loginUser = (LoginUser) authentication.getPrincipal(); 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")) { 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); throw new BaseException(ErrorConstant.USER_NO_PERMISSION);
} }
recordLoginInfo(loginUser.getUserId()); recordLoginInfo(loginUser.getUserId());

2
ruisi_java/ruisi-system/src/main/java/com/ccsens/system/domain/dto/ScaleDto.java

@ -193,6 +193,8 @@ public class ScaleDto {
private Long version; private Long version;
private Long parentId; private Long parentId;
private String level; private String level;
@ApiModelProperty("患者ID")
private Long patientId;
} }

62
ruisi_java/ruisi-system/src/main/java/com/ccsens/system/persist/dao/StatisticsDao.java

@ -16,78 +16,104 @@ public interface StatisticsDao {
/** /**
* 综合数据 * 综合数据
*
* @param dto * @param dto
* @return * @return
*/ */
HomeDpVo.Zhsjgl nntotal(@Param("dto") StatisticsDto.Query dto); HomeDpVo.Zhsjgl nntotal(@Param("dto") StatisticsDto.Query dto,
@Param("deptIdLIst") List<Long> deptIdLIst);
Integer getPatientNum(@Param("dto") StatisticsDto.Query dto, Integer getPatientNum(@Param("dto") StatisticsDto.Query dto,
@Param("sex") Byte sex); @Param("sex") Byte sex,
@Param("deptIdLIst") List<Long> deptIdLIst);
/** /**
* BMI * BMI
*
* @param dto * @param dto
* @return * @return
*/ */
HomeDpVo.Bmi nnbmihjxy(@Param("dto") StatisticsDto.Query dto); HomeDpVo.Bmi nnbmihjxy(@Param("dto") StatisticsDto.Query dto,
@Param("deptIdLIst") List<Long> deptIdLIst);
/** /**
* 最新评估情况 * 最新评估情况
*
* @param dto * @param dto
* @return * @return
*/ */
List<HomeDpVo.Pgqk> nnlast(@Param("dto") StatisticsDto.Query dto); List<HomeDpVo.Pgqk> nnlast(@Param("dto") StatisticsDto.Query dto,
@Param("deptIdLIst") List<Long> deptIdLIst);
/** /**
* 年龄分布 * 年龄分布
*
* @param dto * @param dto
* @return * @return
*/ */
HomeDpVo.Nlfb nnage(@Param("dto") StatisticsDto.Query dto); HomeDpVo.Nlfb nnage(@Param("dto") StatisticsDto.Query dto,
@Param("deptIdLIst") List<Long> deptIdLIst);
/** /**
* T值分析 * T值分析
*
* @param dto * @param dto
* @return * @return
*/ */
HomeDpVo.Tz nntgb(@Param("dto") StatisticsDto.Query dto); HomeDpVo.Tz nntgb(@Param("dto") StatisticsDto.Query dto,
@Param("deptIdLIst") List<Long> deptIdLIst);
HomeDpVo.Ypzb nnYpzb(@Param("dto") StatisticsDto.Query dto); HomeDpVo.Ypzb nnYpzb(@Param("dto") StatisticsDto.Query dto,
@Param("deptIdLIst") List<Long> deptIdLIst);
/** /**
* 疾病排行 * 疾病排行
*
* @param dto * @param dto
* @return * @return
*/ */
List<HomeDpVo.Jbph> nnicd(@Param("dto") StatisticsDto.Query dto); List<HomeDpVo.Jbph> nnicd(@Param("dto") StatisticsDto.Query dto,
@Param("deptIdLIst") List<Long> deptIdLIst);
/** /**
* 地图 * 地图
*
* @param dto * @param dto
* @return * @return
*/ */
List<HomeDpVo.Dt> nnmap(@Param("dto") StatisticsDto.Query dto); List<HomeDpVo.Dt> nnmap(@Param("dto") StatisticsDto.Query dto,
@Param("deptIdLIst") List<Long> deptIdLIst);
/** /**
* 评估结果 * 评估结果
*
* @param dto * @param dto
* @return * @return
*/ */
List<HomeDpVo.Pgjg> nnscale(@Param("dto") StatisticsDto.Query dto); List<HomeDpVo.Pgjg> nnscale(@Param("dto") StatisticsDto.Query dto,
@Param("deptIdLIst") List<Long> deptIdLIst);
List<HomeDpVo.QualificationStatistics> qualificationStatistics(@Param("dto") StatisticsDto.Query dto); List<HomeDpVo.QualificationStatistics> qualificationStatistics(@Param("dto") StatisticsDto.Query dto,
@Param("deptIdLIst") List<Long> deptIdLIst);
HomeDpVo.JzStatistics JzStatistics(@Param("param") StatisticsDto.Query dto); HomeDpVo.JzStatistics JzStatistics(@Param("param") StatisticsDto.Query dto,
@Param("deptIdLIst") List<Long> deptIdLIst);
HomeDpVo.JzStatistics JzStatisticsNum(@Param("dto") StatisticsDto.Query dto); HomeDpVo.JzStatistics JzStatisticsNum(@Param("dto") StatisticsDto.Query dto,
@Param("deptIdLIst") List<Long> deptIdLIst);
List<HomeDpVo.ScaleStatistics> scaleStatistics(@Param("dto") StatisticsDto.Query dto); List<HomeDpVo.ScaleStatistics> scaleStatistics(@Param("dto") StatisticsDto.Query dto,
@Param("deptIdLIst") List<Long> deptIdLIst);
List<HomeDpVo.VersionStatistics> versionStatistics(@Param("dto") StatisticsDto.Query dto); List<HomeDpVo.VersionStatistics> versionStatistics(@Param("dto") StatisticsDto.Query dto,
@Param("deptIdLIst") List<Long> deptIdLIst);
List<HomeDpVo.UserStatistics> userStatistics(@Param("dto") StatisticsDto.Query dto); List<HomeDpVo.UserStatistics> userStatistics(@Param("dto") StatisticsDto.Query dto,
@Param("deptIdLIst") List<Long> deptIdLIst);
HomeDpVo.SexStatistics sexStatistics(@Param("dto") StatisticsDto.Query dto); HomeDpVo.SexStatistics sexStatistics(@Param("dto") StatisticsDto.Query dto,
@Param("deptIdLIst") List<Long> deptIdLIst);
HomeDpVo.XyYjStatistics xyYjStatistics(@Param("dto") StatisticsDto.Query dto); HomeDpVo.XyYjStatistics xyYjStatistics(@Param("dto") StatisticsDto.Query dto,
@Param("deptIdLIst") List<Long> deptIdLIst);
} }

30
ruisi_java/ruisi-system/src/main/java/com/ccsens/system/service/StatisticsService.java

@ -14,32 +14,32 @@ import java.util.List;
*/ */
public interface StatisticsService { public interface StatisticsService {
HomeDpVo.Zhsjgl nntotal(StatisticsDto.Query dto); HomeDpVo.Zhsjgl nntotal(StatisticsDto.Query dto, List<Long> deptIdLIst);
HomeDpVo.Bmi nnbmihjxy(StatisticsDto.Query dto); HomeDpVo.Bmi nnbmihjxy(StatisticsDto.Query dto, List<Long> deptIdLIst);
List<HomeDpVo.Pgqk> nnlast(StatisticsDto.Query dto); List<HomeDpVo.Pgqk> nnlast(StatisticsDto.Query dto, List<Long> deptIdLIst);
HomeDpVo.Nlfb nnage(StatisticsDto.Query dto); HomeDpVo.Nlfb nnage(StatisticsDto.Query dto, List<Long> deptIdLIst);
HomeDpVo.Tz nntgb(StatisticsDto.Query dto); HomeDpVo.Tz nntgb(StatisticsDto.Query dto, List<Long> deptIdLIst);
List<HomeDpVo.Jbph> nnicd(StatisticsDto.Query dto); List<HomeDpVo.Jbph> nnicd(StatisticsDto.Query dto, List<Long> deptIdLIst);
List<HomeDpVo.Dt> nnmap(StatisticsDto.Query dto); List<HomeDpVo.Dt> nnmap(StatisticsDto.Query dto, List<Long> deptIdLIst);
List<HomeDpVo.Pgjg> nnscale(StatisticsDto.Query dto); List<HomeDpVo.Pgjg> nnscale(StatisticsDto.Query dto, List<Long> deptIdLIst);
/** /**
* 学历统计 * 学历统计
* @param dto * @param dto
* @return * @return
*/ */
List<HomeDpVo.QualificationStatistics> qualificationStatistics(StatisticsDto.Query dto); List<HomeDpVo.QualificationStatistics> qualificationStatistics(StatisticsDto.Query dto, List<Long> deptIdLIst);
HomeDpVo.JzStatistics jzStatistics(StatisticsDto.Query dto); HomeDpVo.JzStatistics jzStatistics(StatisticsDto.Query dto, List<Long> deptIdLIst);
List<HomeDpVo.ScaleStatistics> scaleStatistics(StatisticsDto.Query dto); List<HomeDpVo.ScaleStatistics> scaleStatistics(StatisticsDto.Query dto, List<Long> deptIdLIst);
List<HomeDpVo.VersionStatistics> versionStatistics(StatisticsDto.Query dto); List<HomeDpVo.VersionStatistics> versionStatistics(StatisticsDto.Query dto, List<Long> deptIdLIst);
List<HomeDpVo.UserStatistics> userStatistics(StatisticsDto.Query dto); List<HomeDpVo.UserStatistics> userStatistics(StatisticsDto.Query dto, List<Long> deptIdLIst);
HomeDpVo.SexStatistics sexStatistics(StatisticsDto.Query dto); HomeDpVo.SexStatistics sexStatistics(StatisticsDto.Query dto, List<Long> deptIdLIst);
HomeDpVo.XyYjStatistics xyYjStatistics(StatisticsDto.Query dto); HomeDpVo.XyYjStatistics xyYjStatistics(StatisticsDto.Query dto, List<Long> deptIdLIst);
} }

70
ruisi_java/ruisi-system/src/main/java/com/ccsens/system/service/impl/StatisticsServiceImpl.java

@ -26,112 +26,112 @@ public class StatisticsServiceImpl implements StatisticsService {
private StatisticsDao statisticsDao; private StatisticsDao statisticsDao;
@Override @Override
public HomeDpVo.Zhsjgl nntotal(StatisticsDto.Query dto) { public HomeDpVo.Zhsjgl nntotal(StatisticsDto.Query dto, List<Long> deptIdLIst) {
if (dto.getTimeType() != null) { if (dto.getTimeType() != null) {
List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime()); List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime());
dto.setBeginTime(dateByType.get(0)); dto.setBeginTime(dateByType.get(0));
dto.setEndTime(dateByType.get(1)); dto.setEndTime(dateByType.get(1));
} }
HomeDpVo.Zhsjgl nntotal = statisticsDao.nntotal(dto); HomeDpVo.Zhsjgl nntotal = statisticsDao.nntotal(dto, deptIdLIst);
if (nntotal == null) { if (nntotal == null) {
nntotal = new HomeDpVo.Zhsjgl(); nntotal = new HomeDpVo.Zhsjgl();
} }
nntotal.setPtotal(statisticsDao.getPatientNum(dto, null)); nntotal.setPtotal(statisticsDao.getPatientNum(dto, null, deptIdLIst));
nntotal.setMtotal(statisticsDao.getPatientNum(dto, (byte) 0)); nntotal.setMtotal(statisticsDao.getPatientNum(dto, (byte) 0, deptIdLIst));
nntotal.setFtotal(statisticsDao.getPatientNum(dto, (byte) 1)); nntotal.setFtotal(statisticsDao.getPatientNum(dto, (byte) 1, deptIdLIst));
return nntotal; return nntotal;
} }
@Override @Override
public HomeDpVo.Bmi nnbmihjxy(StatisticsDto.Query dto) { public HomeDpVo.Bmi nnbmihjxy(StatisticsDto.Query dto, List<Long> deptIdLIst) {
if (dto.getTimeType() != null) { if (dto.getTimeType() != null) {
List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime()); List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime());
dto.setBeginTime(dateByType.get(0)); dto.setBeginTime(dateByType.get(0));
dto.setEndTime(dateByType.get(1)); dto.setEndTime(dateByType.get(1));
} }
return statisticsDao.nnbmihjxy(dto); return statisticsDao.nnbmihjxy(dto, deptIdLIst);
} }
@Override @Override
public List<HomeDpVo.Pgqk> nnlast(StatisticsDto.Query dto) { public List<HomeDpVo.Pgqk> nnlast(StatisticsDto.Query dto, List<Long> deptIdLIst) {
if (dto.getTimeType() != null) { if (dto.getTimeType() != null) {
List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime()); List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime());
dto.setBeginTime(dateByType.get(0)); dto.setBeginTime(dateByType.get(0));
dto.setEndTime(dateByType.get(1)); dto.setEndTime(dateByType.get(1));
} }
return statisticsDao.nnlast(dto); return statisticsDao.nnlast(dto, deptIdLIst);
} }
@Override @Override
public HomeDpVo.Nlfb nnage(StatisticsDto.Query dto) { public HomeDpVo.Nlfb nnage(StatisticsDto.Query dto, List<Long> deptIdLIst) {
if (dto.getTimeType() != null) { if (dto.getTimeType() != null) {
List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime()); List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime());
dto.setBeginTime(dateByType.get(0)); dto.setBeginTime(dateByType.get(0));
dto.setEndTime(dateByType.get(1)); dto.setEndTime(dateByType.get(1));
} }
return statisticsDao.nnage(dto); return statisticsDao.nnage(dto, deptIdLIst);
} }
@Override @Override
public HomeDpVo.Tz nntgb(StatisticsDto.Query dto) { public HomeDpVo.Tz nntgb(StatisticsDto.Query dto, List<Long> deptIdLIst) {
if (dto.getTimeType() != null) { if (dto.getTimeType() != null) {
List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime()); List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime());
dto.setBeginTime(dateByType.get(0)); dto.setBeginTime(dateByType.get(0));
dto.setEndTime(dateByType.get(1)); dto.setEndTime(dateByType.get(1));
} }
return statisticsDao.nntgb(dto); return statisticsDao.nntgb(dto, deptIdLIst);
} }
@Override @Override
public List<HomeDpVo.Jbph> nnicd(StatisticsDto.Query dto) { public List<HomeDpVo.Jbph> nnicd(StatisticsDto.Query dto, List<Long> deptIdLIst) {
if (dto.getTimeType() != null) { if (dto.getTimeType() != null) {
List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime()); List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime());
dto.setBeginTime(dateByType.get(0)); dto.setBeginTime(dateByType.get(0));
dto.setEndTime(dateByType.get(1)); dto.setEndTime(dateByType.get(1));
} }
return statisticsDao.nnicd(dto); return statisticsDao.nnicd(dto, deptIdLIst);
} }
@Override @Override
public List<HomeDpVo.Dt> nnmap(StatisticsDto.Query dto) { public List<HomeDpVo.Dt> nnmap(StatisticsDto.Query dto, List<Long> deptIdLIst) {
if (dto.getTimeType() != null) { if (dto.getTimeType() != null) {
List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime()); List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime());
dto.setBeginTime(dateByType.get(0)); dto.setBeginTime(dateByType.get(0));
dto.setEndTime(dateByType.get(1)); dto.setEndTime(dateByType.get(1));
} }
return statisticsDao.nnmap(dto); return statisticsDao.nnmap(dto, deptIdLIst);
} }
@Override @Override
public List<HomeDpVo.Pgjg> nnscale(StatisticsDto.Query dto) { public List<HomeDpVo.Pgjg> nnscale(StatisticsDto.Query dto, List<Long> deptIdLIst) {
if (dto.getTimeType() != null) { if (dto.getTimeType() != null) {
List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime()); List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime());
dto.setBeginTime(dateByType.get(0)); dto.setBeginTime(dateByType.get(0));
dto.setEndTime(dateByType.get(1)); dto.setEndTime(dateByType.get(1));
} }
return statisticsDao.nnscale(dto); return statisticsDao.nnscale(dto, deptIdLIst);
} }
@Override @Override
public List<HomeDpVo.QualificationStatistics> qualificationStatistics(StatisticsDto.Query dto) { public List<HomeDpVo.QualificationStatistics> qualificationStatistics(StatisticsDto.Query dto, List<Long> deptIdLIst) {
if (dto.getTimeType() != null) { if (dto.getTimeType() != null) {
List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime()); List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime());
dto.setBeginTime(dateByType.get(0)); dto.setBeginTime(dateByType.get(0));
dto.setEndTime(dateByType.get(1)); dto.setEndTime(dateByType.get(1));
} }
return statisticsDao.qualificationStatistics(dto); return statisticsDao.qualificationStatistics(dto, deptIdLIst);
} }
@Override @Override
public HomeDpVo.JzStatistics jzStatistics(StatisticsDto.Query dto) { public HomeDpVo.JzStatistics jzStatistics(StatisticsDto.Query dto, List<Long> deptIdLIst) {
if (dto.getTimeType() != null) { if (dto.getTimeType() != null) {
List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime()); List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime());
dto.setBeginTime(dateByType.get(0)); dto.setBeginTime(dateByType.get(0));
dto.setEndTime(dateByType.get(1)); dto.setEndTime(dateByType.get(1));
} }
// HomeDpVo.JzStatistics jzStatistics = statisticsDao.JzStatisticsNum(dto); // HomeDpVo.JzStatistics jzStatistics = statisticsDao.JzStatisticsNum(dto, deptIdLIst);
// if (jzStatistics!= null) { // if (jzStatistics!= null) {
HomeDpVo.JzStatistics jzStatistics = statisticsDao.JzStatistics(dto); HomeDpVo.JzStatistics jzStatistics = statisticsDao.JzStatistics(dto, deptIdLIst);
// jzStatistics.setZyNum(jzStatistics1.getZyNum()); // jzStatistics.setZyNum(jzStatistics1.getZyNum());
// jzStatistics.setMzNum(jzStatistics1.getMzNum()); // jzStatistics.setMzNum(jzStatistics1.getMzNum());
// } // }
@ -139,37 +139,37 @@ public class StatisticsServiceImpl implements StatisticsService {
} }
@Override @Override
public List<HomeDpVo.ScaleStatistics> scaleStatistics(StatisticsDto.Query dto) { public List<HomeDpVo.ScaleStatistics> scaleStatistics(StatisticsDto.Query dto, List<Long> deptIdLIst) {
if (dto.getTimeType() != null) { if (dto.getTimeType() != null) {
List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime()); List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime());
dto.setBeginTime(dateByType.get(0)); dto.setBeginTime(dateByType.get(0));
dto.setEndTime(dateByType.get(1)); dto.setEndTime(dateByType.get(1));
} }
return statisticsDao.scaleStatistics(dto); return statisticsDao.scaleStatistics(dto, deptIdLIst);
} }
@Override @Override
public List<HomeDpVo.VersionStatistics> versionStatistics(StatisticsDto.Query dto) { public List<HomeDpVo.VersionStatistics> versionStatistics(StatisticsDto.Query dto, List<Long> deptIdLIst) {
if (dto.getTimeType() != null) { if (dto.getTimeType() != null) {
List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime()); List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime());
dto.setBeginTime(dateByType.get(0)); dto.setBeginTime(dateByType.get(0));
dto.setEndTime(dateByType.get(1)); dto.setEndTime(dateByType.get(1));
} }
return statisticsDao.versionStatistics(dto); return statisticsDao.versionStatistics(dto, deptIdLIst);
} }
@Override @Override
public List<HomeDpVo.UserStatistics> userStatistics(StatisticsDto.Query dto) { public List<HomeDpVo.UserStatistics> userStatistics(StatisticsDto.Query dto, List<Long> deptIdLIst) {
if (dto.getTimeType() != null) { if (dto.getTimeType() != null) {
List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime()); List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime());
dto.setBeginTime(dateByType.get(0)); dto.setBeginTime(dateByType.get(0));
dto.setEndTime(dateByType.get(1)); dto.setEndTime(dateByType.get(1));
} }
return statisticsDao.userStatistics(dto); return statisticsDao.userStatistics(dto, deptIdLIst);
} }
@Override @Override
public HomeDpVo.SexStatistics sexStatistics(StatisticsDto.Query dto) { public HomeDpVo.SexStatistics sexStatistics(StatisticsDto.Query dto, List<Long> deptIdLIst) {
if (dto.getTimeType() != null) { if (dto.getTimeType() != null) {
List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime()); List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime());
dto.setBeginTime(dateByType.get(0)); dto.setBeginTime(dateByType.get(0));
@ -177,15 +177,15 @@ public class StatisticsServiceImpl implements StatisticsService {
} }
HomeDpVo.SexStatistics sexStatistics = new HomeDpVo.SexStatistics(); HomeDpVo.SexStatistics sexStatistics = new HomeDpVo.SexStatistics();
sexStatistics.setBoy(statisticsDao.getPatientNum(dto, (byte) 0)); sexStatistics.setBoy(statisticsDao.getPatientNum(dto, (byte) 0, deptIdLIst));
sexStatistics.setGirl(statisticsDao.getPatientNum(dto, (byte) 1)); sexStatistics.setGirl(statisticsDao.getPatientNum(dto, (byte) 1, deptIdLIst));
return sexStatistics; return sexStatistics;
} }
@Override @Override
public HomeDpVo.XyYjStatistics xyYjStatistics(StatisticsDto.Query dto) { public HomeDpVo.XyYjStatistics xyYjStatistics(StatisticsDto.Query dto, List<Long> deptIdLIst) {
return statisticsDao.xyYjStatistics(dto); return statisticsDao.xyYjStatistics(dto, deptIdLIst);
} }
/** /**

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

@ -14,15 +14,18 @@
ems_evaluation e ems_evaluation e
LEFT JOIN ums_user u ON e.create_by = u.user_name LEFT JOIN ums_user u ON e.create_by = u.user_name
where e.del_flag = 0 and e.complete_status != 0 where e.del_flag = 0 and e.complete_status != 0
<if test="dto.deptId != null">
AND u.dept_id = #{dto.deptId}
</if>
<if test="dto.beginTime != null"> <if test="dto.beginTime != null">
AND e.create_time >= #{dto.beginTime} AND e.create_time >= #{dto.beginTime}
</if> </if>
<if test="dto.endTime != null"> <if test="dto.endTime != null">
AND e.create_time &lt;= #{dto.endTime} AND e.create_time &lt;= #{dto.endTime}
</if> </if>
<if test="deptIdLIst != null and deptIdLIst.size() >0">
AND u.dept_id IN
<foreach item="item" collection="deptIdLIst" separator="," close=")" index="index" open="(">
#{item}
</foreach>
</if>
</select> </select>
<select id="getPatientNum" resultType="java.lang.Integer"> <select id="getPatientNum" resultType="java.lang.Integer">
@ -30,9 +33,13 @@
COUNT(DISTINCT p.id) AS total COUNT(DISTINCT p.id) AS total
FROM FROM
pms_patient p pms_patient p
LEFT JOIN ums_user u ON p.create_by = u.user_name
where p.del_flag = 0 where p.del_flag = 0
<if test="dto.deptId != null"> <if test="deptIdLIst != null and deptIdLIst.size() >0">
AND p.hospital_id = #{dto.deptId} AND u.dept_id IN
<foreach item="item" collection="deptIdLIst" separator="," close=")" index="index" open="(">
#{item}
</foreach>
</if> </if>
<if test="dto.beginTime != null"> <if test="dto.beginTime != null">
AND p.create_time >= #{dto.beginTime} AND p.create_time >= #{dto.beginTime}
@ -57,8 +64,11 @@
left JOIN pms_patient_body pb ON p.id = pb.patient_id left JOIN pms_patient_body pb ON p.id = pb.patient_id
LEFT JOIN ums_user u ON p.create_by = u.user_name LEFT JOIN ums_user u ON p.create_by = u.user_name
where p.del_flag = 0 where p.del_flag = 0
<if test="dto.deptId != null"> <if test="deptIdLIst != null and deptIdLIst.size() >0">
AND u.dept_id = #{dto.deptId} AND u.dept_id IN
<foreach item="item" collection="deptIdLIst" separator="," close=")" index="index" open="(">
#{item}
</foreach>
</if> </if>
<if test="dto.beginTime != null"> <if test="dto.beginTime != null">
AND p.create_time >= #{dto.beginTime} AND p.create_time >= #{dto.beginTime}
@ -81,8 +91,11 @@
LEFT JOIN ums_user u ON e.create_by = u.user_name LEFT JOIN ums_user u ON e.create_by = u.user_name
where e.del_flag = 0 where e.del_flag = 0
and e.patient_id != 0 and e.patient_id != 0
<if test="dto.deptId != null"> <if test="deptIdLIst != null and deptIdLIst.size() >0">
AND u.dept_id = #{dto.deptId} AND u.dept_id IN
<foreach item="item" collection="deptIdLIst" separator="," close=")" index="index" open="(">
#{item}
</foreach>
</if> </if>
<if test="dto.beginTime != null"> <if test="dto.beginTime != null">
AND e.create_time >= #{dto.beginTime} AND e.create_time >= #{dto.beginTime}
@ -101,8 +114,11 @@
pms_patient p pms_patient p
LEFT JOIN ums_user u ON p.create_by = u.user_name LEFT JOIN ums_user u ON p.create_by = u.user_name
where p.del_flag = 0 where p.del_flag = 0
<if test="dto.deptId != null"> <if test="deptIdLIst != null and deptIdLIst.size() >0">
AND u.dept_id = #{dto.deptId} AND u.dept_id IN
<foreach item="item" collection="deptIdLIst" separator="," close=")" index="index" open="(">
#{item}
</foreach>
</if> </if>
<if test="dto.beginTime != null"> <if test="dto.beginTime != null">
AND p.create_time >= #{dto.beginTime} AND p.create_time >= #{dto.beginTime}
@ -122,8 +138,11 @@
LEFT JOIN ums_user u ON b.create_by = u.user_name LEFT JOIN ums_user u ON b.create_by = u.user_name
WHERE WHERE
drug_name IS NOT NULL and del_flag = 0 drug_name IS NOT NULL and del_flag = 0
<if test="dto.deptId != null"> <if test="deptIdLIst != null and deptIdLIst.size() >0">
AND u.dept_id = #{dto.deptId} AND u.dept_id IN
<foreach item="item" collection="deptIdLIst" separator="," close=")" index="index" open="(">
#{item}
</foreach>
</if> </if>
<if test="dto.beginTime != null"> <if test="dto.beginTime != null">
AND b.create_time >= #{dto.beginTime} AND b.create_time >= #{dto.beginTime}
@ -145,12 +164,16 @@
FROM FROM
pms_patient_diagnosis b pms_patient_diagnosis b
LEFT JOIN pms_patient p ON b.patient_id = p.id LEFT JOIN pms_patient p ON b.patient_id = p.id
left JOIN ums_user u ON b.create_by = u.user_name
WHERE WHERE
b.diagnosis_name IS NOT NULL b.diagnosis_name IS NOT NULL
and diagnosis_name != '' and diagnosis_name != ''
and b.del_flag = 0 and b.del_flag = 0
<if test="dto.deptId != null"> <if test="deptIdLIst != null and deptIdLIst.size() >0">
AND p.hospital_id = #{dto.deptId} AND u.dept_id IN
<foreach item="item" collection="deptIdLIst" separator="," close=")" index="index" open="(">
#{item}
</foreach>
</if> </if>
<if test="dto.beginTime != null"> <if test="dto.beginTime != null">
AND b.create_time >= #{dto.beginTime} AND b.create_time >= #{dto.beginTime}
@ -175,10 +198,14 @@
SELECT SELECT
TIMESTAMPDIFF(YEAR, birthday, CURDATE()) - TIMESTAMPDIFF(YEAR, birthday, CURDATE()) -
(DATE_FORMAT(CURDATE(), '%m%d') &lt; DATE_FORMAT(birthday, '%m%d')) AS age (DATE_FORMAT(CURDATE(), '%m%d') &lt; DATE_FORMAT(birthday, '%m%d')) AS age
FROM pms_patient FROM pms_patient p
WHERE del_flag = 0 LEFT JOIN ums_user u ON p.create_by = u.user_name
<if test="dto.deptId != null"> WHERE p.del_flag = 0
AND hospital_id = #{dto.deptId} <if test="deptIdLIst != null and deptIdLIst.size() >0">
AND u.dept_id IN
<foreach item="item" collection="deptIdLIst" separator="," close=")" index="index" open="(">
#{item}
</foreach>
</if> </if>
<if test="dto.beginTime != null"> <if test="dto.beginTime != null">
AND create_time >= #{dto.beginTime} AND create_time >= #{dto.beginTime}
@ -196,8 +223,11 @@
from ums_dept from ums_dept
where del_flag = 0 where del_flag = 0
and parent_id = 0 and parent_id = 0
<if test="dto.deptId != null"> <if test="deptIdLIst != null and deptIdLIst.size() >0">
AND dept_id = #{dto.deptId} AND dept_id IN
<foreach item="item" collection="deptIdLIst" separator="," close=")" index="index" open="(">
#{item}
</foreach>
</if> </if>
<if test="dto.beginTime != null"> <if test="dto.beginTime != null">
AND create_time >= #{dto.beginTime} AND create_time >= #{dto.beginTime}
@ -235,8 +265,11 @@
"PSQI", "PSQI",
"CAM" "CAM"
) )
<if test="dto.deptId != null"> <if test="deptIdLIst != null and deptIdLIst.size() >0">
AND p.hospital_id = #{dto.deptId} AND u.dept_id IN
<foreach item="item" collection="deptIdLIst" separator="," close=")" index="index" open="(">
#{item}
</foreach>
</if> </if>
<if test="dto.beginTime != null"> <if test="dto.beginTime != null">
AND r.create_time >= #{dto.beginTime} AND r.create_time >= #{dto.beginTime}
@ -253,10 +286,14 @@
COUNT( p.id ) AS num COUNT( p.id ) AS num
FROM FROM
pms_patient p pms_patient p
LEFT JOIN ums_user u ON p.create_by = u.user_name
where where
p.del_flag = 0 p.del_flag = 0
<if test="dto.deptId != null"> <if test="deptIdLIst != null and deptIdLIst.size() >0">
AND p.hospital_id = #{dto.deptId} AND u.dept_id IN
<foreach item="item" collection="deptIdLIst" separator="," close=")" index="index" open="(">
#{item}
</foreach>
</if> </if>
<if test="dto.beginTime != null"> <if test="dto.beginTime != null">
AND p.create_time >= #{dto.beginTime} AND p.create_time >= #{dto.beginTime}
@ -286,14 +323,18 @@
pms_patient_body b pms_patient_body b
left join pms_patient p on b.patient_id = p.id left join pms_patient p on b.patient_id = p.id
left join ems_evaluation e on e.visit_no = b.outpatient_no left join ems_evaluation e on e.visit_no = b.outpatient_no
left join ums_user u on b.create_by = u.user_name
<where> <where>
b.del_flag = 0 and p.del_flag = 0 b.del_flag = 0 and p.del_flag = 0
<if test="param.beginTime != null and param.endTime != null"> <if test="param.beginTime != null and param.endTime != null">
and b.diagnosis_date between #{param.beginTime} and #{param.endTime} and b.diagnosis_date between #{param.beginTime} and #{param.endTime}
</if> </if>
<if test="param.deptId != null"> <if test="deptIdLIst != null and deptIdLIst.size() >0">
and p.hospital_id = #{param.deptId} AND u.dept_id IN
<foreach item="item" collection="deptIdLIst" separator="," close=")" index="index" open="(">
#{item}
</foreach>
</if> </if>
</where> </where>
@ -336,8 +377,11 @@
WHERE e.del_flag = 0 WHERE e.del_flag = 0
AND e.visit_no != '0' AND e.visit_no != '0'
AND e.visit_no IS NOT NULL AND e.visit_no IS NOT NULL
<if test="dto.deptId != null"> <if test="deptIdLIst != null and deptIdLIst.size() >0">
AND u.dept_id = #{dto.deptId} AND u.dept_id IN
<foreach item="item" collection="deptIdLIst" separator="," close=")" index="index" open="(">
#{item}
</foreach>
</if> </if>
<if test="dto.beginTime != null"> <if test="dto.beginTime != null">
AND e.create_time >= #{dto.beginTime} AND e.create_time >= #{dto.beginTime}
@ -362,8 +406,11 @@
LEFT JOIN pms_patient p ON e.patient_id = p.id LEFT JOIN pms_patient p ON e.patient_id = p.id
WHERE WHERE
e.del_flag = 0 e.del_flag = 0
<if test="dto.deptId != null"> <if test="deptIdLIst != null and deptIdLIst.size() >0">
AND p.hospital_id = #{dto.deptId} AND u.dept_id IN
<foreach item="item" collection="deptIdLIst" separator="," close=")" index="index" open="(">
#{item}
</foreach>
</if> </if>
<if test="dto.beginTime != null"> <if test="dto.beginTime != null">
AND ees.create_time >= #{dto.beginTime} AND ees.create_time >= #{dto.beginTime}
@ -385,8 +432,11 @@
LEFT JOIN rms_report r on r.evaluation_id = ee.id LEFT JOIN rms_report r on r.evaluation_id = ee.id
LEFT JOIN ums_user u ON ee.create_by = u.user_name AND u.del_flag = 0 LEFT JOIN ums_user u ON ee.create_by = u.user_name AND u.del_flag = 0
WHERE hv.del_flag = 0 WHERE hv.del_flag = 0
<if test="dto.deptId != null"> <if test="deptIdLIst != null and deptIdLIst.size() >0">
AND u.dept_id = #{dto.deptId} AND u.dept_id IN
<foreach item="item" collection="deptIdLIst" separator="," close=")" index="index" open="(">
#{item}
</foreach>
</if> </if>
<if test="dto.beginTime != null"> <if test="dto.beginTime != null">
AND ee.create_time >= #{dto.beginTime} AND ee.create_time >= #{dto.beginTime}
@ -410,8 +460,11 @@
LEFT JOIN rms_report r on r.evaluation_id = ee.id LEFT JOIN rms_report r on r.evaluation_id = ee.id
WHERE WHERE
u.del_flag = 0 u.del_flag = 0
<if test="dto.deptId != null"> <if test="deptIdLIst != null and deptIdLIst.size() >0">
AND u.dept_id = #{dto.deptId} AND u.dept_id IN
<foreach item="item" collection="deptIdLIst" separator="," close=")" index="index" open="(">
#{item}
</foreach>
</if> </if>
<if test="dto.beginTime != null"> <if test="dto.beginTime != null">
AND ee.create_time >= #{dto.beginTime} AND ee.create_time >= #{dto.beginTime}
@ -432,8 +485,11 @@
LEFT JOIN ums_user u ON p.create_by = u.user_name AND u.del_flag = 0 LEFT JOIN ums_user u ON p.create_by = u.user_name AND u.del_flag = 0
WHERE WHERE
p.del_flag = 0 p.del_flag = 0
<if test="dto.deptId != null"> <if test="deptIdLIst != null and deptIdLIst.size() >0">
AND u.dept_id = #{dto.deptId} AND u.dept_id IN
<foreach item="item" collection="deptIdLIst" separator="," close=")" index="index" open="(">
#{item}
</foreach>
</if> </if>
<if test="dto.beginTime != null"> <if test="dto.beginTime != null">
AND p.create_time >= #{dto.beginTime} AND p.create_time >= #{dto.beginTime}
@ -463,8 +519,11 @@
WHERE WHERE
p.del_flag = 0 p.del_flag = 0
AND pp.del_flag = 0 AND pp.del_flag = 0
<if test="dto.deptId != null"> <if test="deptIdLIst != null and deptIdLIst.size() >0">
AND u.dept_id = #{dto.deptId} AND u.dept_id IN
<foreach item="item" collection="deptIdLIst" separator="," close=")" index="index" open="(">
#{item}
</foreach>
</if> </if>
<if test="dto.beginTime != null"> <if test="dto.beginTime != null">
AND p.create_time >= #{dto.beginTime} AND p.create_time >= #{dto.beginTime}

56
ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/PmsController.java

@ -7,6 +7,7 @@ import cn.hutool.core.util.PhoneUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.ccsens.admin.service.IPmsPatientService; import com.ccsens.admin.service.IPmsPatientService;
import com.ccsens.common.constant.ErrorConstant; import com.ccsens.common.constant.ErrorConstant;
import com.ccsens.common.constant.WebConstant;
import com.ccsens.common.core.controller.BaseController; import com.ccsens.common.core.controller.BaseController;
import com.ccsens.common.core.domain.BaseDto; import com.ccsens.common.core.domain.BaseDto;
import com.ccsens.common.core.domain.JsonResponse; import com.ccsens.common.core.domain.JsonResponse;
@ -19,6 +20,7 @@ import com.ccsens.common.utils.file.MimeTypeUtils;
import com.ccsens.common.utils.sign.Md5Utils; import com.ccsens.common.utils.sign.Md5Utils;
import com.ccsens.system.domain.dto.PmsPatientDto; import com.ccsens.system.domain.dto.PmsPatientDto;
import com.ccsens.system.domain.vo.PmsPatientVo; import com.ccsens.system.domain.vo.PmsPatientVo;
import com.ccsens.system.service.SysPowerService;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -28,11 +30,15 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -46,20 +52,32 @@ import java.util.List;
public class PmsController extends BaseController { public class PmsController extends BaseController {
@Resource @Resource
private IPmsPatientService patientService; private IPmsPatientService patientService;
@Resource
private SysPowerService sysPowerService;
@ApiOperation("获取患者信息列表") @ApiOperation("获取患者信息列表")
@PostMapping("/queryList") @PostMapping("/queryList")
public JsonResponse<PageInfo<PmsPatientVo.PatientList>> queryPatientList(@RequestBody @Validated BaseDto<PmsPatientDto.QueryPatient> dto) { public JsonResponse<PageInfo<PmsPatientVo.PatientList>> queryPatientList(@RequestBody @Validated BaseDto<PmsPatientDto.QueryPatient> dto) {
//获取用户的权限 List<Long> deptIdList = new ArrayList<>();
LoginUser loginUser = SecurityUtils.getLoginUser(); if (dto.getParam().getDeptId() == null) {
//当前默认一个用户只有一个角色 try {
String dataScope = "5"; deptIdList.addAll(sysPowerService.queryPowerDept());
if(CollUtil.isNotEmpty(loginUser.getUser().getRoles())){ } catch (Exception e) {
dataScope = loginUser.getUser().getRoles().get(0).getDataScope(); log.info("获取当前登录用户部门错误");
// 获取请求携带的令牌
HttpServletRequest request = ((ServletRequestAttributes)
RequestContextHolder.getRequestAttributes()).getRequest();
String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID);
if (StrUtil.isNotEmpty(deptId)) {
deptIdList.add(Long.parseLong(deptId));
}
}
}else {
deptIdList.add(dto.getParam().getDeptId());
} }
startPage(dto); startPage(dto);
List<PmsPatientVo.PatientList> list = patientService.queryPatientList(dto.getParam(),dataScope,loginUser.getUserId(),loginUser.getUsername()); List<PmsPatientVo.PatientList> list = patientService.queryPatientList(dto.getParam(),null,SecurityUtils.getUserId(),SecurityUtils.getUsername(), deptIdList);
return JsonResponse.ok(new PageInfo<>(list)); return JsonResponse.ok(new PageInfo<>(list));
} }
@ -211,14 +229,24 @@ public class PmsController extends BaseController {
@ApiOperation("导出患者列表") @ApiOperation("导出患者列表")
@PostMapping("/exportPatient") @PostMapping("/exportPatient")
public void exportPatient(HttpServletResponse response, @RequestBody @Validated BaseDto<PmsPatientDto.QueryPatient> dto) throws IOException{ public void exportPatient(HttpServletResponse response, @RequestBody @Validated BaseDto<PmsPatientDto.QueryPatient> dto) throws IOException{
//获取用户的权限 List<Long> deptIdList = new ArrayList<>();
LoginUser loginUser = SecurityUtils.getLoginUser(); if (dto.getParam().getDeptId() == null) {
//当前默认一个用户只有一个角色 try {
String dataScope = "5"; deptIdList.addAll(sysPowerService.queryPowerDept());
if(CollUtil.isNotEmpty(loginUser.getUser().getRoles())){ } catch (Exception e) {
dataScope = loginUser.getUser().getRoles().get(0).getDataScope(); log.info("获取当前登录用户部门错误");
// 获取请求携带的令牌
HttpServletRequest request = ((ServletRequestAttributes)
RequestContextHolder.getRequestAttributes()).getRequest();
String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID);
if (StrUtil.isNotEmpty(deptId)) {
deptIdList.add(Long.parseLong(deptId));
}
}
}else {
deptIdList.add(dto.getParam().getDeptId());
} }
patientService.exportPatient(response, dto.getParam(), dataScope, loginUser.getUserId(),loginUser.getUsername()); patientService.exportPatient(response, dto.getParam(), null, SecurityUtils.getUserId(),SecurityUtils.getUsername(), deptIdList);
} }
@ApiOperation("查询就诊列表") @ApiOperation("查询就诊列表")

14
ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/RmsController.java

@ -3,6 +3,7 @@ package com.ccsens.admin.controller;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.CharsetUtil; import cn.hutool.core.util.CharsetUtil;
import com.ccsens.admin.service.IRmsService; import com.ccsens.admin.service.IRmsService;
import com.ccsens.common.annotation.Anonymous;
import com.ccsens.common.core.controller.BaseController; import com.ccsens.common.core.controller.BaseController;
import com.ccsens.common.core.domain.BaseDto; import com.ccsens.common.core.domain.BaseDto;
import com.ccsens.common.core.domain.JsonResponse; import com.ccsens.common.core.domain.JsonResponse;
@ -163,8 +164,8 @@ public class RmsController extends BaseController {
} }
@ApiOperation(value = "查询测评列表", notes = "管理员查询测评列表") @ApiOperation(value = "查询测评列表", notes = "管理员查询测评列表")
@PostMapping("/queryReport") @PostMapping("/queryEvaluation")
public JsonResponse<PageInfo<RmsVo.Report>> queryReport(@RequestBody @ApiParam @Valid BaseDto<RmsDto.ReportQuery> param) { public JsonResponse<PageInfo<RmsVo.Report>> queryEvaluation(@RequestBody @ApiParam @Valid BaseDto<RmsDto.ReportQuery> param) {
if (param.getPageNum() > 0) { if (param.getPageNum() > 0) {
PageHelper.startPage(param.getPageNum(), param.getPageSize()); PageHelper.startPage(param.getPageNum(), param.getPageSize());
} }
@ -177,4 +178,13 @@ public class RmsController extends BaseController {
rmsService.exportEvaluation(dto.getParam(), response); rmsService.exportEvaluation(dto.getParam(), response);
} }
@Anonymous
@ApiOperation(value = "查询报告单详情",notes = "根据测评ID查询报告单详情")
@PostMapping(value="/queryReport")
public JsonResponse<RmsVo.ReportDetail> queryReport(@RequestBody @ApiParam @Valid RmsDto.QueryDetail dto){
log.info("生成报告单请求参数:{}", dto);
RmsVo.ReportDetail detail = rmsService.queryReport(dto);
return JsonResponse.ok(detail);
}
} }

197
ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/StatisticsController.java

@ -4,9 +4,11 @@ import cn.hutool.core.util.StrUtil;
import com.ccsens.common.annotation.Anonymous; import com.ccsens.common.annotation.Anonymous;
import com.ccsens.common.constant.WebConstant; import com.ccsens.common.constant.WebConstant;
import com.ccsens.common.core.domain.JsonResponse; import com.ccsens.common.core.domain.JsonResponse;
import com.ccsens.common.utils.SecurityUtils;
import com.ccsens.system.domain.dto.StatisticsDto; import com.ccsens.system.domain.dto.StatisticsDto;
import com.ccsens.system.domain.vo.HomeDpVo; import com.ccsens.system.domain.vo.HomeDpVo;
import com.ccsens.system.service.StatisticsService; import com.ccsens.system.service.StatisticsService;
import com.ccsens.system.service.SysPowerService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -20,6 +22,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
@ -36,245 +39,367 @@ public class StatisticsController {
@Resource @Resource
private StatisticsService statisticsService; private StatisticsService statisticsService;
@Resource
private SysPowerService sysPowerService;
@Anonymous @Anonymous
@ApiOperation("获取疾病统计信息") @ApiOperation("获取疾病统计信息")
@PostMapping("/nntotal") @PostMapping("/nntotal")
public JsonResponse<HomeDpVo.Zhsjgl> nntotal(@RequestBody StatisticsDto.Query dto) { public JsonResponse<HomeDpVo.Zhsjgl> nntotal(@RequestBody StatisticsDto.Query dto) {
List<Long> deptIdList = new ArrayList<>();
if (dto.getDeptId() == null) { if (dto.getDeptId() == null) {
try {
deptIdList.addAll(sysPowerService.queryPowerDept());
} catch (Exception e) {
log.info("获取当前登录用户部门错误");
// 获取请求携带的令牌 // 获取请求携带的令牌
HttpServletRequest request = ((ServletRequestAttributes) HttpServletRequest request = ((ServletRequestAttributes)
RequestContextHolder.getRequestAttributes()).getRequest(); RequestContextHolder.getRequestAttributes()).getRequest();
String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID);
if (StrUtil.isNotEmpty(deptId)) { if (StrUtil.isNotEmpty(deptId)) {
dto.setDeptId(Long.parseLong(deptId)); deptIdList.add(Long.parseLong(deptId));
}
} }
}else {
deptIdList.add(dto.getDeptId());
} }
return JsonResponse.ok(statisticsService.nntotal(dto)); return JsonResponse.ok(statisticsService.nntotal(dto, deptIdList));
} }
@Anonymous @Anonymous
@ApiOperation("BMI") @ApiOperation("BMI")
@PostMapping("/nnbmihjxy") @PostMapping("/nnbmihjxy")
public JsonResponse<HomeDpVo.Bmi> nnbmihjxy(@RequestBody StatisticsDto.Query dto) { public JsonResponse<HomeDpVo.Bmi> nnbmihjxy(@RequestBody StatisticsDto.Query dto) {
List<Long> deptIdList = new ArrayList<>();
if (dto.getDeptId() == null) { if (dto.getDeptId() == null) {
try {
deptIdList.addAll(sysPowerService.queryPowerDept());
} catch (Exception e) {
log.info("获取当前登录用户部门错误");
// 获取请求携带的令牌 // 获取请求携带的令牌
HttpServletRequest request = ((ServletRequestAttributes) HttpServletRequest request = ((ServletRequestAttributes)
RequestContextHolder.getRequestAttributes()).getRequest(); RequestContextHolder.getRequestAttributes()).getRequest();
String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID);
if (StrUtil.isNotEmpty(deptId)) { if (StrUtil.isNotEmpty(deptId)) {
dto.setDeptId(Long.parseLong(deptId)); deptIdList.add(Long.parseLong(deptId));
} }
} }
return JsonResponse.ok(statisticsService.nnbmihjxy(dto)); }else {
deptIdList.add(dto.getDeptId());
}
return JsonResponse.ok(statisticsService.nnbmihjxy(dto, deptIdList));
} }
@Anonymous @Anonymous
@ApiOperation("评估情况") @ApiOperation("评估情况")
@PostMapping("/nnlast") @PostMapping("/nnlast")
public JsonResponse<List<HomeDpVo.Pgqk>> nnlast(@RequestBody StatisticsDto.Query dto) { public JsonResponse<List<HomeDpVo.Pgqk>> nnlast(@RequestBody StatisticsDto.Query dto) {
List<Long> deptIdList = new ArrayList<>();
if (dto.getDeptId() == null) { if (dto.getDeptId() == null) {
try {
deptIdList.addAll(sysPowerService.queryPowerDept());
} catch (Exception e) {
log.info("获取当前登录用户部门错误");
// 获取请求携带的令牌 // 获取请求携带的令牌
HttpServletRequest request = ((ServletRequestAttributes) HttpServletRequest request = ((ServletRequestAttributes)
RequestContextHolder.getRequestAttributes()).getRequest(); RequestContextHolder.getRequestAttributes()).getRequest();
String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID);
if (StrUtil.isNotEmpty(deptId)) { if (StrUtil.isNotEmpty(deptId)) {
dto.setDeptId(Long.parseLong(deptId)); deptIdList.add(Long.parseLong(deptId));
}
} }
}else {
deptIdList.add(dto.getDeptId());
} }
return JsonResponse.ok(statisticsService.nnlast(dto)); return JsonResponse.ok(statisticsService.nnlast(dto, deptIdList));
} }
@Anonymous @Anonymous
@ApiOperation("年龄") @ApiOperation("年龄")
@PostMapping("/nnage") @PostMapping("/nnage")
public JsonResponse<HomeDpVo.Nlfb> nnage(@RequestBody StatisticsDto.Query dto) { public JsonResponse<HomeDpVo.Nlfb> nnage(@RequestBody StatisticsDto.Query dto) {
List<Long> deptIdList = new ArrayList<>();
if (dto.getDeptId() == null) { if (dto.getDeptId() == null) {
try {
deptIdList.addAll(sysPowerService.queryPowerDept());
} catch (Exception e) {
log.info("获取当前登录用户部门错误");
// 获取请求携带的令牌 // 获取请求携带的令牌
HttpServletRequest request = ((ServletRequestAttributes) HttpServletRequest request = ((ServletRequestAttributes)
RequestContextHolder.getRequestAttributes()).getRequest(); RequestContextHolder.getRequestAttributes()).getRequest();
String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID);
if (StrUtil.isNotEmpty(deptId)) { if (StrUtil.isNotEmpty(deptId)) {
dto.setDeptId(Long.parseLong(deptId)); deptIdList.add(Long.parseLong(deptId));
} }
} }
return JsonResponse.ok(statisticsService.nnage(dto)); }else {
deptIdList.add(dto.getDeptId());
}
return JsonResponse.ok(statisticsService.nnage(dto, deptIdList));
} }
@Anonymous @Anonymous
@ApiOperation("T值") @ApiOperation("T值")
@PostMapping("/nntgb") @PostMapping("/nntgb")
public JsonResponse<HomeDpVo.Tz> nntgb(@RequestBody StatisticsDto.Query dto) { public JsonResponse<HomeDpVo.Tz> nntgb(@RequestBody StatisticsDto.Query dto) {
List<Long> deptIdList = new ArrayList<>();
if (dto.getDeptId() == null) { if (dto.getDeptId() == null) {
try {
deptIdList.addAll(sysPowerService.queryPowerDept());
} catch (Exception e) {
log.info("获取当前登录用户部门错误");
// 获取请求携带的令牌 // 获取请求携带的令牌
HttpServletRequest request = ((ServletRequestAttributes) HttpServletRequest request = ((ServletRequestAttributes)
RequestContextHolder.getRequestAttributes()).getRequest(); RequestContextHolder.getRequestAttributes()).getRequest();
String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID);
if (StrUtil.isNotEmpty(deptId)) { if (StrUtil.isNotEmpty(deptId)) {
dto.setDeptId(Long.parseLong(deptId)); deptIdList.add(Long.parseLong(deptId));
}
} }
}else {
deptIdList.add(dto.getDeptId());
} }
return JsonResponse.ok(statisticsService.nntgb(dto)); return JsonResponse.ok(statisticsService.nntgb(dto, deptIdList));
} }
@Anonymous @Anonymous
@ApiOperation("疾病排行") @ApiOperation("疾病排行")
@PostMapping("/nnicd") @PostMapping("/nnicd")
public JsonResponse<List<HomeDpVo.Jbph>> nnicd(@RequestBody StatisticsDto.Query dto) { public JsonResponse<List<HomeDpVo.Jbph>> nnicd(@RequestBody StatisticsDto.Query dto) {
List<Long> deptIdList = new ArrayList<>();
if (dto.getDeptId() == null) { if (dto.getDeptId() == null) {
try {
deptIdList.addAll(sysPowerService.queryPowerDept());
} catch (Exception e) {
log.info("获取当前登录用户部门错误");
// 获取请求携带的令牌 // 获取请求携带的令牌
HttpServletRequest request = ((ServletRequestAttributes) HttpServletRequest request = ((ServletRequestAttributes)
RequestContextHolder.getRequestAttributes()).getRequest(); RequestContextHolder.getRequestAttributes()).getRequest();
String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID);
if (StrUtil.isNotEmpty(deptId)) { if (StrUtil.isNotEmpty(deptId)) {
dto.setDeptId(Long.parseLong(deptId)); deptIdList.add(Long.parseLong(deptId));
} }
} }
return JsonResponse.ok(statisticsService.nnicd(dto)); }else {
deptIdList.add(dto.getDeptId());
}
return JsonResponse.ok(statisticsService.nnicd(dto, deptIdList));
} }
@Anonymous @Anonymous
@ApiOperation("地图") @ApiOperation("地图")
@PostMapping("/nnmap") @PostMapping("/nnmap")
public JsonResponse<List<HomeDpVo.Dt>> nnmap(@RequestBody StatisticsDto.Query dto) { public JsonResponse<List<HomeDpVo.Dt>> nnmap(@RequestBody StatisticsDto.Query dto) {
List<Long> deptIdList = new ArrayList<>();
if (dto.getDeptId() == null) { if (dto.getDeptId() == null) {
try {
deptIdList.addAll(sysPowerService.queryPowerDept());
} catch (Exception e) {
log.info("获取当前登录用户部门错误");
// 获取请求携带的令牌 // 获取请求携带的令牌
HttpServletRequest request = ((ServletRequestAttributes) HttpServletRequest request = ((ServletRequestAttributes)
RequestContextHolder.getRequestAttributes()).getRequest(); RequestContextHolder.getRequestAttributes()).getRequest();
String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID);
if (StrUtil.isNotEmpty(deptId)) { if (StrUtil.isNotEmpty(deptId)) {
dto.setDeptId(Long.parseLong(deptId)); deptIdList.add(Long.parseLong(deptId));
}
} }
}else {
deptIdList.add(dto.getDeptId());
} }
return JsonResponse.ok(statisticsService.nnmap(dto)); return JsonResponse.ok(statisticsService.nnmap(dto, deptIdList));
} }
@Anonymous @Anonymous
@ApiOperation("评估结果") @ApiOperation("评估结果")
@PostMapping("/nnscale") @PostMapping("/nnscale")
public JsonResponse<List<HomeDpVo.Pgjg>> nnscale(@RequestBody StatisticsDto.Query dto) { public JsonResponse<List<HomeDpVo.Pgjg>> nnscale(@RequestBody StatisticsDto.Query dto) {
List<Long> deptIdList = new ArrayList<>();
if (dto.getDeptId() == null) { if (dto.getDeptId() == null) {
try {
deptIdList.addAll(sysPowerService.queryPowerDept());
} catch (Exception e) {
log.info("获取当前登录用户部门错误");
// 获取请求携带的令牌 // 获取请求携带的令牌
HttpServletRequest request = ((ServletRequestAttributes) HttpServletRequest request = ((ServletRequestAttributes)
RequestContextHolder.getRequestAttributes()).getRequest(); RequestContextHolder.getRequestAttributes()).getRequest();
String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID);
if (StrUtil.isNotEmpty(deptId)) { if (StrUtil.isNotEmpty(deptId)) {
dto.setDeptId(Long.parseLong(deptId)); deptIdList.add(Long.parseLong(deptId));
} }
} }
return JsonResponse.ok(statisticsService.nnscale(dto)); }else {
deptIdList.add(dto.getDeptId());
}
return JsonResponse.ok(statisticsService.nnscale(dto, deptIdList));
} }
@Anonymous @Anonymous
@ApiOperation("学历统计") @ApiOperation("学历统计")
@PostMapping("/qualificationStatistics") @PostMapping("/qualificationStatistics")
public JsonResponse<List<HomeDpVo.QualificationStatistics>> qualificationStatistics(@RequestBody StatisticsDto.Query dto) { public JsonResponse<List<HomeDpVo.QualificationStatistics>> qualificationStatistics(@RequestBody StatisticsDto.Query dto) {
List<Long> deptIdList = new ArrayList<>();
if (dto.getDeptId() == null) { if (dto.getDeptId() == null) {
try {
deptIdList.addAll(sysPowerService.queryPowerDept());
} catch (Exception e) {
log.info("获取当前登录用户部门错误");
// 获取请求携带的令牌 // 获取请求携带的令牌
HttpServletRequest request = ((ServletRequestAttributes) HttpServletRequest request = ((ServletRequestAttributes)
RequestContextHolder.getRequestAttributes()).getRequest(); RequestContextHolder.getRequestAttributes()).getRequest();
String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID);
if (StrUtil.isNotEmpty(deptId)) { if (StrUtil.isNotEmpty(deptId)) {
dto.setDeptId(Long.parseLong(deptId)); deptIdList.add(Long.parseLong(deptId));
}
} }
}else {
deptIdList.add(dto.getDeptId());
} }
return JsonResponse.ok(statisticsService.qualificationStatistics(dto)); return JsonResponse.ok(statisticsService.qualificationStatistics(dto, deptIdList));
} }
@Anonymous @Anonymous
@ApiOperation("就诊数量统计") @ApiOperation("就诊数量统计")
@PostMapping("/jzStatistics") @PostMapping("/jzStatistics")
public JsonResponse<HomeDpVo.JzStatistics> jzStatistics(@RequestBody StatisticsDto.Query dto){ public JsonResponse<HomeDpVo.JzStatistics> jzStatistics(@RequestBody StatisticsDto.Query dto) {
List<Long> deptIdList = new ArrayList<>();
if (dto.getDeptId() == null) { if (dto.getDeptId() == null) {
try {
deptIdList.addAll(sysPowerService.queryPowerDept());
} catch (Exception e) {
log.info("获取当前登录用户部门错误");
// 获取请求携带的令牌 // 获取请求携带的令牌
HttpServletRequest request = ((ServletRequestAttributes) HttpServletRequest request = ((ServletRequestAttributes)
RequestContextHolder.getRequestAttributes()).getRequest(); RequestContextHolder.getRequestAttributes()).getRequest();
String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID);
if (StrUtil.isNotEmpty(deptId)) { if (StrUtil.isNotEmpty(deptId)) {
dto.setDeptId(Long.parseLong(deptId)); deptIdList.add(Long.parseLong(deptId));
} }
} }
return JsonResponse.ok(statisticsService.jzStatistics(dto)); }else {
deptIdList.add(dto.getDeptId());
}
return JsonResponse.ok(statisticsService.jzStatistics(dto, deptIdList));
} }
@Anonymous @Anonymous
@ApiOperation("测评量表统计") @ApiOperation("测评量表统计")
@PostMapping("/scaleStatistics") @PostMapping("/scaleStatistics")
public JsonResponse<List<HomeDpVo.ScaleStatistics>> scaleStatistics(@RequestBody StatisticsDto.Query dto){ public JsonResponse<List<HomeDpVo.ScaleStatistics>> scaleStatistics(@RequestBody StatisticsDto.Query dto) {
List<Long> deptIdList = new ArrayList<>();
if (dto.getDeptId() == null) { if (dto.getDeptId() == null) {
try {
deptIdList.addAll(sysPowerService.queryPowerDept());
} catch (Exception e) {
log.info("获取当前登录用户部门错误");
// 获取请求携带的令牌 // 获取请求携带的令牌
HttpServletRequest request = ((ServletRequestAttributes) HttpServletRequest request = ((ServletRequestAttributes)
RequestContextHolder.getRequestAttributes()).getRequest(); RequestContextHolder.getRequestAttributes()).getRequest();
String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID);
if (StrUtil.isNotEmpty(deptId)) { if (StrUtil.isNotEmpty(deptId)) {
dto.setDeptId(Long.parseLong(deptId)); deptIdList.add(Long.parseLong(deptId));
}
} }
}else {
deptIdList.add(dto.getDeptId());
} }
return JsonResponse.ok(statisticsService.scaleStatistics(dto)); return JsonResponse.ok(statisticsService.scaleStatistics(dto, deptIdList));
} }
@Anonymous @Anonymous
@ApiOperation("测评版本统计") @ApiOperation("测评版本统计")
@PostMapping("/versionStatistics") @PostMapping("/versionStatistics")
public JsonResponse<List<HomeDpVo.VersionStatistics>> versionStatistics(@RequestBody StatisticsDto.Query dto){ public JsonResponse<List<HomeDpVo.VersionStatistics>> versionStatistics(@RequestBody StatisticsDto.Query dto) {
List<Long> deptIdList = new ArrayList<>();
if (dto.getDeptId() == null) { if (dto.getDeptId() == null) {
try {
deptIdList.addAll(sysPowerService.queryPowerDept());
} catch (Exception e) {
log.info("获取当前登录用户部门错误");
// 获取请求携带的令牌 // 获取请求携带的令牌
HttpServletRequest request = ((ServletRequestAttributes) HttpServletRequest request = ((ServletRequestAttributes)
RequestContextHolder.getRequestAttributes()).getRequest(); RequestContextHolder.getRequestAttributes()).getRequest();
String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID);
if (StrUtil.isNotEmpty(deptId)) { if (StrUtil.isNotEmpty(deptId)) {
dto.setDeptId(Long.parseLong(deptId)); deptIdList.add(Long.parseLong(deptId));
} }
} }
return JsonResponse.ok(statisticsService.versionStatistics(dto)); }else {
deptIdList.add(dto.getDeptId());
}
return JsonResponse.ok(statisticsService.versionStatistics(dto, deptIdList));
} }
@Anonymous @Anonymous
@ApiOperation("测评师测评统计") @ApiOperation("测评师测评统计")
@PostMapping("/userStatistics") @PostMapping("/userStatistics")
public JsonResponse<List<HomeDpVo.UserStatistics>> userStatistics(@RequestBody StatisticsDto.Query dto){ public JsonResponse<List<HomeDpVo.UserStatistics>> userStatistics(@RequestBody StatisticsDto.Query dto) {
List<Long> deptIdList = new ArrayList<>();
if (dto.getDeptId() == null) { if (dto.getDeptId() == null) {
try {
deptIdList.addAll(sysPowerService.queryPowerDept());
} catch (Exception e) {
log.info("获取当前登录用户部门错误");
// 获取请求携带的令牌 // 获取请求携带的令牌
HttpServletRequest request = ((ServletRequestAttributes) HttpServletRequest request = ((ServletRequestAttributes)
RequestContextHolder.getRequestAttributes()).getRequest(); RequestContextHolder.getRequestAttributes()).getRequest();
String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID);
if (StrUtil.isNotEmpty(deptId)) { if (StrUtil.isNotEmpty(deptId)) {
dto.setDeptId(Long.parseLong(deptId)); deptIdList.add(Long.parseLong(deptId));
}
} }
}else {
deptIdList.add(dto.getDeptId());
} }
return JsonResponse.ok(statisticsService.userStatistics(dto)); return JsonResponse.ok(statisticsService.userStatistics(dto, deptIdList));
} }
@Anonymous @Anonymous
@ApiOperation("性别统计") @ApiOperation("性别统计")
@PostMapping("/sexStatistics") @PostMapping("/sexStatistics")
public JsonResponse<HomeDpVo.SexStatistics> sexStatistics(@RequestBody StatisticsDto.Query dto){ public JsonResponse<HomeDpVo.SexStatistics> sexStatistics(@RequestBody StatisticsDto.Query dto) {
List<Long> deptIdList = new ArrayList<>();
if (dto.getDeptId() == null) { if (dto.getDeptId() == null) {
try {
deptIdList.addAll(sysPowerService.queryPowerDept());
} catch (Exception e) {
log.info("获取当前登录用户部门错误");
// 获取请求携带的令牌 // 获取请求携带的令牌
HttpServletRequest request = ((ServletRequestAttributes) HttpServletRequest request = ((ServletRequestAttributes)
RequestContextHolder.getRequestAttributes()).getRequest(); RequestContextHolder.getRequestAttributes()).getRequest();
String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID);
if (StrUtil.isNotEmpty(deptId)) { if (StrUtil.isNotEmpty(deptId)) {
dto.setDeptId(Long.parseLong(deptId)); deptIdList.add(Long.parseLong(deptId));
} }
} }
return JsonResponse.ok(statisticsService.sexStatistics(dto)); }else {
deptIdList.add(dto.getDeptId());
}
return JsonResponse.ok(statisticsService.sexStatistics(dto, deptIdList));
} }
@Anonymous @Anonymous
@ApiOperation("吸烟饮酒统计") @ApiOperation("吸烟饮酒统计")
@PostMapping("/xyYjStatistics") @PostMapping("/xyYjStatistics")
public JsonResponse<HomeDpVo.XyYjStatistics> xyYjStatistics(@RequestBody StatisticsDto.Query dto){ public JsonResponse<HomeDpVo.XyYjStatistics> xyYjStatistics(@RequestBody StatisticsDto.Query dto) {
List<Long> deptIdList = new ArrayList<>();
if (dto.getDeptId() == null) { if (dto.getDeptId() == null) {
try {
deptIdList.addAll(sysPowerService.queryPowerDept());
} catch (Exception e) {
log.info("获取当前登录用户部门错误");
// 获取请求携带的令牌 // 获取请求携带的令牌
HttpServletRequest request = ((ServletRequestAttributes) HttpServletRequest request = ((ServletRequestAttributes)
RequestContextHolder.getRequestAttributes()).getRequest(); RequestContextHolder.getRequestAttributes()).getRequest();
String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID);
if (StrUtil.isNotEmpty(deptId)) { if (StrUtil.isNotEmpty(deptId)) {
dto.setDeptId(Long.parseLong(deptId)); deptIdList.add(Long.parseLong(deptId));
}
} }
}else {
deptIdList.add(dto.getDeptId());
} }
return JsonResponse.ok(statisticsService.xyYjStatistics(dto)); return JsonResponse.ok(statisticsService.xyYjStatistics(dto, deptIdList));
} }
} }

308
ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/controller/TjfxController.java

@ -1,154 +1,154 @@
package com.ccsens.admin.controller; //package com.ccsens.admin.controller;
//
import cn.hutool.core.util.StrUtil; //import cn.hutool.core.util.StrUtil;
import com.ccsens.common.annotation.Anonymous; //import com.ccsens.common.annotation.Anonymous;
import com.ccsens.common.constant.WebConstant; //import com.ccsens.common.constant.WebConstant;
import com.ccsens.common.core.domain.JsonResponse; //import com.ccsens.common.core.domain.JsonResponse;
import com.ccsens.system.domain.dto.StatisticsDto; //import com.ccsens.system.domain.dto.StatisticsDto;
import com.ccsens.system.domain.vo.HomeDpVo; //import com.ccsens.system.domain.vo.HomeDpVo;
import com.ccsens.system.service.StatisticsService; //import com.ccsens.system.service.StatisticsService;
import io.swagger.annotations.Api; //import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; //import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; //import lombok.extern.slf4j.Slf4j;
import org.springframework.web.HttpRequestHandler; //import org.springframework.web.HttpRequestHandler;
import org.springframework.web.bind.annotation.PostMapping; //import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; //import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; //import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; //import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.RequestContextHolder; //import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; //import org.springframework.web.context.request.ServletRequestAttributes;
//
import javax.annotation.Resource; //import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; //import javax.servlet.http.HttpServletRequest;
import java.util.List; //import java.util.List;
//
/** ///**
* @Author zzc // * @Author zzc
* @Package com.ccsens.admin.controller // * @Package com.ccsens.admin.controller
* @Date 2025/9/6 9:47 // * @Date 2025/9/6 9:47
* @description: // * @description:
*/ // */
@Slf4j //@Slf4j
@Api(tags = "统计分析") //@Api(tags = "统计分析")
@RestController //@RestController
@RequestMapping("/tjfx") //@RequestMapping("/tjfx")
public class TjfxController { //public class TjfxController {
//
@Resource // @Resource
private StatisticsService statisticsService; // private StatisticsService statisticsService;
//
//
@Anonymous // @Anonymous
@ApiOperation("获取疾病统计信息") // @ApiOperation("获取疾病统计信息")
@PostMapping("/nntotal") // @PostMapping("/nntotal")
public JsonResponse<HomeDpVo.Zhsjgl> nntotal(@RequestBody StatisticsDto.Query dto) { // public JsonResponse<HomeDpVo.Zhsjgl> nntotal(@RequestBody StatisticsDto.Query dto) {
return JsonResponse.ok(statisticsService.nntotal(dto)); // return JsonResponse.ok(statisticsService.nntotal(dto));
} // }
//
@Anonymous // @Anonymous
@ApiOperation("BMI") // @ApiOperation("BMI")
@PostMapping("/nnbmihjxy") // @PostMapping("/nnbmihjxy")
public JsonResponse<HomeDpVo.Bmi> nnbmihjxy(@RequestBody StatisticsDto.Query dto) { // public JsonResponse<HomeDpVo.Bmi> nnbmihjxy(@RequestBody StatisticsDto.Query dto) {
return JsonResponse.ok(statisticsService.nnbmihjxy(dto)); // return JsonResponse.ok(statisticsService.nnbmihjxy(dto));
} // }
//
@Anonymous // @Anonymous
@ApiOperation("评估情况") // @ApiOperation("评估情况")
@PostMapping("/nnlast") // @PostMapping("/nnlast")
public JsonResponse<List<HomeDpVo.Pgqk>> nnlast(@RequestBody StatisticsDto.Query dto) { // public JsonResponse<List<HomeDpVo.Pgqk>> nnlast(@RequestBody StatisticsDto.Query dto) {
return JsonResponse.ok(statisticsService.nnlast(dto)); // return JsonResponse.ok(statisticsService.nnlast(dto));
} // }
//
@Anonymous // @Anonymous
@ApiOperation("年龄") // @ApiOperation("年龄")
@PostMapping("/nnage") // @PostMapping("/nnage")
public JsonResponse<HomeDpVo.Nlfb> nnage(@RequestBody StatisticsDto.Query dto) { // public JsonResponse<HomeDpVo.Nlfb> nnage(@RequestBody StatisticsDto.Query dto) {
return JsonResponse.ok(statisticsService.nnage(dto)); // return JsonResponse.ok(statisticsService.nnage(dto));
} // }
//
@Anonymous // @Anonymous
@ApiOperation("T值") // @ApiOperation("T值")
@PostMapping("/nntgb") // @PostMapping("/nntgb")
public JsonResponse<HomeDpVo.Tz> nntgb(@RequestBody StatisticsDto.Query dto) { // public JsonResponse<HomeDpVo.Tz> nntgb(@RequestBody StatisticsDto.Query dto) {
return JsonResponse.ok(statisticsService.nntgb(dto)); // return JsonResponse.ok(statisticsService.nntgb(dto));
} // }
//
@Anonymous // @Anonymous
@ApiOperation("疾病排行") // @ApiOperation("疾病排行")
@PostMapping("/nnicd") // @PostMapping("/nnicd")
public JsonResponse<List<HomeDpVo.Jbph>> nnicd(@RequestBody StatisticsDto.Query dto) { // public JsonResponse<List<HomeDpVo.Jbph>> nnicd(@RequestBody StatisticsDto.Query dto) {
return JsonResponse.ok(statisticsService.nnicd(dto)); // return JsonResponse.ok(statisticsService.nnicd(dto));
} // }
//
@Anonymous // @Anonymous
@ApiOperation("地图") // @ApiOperation("地图")
@PostMapping("/nnmap") // @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)); // return JsonResponse.ok(statisticsService.nnmap(dto));
} // }
//
@Anonymous // @Anonymous
@ApiOperation("评估结果") // @ApiOperation("评估结果")
@PostMapping("/nnscale") // @PostMapping("/nnscale")
public JsonResponse<List<HomeDpVo.Pgjg>> nnscale(@RequestBody StatisticsDto.Query dto) { // public JsonResponse<List<HomeDpVo.Pgjg>> nnscale(@RequestBody StatisticsDto.Query dto) {
return JsonResponse.ok(statisticsService.nnscale(dto)); // return JsonResponse.ok(statisticsService.nnscale(dto));
} // }
//
@Anonymous // @Anonymous
@ApiOperation("学历统计") // @ApiOperation("学历统计")
@PostMapping("/qualificationStatistics") // @PostMapping("/qualificationStatistics")
public JsonResponse<List<HomeDpVo.QualificationStatistics>> qualificationStatistics(@RequestBody StatisticsDto.Query dto) { // public JsonResponse<List<HomeDpVo.QualificationStatistics>> qualificationStatistics(@RequestBody StatisticsDto.Query dto) {
return JsonResponse.ok(statisticsService.qualificationStatistics(dto)); // return JsonResponse.ok(statisticsService.qualificationStatistics(dto));
} // }
//
@Anonymous // @Anonymous
@ApiOperation("就诊数量统计") // @ApiOperation("就诊数量统计")
@PostMapping("/jzStatistics") // @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)); // return JsonResponse.ok(statisticsService.jzStatistics(dto));
} // }
//
@Anonymous // @Anonymous
@ApiOperation("测评量表统计") // @ApiOperation("测评量表统计")
@PostMapping("/scaleStatistics") // @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)); // return JsonResponse.ok(statisticsService.scaleStatistics(dto));
} // }
//
@Anonymous // @Anonymous
@ApiOperation("测评版本统计") // @ApiOperation("测评版本统计")
@PostMapping("/versionStatistics") // @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)); // return JsonResponse.ok(statisticsService.versionStatistics(dto));
} // }
//
@Anonymous // @Anonymous
@ApiOperation("测评师测评统计") // @ApiOperation("测评师测评统计")
@PostMapping("/userStatistics") // @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)); // return JsonResponse.ok(statisticsService.userStatistics(dto));
} // }
//
@Anonymous // @Anonymous
@ApiOperation("性别统计统计") // @ApiOperation("性别统计统计")
@PostMapping("/sexStatistics") // @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)); // return JsonResponse.ok(statisticsService.sexStatistics(dto));
} // }
//
@Anonymous // @Anonymous
@ApiOperation("吸烟饮酒统计") // @ApiOperation("吸烟饮酒统计")
@PostMapping("/xyYjStatistics") // @PostMapping("/xyYjStatistics")
public JsonResponse<HomeDpVo.XyYjStatistics> xyYjStatistics(@RequestBody StatisticsDto.Query dto) { // public JsonResponse<HomeDpVo.XyYjStatistics> xyYjStatistics(@RequestBody StatisticsDto.Query dto) {
if (dto.getDeptId() == null) { // if (dto.getDeptId() == null) {
// 获取请求携带的令牌 // // 获取请求携带的令牌
HttpServletRequest request = ((ServletRequestAttributes) // HttpServletRequest request = ((ServletRequestAttributes)
RequestContextHolder.getRequestAttributes()).getRequest(); // RequestContextHolder.getRequestAttributes()).getRequest();
String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID); // String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID);
if (StrUtil.isNotEmpty(deptId)) { // if (StrUtil.isNotEmpty(deptId)) {
dto.setDeptId(Long.parseLong(deptId)); // dto.setDeptId(Long.parseLong(deptId));
} // }
} // }
return JsonResponse.ok(statisticsService.xyYjStatistics(dto)); // return JsonResponse.ok(statisticsService.xyYjStatistics(dto));
} // }
} //}

4
ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/persist/dao/PmsPatientDao.java

@ -6,6 +6,7 @@ import com.ccsens.system.domain.po.PmsPatient;
import com.ccsens.system.domain.vo.PmsPatientVo; import com.ccsens.system.domain.vo.PmsPatientVo;
import com.ccsens.system.persist.mapper.PmsPatientMapper; import com.ccsens.system.persist.mapper.PmsPatientMapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.security.core.parameters.P;
import java.util.List; import java.util.List;
@ -13,7 +14,8 @@ public interface PmsPatientDao extends PmsPatientMapper {
List<PmsPatientVo.PatientList> queryPatientList(@Param("param") PmsPatientDto.QueryPatient param, List<PmsPatientVo.PatientList> queryPatientList(@Param("param") PmsPatientDto.QueryPatient param,
@Param("dataScope") String dataScope, @Param("dataScope") String dataScope,
@Param("userId") Long userId, @Param("userId") Long userId,
@Param("userName")String userName); @Param("userName")String userName,
@Param("deptIdList")List<Long> deptIdList);
PmsPatientVo.PatientInfo queryPatientEvaluationById(@Param("id")Long id); PmsPatientVo.PatientInfo queryPatientEvaluationById(@Param("id")Long id);

2
ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/persist/dao/RmsDao.java

@ -138,7 +138,7 @@ public interface RmsDao {
List<RmsVo.Report> queryReport(@Param("dto") RmsDto.ReportQuery dto, List<RmsVo.Report> queryReport(@Param("dto") RmsDto.ReportQuery dto,
@Param("userId") Long userId); @Param("userId") Long userId);
List<RmsVo.ReportScore> queryEmsScaleScore(@Param("evaId") Long evaId, List<RmsVo.ReportScore> queryEmsScaleScore(@Param("evaluationId") Long evaluationId,
@Param("scaleCodeList") List<String> scaleCodeList); @Param("scaleCodeList") List<String> scaleCodeList);
List<RmsVo.ReportPDF> viewReportPdfByVisitNo(@Param("visitNo")String visitNo); List<RmsVo.ReportPDF> viewReportPdfByVisitNo(@Param("visitNo")String visitNo);

5
ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/IPmsPatientService.java

@ -18,7 +18,8 @@ public interface IPmsPatientService {
List<PmsPatientVo.PatientList> queryPatientList(PmsPatientDto.QueryPatient dto, List<PmsPatientVo.PatientList> queryPatientList(PmsPatientDto.QueryPatient dto,
String dataScope, String dataScope,
Long userId, Long userId,
String userName); String userName,
List<Long> deptIdList);
PmsPatientVo.PatientInfo queryPatientByIdCard(PmsPatientDto.QueryPatient param); PmsPatientVo.PatientInfo queryPatientByIdCard(PmsPatientDto.QueryPatient param);
@ -48,7 +49,7 @@ public interface IPmsPatientService {
Integer batchSaveTjbg(List<LdPatientRecord> pmsPatientList); Integer batchSaveTjbg(List<LdPatientRecord> pmsPatientList);
void exportPatient(HttpServletResponse response, PmsPatientDto.QueryPatient param, String dataScope, Long userId, String userName) throws IOException; void exportPatient(HttpServletResponse response, PmsPatientDto.QueryPatient param, String dataScope, Long userId, String userName, List<Long> deptIdList) throws IOException;
// //
// Long insertPatientIllnessHistory(AmsPatientReportDto.EditPatientIllnessHistory param,Long patientId); // Long insertPatientIllnessHistory(AmsPatientReportDto.EditPatientIllnessHistory param,Long patientId);
// //

127
ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/impl/AmsReportServiceImpl.java

@ -870,6 +870,7 @@ public class AmsReportServiceImpl implements AmsReportService {
Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$"); Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
return pattern.matcher(str).matches(); 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) { 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(); RmsVo.ReportPatient patientInfo = detail.getPatient();
params.put("h_name", patientInfo.getHospitalName()); params.put("h_name", patientInfo.getHospitalName());
@ -877,6 +878,32 @@ public class AmsReportServiceImpl implements AmsReportService {
params.put("p_name", patientInfo.getPatientName()); params.put("p_name", patientInfo.getPatientName());
params.put("p_sex", patientInfo.getSex() == 0 ? "男" : "女"); params.put("p_sex", patientInfo.getSex() == 0 ? "男" : "女");
params.put("p_age", patientInfo.getPatientAge()); 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; CultureEnum cultureEnum = null;
if (dto.getSignId() != null) { if (dto.getSignId() != null) {
HmsDoctorSign emsEvaluationInformedConsent = hmsDoctorSignMapper.selectByPrimaryKey(dto.getSignId()); HmsDoctorSign emsEvaluationInformedConsent = hmsDoctorSignMapper.selectByPrimaryKey(dto.getSignId());
@ -926,32 +953,32 @@ public class AmsReportServiceImpl implements AmsReportService {
params.put("place", patientInfoById.getNativePlace()); params.put("place", patientInfoById.getNativePlace());
params.put("address", patientInfoById.getAddress()); params.put("address", patientInfoById.getAddress());
params.put("hobby", patientInfoById.getHobby()); params.put("hobby", patientInfoById.getHobby());
params.put("aboBlood", patientInfoById.getAboBloodType()); 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", patientInfoById.getRhBloodType()); 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", pmsPatientBodyMap.get("visit_type")); params.put("visit_type", ObjectUtil.isEmpty(pmsPatientBodyMap.get("visitType")) ? "" : ObjectUtil.equals(pmsPatientBodyMap.get("visitType"), "1") ? "门诊" : "住院");
params.put("visitNo", pmsPatientBodyMap.get("outpatient_no")); params.put("visitNo", pmsPatientBodyMap.get("outpatientNo"));
params.put("age", pmsPatientBodyMap.get("age")); params.put("age", pmsPatientBodyMap.get("age"));
params.put("dept", pmsPatientBodyMap.get("department")); params.put("dept", pmsPatientBodyMap.get("department"));
params.put("doctor", pmsPatientBodyMap.get("doctor")); params.put("doctor", pmsPatientBodyMap.get("doctor"));
params.put("admissionDate", pmsPatientBodyMap.get("admission_date")); params.put("admissionDate", ObjectUtil.isEmpty(pmsPatientBodyMap.get("admissionDate")) ? "": DateUtil.format(DateUtil.parse(pmsPatientBodyMap.get("admissionDate").toString()), "yyyy-MM-dd"));
params.put("num", pmsPatientBodyMap.get("admission_count")); params.put("num", pmsPatientBodyMap.get("admissionCount"));
params.put("admissionMethod", pmsPatientBodyMap.get("admission_method")); 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("bed_number")); params.put("bedNumber", pmsPatientBodyMap.get("bedNumber"));
params.put("dischargeDate", pmsPatientBodyMap.get("")); params.put("dischargeDate", ObjectUtil.isEmpty(pmsPatientBodyMap.get("dischargeDate")) ? "": DateUtil.format(DateUtil.parse(pmsPatientBodyMap.get("dischargeDate").toString()), "yyyy-MM-dd"));
params.put("dischargeMethod", pmsPatientBodyMap.get("discharge_date")); 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", pmsPatientBodyMap.get("height")); params.put("height", ObjectUtil.isEmpty(pmsPatientBodyMap.get("height")) ? "" : pmsPatientBodyMap.get("height") + "cm");
params.put("weight", pmsPatientBodyMap.get("weight")); params.put("weight", ObjectUtil.isEmpty(pmsPatientBodyMap.get("weight")) ? "" : pmsPatientBodyMap.get("weight") + "kg");
params.put("bmi", pmsPatientBodyMap.get("bmi")); params.put("bmi", pmsPatientBodyMap.get("bmi"));
params.put("tz", pmsPatientBodyMap.get("tz")); params.put("tz", pmsPatientBodyMap.get("tz"));
params.put("temperature", pmsPatientBodyMap.get("temperature")); params.put("temperature", pmsPatientBodyMap.get("temperature"));
params.put("systolic_pressure", pmsPatientBodyMap.get("systolic_pressure")); params.put("systolic_pressure", pmsPatientBodyMap.get("systolicPressure"));
params.put("diastolic_pressure", pmsPatientBodyMap.get("diastolic_pressure")); params.put("diastolic_pressure", pmsPatientBodyMap.get("diastolicPressure"));
params.put("pulse", pmsPatientBodyMap.get("pulse")); params.put("pulse", pmsPatientBodyMap.get("pulse"));
params.put("creatinine", pmsPatientBodyMap.get("creatinine")); params.put("creatinine", pmsPatientBodyMap.get("creatinine"));
params.put("oxygen_saturation", pmsPatientBodyMap.get("oxygen_saturation")); params.put("oxygen_saturation", pmsPatientBodyMap.get("oxygenSaturation"));
params.put("albumin", pmsPatientBodyMap.get("albumin")); params.put("albumin", pmsPatientBodyMap.get("albumin"));
params.put("total_protein", pmsPatientBodyMap.get("total_protein")); params.put("total_protein", pmsPatientBodyMap.get("totalProtein"));
params.put("vitamin_d3", pmsPatientBodyMap.get("vitamin_d3")); params.put("vitamin_d3", pmsPatientBodyMap.get("vitaminD3"));
params.put("hematocrit", pmsPatientBodyMap.get("hematocrit")); params.put("hematocrit", pmsPatientBodyMap.get("hematocrit"));
params.put("dimer", pmsPatientBodyMap.get("dimer")); params.put("dimer", pmsPatientBodyMap.get("dimer"));
} }
@ -983,24 +1010,18 @@ public class AmsReportServiceImpl implements AmsReportService {
// params.put("cpy_img_url", patientInfo.getName()); // params.put("cpy_img_url", patientInfo.getName());
params.put("report_date", DateUtil.date(patientInfo.getReportTime())); params.put("report_date", DateUtil.date(patientInfo.getReportTime()));
params.put("reportDate", DateUtil.format(DateUtil.date(patientInfo.getReportTime()), "yyyy-MM-dd"));
//生成表格 //生成表格
// 创建带有样式的文本 //查询报告数据
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()); List<RmsVo.ExportInfo> exportInfos = rmsDao.queryReportExportInfo(dto.getEvaluationId());
if (CollUtil.isEmpty(exportInfos)) { if (CollUtil.isEmpty(exportInfos)) {
return null; return null;
} }
RowRenderData titleRow = Rows.of("一级指标/二级指标", "量表名称", "得分", "结论").create();
Tables.TableBuilder of = Tables.of(headerRow, titleRow); RowRenderData titleRow = Rows.of("一级指标/二级指标", "量表名称", "得分", "结论").center()
.create();
Tables.TableBuilder of = Tables.of(titleRow);
for (int i = 0; i < exportInfos.size(); i++) { for (int i = 0; i < exportInfos.size(); i++) {
RmsVo.Pgjl pgjl = new RmsVo.Pgjl(); RmsVo.Pgjl pgjl = new RmsVo.Pgjl();
params.put("yjzb", exportInfos.get(i).getComboParentName()); params.put("yjzb", exportInfos.get(i).getComboParentName());
@ -1018,7 +1039,7 @@ public class AmsReportServiceImpl implements AmsReportService {
textName, textName,
textScore, textScore,
textImpression textImpression
).create(); ).center().create();
// if (StrUtil.isNotEmpty(exportInfos.get(i).getComboName() + "/" + exportInfos.get(i).getComboParentName())) { // 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.mergeRule(MergeCellRule.builder().map(MergeCellRule.Grid.of(i + 1, i + 1), MergeCellRule.Grid.of(0, 1)).build());
// } // }
@ -1037,7 +1058,7 @@ public class AmsReportServiceImpl implements AmsReportService {
textName, textName,
textScore, textScore,
textImpression textImpression
).create(); ).center().create();
of.addRow(row1); of.addRow(row1);
} else { } else {
TextRenderData textStr = Texts.of(exportInfos.get(i).getImpression().contains("\n") ? "量表结论" + "\n" + "肌少总结论" : "肌少总结论").bold().create(); TextRenderData textStr = Texts.of(exportInfos.get(i).getImpression().contains("\n") ? "量表结论" + "\n" + "肌少总结论" : "肌少总结论").bold().create();
@ -1052,12 +1073,12 @@ public class AmsReportServiceImpl implements AmsReportService {
textName, textName,
textImpression, textImpression,
textScore textScore
).create(); ).center().create();
if (StrUtil.isNotEmpty(exportInfos.get(i).getComboName() + "/" + exportInfos.get(i).getComboParentName())) { if (StrUtil.isNotEmpty(exportInfos.get(i).getComboName() + "/" + exportInfos.get(i).getComboParentName())) {
of.mergeRule( of.mergeRule(
MergeCellRule.builder().map( MergeCellRule.builder().map(
MergeCellRule.Grid.of(i + 2, 0), MergeCellRule.Grid.of(i + 2, 1)) MergeCellRule.Grid.of(i + 1, 0), MergeCellRule.Grid.of(i + 1, 1))
.map(MergeCellRule.Grid.of(i + 2, 2), MergeCellRule.Grid.of(i + 2, 3) .map(MergeCellRule.Grid.of(i + 1, 2), MergeCellRule.Grid.of(i + 1, 3)
).build() ).build()
); );
@ -1136,16 +1157,52 @@ public class AmsReportServiceImpl implements AmsReportService {
listMap.add(map); listMap.add(map);
} }
} }
//阳性报告单
generateYx(params, exportInfos);
params.put("questionTables", listMap); params.put("questionTables", listMap);
TableRenderData tableData = of TableRenderData tableData = of
.center()
.create(); .create();
params.put("table", tableData); params.put("table", tableData);
return params; 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 @Override
public AmsReportVo.Result export(RmsDto.Export dto) { public AmsReportVo.Result export(RmsDto.Export dto) {
//1. 查询是否已生成对应版本的报告单 //1. 查询是否已生成对应版本的报告单

8
ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/impl/PmsPatientServiceImpl.java

@ -101,13 +101,13 @@ public class PmsPatientServiceImpl implements IPmsPatientService {
private String ldTjbgDir; private String ldTjbgDir;
@Override @Override
public List<PmsPatientVo.PatientList> queryPatientList(PmsPatientDto.QueryPatient param, String dataScope, Long userId, String userName) { public List<PmsPatientVo.PatientList> queryPatientList(PmsPatientDto.QueryPatient param, String dataScope, Long userId, String userName,List<Long> deptIdList) {
//处理身份证信息 //处理身份证信息
if (StrUtil.isNotEmpty(param.getIdCard()) && IdcardUtil.isValidCard(param.getIdCard())) { if (StrUtil.isNotEmpty(param.getIdCard()) && IdcardUtil.isValidCard(param.getIdCard())) {
String hash = Md5Utils.hash(param.getIdCard().substring(2, 14)); String hash = Md5Utils.hash(param.getIdCard().substring(2, 14));
param.setIdCard(param.getIdCard().substring(0, 2) + hash + param.getIdCard().substring(14, 18)); param.setIdCard(param.getIdCard().substring(0, 2) + hash + param.getIdCard().substring(14, 18));
} }
return patientDao.queryPatientList(param, dataScope, SecurityUtils.isAdmin(userId) ? null : userId, userName); return patientDao.queryPatientList(param, dataScope, SecurityUtils.isAdmin(userId) ? null : userId, userName, deptIdList);
} }
@Override @Override
@ -2145,8 +2145,8 @@ public class PmsPatientServiceImpl implements IPmsPatientService {
} }
@Override @Override
public void exportPatient(HttpServletResponse response, PmsPatientDto.QueryPatient param, String dataScope, Long userId, String userName) throws IOException { public void exportPatient(HttpServletResponse response, PmsPatientDto.QueryPatient param, String dataScope, Long userId, String userName,List<Long> deptIdList) throws IOException {
List<PmsPatientVo.PatientList> patientLists = queryPatientList(param, dataScope, userId, userName); List<PmsPatientVo.PatientList> patientLists = queryPatientList(param, dataScope, userId, userName, deptIdList);
if (CollUtil.isEmpty(patientLists)) { if (CollUtil.isEmpty(patientLists)) {
throw new BaseException("没有数据"); throw new BaseException("没有数据");
} }

23
ruisi_java/ruisi-web-admin/src/main/java/com/ccsens/admin/service/impl/RmsServiceImpl.java

@ -2942,11 +2942,32 @@ public class RmsServiceImpl implements IRmsService {
} }
} }
//查询测评量表 //查询测评量表
List<RmsVo.ReportScore> scores = rmsDao.queryEmsScaleScore(dto.getEvaluationId(), CollectionUtil.newArrayList()); List<RmsVo.ReportScore> scores = rmsDao.queryEmsScaleScore(report.getEvaluationId(), CollectionUtil.newArrayList());
if (CollUtil.isNotEmpty(scores)) { if (CollUtil.isNotEmpty(scores)) {
//组装成父子级关系 //组装成父子级关系
scores = buildReportScoreTree(scores, 0L); 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.setPatient(reportPatient);
detail.setScores(scores); detail.setScores(scores);
return detail; return detail;

222
ruisi_java/ruisi-web-admin/src/main/resources/mapper/dao/PmsPatientDao.xml

@ -77,45 +77,83 @@
</delete> </delete>
<select id="queryPatientList" resultType="com.ccsens.system.domain.vo.PmsPatientVo$PatientList"> <select id="queryPatientList" resultType="com.ccsens.system.domain.vo.PmsPatientVo$PatientList">
SELECT SELECT DISTINCT
DISTINCT a.patientId,
pp.id as patientId, a.patientName,
pp.`name` as patientName, a.sex,
a.idcard,
a.phone, -- 核心修复:将 a.mobile 改为 a.phone(与内层别名一致)
a.educationalStatus,
a.independentLivingSkills,
a.birthNumber,
a.dwellingState,
a.lastEvaluationTime,
a.lastTesterName, -- 修正之前的笔误(原 astTesterName)
a.evaluationCount,
a.createBy,
a.createTime,
a.hospitalName,
a.birthday,
a.career,
a.maritalStatus,
a.domicile,
a.nation,
a.nativePlace,
a.contactName,
a.contactRelation,
a.contactMobile,
a.address,
a.belief,
a.hobby,
a.aboBloodType,
a.rhBloodType
FROM
(
SELECT DISTINCT
pp.id AS patientId,
pp.`name` AS patientName,
pp.sex, pp.sex,
-- pp.age,
pp.idcard, pp.idcard,
pp.mobile as phone, pp.mobile AS phone, -- 内层别名是 phone
pp.educational_status as educationalStatus, pp.educational_status AS educationalStatus,
pp.independent_living_skills as independentLivingSkills, pp.independent_living_skills AS independentLivingSkills,
pp.birth_number as birthNumber, pp.birth_number AS birthNumber,
pp.dwelling_state as dwellingState, pp.dwelling_state AS dwellingState,
MAX(ee.create_time) as lastEvaluationTime, MAX(ee.create_time) AS lastEvaluationTime,
uu.nick_name as lastTesterName, uu.nick_name AS lastTesterName,
COUNT(ee.id) as evaluationCount, COUNT(ee.id) AS evaluationCount,
(select nick_name from ums_user where user_name = pp.create_by and del_flag = 0) as createBy, (SELECT nick_name FROM ums_user WHERE user_name = pp.create_by AND del_flag = 0) AS createBy,
pp.create_time as createTime, pp.create_time AS createTime,
ud.dept_name as hospitalName, ud.dept_name AS hospitalName,
pp.birthday, pp.birthday,
pp.career, pp.career,
pp.marital_status as maritalStatus, pp.marital_status AS maritalStatus,
pp.domicile, pp.domicile,
pp.nation, pp.nation,
pp.native_place as nativePlace, pp.native_place AS nativePlace,
pp.contact_name as contactName, pp.contact_name AS contactName,
pp.contact_relation as contactRelation, pp.contact_relation AS contactRelation,
pp.contact_mobile as contactMobile, pp.contact_mobile AS contactMobile,
pp.address, pp.address,
pp.belief, pp.belief,
pp.hobby, pp.hobby,
pp.abo_blood_type as aboBloodType, pp.abo_blood_type AS aboBloodType,
pp.rh_blood_type as rhBloodType pp.rh_blood_type AS rhBloodType
FROM FROM
pms_patient pp pms_patient pp
LEFT JOIN ems_evaluation ee ON pp.id = ee.patient_id and ee.del_flag = 0 LEFT JOIN ems_evaluation ee ON pp.id = ee.patient_id AND ee.del_flag = 0
LEFT JOIN ums_user uu ON ee.tester_id = uu.user_id LEFT JOIN ums_user uu ON ee.tester_id = uu.user_id
LEFT JOIN ums_dept ud ON pp.hospital_id = ud.dept_id LEFT JOIN ums_dept ud ON pp.hospital_id = ud.dept_id
WHERE WHERE
pp.del_flag = 0 pp.del_flag = 0
<if test="deptIdList != null and deptIdList.size()>0">
<if test="deptIdList != null and deptIdList.size()>0">
and pp.hospital_id IN
<foreach item="item" collection="deptIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</if>
<if test="param.searchValue != null and param.searchValue != ''"> <if test="param.searchValue != null and param.searchValue != ''">
and ( and (
pp.name like CONCAT('%',#{param.searchValue},'%') pp.name like CONCAT('%',#{param.searchValue},'%')
@ -169,35 +207,112 @@
</when> </when>
</choose> </choose>
</if> </if>
<if test="userId != null"> GROUP BY
<!-- 权限 总测评师和测评师都是本部门及以下 --> pp.id
and uu.dept_id IN ( UNION ALL
SELECT d.dept_id FROM ums_user u LEFT JOIN ums_dept d on (d.dept_id = u.dept_id or SELECT DISTINCT
FIND_IN_SET(u.dept_id,ancestors)) pp.id AS patientId,
WHERE user_id = #{userId} pp.`name` AS patientName,
pp.sex,
pp.idcard,
pp.mobile AS phone, -- 内层别名统一为 phone
pp.educational_status AS educationalStatus,
pp.independent_living_skills AS independentLivingSkills,
pp.birth_number AS birthNumber,
pp.dwelling_state AS dwellingState,
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 createBy,
pp.create_time AS createTime,
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 pms_patient_body pb ON pb.patient_id = pp.id AND pb.del_flag = 0
LEFT JOIN ems_evaluation ee ON pp.id = ee.patient_id AND ee.del_flag = 0
LEFT JOIN ums_user uu ON ee.tester_id = uu.user_id
LEFT JOIN ums_dept ud ON pp.hospital_id = ud.dept_id
WHERE
pp.del_flag = 0
<if test="param.searchValue != null and param.searchValue != ''">
and (
pp.name like CONCAT('%',#{param.searchValue},'%')
or
pp.name_initial like CONCAT('%',LOWER(#{param.searchValue}),'%')
or
pp.name_full like CONCAT('%',LOWER(#{param.searchValue}),'%')
or
pp.idcard like CONCAT('%',#{param.searchValue},'%')
) )
</if> </if>
<!-- <choose>--> <if test="param.beginTime != null and param.beginTime != ''"><!-- 开始时间检索 -->
<!-- <when test="dataScope == 5">--> and date_format(pp.create_time,'%y%m%d') &gt;= date_format(#{param.beginTime},'%y%m%d')
<!-- and (pp.create_by = #{userName} or ae.tester_id = #{userId})--> </if>
<!-- </when>--> <if test="param.endTime != null and param.endTime != ''"><!-- 结束时间检索 -->
<!-- &lt;!&ndash; 当前医院不区分多级,所以本部门及以下权限和本部门数据权限使用相同的查询语句 &ndash;&gt;--> and date_format(pp.create_time,'%y%m%d') &lt;= date_format(#{param.endTime},'%y%m%d')
<!-- <when test="dataScope == 3 or dataScope == 4">--> </if>
<!-- and uu.dept_id = (SELECT dept_id FROM ums_user WHERE user_id = #{userId})--> <if test="param.hospitalId != null">
<!-- </when>--> and pp.hospital_id = #{param.hospitalId}
<!-- <when test="dataScope == 2">--> </if>
<!-- and uu.dept_id in (--> <if test="param.sex != null">
<!-- SELECT pud.dept_id FROM ums_user u--> and pp.sex = #{param.sex}
<!-- LEFT JOIN ums_dept ud ON ud.dept_id = u.dept_id--> </if>
<!-- LEFT JOIN ums_dept pud ON pud.dept_id = ud.parent_id--> <if test="param.deptId != null">
<!-- WHERE u.user_id = #{userId}--> and pp.hospital_id = #{param.deptId}
<!-- UNION ALL--> </if>
<!-- SELECT u.dept_id FROM ums_user u WHERE u.user_id = #{userId}--> <if test="param.educationalStatus != null">
<!-- )--> and pp.educational_status = #{param.educationalStatus}
<!-- </when>--> </if>
<!-- </choose>--> <if test="param.ageStatus != null">
GROUP BY pp.id <choose>
order by pp.create_time desc <when test="param.ageStatus == 0">
and (TIMESTAMPDIFF(YEAR, pp.birthday, CURDATE()) -
(DATE_FORMAT(CURDATE(), '%m%d') &lt; DATE_FORMAT(pp.birthday, '%m%d'))) &lt; 60
</when>
<when test="param.ageStatus == 1">
and (TIMESTAMPDIFF(YEAR, pp.birthday, CURDATE()) -
(DATE_FORMAT(CURDATE(), '%m%d') &lt; DATE_FORMAT(pp.birthday, '%m%d'))) BETWEEN 60 AND 69
</when>
<when test="param.ageStatus == 2">
and (TIMESTAMPDIFF(YEAR, pp.birthday, CURDATE()) -
(DATE_FORMAT(CURDATE(), '%m%d') &lt; DATE_FORMAT(pp.birthday, '%m%d'))) BETWEEN 70 AND 79
</when>
<when test="param.ageStatus == 3">
and (TIMESTAMPDIFF(YEAR, pp.birthday, CURDATE()) -
(DATE_FORMAT(CURDATE(), '%m%d') &lt; DATE_FORMAT(pp.birthday, '%m%d'))) BETWEEN 80 AND 89
</when>
<when test="param.ageStatus == 4">
and (TIMESTAMPDIFF(YEAR, pp.birthday, CURDATE()) -
(DATE_FORMAT(CURDATE(), '%m%d') &lt; DATE_FORMAT(pp.birthday, '%m%d'))) >= 90
</when>
</choose>
</if>
<if test="deptIdList != null and deptIdList.size()>0">
<if test="deptIdList != null and deptIdList.size()>0">
and pp.hospital_id IN
<foreach item="item" collection="deptIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</if>
GROUP BY
pp.id
) a
ORDER BY a.createTime DESC
</select> </select>
<select id="queryPatientByIdCard" resultType="com.ccsens.system.domain.vo.PmsPatientVo$PatientInfo"> <select id="queryPatientByIdCard" resultType="com.ccsens.system.domain.vo.PmsPatientVo$PatientInfo">
SELECT SELECT
@ -307,7 +422,7 @@
from from
pms_patient_body b pms_patient_body b
left join pms_patient p on b.patient_id = p.id left join pms_patient p on b.patient_id = p.id
left join ums_user uu on p.create_by = uu.user_name left join ums_user uu on b.create_by = uu.user_name
<where> <where>
b.del_flag = 0 and p.del_flag = 0 b.del_flag = 0 and p.del_flag = 0
<if test="param.visitType != null"> <if test="param.visitType != null">
@ -335,5 +450,8 @@
</if> </if>
</where> </where>
order by b.id desc order by b.id desc
</select> </select>
</mapper> </mapper>

66
ruisi_java/ruisi-web-admin/src/main/resources/mapper/dao/RmsDao.xml

@ -1010,7 +1010,8 @@ d.dept_name as hospitalName
<select id="queryReportListCopyClient" resultType="com.ccsens.system.domain.vo.RmsVo$QueryReportHistoryPatient"> <select id="queryReportListCopyClient" resultType="com.ccsens.system.domain.vo.RmsVo$QueryReportHistoryPatient">
SELECT SELECT
rr.id as evaluationId, rr.id as reportId,
ee.id as evaluationId,
pp.name, pp.name,
pp.sex, pp.sex,
pb.outpatient_no as outpatientNo, pb.outpatient_no as outpatientNo,
@ -1024,8 +1025,8 @@ d.dept_name as hospitalName
FROM FROM
rms_report rr rms_report rr
Left Join pms_patient_body pb on rr.visit_no = pb.outpatient_no and pb.del_flag = 0 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 ems_evaluation ee on rr.evaluation_id = ee.id
LEFT JOIN pms_patient pp on ee.patient_id = pp.id
LEFT JOIN hms_version hv on ee.version = hv.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 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 ems_evaluation_scale_relevance e on e.evaluation_id = ee.id and e.del_flag = 0
@ -1500,46 +1501,59 @@ d.dept_name as hospitalName
<select id="queryEmsScaleScore" resultType="com.ccsens.system.domain.vo.RmsVo$ReportScore"> <select id="queryEmsScaleScore" resultType="com.ccsens.system.domain.vo.RmsVo$ReportScore">
WITH RECURSIVE cognitive_relevance_tree AS ( WITH RECURSIVE cognitive_relevance_tree AS (
SELECT SELECT
id AS node_id, r.id AS scale_id,
evaluation_id, r.evaluation_id,
scale_code AS scale_code, r.scale_code AS scale_code,
'' AS second_level_cognitive_code, q.name as name,
cognitive_code AS current_cognitive_code, q.description,
score AS level_score, r.score AS level_score,
total_score AS level_total_score, q.total_score AS total_score,
parent_id, r.parent_id,
sort, r.sort,
1 AS level 1 AS level
FROM ems_evaluation_scale_cognitive_relevance FROM ems_evaluation_scale_cognitive_relevance r
WHERE parent_id IS NULL LEFT JOIN qms_scale q on r.scale_code = q.code
AND del_flag = 0 WHERE r.parent_id = 0 and r.del_flag = 0 and r.evaluation_id = #{evaluationId}
<if test="scaleCodeList != null and scaleCodeList.size()>0">
and scale_code in (
<foreach item="item" collection="scaleCodeList" index="index" open="(" separator="," close=")">
#{item}
</foreach>
)
</if>
UNION ALL UNION ALL
SELECT SELECT
child.id AS node_id, child.id AS scale_id,
child.evaluation_id, child.evaluation_id,
parent.scale_code, child.cognitive_code AS scale_code,
child.cognitive_code AS second_level_cognitive_code, c.name,
child.cognitive_code AS current_cognitive_code, c.description,
child.score AS level_score, child.score AS level_score,
child.total_score AS level_total_score, child.total_score AS total_score,
child.parent_id, child.parent_id,
child.sort, child.sort,
2 AS level 2 AS level
FROM ems_evaluation_scale_cognitive_relevance child FROM ems_evaluation_scale_cognitive_relevance child
INNER JOIN cognitive_relevance_tree parent INNER JOIN cognitive_relevance_tree parent
ON child.parent_id = parent.node_id ON child.parent_id = parent.scale_id
left join qms_cognitive_domain c on c.code = child.cognitive_code and c.parent_code = parent.scale_code
WHERE child.del_flag = 0 WHERE child.del_flag = 0
) )
SELECT SELECT
rt.scale_id as scaleId,
rt.parent_id as parentId,
rt.name AS name,
rt.evaluation_id AS evaluationId, rt.evaluation_id AS evaluationId,
rt.scale_code AS scaleCode, rt.scale_code AS code,
rt.second_level_cognitive_code AS cognitiveCode,
rt.level_score AS score, rt.level_score AS score,
IF(rt.level_total_score = null , q.total_score, rt.level_total_score) AS totalScale, rt.sort as sort,
rt.sort rt.total_score as totalScore,
r.combo_id as comboId
FROM cognitive_relevance_tree rt FROM cognitive_relevance_tree rt
LEFT JOIN qms_scale q on rt.scale_code = q.code left join ems_evaluation_scale_relevance r on r.evaluation_id = rt.evaluation_id and r.scale_code = rt.scale_code
ORDER BY evaluation_id, level, sort group by rt.scale_code
ORDER BY rt.evaluation_id, rt.level, rt.sort
</select> </select>
<select id="viewReportPdfByVisitNo" resultType="com.ccsens.system.domain.vo.RmsVo$ReportPDF"> <select id="viewReportPdfByVisitNo" resultType="com.ccsens.system.domain.vo.RmsVo$ReportPDF">

55
ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/controller/PmsController.java

@ -11,6 +11,7 @@ import com.ccsens.client.service.ILtHisConnectionService;
import com.ccsens.client.service.IPmsPatientService; import com.ccsens.client.service.IPmsPatientService;
import com.ccsens.common.annotation.Anonymous; import com.ccsens.common.annotation.Anonymous;
import com.ccsens.common.constant.ErrorConstant; import com.ccsens.common.constant.ErrorConstant;
import com.ccsens.common.constant.WebConstant;
import com.ccsens.common.core.controller.BaseController; import com.ccsens.common.core.controller.BaseController;
import com.ccsens.common.core.domain.BaseDto; import com.ccsens.common.core.domain.BaseDto;
import com.ccsens.common.core.domain.JsonResponse; import com.ccsens.common.core.domain.JsonResponse;
@ -23,6 +24,7 @@ import com.ccsens.system.domain.dto.PmsPatientDto;
import com.ccsens.system.domain.po.HmsHospitalConfig; import com.ccsens.system.domain.po.HmsHospitalConfig;
import com.ccsens.system.domain.vo.LdPatientVo; import com.ccsens.system.domain.vo.LdPatientVo;
import com.ccsens.system.domain.vo.PmsPatientVo; import com.ccsens.system.domain.vo.PmsPatientVo;
import com.ccsens.system.service.SysPowerService;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -33,8 +35,11 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; 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.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function; import java.util.function.Function;
@ -54,49 +59,35 @@ public class PmsController extends BaseController {
private IPmsPatientService patientService; private IPmsPatientService patientService;
@Resource @Resource
private IHmsService hmsService; private IHmsService hmsService;
// @Resource
// private ILtHisConnectionService ltHisConnectionService;
private final String hospitalConfKey = "patient_encryption"; private final String hospitalConfKey = "patient_encryption";
@Resource
private SysPowerService sysPowerService;
@ApiOperation("获取患者信息列表") @ApiOperation("获取患者信息列表")
@PostMapping("/queryList") @PostMapping("/queryList")
public JsonResponse<PageInfo<PmsPatientVo.PatientList>> queryPatientList(@RequestBody @Validated BaseDto<PmsPatientDto.QueryPatient> dto) { public JsonResponse<PageInfo<PmsPatientVo.PatientList>> queryPatientList(@RequestBody @Validated BaseDto<PmsPatientDto.QueryPatient> dto) {
// List<PmsPatientVo.PatientList> list = new ArrayList<>();
// PmsPatientDto.QueryPatient param = dto.getParam();
// if (StrUtil.isNotEmpty(param.getSearchValue()) && param.getSearchValue().length() == 10) {
// //关键字不为空,且长度等于10,先查询院内his信息
// List<PmsPatientVo.PatientList> hisList = ltHisConnectionService.queryHisPatient(param.getSearchValue());
// if (CollUtil.isNotEmpty(hisList)) {
// list.addAll(hisList);
// }
// }
//获取用户的权限 //获取用户的权限
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
//当前默认一个用户只有一个角色 List<Long> deptIdList = new ArrayList<>();
String dataScope = "5"; if (dto.getParam().getDeptId() == null) {
if (CollUtil.isNotEmpty(loginUser.getUser().getRoles())) { try {
dataScope = loginUser.getUser().getRoles().get(0).getDataScope(); deptIdList.addAll(sysPowerService.queryPowerDept());
} catch (Exception e) {
log.info("获取当前登录用户部门错误");
// 获取请求携带的令牌
HttpServletRequest request = ((ServletRequestAttributes)
RequestContextHolder.getRequestAttributes()).getRequest();
String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID);
if (StrUtil.isNotEmpty(deptId)) {
deptIdList.add(Long.parseLong(deptId));
} }
}
if (IdcardUtil.isValidCard(dto.getParam().getSearchValue())) { }else {
dataScope = "2"; deptIdList.add(dto.getParam().getDeptId());
} }
startPageOvertop(dto); startPageOvertop(dto);
List<PmsPatientVo.PatientList> serverList = patientService.queryPatientList(dto.getParam(), dataScope, loginUser.getUserId(), loginUser.getUsername()); List<PmsPatientVo.PatientList> serverList = patientService.queryPatientList(dto.getParam(), null, loginUser.getUserId(), loginUser.getUsername(), deptIdList);
// 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);
return JsonResponse.ok(new PageInfo<>(serverList)); return JsonResponse.ok(new PageInfo<>(serverList));
} }

3
ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/persist/dao/PmsPatientDao.java

@ -13,7 +13,8 @@ public interface PmsPatientDao extends PmsPatientMapper {
@Param("userId") Long userId, @Param("userId") Long userId,
@Param("userName")String userName, @Param("userName")String userName,
@Param("idcard")String idcard, @Param("idcard")String idcard,
@Param("idcardEncrypt")String idcardEncrypt); @Param("idcardEncrypt")String idcardEncrypt,
@Param("deptIdList")List<Long> deptIdList);
PmsPatientVo.PatientInfo queryPatientEvaluationById(@Param("id")Long id); PmsPatientVo.PatientInfo queryPatientEvaluationById(@Param("id")Long id);

3
ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/persist/dao/ScaleDao.java

@ -20,7 +20,8 @@ public interface ScaleDao {
@Param("version")Long version, @Param("version")Long version,
@Param("level") String level); @Param("level") String level);
List<ScaleVo.ComboInfo> queryComboChildList(@Param("id")Long id); List<ScaleVo.ComboInfo> queryComboChildList(@Param("id")Long id,
@Param("isFemale") Boolean isFemale);
ScaleVo.ComboInfo queryComboInfo(Long id); ScaleVo.ComboInfo queryComboInfo(Long id);

3
ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/IPmsPatientService.java

@ -12,7 +12,8 @@ public interface IPmsPatientService {
List<PmsPatientVo.PatientList> queryPatientList(PmsPatientDto.QueryPatient dto, List<PmsPatientVo.PatientList> queryPatientList(PmsPatientDto.QueryPatient dto,
String dataScope, String dataScope,
Long userId, Long userId,
String userName); String userName,
List<Long> deptIdList);
PmsPatientVo.PatientInfo queryPatientByIdCard(PmsPatientDto.QueryPatient param); PmsPatientVo.PatientInfo queryPatientByIdCard(PmsPatientDto.QueryPatient param);

4
ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/PmsPatientServiceImpl.java

@ -64,7 +64,7 @@ public class PmsPatientServiceImpl implements IPmsPatientService {
private PmsPatientDiagnosisMapper pmsPatientDiagnosisMapper; private PmsPatientDiagnosisMapper pmsPatientDiagnosisMapper;
@Override @Override
public List<PmsPatientVo.PatientList> queryPatientList(PmsPatientDto.QueryPatient param, String dataScope, Long userId, String userName) { public List<PmsPatientVo.PatientList> queryPatientList(PmsPatientDto.QueryPatient param, String dataScope, Long userId, String userName,List<Long> deptIdList) {
if (StrUtil.isNotEmpty(param.getSearchValue()) if (StrUtil.isNotEmpty(param.getSearchValue())
&& IdcardUtil.isValidCard(param.getSearchValue()) && IdcardUtil.isValidCard(param.getSearchValue())
&& StrUtil.isEmpty(param.getIdCard())) { && StrUtil.isEmpty(param.getIdCard())) {
@ -77,7 +77,7 @@ public class PmsPatientServiceImpl implements IPmsPatientService {
String hash = Md5Utils.hash(param.getIdCard().substring(2, 14)); String hash = Md5Utils.hash(param.getIdCard().substring(2, 14));
param.setIdCard(param.getIdCard().substring(0, 2) + hash + param.getIdCard().substring(14, 18)); param.setIdCard(param.getIdCard().substring(0, 2) + hash + param.getIdCard().substring(14, 18));
} }
return patientDao.queryPatientList(param.getSearchValue(), dataScope, userId, userName, param.getIdCard(), param.getIdcardEncrypt()); return patientDao.queryPatientList(param.getSearchValue(), dataScope, userId, userName, param.getIdCard(), param.getIdcardEncrypt(), deptIdList);
} }
@Override @Override

13
ruisi_java/ruisi-web-client/src/main/java/com/ccsens/client/service/impl/ScaleServiceImpl.java

@ -41,6 +41,8 @@ public class ScaleServiceImpl implements IScaleService {
private HmsComboScaleRelevanceMapper qmsComboScaleRelevanceMapper; private HmsComboScaleRelevanceMapper qmsComboScaleRelevanceMapper;
@Resource @Resource
private QmsQuestionMapper qmsQuestionMapper; private QmsQuestionMapper qmsQuestionMapper;
@Resource
private PmsPatientMapper pmsPatientMapper;
@Override @Override
public List<ScaleVo.ScaleTypeInfo> queryScaleType() { public List<ScaleVo.ScaleTypeInfo> queryScaleType() {
@ -135,12 +137,21 @@ public class ScaleServiceImpl implements IScaleService {
@Override @Override
public List<ScaleVo.ComboInfo> queryComboChildList(ScaleDto.QueryCombo dto) { public List<ScaleVo.ComboInfo> queryComboChildList(ScaleDto.QueryCombo dto) {
//根据患者ID查询性别 女性患者不需要评前列腺
Boolean isFemale = false;
if (dto.getPatientId() != null) {
PmsPatient pmsPatient = pmsPatientMapper.selectByPrimaryKey(dto.getPatientId());
if (pmsPatient.getSex() == 1) {
isFemale = true;
}
}
LoginUser loginUser = getLoginUser(); LoginUser loginUser = getLoginUser();
List<ScaleVo.ComboInfo> comboInfos = scaleDao.queryComboList(loginUser.getUsername(),dto.getName(),loginUser.getHospitalId(), dto.getVersion(), dto.getLevel()); List<ScaleVo.ComboInfo> comboInfos = scaleDao.queryComboList(loginUser.getUsername(),dto.getName(),loginUser.getHospitalId(), dto.getVersion(), dto.getLevel());
if (CollUtil.isNotEmpty(comboInfos)) { if (CollUtil.isNotEmpty(comboInfos)) {
for (ScaleVo.ComboInfo comboInfo : comboInfos) { for (ScaleVo.ComboInfo comboInfo : comboInfos) {
int i = 0; int i = 0;
comboInfo.setChildrenList(scaleDao.queryComboChildList(comboInfo.getId())); comboInfo.setChildrenList(scaleDao.queryComboChildList(comboInfo.getId(), isFemale));
// if (CollUtil.isNotEmpty(comboInfo.getChildrenList())) { // if (CollUtil.isNotEmpty(comboInfo.getChildrenList())) {
// for (ScaleVo.ComboInfo info : comboInfo.getChildrenList()) { // for (ScaleVo.ComboInfo info : comboInfo.getChildrenList()) {
// if (CollUtil.isNotEmpty(info.getScaleList())) { // if (CollUtil.isNotEmpty(info.getScaleList())) {

8
ruisi_java/ruisi-web-client/src/main/resources/application-dev.yml

@ -11,21 +11,21 @@ spring:
# password: po3OynBO[M3579p6L7)o # 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 url: jdbc:mysql://127.0.0.1:3306/ruisi_cga?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root username: root
password: 123456 password: q7510327
# 从库数据源 # 从库数据源
slave: slave:
# 从数据源开关/默认关闭 # 从数据源开关/默认关闭
enabled: true enabled: false
url: jdbc:mysql://127.0.0.1:3306/ruisi_cga_yf?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 username: root
password: 123456 password: q7510327
# driverClassName: oracle.jdbc.driver.OracleDriver # driverClassName: oracle.jdbc.driver.OracleDriver
# url: jdbc:oracle:thin:@200.1.8.115:1521:hisdb # url: jdbc:oracle:thin:@200.1.8.115:1521:hisdb
# username: interface_lnpg # username: interface_lnpg
# password: interface_lnpg # password: interface_lnpg
oracle: oracle:
# 从数据源开关/默认关闭 # 从数据源开关/默认关闭
enabled: true enabled: false
driverClassName: oracle.jdbc.driver.OracleDriver driverClassName: oracle.jdbc.driver.OracleDriver
url: jdbc:oracle:thin:@//192.168.1.5:1521/ORCL url: jdbc:oracle:thin:@//192.168.1.5:1521/ORCL
username: USER_LNPGXT username: USER_LNPGXT

193
ruisi_java/ruisi-web-client/src/main/resources/mapper/dao/PmsPatientDao.xml

@ -23,38 +23,85 @@
update pms_patient_personal set del_flag = 1 where patient_id = #{patientId}; update pms_patient_personal set del_flag = 1 where patient_id = #{patientId};
</delete> </delete>
<select id="queryPatientList" resultType="com.ccsens.system.domain.vo.PmsPatientVo$PatientList"> <select id="queryPatientList" resultType="com.ccsens.system.domain.vo.PmsPatientVo$PatientList">
SELECT SELECT DISTINCT
DISTINCT a.patientId,
pp.id as patientId, a.patientName,
pp.`name` as patientName, a.sex,
a.idcard,
a.phone, -- 核心修复:将 a.mobile 改为 a.phone(与内层别名一致)
a.educationalStatus,
a.independentLivingSkills,
a.birthNumber,
a.dwellingState,
a.lastEvaluationTime,
a.lastTesterName, -- 修正之前的笔误(原 astTesterName)
a.evaluationCount,
a.createBy,
a.createTime,
a.hospitalName,
a.birthday,
a.career,
a.maritalStatus,
a.domicile,
a.nation,
a.nativePlace,
a.contactName,
a.contactRelation,
a.contactMobile,
a.address,
a.belief,
a.hobby,
a.aboBloodType,
a.rhBloodType
FROM
(
SELECT DISTINCT
pp.id AS patientId,
pp.`name` AS patientName,
pp.sex, pp.sex,
pp.idcard, pp.idcard,
pp.mobile as phone, pp.mobile AS phone, -- 内层别名是 phone
pp.birth_year as birthYear, pp.educational_status AS educationalStatus,
pp.independent_living_skills AS independentLivingSkills,
pp.birth_number AS birthNumber,
pp.dwelling_state AS dwellingState,
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 createBy,
pp.create_time AS createTime,
ud.dept_name AS hospitalName,
pp.birthday, 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.belief,
pp.hobby, pp.hobby,
pp.contact_name as contactName, pp.abo_blood_type AS aboBloodType,
pp.contact_relation as contactRelation, pp.rh_blood_type AS rhBloodType
pp.contact_mobile as contactMobile,
pp.contact_other as contactOther,
pp.id_card_type as idCardType,
pp.id_card_type_other as idCardTypeOther,
pp.abo_blood_type as aboBloodType,
pp.rh_blood_type as rhBloodType,
MAX(ae.create_time) as lastEvaluationTime,
uu.nick_name as lastTesterName,
COUNT(ae.id) as evaluationCount,
(select nick_name from ums_user where user_name = pp.create_by and del_flag = 0) as creatorName,
pp.create_time as createTime
FROM FROM
pms_patient pp pms_patient pp
LEFT JOIN ems_evaluation ae on pp.id = ae.patient_id LEFT JOIN ems_evaluation ee ON pp.id = ee.patient_id AND ee.del_flag = 0
LEFT JOIN ums_user uu on pp.create_by = uu.user_name LEFT JOIN ums_user uu ON ee.tester_id = uu.user_id
left join pms_patient_body pb on pp.id = pb.patient_id LEFT JOIN ums_dept ud ON pp.hospital_id = ud.dept_id
WHERE WHERE
pp.del_flag = 0 pp.del_flag = 0
<if test="deptIdList != null and deptIdList.size()>0">
<if test="deptIdList != null and deptIdList.size()>0">
and pp.hospital_id IN
<foreach item="item" collection="deptIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</if>
<if test="searchValue != null and searchValue != ''"> <if test="searchValue != null and searchValue != ''">
and ( and (
pp.name like CONCAT('%',#{searchValue},'%') pp.name like CONCAT('%',#{searchValue},'%')
@ -71,39 +118,79 @@
<if test="idcard != null and idcard != ''"> <if test="idcard != null and idcard != ''">
and (pp.idcard = #{idcard} or pp.idcard = #{idcardEncrypt}) and (pp.idcard = #{idcard} or pp.idcard = #{idcardEncrypt})
</if> </if>
<!-- 权限 总测评师和测评师都是本部门及以下 --> GROUP BY
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)) pp.id
WHERE user_id = #{userId} UNION ALL
SELECT DISTINCT
pp.id AS patientId,
pp.`name` AS patientName,
pp.sex,
pp.idcard,
pp.mobile AS phone, -- 内层别名统一为 phone
pp.educational_status AS educationalStatus,
pp.independent_living_skills AS independentLivingSkills,
pp.birth_number AS birthNumber,
pp.dwelling_state AS dwellingState,
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 createBy,
pp.create_time AS createTime,
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 pms_patient_body pb ON pb.patient_id = pp.id AND pb.del_flag = 0
LEFT JOIN ems_evaluation ee ON pp.id = ee.patient_id AND ee.del_flag = 0
LEFT JOIN ums_user uu ON ee.tester_id = uu.user_id
LEFT JOIN ums_dept ud ON pp.hospital_id = ud.dept_id
WHERE
pp.del_flag = 0
<if test="searchValue != null and searchValue != ''">
and (
pp.name like CONCAT('%',#{searchValue},'%')
or
pp.name_initial like CONCAT('%',LOWER(#{searchValue}),'%')
or
pp.name_full like CONCAT('%',LOWER(#{searchValue}),'%')
or
pp.idcard like CONCAT('%',#{searchValue},'%')
or
pb.outpatient_no like CONCAT('%',#{searchValue},'%')
) )
</if>
<!-- <choose>--> <if test="idcard != null and idcard != ''">
<!-- &lt;!&ndash; 测评师查看自己的患者 &ndash;&gt;--> and (pp.idcard = #{idcard} or pp.idcard = #{idcardEncrypt})
<!-- <when test="dataScope == 5">--> </if>
<!-- and (pp.create_by = #{userName} or ae.tester_id = #{userId})--> <if test="deptIdList != null and deptIdList.size()>0">
<!-- </when>--> <if test="deptIdList != null and deptIdList.size()>0">
<!-- &lt;!&ndash; 总测评师查看自己部门的患者 &ndash;&gt;--> and pp.hospital_id IN
<!-- <when test="dataScope == 3 or dataScope == 4">--> <foreach item="item" collection="deptIdList" open="(" separator="," close=")">
<!-- and(--> #{item}
<!-- (EXISTS ( SELECT 1 FROM ums_user WHERE user_id = #{userId} AND data_power = 'ALL' ))--> </foreach>
<!-- OR--> </if>
<!-- (uu.dept_id IN ( SELECT CONCAT(dept_id, ',', data_power) FROM ums_user WHERE user_id = #{userId} ))--> </if>
<!-- )--> GROUP BY
<!-- </when>--> pp.id
<!-- &lt;!&ndash; 目前没有2的权限 &ndash;&gt;--> ) a
<!-- <when test="dataScope == 2">--> group by a.patientId
<!-- and uu.dept_id in (--> ORDER BY a.createTime DESC
<!-- 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> </select>
<select id="queryPatientByIdCard" resultType="com.ccsens.system.domain.vo.PmsPatientVo$PatientInfo"> <select id="queryPatientByIdCard" resultType="com.ccsens.system.domain.vo.PmsPatientVo$PatientInfo">
SELECT SELECT
DISTINCT DISTINCT

3
ruisi_java/ruisi-web-client/src/main/resources/mapper/dao/ScaleDao.xml

@ -141,6 +141,9 @@
left join hms_version v on v.id = c.version left join hms_version v on v.id = c.version
where where
c.del_flag = 0 and c.parent_id != 0 and s.is_show = 1 and c.status = 1 c.del_flag = 0 and c.parent_id != 0 and s.is_show = 1 and c.status = 1
<if test="isFemale != null and isFemale">
and c.id != 1982752141751750656
</if>
and c.parent_id = #{id} and c.parent_id = #{id}
order by c.sort, csr.sort, c.level desc, c.create_time DESC, order by c.sort, csr.sort, c.level desc, c.create_time DESC,
s.sort s.sort

Loading…
Cancel
Save