@ -16,6 +16,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional ;
import javax.annotation.Resource ;
import java.math.BigDecimal ;
import java.util.ArrayList ;
import java.util.List ;
@ -52,16 +53,18 @@ public class StatisticalService implements IStatisticalService {
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 ) ) ;
common . setList ( items ) ;
return common ;
}
@Override
public StatisticalVo . Common dnt ( StatisticalDto . Time param , Long userId ) {
List < Long > hospitalIds = getHospitalIds ( param . getProjectId ( ) ) ;
@ -76,10 +79,81 @@ public class StatisticalService implements IStatisticalService {
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 ( ) ) ) ;
common . setList ( items ) ;
return common ;
}
@Override
public StatisticalVo . Common dpt ( StatisticalDto . Time param , Long userId ) {
List < Long > hospitalIds = getHospitalIds ( param . getProjectId ( ) ) ;
StatisticalVo . Dpt dpt = firstAidRecordDao . countDpt ( hospitalIds , param . getStartTime ( ) , param . getEndTime ( ) ) ;
if ( dpt = = null ) {
dpt = new StatisticalVo . Dpt ( ) ;
}
StatisticalVo . Common common = new StatisticalVo . Common ( ) ;
common . setTotal ( dpt . sum ( ) ) ;
List < StatisticalVo . Item > items = new ArrayList < > ( ) ;
items . add ( new StatisticalVo . Item ( Constant . Statistical . Dpt . ONE , "" + dpt . getOne ( ) ) ) ;
items . add ( new StatisticalVo . Item ( Constant . Statistical . Dpt . TWO , "" + dpt . getTwo ( ) ) ) ;
items . add ( new StatisticalVo . Item ( Constant . Statistical . Dpt . THREE , "" + dpt . getThree ( ) ) ) ;
items . add ( new StatisticalVo . Item ( Constant . Statistical . Dpt . FOUR , "" + dpt . getFour ( ) ) ) ;
items . add ( new StatisticalVo . Item ( Constant . Statistical . Dpt . FIVE , "" + dpt . getFour ( ) ) ) ;
items . add ( new StatisticalVo . Item ( Constant . Statistical . Dpt . SIX , "" + dpt . getFour ( ) ) ) ;
common . setList ( items ) ;
return common ;
}
@Override
public StatisticalVo . CommonList list ( StatisticalDto . Time param , Long userId ) {
List < Long > hospitalIds = getHospitalIds ( param . getProjectId ( ) ) ;
List < StatisticalVo . Item > items = new ArrayList < > ( ) ;
// 时间窗患者
Long timeWindowPatient = firstAidRecordDao . countTimeWindowPatient ( hospitalIds , param . getStartTime ( ) , param . getEndTime ( ) ) ;
items . add ( new StatisticalVo . Item ( Constant . Statistical . TIME_WINDOW_NAME , timeWindowPatient + "" ) ) ;
//统计溶栓例数(开始静脉溶栓时间)
Long thrombosis = firstAidRecordDao . countSpecifyAnswer ( Constant . Statistical . Thrombosis . QUESTION_CODE ,
Constant . Statistical . Thrombosis . ANSWER , Constant . Statistical . Thrombosis . TIME_CODE ,
hospitalIds , param . getStartTime ( ) , param . getEndTime ( ) ) ;
items . add ( new StatisticalVo . Item ( Constant . Statistical . Thrombosis . NAME , "" + thrombosis ) ) ;
// 溶栓率 四舍五入,保留两位 52.33%
items . add ( new StatisticalVo . Item ( Constant . Statistical . THROMBOSIS_RATE_NAME ,
timeWindowPatient = = null | | timeWindowPatient = = 0 ? "" :
new BigDecimal ( thrombosis * 100 . 00 ) . divide ( new BigDecimal ( timeWindowPatient ) , 2 , BigDecimal . ROUND_HALF_UP ) + "%" ) ) ;
//机械再通例数(穿刺完成时间)
Long mechanical = firstAidRecordDao . countSpecifyAnswer ( Constant . Statistical . Mechanical . QUESTION_CODE ,
Constant . Statistical . Mechanical . ANSWER , Constant . Statistical . Mechanical . TIME_CODE ,
hospitalIds , param . getStartTime ( ) , param . getEndTime ( ) ) ;
items . add ( new StatisticalVo . Item ( Constant . Statistical . Mechanical . NAME , "" + mechanical ) ) ;
//脑出血例数(手术开始时间)
Long ich = firstAidRecordDao . countSpecifyAnswer ( Constant . Statistical . Ich . QUESTION_CODE ,
Constant . Statistical . Ich . ANSWER , Constant . Statistical . Ich . TIME_CODE ,
hospitalIds , param . getStartTime ( ) , param . getEndTime ( ) ) ;
items . add ( new StatisticalVo . Item ( Constant . Statistical . Ich . NAME , "" + ich ) ) ;
// DNT中位数
Long dntMedian = firstAidRecordDao . countMedian ( Constant . Statistical . Dnt . MINUEND_CODE , Constant . Statistical . Dnt . SUBTRACTION_CODE , hospitalIds , param . getStartTime ( ) , param . getEndTime ( ) ) ;
items . add ( new StatisticalVo . Item ( Constant . Statistical . DNT_MEDIAN_NAME , "" + dntMedian ) ) ;
// DPT中位数
Long dptMedian = firstAidRecordDao . countMedian ( Constant . Statistical . Dpt . MINUEND_CODE , Constant . Statistical . Dpt . SUBTRACTION_CODE , hospitalIds , param . getStartTime ( ) , param . getEndTime ( ) ) ;
items . add ( new StatisticalVo . Item ( Constant . Statistical . DPT_MEDIAN_NAME , "" + dptMedian ) ) ;
// 累计收录病例数
Long total = firstAidRecordDao . countPatient ( hospitalIds , param . getStartTime ( ) , param . getEndTime ( ) ) ;
items . add ( new StatisticalVo . Item ( Constant . Statistical . PATIENT_TOTAL_NAME , "" + total ) ) ;
StatisticalVo . CommonList common = new StatisticalVo . CommonList ( ) ;
items . add ( new StatisticalVo . Item ( Constant . Statistical . TIME_WINDOW_NAME , "" + timeWindowPatient ) ) ;
common . setList ( items ) ;
return common ;
}
@Override
public StatisticalVo . Common thrombosisRate ( StatisticalDto . ThrombosisRate param , Long userId ) {
List < Long > hospitalIds = getHospitalIds ( param . getProjectId ( ) ) ;
List < StatisticalVo . Item > items = firstAidRecordDao . countThrombosisRateDate ( param . getCountType ( ) , hospitalIds , param . getStartTime ( ) , param . getEndTime ( ) ) ;
StatisticalVo . Common common = new StatisticalVo . Common ( ) ;
// TODO 补充items 计算求和
common . setTotal ( 0L ) ;
common . setList ( items ) ;
return common ;
}
/ * *