|
@ -35,9 +35,61 @@ public class StatisticalService implements IStatisticalService { |
|
|
private OrganizationDao organizationDao; |
|
|
private OrganizationDao organizationDao; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public StatisticalVo.Common runway(StatisticalDto.RunWay param, Long userId) { |
|
|
public StatisticalVo.Common runway(StatisticalDto.Time param, Long userId) { |
|
|
|
|
|
|
|
|
|
|
|
List<Long> hospitalIds = getHospitalIds(param.getProjectId()); |
|
|
|
|
|
// 时间窗患者
|
|
|
|
|
|
Long timeWindowPatient = firstAidRecordDao.countTimeWindowPatient(hospitalIds, param.getStartTime(), param.getEndTime()); |
|
|
|
|
|
//统计溶栓例数(开始静脉溶栓时间)
|
|
|
|
|
|
Long thrombosis = firstAidRecordDao.countSpecifyAnswer(Constant.Statistical.Thrombosis.QUESTION_CODE, |
|
|
|
|
|
Constant.Statistical.Thrombosis.ANSWER, Constant.Statistical.Thrombosis.TIME_CODE, |
|
|
|
|
|
hospitalIds, param.getStartTime(), param.getEndTime()); |
|
|
|
|
|
//机械再通例数(穿刺完成时间)
|
|
|
|
|
|
Long mechanical = firstAidRecordDao.countSpecifyAnswer(Constant.Statistical.Mechanical.QUESTION_CODE, |
|
|
|
|
|
Constant.Statistical.Mechanical.ANSWER, Constant.Statistical.Mechanical.TIME_CODE, |
|
|
|
|
|
hospitalIds, param.getStartTime(), param.getEndTime()); |
|
|
|
|
|
//脑出血例数(手术开始时间)
|
|
|
|
|
|
Long ich = firstAidRecordDao.countSpecifyAnswer(Constant.Statistical.Ich.QUESTION_CODE, |
|
|
|
|
|
Constant.Statistical.Ich.ANSWER, Constant.Statistical.Ich.TIME_CODE, |
|
|
|
|
|
hospitalIds, param.getStartTime(), param.getEndTime()); |
|
|
|
|
|
|
|
|
|
|
|
StatisticalVo.Common common = new StatisticalVo.Common(); |
|
|
|
|
|
common.setTotal(timeWindowPatient); |
|
|
|
|
|
List<StatisticalVo.Item> items = new ArrayList<>(); |
|
|
|
|
|
items.add(new StatisticalVo.Item(Constant.Statistical.Thrombosis.NAME, ""+thrombosis)); |
|
|
|
|
|
items.add(new StatisticalVo.Item(Constant.Statistical.Mechanical.NAME, ""+mechanical)); |
|
|
|
|
|
items.add(new StatisticalVo.Item(Constant.Statistical.Ich.NAME, ""+ich)); |
|
|
|
|
|
return common; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public StatisticalVo.Common dnt(StatisticalDto.Time param, Long userId) { |
|
|
|
|
|
List<Long> hospitalIds = getHospitalIds(param.getProjectId()); |
|
|
|
|
|
StatisticalVo.Dnt dnt = firstAidRecordDao.countDnt(hospitalIds, param.getStartTime(), param.getEndTime()); |
|
|
|
|
|
if (dnt == null) { |
|
|
|
|
|
dnt = new StatisticalVo.Dnt(); |
|
|
|
|
|
} |
|
|
|
|
|
StatisticalVo.Common common = new StatisticalVo.Common(); |
|
|
|
|
|
common.setTotal(dnt.sum()); |
|
|
|
|
|
List<StatisticalVo.Item> items = new ArrayList<>(); |
|
|
|
|
|
items.add(new StatisticalVo.Item(Constant.Statistical.Dnt.ONE, ""+dnt.getOne())); |
|
|
|
|
|
items.add(new StatisticalVo.Item(Constant.Statistical.Dnt.TWO, ""+dnt.getTwo())); |
|
|
|
|
|
items.add(new StatisticalVo.Item(Constant.Statistical.Dnt.THREE, ""+dnt.getThree())); |
|
|
|
|
|
items.add(new StatisticalVo.Item(Constant.Statistical.Dnt.FOUR, ""+dnt.getFour())); |
|
|
|
|
|
return common; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 查找项目对应的医院ID或对应下级医院ID |
|
|
|
|
|
* @param projectId 项目ID |
|
|
|
|
|
* @return 医院ID |
|
|
|
|
|
*/ |
|
|
|
|
|
private List<Long> getHospitalIds(Long projectId) { |
|
|
// 判断机构是否存在
|
|
|
// 判断机构是否存在
|
|
|
Organization organization = organizationDao.getByProjectId(param.getProjectId()); |
|
|
Organization organization = organizationDao.getByProjectId(projectId); |
|
|
if (organization == null) { |
|
|
if (organization == null) { |
|
|
throw new BaseException(DefaultCodeError.NOT_ORGANIZATION); |
|
|
throw new BaseException(DefaultCodeError.NOT_ORGANIZATION); |
|
|
} |
|
|
} |
|
@ -53,8 +105,6 @@ public class StatisticalService implements IStatisticalService { |
|
|
} |
|
|
} |
|
|
hospitals.forEach(hospital -> hospitalIds.add(hospital.getId())); |
|
|
hospitals.forEach(hospital -> hospitalIds.add(hospital.getId())); |
|
|
} |
|
|
} |
|
|
|
|
|
return hospitalIds; |
|
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |