Browse Source

合并后端

master
lzp 15 hours 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. 141
      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. 349
      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. 228
      ruisi_java/ruisi-web-admin/src/main/resources/mapper/dao/PmsPatientDao.xml
  19. 94
      ruisi_java/ruisi-web-admin/src/main/resources/mapper/dao/RmsDao.xml
  20. 57
      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. 201
      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()));
} else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope)) {
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()));
} else if (DATA_SCOPE_SELF.equals(dataScope)) {
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));
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);
}
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 parentId;
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
* @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,
@Param("sex") Byte sex);
@Param("sex") Byte sex,
@Param("deptIdLIst") List<Long> deptIdLIst);
/**
* BMI
*
* @param dto
* @return
*/
HomeDpVo.Bmi nnbmihjxy(@Param("dto") StatisticsDto.Query dto);
HomeDpVo.Bmi nnbmihjxy(@Param("dto") StatisticsDto.Query dto,
@Param("deptIdLIst") List<Long> deptIdLIst);
/**
* 最新评估情况
*
* @param dto
* @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
* @return
*/
HomeDpVo.Nlfb nnage(@Param("dto") StatisticsDto.Query dto);
HomeDpVo.Nlfb nnage(@Param("dto") StatisticsDto.Query dto,
@Param("deptIdLIst") List<Long> deptIdLIst);
/**
* T值分析
*
* @param dto
* @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
* @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
* @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
* @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 {
HomeDpVo.Zhsjgl nntotal(StatisticsDto.Query dto);
HomeDpVo.Zhsjgl nntotal(StatisticsDto.Query dto, List<Long> deptIdLIst);
HomeDpVo.Bmi nnbmihjxy(StatisticsDto.Query dto);
List<HomeDpVo.Pgqk> nnlast(StatisticsDto.Query dto);
HomeDpVo.Nlfb nnage(StatisticsDto.Query dto);
HomeDpVo.Tz nntgb(StatisticsDto.Query dto);
List<HomeDpVo.Jbph> nnicd(StatisticsDto.Query dto);
List<HomeDpVo.Dt> nnmap(StatisticsDto.Query dto);
List<HomeDpVo.Pgjg> nnscale(StatisticsDto.Query dto);
HomeDpVo.Bmi nnbmihjxy(StatisticsDto.Query dto, List<Long> deptIdLIst);
List<HomeDpVo.Pgqk> nnlast(StatisticsDto.Query dto, List<Long> deptIdLIst);
HomeDpVo.Nlfb nnage(StatisticsDto.Query dto, List<Long> deptIdLIst);
HomeDpVo.Tz nntgb(StatisticsDto.Query dto, List<Long> deptIdLIst);
List<HomeDpVo.Jbph> nnicd(StatisticsDto.Query dto, List<Long> deptIdLIst);
List<HomeDpVo.Dt> nnmap(StatisticsDto.Query dto, List<Long> deptIdLIst);
List<HomeDpVo.Pgjg> nnscale(StatisticsDto.Query dto, List<Long> deptIdLIst);
/**
* 学历统计
* @param dto
* @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;
@Override
public HomeDpVo.Zhsjgl nntotal(StatisticsDto.Query dto) {
public HomeDpVo.Zhsjgl nntotal(StatisticsDto.Query dto, List<Long> deptIdLIst) {
if (dto.getTimeType() != null) {
List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime());
dto.setBeginTime(dateByType.get(0));
dto.setEndTime(dateByType.get(1));
}
HomeDpVo.Zhsjgl nntotal = statisticsDao.nntotal(dto);
HomeDpVo.Zhsjgl nntotal = statisticsDao.nntotal(dto, deptIdLIst);
if (nntotal == null) {
nntotal = new HomeDpVo.Zhsjgl();
}
nntotal.setPtotal(statisticsDao.getPatientNum(dto, null));
nntotal.setMtotal(statisticsDao.getPatientNum(dto, (byte) 0));
nntotal.setFtotal(statisticsDao.getPatientNum(dto, (byte) 1));
nntotal.setPtotal(statisticsDao.getPatientNum(dto, null, deptIdLIst));
nntotal.setMtotal(statisticsDao.getPatientNum(dto, (byte) 0, deptIdLIst));
nntotal.setFtotal(statisticsDao.getPatientNum(dto, (byte) 1, deptIdLIst));
return nntotal;
}
@Override
public HomeDpVo.Bmi nnbmihjxy(StatisticsDto.Query dto) {
public HomeDpVo.Bmi nnbmihjxy(StatisticsDto.Query dto, List<Long> deptIdLIst) {
if (dto.getTimeType() != null) {
List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime());
dto.setBeginTime(dateByType.get(0));
dto.setEndTime(dateByType.get(1));
}
return statisticsDao.nnbmihjxy(dto);
return statisticsDao.nnbmihjxy(dto, deptIdLIst);
}
@Override
public List<HomeDpVo.Pgqk> nnlast(StatisticsDto.Query dto) {
public List<HomeDpVo.Pgqk> nnlast(StatisticsDto.Query dto, List<Long> deptIdLIst) {
if (dto.getTimeType() != null) {
List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime());
dto.setBeginTime(dateByType.get(0));
dto.setEndTime(dateByType.get(1));
}
return statisticsDao.nnlast(dto);
return statisticsDao.nnlast(dto, deptIdLIst);
}
@Override
public HomeDpVo.Nlfb nnage(StatisticsDto.Query dto) {
public HomeDpVo.Nlfb nnage(StatisticsDto.Query dto, List<Long> deptIdLIst) {
if (dto.getTimeType() != null) {
List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime());
dto.setBeginTime(dateByType.get(0));
dto.setEndTime(dateByType.get(1));
}
return statisticsDao.nnage(dto);
return statisticsDao.nnage(dto, deptIdLIst);
}
@Override
public HomeDpVo.Tz nntgb(StatisticsDto.Query dto) {
public HomeDpVo.Tz nntgb(StatisticsDto.Query dto, List<Long> deptIdLIst) {
if (dto.getTimeType() != null) {
List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime());
dto.setBeginTime(dateByType.get(0));
dto.setEndTime(dateByType.get(1));
}
return statisticsDao.nntgb(dto);
return statisticsDao.nntgb(dto, deptIdLIst);
}
@Override
public List<HomeDpVo.Jbph> nnicd(StatisticsDto.Query dto) {
public List<HomeDpVo.Jbph> nnicd(StatisticsDto.Query dto, List<Long> deptIdLIst) {
if (dto.getTimeType() != null) {
List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime());
dto.setBeginTime(dateByType.get(0));
dto.setEndTime(dateByType.get(1));
}
return statisticsDao.nnicd(dto);
return statisticsDao.nnicd(dto, deptIdLIst);
}
@Override
public List<HomeDpVo.Dt> nnmap(StatisticsDto.Query dto) {
public List<HomeDpVo.Dt> nnmap(StatisticsDto.Query dto, List<Long> deptIdLIst) {
if (dto.getTimeType() != null) {
List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime());
dto.setBeginTime(dateByType.get(0));
dto.setEndTime(dateByType.get(1));
}
return statisticsDao.nnmap(dto);
return statisticsDao.nnmap(dto, deptIdLIst);
}
@Override
public List<HomeDpVo.Pgjg> nnscale(StatisticsDto.Query dto) {
public List<HomeDpVo.Pgjg> nnscale(StatisticsDto.Query dto, List<Long> deptIdLIst) {
if (dto.getTimeType() != null) {
List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime());
dto.setBeginTime(dateByType.get(0));
dto.setEndTime(dateByType.get(1));
}
return statisticsDao.nnscale(dto);
return statisticsDao.nnscale(dto, deptIdLIst);
}
@Override
public List<HomeDpVo.QualificationStatistics> qualificationStatistics(StatisticsDto.Query dto) {
public List<HomeDpVo.QualificationStatistics> qualificationStatistics(StatisticsDto.Query dto, List<Long> deptIdLIst) {
if (dto.getTimeType() != null) {
List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime());
dto.setBeginTime(dateByType.get(0));
dto.setEndTime(dateByType.get(1));
}
return statisticsDao.qualificationStatistics(dto);
return statisticsDao.qualificationStatistics(dto, deptIdLIst);
}
@Override
public HomeDpVo.JzStatistics jzStatistics(StatisticsDto.Query dto) {
public HomeDpVo.JzStatistics jzStatistics(StatisticsDto.Query dto, List<Long> deptIdLIst) {
if (dto.getTimeType() != null) {
List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime());
dto.setBeginTime(dateByType.get(0));
dto.setEndTime(dateByType.get(1));
}
// HomeDpVo.JzStatistics jzStatistics = statisticsDao.JzStatisticsNum(dto);
// HomeDpVo.JzStatistics jzStatistics = statisticsDao.JzStatisticsNum(dto, deptIdLIst);
// if (jzStatistics!= null) {
HomeDpVo.JzStatistics jzStatistics = statisticsDao.JzStatistics(dto);
HomeDpVo.JzStatistics jzStatistics = statisticsDao.JzStatistics(dto, deptIdLIst);
// jzStatistics.setZyNum(jzStatistics1.getZyNum());
// jzStatistics.setMzNum(jzStatistics1.getMzNum());
// }
@ -139,37 +139,37 @@ public class StatisticsServiceImpl implements StatisticsService {
}
@Override
public List<HomeDpVo.ScaleStatistics> scaleStatistics(StatisticsDto.Query dto) {
public List<HomeDpVo.ScaleStatistics> scaleStatistics(StatisticsDto.Query dto, List<Long> deptIdLIst) {
if (dto.getTimeType() != null) {
List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime());
dto.setBeginTime(dateByType.get(0));
dto.setEndTime(dateByType.get(1));
}
return statisticsDao.scaleStatistics(dto);
return statisticsDao.scaleStatistics(dto, deptIdLIst);
}
@Override
public List<HomeDpVo.VersionStatistics> versionStatistics(StatisticsDto.Query dto) {
public List<HomeDpVo.VersionStatistics> versionStatistics(StatisticsDto.Query dto, List<Long> deptIdLIst) {
if (dto.getTimeType() != null) {
List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime());
dto.setBeginTime(dateByType.get(0));
dto.setEndTime(dateByType.get(1));
}
return statisticsDao.versionStatistics(dto);
return statisticsDao.versionStatistics(dto, deptIdLIst);
}
@Override
public List<HomeDpVo.UserStatistics> userStatistics(StatisticsDto.Query dto) {
public List<HomeDpVo.UserStatistics> userStatistics(StatisticsDto.Query dto, List<Long> deptIdLIst) {
if (dto.getTimeType() != null) {
List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime());
dto.setBeginTime(dateByType.get(0));
dto.setEndTime(dateByType.get(1));
}
return statisticsDao.userStatistics(dto);
return statisticsDao.userStatistics(dto, deptIdLIst);
}
@Override
public HomeDpVo.SexStatistics sexStatistics(StatisticsDto.Query dto) {
public HomeDpVo.SexStatistics sexStatistics(StatisticsDto.Query dto, List<Long> deptIdLIst) {
if (dto.getTimeType() != null) {
List<Date> dateByType = getDateByType(dto.getTimeType(), dto.getBeginTime());
dto.setBeginTime(dateByType.get(0));
@ -177,15 +177,15 @@ public class StatisticsServiceImpl implements StatisticsService {
}
HomeDpVo.SexStatistics sexStatistics = new HomeDpVo.SexStatistics();
sexStatistics.setBoy(statisticsDao.getPatientNum(dto, (byte) 0));
sexStatistics.setGirl(statisticsDao.getPatientNum(dto, (byte) 1));
sexStatistics.setBoy(statisticsDao.getPatientNum(dto, (byte) 0, deptIdLIst));
sexStatistics.setGirl(statisticsDao.getPatientNum(dto, (byte) 1, deptIdLIst));
return sexStatistics;
}
@Override
public HomeDpVo.XyYjStatistics xyYjStatistics(StatisticsDto.Query dto) {
return statisticsDao.xyYjStatistics(dto);
public HomeDpVo.XyYjStatistics xyYjStatistics(StatisticsDto.Query dto, List<Long> deptIdLIst) {
return statisticsDao.xyYjStatistics(dto, deptIdLIst);
}
/**

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

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

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 com.ccsens.admin.service.IPmsPatientService;
import com.ccsens.common.constant.ErrorConstant;
import com.ccsens.common.constant.WebConstant;
import com.ccsens.common.core.controller.BaseController;
import com.ccsens.common.core.domain.BaseDto;
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.system.domain.dto.PmsPatientDto;
import com.ccsens.system.domain.vo.PmsPatientVo;
import com.ccsens.system.service.SysPowerService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
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.RequestMapping;
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 javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@ -46,20 +52,32 @@ import java.util.List;
public class PmsController extends BaseController {
@Resource
private IPmsPatientService patientService;
@Resource
private SysPowerService sysPowerService;
@ApiOperation("获取患者信息列表")
@PostMapping("/queryList")
public JsonResponse<PageInfo<PmsPatientVo.PatientList>> queryPatientList(@RequestBody @Validated BaseDto<PmsPatientDto.QueryPatient> dto) {
//获取用户的权限
LoginUser loginUser = SecurityUtils.getLoginUser();
//当前默认一个用户只有一个角色
String dataScope = "5";
if(CollUtil.isNotEmpty(loginUser.getUser().getRoles())){
dataScope = loginUser.getUser().getRoles().get(0).getDataScope();
List<Long> deptIdList = new ArrayList<>();
if (dto.getParam().getDeptId() == null) {
try {
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));
}
}
}else {
deptIdList.add(dto.getParam().getDeptId());
}
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));
}
@ -211,14 +229,24 @@ public class PmsController extends BaseController {
@ApiOperation("导出患者列表")
@PostMapping("/exportPatient")
public void exportPatient(HttpServletResponse response, @RequestBody @Validated BaseDto<PmsPatientDto.QueryPatient> dto) throws IOException{
//获取用户的权限
LoginUser loginUser = SecurityUtils.getLoginUser();
//当前默认一个用户只有一个角色
String dataScope = "5";
if(CollUtil.isNotEmpty(loginUser.getUser().getRoles())){
dataScope = loginUser.getUser().getRoles().get(0).getDataScope();
List<Long> deptIdList = new ArrayList<>();
if (dto.getParam().getDeptId() == null) {
try {
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));
}
}
}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("查询就诊列表")

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.util.CharsetUtil;
import com.ccsens.admin.service.IRmsService;
import com.ccsens.common.annotation.Anonymous;
import com.ccsens.common.core.controller.BaseController;
import com.ccsens.common.core.domain.BaseDto;
import com.ccsens.common.core.domain.JsonResponse;
@ -163,8 +164,8 @@ public class RmsController extends BaseController {
}
@ApiOperation(value = "查询测评列表", notes = "管理员查询测评列表")
@PostMapping("/queryReport")
public JsonResponse<PageInfo<RmsVo.Report>> queryReport(@RequestBody @ApiParam @Valid BaseDto<RmsDto.ReportQuery> param) {
@PostMapping("/queryEvaluation")
public JsonResponse<PageInfo<RmsVo.Report>> queryEvaluation(@RequestBody @ApiParam @Valid BaseDto<RmsDto.ReportQuery> param) {
if (param.getPageNum() > 0) {
PageHelper.startPage(param.getPageNum(), param.getPageSize());
}
@ -177,4 +178,13 @@ public class RmsController extends BaseController {
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);
}
}

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

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.persist.mapper.PmsPatientMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.security.core.parameters.P;
import java.util.List;
@ -13,7 +14,8 @@ public interface PmsPatientDao extends PmsPatientMapper {
List<PmsPatientVo.PatientList> queryPatientList(@Param("param") PmsPatientDto.QueryPatient param,
@Param("dataScope") String dataScope,
@Param("userId") Long userId,
@Param("userName")String userName);
@Param("userName")String userName,
@Param("deptIdList")List<Long> deptIdList);
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,
@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);
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,
String dataScope,
Long userId,
String userName);
String userName,
List<Long> deptIdList);
PmsPatientVo.PatientInfo queryPatientByIdCard(PmsPatientDto.QueryPatient param);
@ -48,7 +49,7 @@ public interface IPmsPatientService {
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);
//

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]*$");
return pattern.matcher(str).matches();
}
public Map<String, Object> generateParams(Map<String, Object> params, List<RmsVo.ReportScore> scores, PmsPatientVo.PatientInfo patientInfoById, RmsVo.ReportDetail detail, RmsDto.Export dto, EmsEvaluation emsEvaluation) {
RmsVo.ReportPatient patientInfo = detail.getPatient();
params.put("h_name", patientInfo.getHospitalName());
@ -877,6 +878,32 @@ public class AmsReportServiceImpl implements AmsReportService {
params.put("p_name", patientInfo.getPatientName());
params.put("p_sex", patientInfo.getSex() == 0 ? "男" : "女");
params.put("p_age", patientInfo.getPatientAge());
params.put("phone", patientInfo.getMobile());
if (dto.getVersion() != null) {
if(dto.getVersion() == 0) {
params.put("versionName", "完整版");
}
if(dto.getVersion() == 1) {
params.put("versionName", "医生版");
}
if(dto.getVersion() == 2) {
params.put("versionName", "个人版");
}
if(dto.getVersion() == 3) {
params.put("versionName", "阳性版");
}
}
if (patientInfo.getCareer() != null) {
JobEnum jobEnum = BaseEnum.codeOf(JobEnum.class, patientInfo.getCareer().intValue());
if (jobEnum != null) {
params.put("job", jobEnum.getDesc());
}
}
params.put("marital", patientInfo.getMarial());
params.put("dwelling", patientInfo.getDwelling());
params.put("nation", patientInfo.getNation());
params.put("belief", patientInfo.getBelief());
params.put("testerName", patientInfo.getTesterName());
CultureEnum cultureEnum = null;
if (dto.getSignId() != null) {
HmsDoctorSign emsEvaluationInformedConsent = hmsDoctorSignMapper.selectByPrimaryKey(dto.getSignId());
@ -926,32 +953,32 @@ public class AmsReportServiceImpl implements AmsReportService {
params.put("place", patientInfoById.getNativePlace());
params.put("address", patientInfoById.getAddress());
params.put("hobby", patientInfoById.getHobby());
params.put("aboBlood", patientInfoById.getAboBloodType());
params.put("rhBlood", patientInfoById.getRhBloodType());
params.put("visit_type", pmsPatientBodyMap.get("visit_type"));
params.put("visitNo", pmsPatientBodyMap.get("outpatient_no"));
params.put("aboBlood", ObjectUtil.isEmpty(patientInfoById.getAboBloodType()) ? "" : ObjectUtil.equals(patientInfoById.getAboBloodType(), "1") ? "A" : ObjectUtil.equals(patientInfoById.getAboBloodType(), "2") ? "B" : ObjectUtil.equals(patientInfoById.getAboBloodType(), "3") ? "O" : ObjectUtil.equals(patientInfoById.getAboBloodType(), "4") ? "AB" : ObjectUtil.equals(patientInfoById.getAboBloodType(), "5") ? "不详" : "未查");
params.put("rhBlood", ObjectUtil.isEmpty(patientInfoById.getRhBloodType()) ? "" : ObjectUtil.equals(patientInfoById.getRhBloodType(), "1") ? "阳性" : ObjectUtil.equals(patientInfoById.getRhBloodType(), "2") ? "阴性" :ObjectUtil.equals(patientInfoById.getRhBloodType(), "3") ? "不详" : "未查");
params.put("visit_type", ObjectUtil.isEmpty(pmsPatientBodyMap.get("visitType")) ? "" : ObjectUtil.equals(pmsPatientBodyMap.get("visitType"), "1") ? "门诊" : "住院");
params.put("visitNo", pmsPatientBodyMap.get("outpatientNo"));
params.put("age", pmsPatientBodyMap.get("age"));
params.put("dept", pmsPatientBodyMap.get("department"));
params.put("doctor", pmsPatientBodyMap.get("doctor"));
params.put("admissionDate", pmsPatientBodyMap.get("admission_date"));
params.put("num", pmsPatientBodyMap.get("admission_count"));
params.put("admissionMethod", pmsPatientBodyMap.get("admission_method"));
params.put("bedNumber", pmsPatientBodyMap.get("bed_number"));
params.put("dischargeDate", pmsPatientBodyMap.get(""));
params.put("dischargeMethod", pmsPatientBodyMap.get("discharge_date"));
params.put("height", pmsPatientBodyMap.get("height"));
params.put("weight", pmsPatientBodyMap.get("weight"));
params.put("admissionDate", ObjectUtil.isEmpty(pmsPatientBodyMap.get("admissionDate")) ? "": DateUtil.format(DateUtil.parse(pmsPatientBodyMap.get("admissionDate").toString()), "yyyy-MM-dd"));
params.put("num", pmsPatientBodyMap.get("admissionCount"));
params.put("admissionMethod", ObjectUtil.isNull(pmsPatientBodyMap.get("admissionMethod")) ? "" : ObjectUtil.equals(pmsPatientBodyMap.get("admissionMethod"), "1") ? "急诊": ObjectUtil.equals(pmsPatientBodyMap.get("admissionMethod"), "2") ? "门诊": ObjectUtil.equals(pmsPatientBodyMap.get("admissionMethod"), "3") ? "其他医疗机构转入": "其他");
params.put("bedNumber", pmsPatientBodyMap.get("bedNumber"));
params.put("dischargeDate", ObjectUtil.isEmpty(pmsPatientBodyMap.get("dischargeDate")) ? "": DateUtil.format(DateUtil.parse(pmsPatientBodyMap.get("dischargeDate").toString()), "yyyy-MM-dd"));
params.put("dischargeMethod", ObjectUtil.isNull(pmsPatientBodyMap.get("dischargeMethod")) ? "": ObjectUtil.equals(pmsPatientBodyMap.get("dischargeMethod"), "1") ? "医嘱离院" : ObjectUtil.equals(pmsPatientBodyMap.get("dischargeMethod"), "2") ? "医嘱转院" :ObjectUtil.equals(pmsPatientBodyMap.get("dischargeMethod"), "3") ? "医嘱转社区卫生服务机构/乡镇卫生院":ObjectUtil.equals(pmsPatientBodyMap.get("dischargeMethod"), "4") ? "非医嘱离院":ObjectUtil.equals(pmsPatientBodyMap.get("dischargeMethod"), "5") ? "死亡": "其他");
params.put("height", ObjectUtil.isEmpty(pmsPatientBodyMap.get("height")) ? "" : pmsPatientBodyMap.get("height") + "cm");
params.put("weight", ObjectUtil.isEmpty(pmsPatientBodyMap.get("weight")) ? "" : pmsPatientBodyMap.get("weight") + "kg");
params.put("bmi", pmsPatientBodyMap.get("bmi"));
params.put("tz", pmsPatientBodyMap.get("tz"));
params.put("temperature", pmsPatientBodyMap.get("temperature"));
params.put("systolic_pressure", pmsPatientBodyMap.get("systolic_pressure"));
params.put("diastolic_pressure", pmsPatientBodyMap.get("diastolic_pressure"));
params.put("systolic_pressure", pmsPatientBodyMap.get("systolicPressure"));
params.put("diastolic_pressure", pmsPatientBodyMap.get("diastolicPressure"));
params.put("pulse", pmsPatientBodyMap.get("pulse"));
params.put("creatinine", pmsPatientBodyMap.get("creatinine"));
params.put("oxygen_saturation", pmsPatientBodyMap.get("oxygen_saturation"));
params.put("oxygen_saturation", pmsPatientBodyMap.get("oxygenSaturation"));
params.put("albumin", pmsPatientBodyMap.get("albumin"));
params.put("total_protein", pmsPatientBodyMap.get("total_protein"));
params.put("vitamin_d3", pmsPatientBodyMap.get("vitamin_d3"));
params.put("total_protein", pmsPatientBodyMap.get("totalProtein"));
params.put("vitamin_d3", pmsPatientBodyMap.get("vitaminD3"));
params.put("hematocrit", pmsPatientBodyMap.get("hematocrit"));
params.put("dimer", pmsPatientBodyMap.get("dimer"));
}
@ -983,24 +1010,18 @@ public class AmsReportServiceImpl implements AmsReportService {
// params.put("cpy_img_url", patientInfo.getName());
params.put("report_date", DateUtil.date(patientInfo.getReportTime()));
params.put("reportDate", DateUtil.format(DateUtil.date(patientInfo.getReportTime()), "yyyy-MM-dd"));
//生成表格
// 创建带有样式的文本
TextRenderData text1 = Texts.of("评估结论").bold().fontSize(12).create();
TextRenderData text2 = Texts.of("评估结论").bold().fontSize(12).create();
TextRenderData text3 = Texts.of("评估结论").bold().fontSize(12).create();
TextRenderData text4 = Texts.of("评估结论").bold().fontSize(12).create();
// TextRenderData text5 = Texts.of("评估结论").bold().fontSize(12).create();
RowRenderData headerRow = Rows.of(text1, text2, text3, text4).create();
//查询
//查询报告数据
List<RmsVo.ExportInfo> exportInfos = rmsDao.queryReportExportInfo(dto.getEvaluationId());
if (CollUtil.isEmpty(exportInfos)) {
return null;
}
RowRenderData titleRow = Rows.of("一级指标/二级指标", "量表名称", "得分", "结论").create();
Tables.TableBuilder of = Tables.of(headerRow, titleRow);
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());
@ -1018,7 +1039,7 @@ public class AmsReportServiceImpl implements AmsReportService {
textName,
textScore,
textImpression
).create();
).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());
// }
@ -1037,7 +1058,7 @@ public class AmsReportServiceImpl implements AmsReportService {
textName,
textScore,
textImpression
).create();
).center().create();
of.addRow(row1);
} else {
TextRenderData textStr = Texts.of(exportInfos.get(i).getImpression().contains("\n") ? "量表结论" + "\n" + "肌少总结论" : "肌少总结论").bold().create();
@ -1052,12 +1073,12 @@ public class AmsReportServiceImpl implements AmsReportService {
textName,
textImpression,
textScore
).create();
).center().create();
if (StrUtil.isNotEmpty(exportInfos.get(i).getComboName() + "/" + exportInfos.get(i).getComboParentName())) {
of.mergeRule(
MergeCellRule.builder().map(
MergeCellRule.Grid.of(i + 2, 0), MergeCellRule.Grid.of(i + 2, 1))
.map(MergeCellRule.Grid.of(i + 2, 2), MergeCellRule.Grid.of(i + 2, 3)
MergeCellRule.Grid.of(i + 1, 0), MergeCellRule.Grid.of(i + 1, 1))
.map(MergeCellRule.Grid.of(i + 1, 2), MergeCellRule.Grid.of(i + 1, 3)
).build()
);
@ -1136,16 +1157,52 @@ public class AmsReportServiceImpl implements AmsReportService {
listMap.add(map);
}
}
//阳性报告单
generateYx(params, exportInfos);
params.put("questionTables", listMap);
TableRenderData tableData = of
.center()
.create();
params.put("table", tableData);
return params;
}
public void generateYx(Map<String, Object> params, List<RmsVo.ExportInfo> exportInfos) {
RowRenderData titleRow = Rows.of("一级指标/二级指标", "量表名称", "得分", "结论").center()
.create();
Tables.TableBuilder of = Tables.of(titleRow);
for (int i = 0; i < exportInfos.size(); i++) {
RmsVo.Pgjl pgjl = new RmsVo.Pgjl();
params.put("yjzb", exportInfos.get(i).getComboParentName());
params.put("ejzb", exportInfos.get(i).getComboName());
if (exportInfos.get(i).getNeedPlan() != null && exportInfos.get(i).getNeedPlan() == 1) {
TextRenderData textStr = Texts.of(StrUtil.isEmpty(exportInfos.get(i).getComboParentName()) ? "" : exportInfos.get(i).getComboParentName() + "/" + exportInfos.get(i).getComboName()).bold().color("FF0000").create();
TextRenderData textName = Texts.of(exportInfos.get(i).getScaleName()).bold().color("FF0000").create();
TextRenderData textScore = Texts.of(exportInfos.get(i).getScore() == null ? "" : exportInfos.get(i).getScore() + "").bold().color("FF0000").create();
TextRenderData textImpression = Texts.of(StrUtil.isEmpty(exportInfos.get(i).getImpression()) ? exportInfos.get(i).getResult() : exportInfos.get(i).getImpression()).bold().color("FF0000").create();
pgjl.setTitle(StrUtil.isEmpty(exportInfos.get(i).getComboParentName()) ? "" : exportInfos.get(i).getComboParentName() + "/" + exportInfos.get(i).getComboName());
//查询一二级套餐
RowRenderData row1 = Rows.of(
textStr,
textName,
textScore,
textImpression
).center().create();
// if (StrUtil.isNotEmpty(exportInfos.get(i).getComboName() + "/" + exportInfos.get(i).getComboParentName())) {
// of.mergeRule(MergeCellRule.builder().map(MergeCellRule.Grid.of(i + 1, i + 1), MergeCellRule.Grid.of(0, 1)).build());
// }
of.addRow(row1);
}
}
TableRenderData tableData = of
.center()
.create();
params.put("yxTable", tableData);
}
@Override
public AmsReportVo.Result export(RmsDto.Export dto) {
//1. 查询是否已生成对应版本的报告单

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;
@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())) {
String hash = Md5Utils.hash(param.getIdCard().substring(2, 14));
param.setIdCard(param.getIdCard().substring(0, 2) + hash + param.getIdCard().substring(14, 18));
}
return patientDao.queryPatientList(param, dataScope, SecurityUtils.isAdmin(userId) ? null : userId, userName);
return patientDao.queryPatientList(param, dataScope, SecurityUtils.isAdmin(userId) ? null : userId, userName, deptIdList);
}
@Override
@ -2145,8 +2145,8 @@ public class PmsPatientServiceImpl implements IPmsPatientService {
}
@Override
public void exportPatient(HttpServletResponse response, PmsPatientDto.QueryPatient param, String dataScope, Long userId, String userName) throws IOException {
List<PmsPatientVo.PatientList> patientLists = queryPatientList(param, dataScope, userId, userName);
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, deptIdList);
if (CollUtil.isEmpty(patientLists)) {
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)) {
//组装成父子级关系
scores = buildReportScoreTree(scores, 0L);
for (RmsVo.ReportScore score : scores) {
//查询量表的总分趋势信息
List<RmsVo.ScoreTrend> scoreTrend = rmsDao.getScoreTrend(reportPatient.getPatientId(), score.getCode(), time.getMinTime(), time.getMaxTime());
//折线图上只显示近5条记录
if (CollectionUtil.isNotEmpty(scoreTrend) && scoreTrend.size() > 5) {
scoreTrend = scoreTrend.subList(scoreTrend.size() - 5, scoreTrend.size());
}
score.setScoreTrend(scoreTrend);
//给moca添加雷达图信息
if (GenConstants.Ht.Report.MOCA.equals(score.getCode())) {
List<RmsVo.EvaluationScoreDistribution> scoreDistributions = rmsDao.getScoreDistributions(reportPatient.getPatientId());
if (CollUtil.isNotEmpty(scoreDistributions)) {
//处理认知域
List<RmsVo.EvaluationScoreDistribution> distributions = disposeDistribution(scoreDistributions);
//根据日期倒序排序
distributions.sort(Comparator.comparing(RmsVo.EvaluationScoreDistribution::getDay).reversed());
score.setScoreDistributions(distributions);
}
}
}
}
detail.setPatient(reportPatient);
detail.setScores(scores);
return detail;

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

@ -77,45 +77,83 @@
</delete>
<select id="queryPatientList" resultType="com.ccsens.system.domain.vo.PmsPatientVo$PatientList">
SELECT
DISTINCT
pp.id as patientId,
pp.`name` as patientName,
SELECT DISTINCT
a.patientId,
a.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.age,
pp.idcard,
pp.mobile as 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.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.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.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
pp.abo_blood_type AS aboBloodType,
pp.rh_blood_type AS rhBloodType
FROM
pms_patient pp
LEFT JOIN ems_evaluation ee ON pp.id = ee.patient_id and ee.del_flag = 0
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="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 != ''">
and (
pp.name like CONCAT('%',#{param.searchValue},'%')
@ -136,13 +174,13 @@
<if test="param.hospitalId != null">
and pp.hospital_id = #{param.hospitalId}
</if>
<if test="param.sex != null">
<if test="param.sex != null">
and pp.sex = #{param.sex}
</if>
<if test="param.deptId != null">
and pp.hospital_id = #{param.deptId}
and pp.hospital_id = #{param.deptId}
</if>
<if test="param.educationalStatus != null">
<if test="param.educationalStatus != null">
and pp.educational_status = #{param.educationalStatus}
</if>
<if test="param.ageStatus != null">
@ -169,35 +207,112 @@
</when>
</choose>
</if>
<if test="userId != null">
<!-- 权限 总测评师和测评师都是本部门及以下 -->
and uu.dept_id IN (
SELECT d.dept_id FROM ums_user u LEFT JOIN ums_dept d on (d.dept_id = u.dept_id or
FIND_IN_SET(u.dept_id,ancestors))
WHERE user_id = #{userId}
GROUP BY
pp.id
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="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>
<!-- <choose>-->
<!-- <when test="dataScope == 5">-->
<!-- and (pp.create_by = #{userName} or ae.tester_id = #{userId})-->
<!-- </when>-->
<!-- &lt;!&ndash; 当前医院不区分多级,所以本部门及以下权限和本部门数据权限使用相同的查询语句 &ndash;&gt;-->
<!-- <when test="dataScope == 3 or dataScope == 4">-->
<!-- and uu.dept_id = (SELECT dept_id FROM ums_user WHERE user_id = #{userId})-->
<!-- </when>-->
<!-- <when test="dataScope == 2">-->
<!-- and uu.dept_id in (-->
<!-- SELECT pud.dept_id FROM ums_user u-->
<!-- LEFT JOIN ums_dept ud ON ud.dept_id = u.dept_id-->
<!-- LEFT JOIN ums_dept pud ON pud.dept_id = ud.parent_id-->
<!-- WHERE u.user_id = #{userId}-->
<!-- UNION ALL-->
<!-- SELECT u.dept_id FROM ums_user u WHERE u.user_id = #{userId}-->
<!-- )-->
<!-- </when>-->
<!-- </choose>-->
GROUP BY pp.id
order by pp.create_time desc
<if test="param.beginTime != null and param.beginTime != ''"><!-- 开始时间检索 -->
and date_format(pp.create_time,'%y%m%d') &gt;= date_format(#{param.beginTime},'%y%m%d')
</if>
<if test="param.endTime != null and param.endTime != ''"><!-- 结束时间检索 -->
and date_format(pp.create_time,'%y%m%d') &lt;= date_format(#{param.endTime},'%y%m%d')
</if>
<if test="param.hospitalId != null">
and pp.hospital_id = #{param.hospitalId}
</if>
<if test="param.sex != null">
and pp.sex = #{param.sex}
</if>
<if test="param.deptId != null">
and pp.hospital_id = #{param.deptId}
</if>
<if test="param.educationalStatus != null">
and pp.educational_status = #{param.educationalStatus}
</if>
<if test="param.ageStatus != null">
<choose>
<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 id="queryPatientByIdCard" resultType="com.ccsens.system.domain.vo.PmsPatientVo$PatientInfo">
SELECT
@ -307,7 +422,7 @@
from
pms_patient_body b
left join pms_patient p on b.patient_id = p.id
left join ums_user uu on p.create_by = uu.user_name
left join ums_user uu on b.create_by = uu.user_name
<where>
b.del_flag = 0 and p.del_flag = 0
<if test="param.visitType != null">
@ -335,5 +450,8 @@
</if>
</where>
order by b.id desc
</select>
</mapper>

94
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
rr.id as evaluationId,
rr.id as reportId,
ee.id as evaluationId,
pp.name,
pp.sex,
pb.outpatient_no as outpatientNo,
@ -1024,8 +1025,8 @@ d.dept_name as hospitalName
FROM
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 pp on pb.patient_id = pp.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 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
@ -1499,47 +1500,60 @@ d.dept_name as hospitalName
<select id="queryEmsScaleScore" resultType="com.ccsens.system.domain.vo.RmsVo$ReportScore">
WITH RECURSIVE cognitive_relevance_tree AS (
SELECT
id AS node_id,
evaluation_id,
scale_code AS scale_code,
'' AS second_level_cognitive_code,
cognitive_code AS current_cognitive_code,
score AS level_score,
total_score AS level_total_score,
parent_id,
sort,
1 AS level
FROM ems_evaluation_scale_cognitive_relevance
WHERE parent_id IS NULL
AND del_flag = 0
UNION ALL
SELECT
child.id AS node_id,
child.evaluation_id,
parent.scale_code,
child.cognitive_code AS second_level_cognitive_code,
child.cognitive_code AS current_cognitive_code,
child.score AS level_score,
child.total_score AS level_total_score,
child.parent_id,
child.sort,
2 AS level
FROM ems_evaluation_scale_cognitive_relevance child
INNER JOIN cognitive_relevance_tree parent
ON child.parent_id = parent.node_id
WHERE child.del_flag = 0
SELECT
r.id AS scale_id,
r.evaluation_id,
r.scale_code AS scale_code,
q.name as name,
q.description,
r.score AS level_score,
q.total_score AS total_score,
r.parent_id,
r.sort,
1 AS level
FROM ems_evaluation_scale_cognitive_relevance r
LEFT JOIN qms_scale q on r.scale_code = q.code
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
SELECT
child.id AS scale_id,
child.evaluation_id,
child.cognitive_code AS scale_code,
c.name,
c.description,
child.score AS level_score,
child.total_score AS total_score,
child.parent_id,
child.sort,
2 AS level
FROM ems_evaluation_scale_cognitive_relevance child
INNER JOIN cognitive_relevance_tree parent
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
)
SELECT
rt.evaluation_id AS evaluationId,
rt.scale_code AS scaleCode,
rt.second_level_cognitive_code AS cognitiveCode,
rt.level_score AS score,
IF(rt.level_total_score = null , q.total_score, rt.level_total_score) AS totalScale,
rt.sort
rt.scale_id as scaleId,
rt.parent_id as parentId,
rt.name AS name,
rt.evaluation_id AS evaluationId,
rt.scale_code AS code,
rt.level_score AS score,
rt.sort as sort,
rt.total_score as totalScore,
r.combo_id as comboId
FROM cognitive_relevance_tree rt
LEFT JOIN qms_scale q on rt.scale_code = q.code
ORDER BY evaluation_id, level, sort
left join ems_evaluation_scale_relevance r on r.evaluation_id = rt.evaluation_id and r.scale_code = rt.scale_code
group by rt.scale_code
ORDER BY rt.evaluation_id, rt.level, rt.sort
</select>
<select id="viewReportPdfByVisitNo" resultType="com.ccsens.system.domain.vo.RmsVo$ReportPDF">

57
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.common.annotation.Anonymous;
import com.ccsens.common.constant.ErrorConstant;
import com.ccsens.common.constant.WebConstant;
import com.ccsens.common.core.controller.BaseController;
import com.ccsens.common.core.domain.BaseDto;
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.vo.LdPatientVo;
import com.ccsens.system.domain.vo.PmsPatientVo;
import com.ccsens.system.service.SysPowerService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
@ -54,49 +59,35 @@ public class PmsController extends BaseController {
private IPmsPatientService patientService;
@Resource
private IHmsService hmsService;
// @Resource
// private ILtHisConnectionService ltHisConnectionService;
private final String hospitalConfKey = "patient_encryption";
@Resource
private SysPowerService sysPowerService;
@ApiOperation("获取患者信息列表")
@PostMapping("/queryList")
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();
//当前默认一个用户只有一个角色
String dataScope = "5";
if (CollUtil.isNotEmpty(loginUser.getUser().getRoles())) {
dataScope = loginUser.getUser().getRoles().get(0).getDataScope();
}
if (IdcardUtil.isValidCard(dto.getParam().getSearchValue())) {
dataScope = "2";
List<Long> deptIdList = new ArrayList<>();
if (dto.getParam().getDeptId() == null) {
try {
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));
}
}
}else {
deptIdList.add(dto.getParam().getDeptId());
}
startPageOvertop(dto);
List<PmsPatientVo.PatientList> serverList = patientService.queryPatientList(dto.getParam(), dataScope, loginUser.getUserId(), loginUser.getUsername());
// 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);
List<PmsPatientVo.PatientList> serverList = patientService.queryPatientList(dto.getParam(), null, loginUser.getUserId(), loginUser.getUsername(), deptIdList);
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("userName")String userName,
@Param("idcard")String idcard,
@Param("idcardEncrypt")String idcardEncrypt);
@Param("idcardEncrypt")String idcardEncrypt,
@Param("deptIdList")List<Long> deptIdList);
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("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);

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,
String dataScope,
Long userId,
String userName);
String userName,
List<Long> deptIdList);
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;
@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())
&& IdcardUtil.isValidCard(param.getSearchValue())
&& StrUtil.isEmpty(param.getIdCard())) {
@ -77,7 +77,7 @@ public class PmsPatientServiceImpl implements IPmsPatientService {
String hash = Md5Utils.hash(param.getIdCard().substring(2, 14));
param.setIdCard(param.getIdCard().substring(0, 2) + hash + param.getIdCard().substring(14, 18));
}
return patientDao.queryPatientList(param.getSearchValue(), dataScope, userId, userName, param.getIdCard(), param.getIdcardEncrypt());
return patientDao.queryPatientList(param.getSearchValue(), dataScope, userId, userName, param.getIdCard(), param.getIdcardEncrypt(), deptIdList);
}
@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;
@Resource
private QmsQuestionMapper qmsQuestionMapper;
@Resource
private PmsPatientMapper pmsPatientMapper;
@Override
public List<ScaleVo.ScaleTypeInfo> queryScaleType() {
@ -135,12 +137,21 @@ public class ScaleServiceImpl implements IScaleService {
@Override
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();
List<ScaleVo.ComboInfo> comboInfos = scaleDao.queryComboList(loginUser.getUsername(),dto.getName(),loginUser.getHospitalId(), dto.getVersion(), dto.getLevel());
if (CollUtil.isNotEmpty(comboInfos)) {
for (ScaleVo.ComboInfo comboInfo : comboInfos) {
int i = 0;
comboInfo.setChildrenList(scaleDao.queryComboChildList(comboInfo.getId()));
comboInfo.setChildrenList(scaleDao.queryComboChildList(comboInfo.getId(), isFemale));
// if (CollUtil.isNotEmpty(comboInfo.getChildrenList())) {
// for (ScaleVo.ComboInfo info : comboInfo.getChildrenList()) {
// 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
url: jdbc:mysql://127.0.0.1:3306/ruisi_cga?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: 123456
password: q7510327
# 从库数据源
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
username: root
password: 123456
password: q7510327
# driverClassName: oracle.jdbc.driver.OracleDriver
# url: jdbc:oracle:thin:@200.1.8.115:1521:hisdb
# username: interface_lnpg
# password: interface_lnpg
oracle:
# 从数据源开关/默认关闭
enabled: true
enabled: false
driverClassName: oracle.jdbc.driver.OracleDriver
url: jdbc:oracle:thin:@//192.168.1.5:1521/ORCL
username: USER_LNPGXT

201
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};
</delete>
<select id="queryPatientList" resultType="com.ccsens.system.domain.vo.PmsPatientVo$PatientList">
SELECT
DISTINCT
pp.id as patientId,
pp.`name` as patientName,
SELECT DISTINCT
a.patientId,
a.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.idcard,
pp.mobile as phone,
pp.birth_year as birthYear,
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.contact_name as contactName,
pp.contact_relation as contactRelation,
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
pp.abo_blood_type AS aboBloodType,
pp.rh_blood_type AS rhBloodType
FROM
pms_patient pp
LEFT JOIN ems_evaluation ae on pp.id = ae.patient_id
LEFT JOIN ums_user uu on pp.create_by = uu.user_name
left join pms_patient_body pb on pp.id = pb.patient_id
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="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 != ''">
and (
pp.name like CONCAT('%',#{searchValue},'%')
@ -68,42 +115,82 @@
pb.outpatient_no like CONCAT('%',#{searchValue},'%')
)
</if>
<if test="idcard != null and idcard != ''">
and (pp.idcard = #{idcard} or pp.idcard = #{idcardEncrypt})
</if>
<!-- 权限 总测评师和测评师都是本部门及以下 -->
and uu.dept_id IN ( SELECT d.dept_id FROM ums_user u LEFT JOIN ums_dept d on (d.dept_id = u.dept_id or FIND_IN_SET(u.dept_id,ancestors))
WHERE user_id = #{userId}
)
<!-- <choose>-->
<!-- &lt;!&ndash; 测评师查看自己的患者 &ndash;&gt;-->
<!-- <when test="dataScope == 5">-->
<!-- and (pp.create_by = #{userName} or ae.tester_id = #{userId})-->
<!-- </when>-->
<!-- &lt;!&ndash; 总测评师查看自己部门的患者 &ndash;&gt;-->
<!-- <when test="dataScope == 3 or dataScope == 4">-->
<!-- and(-->
<!-- (EXISTS ( SELECT 1 FROM ums_user WHERE user_id = #{userId} AND data_power = 'ALL' ))-->
<!-- OR-->
<!-- (uu.dept_id IN ( SELECT CONCAT(dept_id, ',', data_power) FROM ums_user WHERE user_id = #{userId} ))-->
<!-- )-->
<!-- </when>-->
<!-- &lt;!&ndash; 目前没有2的权限 &ndash;&gt;-->
<!-- <when test="dataScope == 2">-->
<!-- and uu.dept_id in (-->
<!-- SELECT pud.dept_id FROM ums_user u-->
<!-- LEFT JOIN ums_dept ud ON ud.dept_id = u.dept_id-->
<!-- LEFT JOIN ums_dept pud ON pud.dept_id = ud.parent_id-->
<!-- WHERE u.user_id = #{userId}-->
<!-- UNION ALL-->
<!-- SELECT u.dept_id FROM ums_user u WHERE u.user_id = #{userId}-->
<!-- )-->
<!-- </when>-->
<!-- </choose>-->
GROUP BY pp.id
order by pp.create_time desc
<if test="idcard != null and idcard != ''">
and (pp.idcard = #{idcard} or pp.idcard = #{idcardEncrypt})
</if>
GROUP BY
pp.id
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>
<if test="idcard != null and idcard != ''">
and (pp.idcard = #{idcard} or pp.idcard = #{idcardEncrypt})
</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
group by a.patientId
ORDER BY a.createTime DESC
</select>
<select id="queryPatientByIdCard" resultType="com.ccsens.system.domain.vo.PmsPatientVo$PatientInfo">
SELECT
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
where
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}
order by c.sort, csr.sort, c.level desc, c.create_time DESC,
s.sort

Loading…
Cancel
Save