public TotalStatisticsInfo GetTotalStatisticsGL1(DateTime beginTime, DateTime endTime)
        {
            TotalStatisticsInfo ACinfo = new TotalStatisticsInfo();
            int PKilometer = 0; int PChargeCarFee = 0; int PChargeWaitFee = 0; int PChargeAidFee = 0; int PCharge = 0;

            DataTable tableall = GetStatisticsCharge(beginTime, endTime);

            foreach (DataRow dr in tableall.Rows)
            {
                PKilometer += Convert.ToInt32(dr["收费公里数"]);
                PChargeCarFee += Convert.ToInt32(dr["车费"]);
                PChargeWaitFee += Convert.ToInt32(dr["等候费"]);
                PChargeAidFee += Convert.ToInt32(dr["治疗费"]);
                PCharge += Convert.ToInt32(dr["收费金额"]);
            }
            ACinfo.TKilometer = Convert.ToString(PKilometer);
            ACinfo.TChargeCarFee = Convert.ToString(PChargeCarFee);
            ACinfo.TChargeWaitFee = Convert.ToString(PChargeWaitFee);
            ACinfo.TChargeAidFee = Convert.ToString(PChargeAidFee);
            ACinfo.TCharge = Convert.ToString(PCharge);
            return ACinfo;
        }
示例#2
0
        public TotalStatisticsInfo GetTotalStatisticsGL2(DateTime beginTime, DateTime endTime)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append(@" select
                         除去拒绝治疗病历数=sum(case when mpr.IFRefuseTreatment<>'拒绝治疗' then 1 else 0 end),
                         sum(case when mpr.CPRIFSuccess ='ROSC' then 1 else 0 end ) as ROSC数,
                         count(*) as 病历数
                         into #temp
                           from M_PatientRecord  mpr
                            where mpr.MedicalRecordGenerationTime >= '" + beginTime + "' and mpr.MedicalRecordGenerationTime <='" + endTime + "' ");

            sb.Append(@" select isnull(sum(有救治措施除去只有搬运和护送),0) as 有救治措施除去只有搬运和护送
                    into #temp1
                        from( select  distinct mprm.TaskCode,
                       有救治措施除去只有搬运和护送= (case when mprm.RescueMeasureCode in(229,231,282,296,317,318,320,322,325,329,332,333,334,335,338,341,342,344,351,352,353
                        ,397,398,399,400,402,404,405,406,407,408,410,418,419,420,422,436,449,450,489,490)
                        then 1 else 0 end)
                        from M_PatientRecordMeasure mprm
                        inner join M_PatientRecord mpr on mpr.TaskCode = mprm.TaskCode and mpr.PatientOrder = mprm.PatientOrder

                         where mpr.MedicalRecordGenerationTime >= '" + beginTime + "' and mpr.MedicalRecordGenerationTime <='" + endTime + "' ");

            sb.Append(@"  ) t

                            select isnull(sum(静脉开通数),0) as 静脉开通数
                         into #temp2
                            from
                        (select  distinct mprm.TaskCode,(case when mprm.RescueMeasureCode in(329,422,436) then 1 else 0 end) as 静脉开通数
                        from M_PatientRecordMeasure mprm
                        inner join M_PatientRecord mpr on mpr.TaskCode = mprm.TaskCode and mpr.PatientOrder = mprm.PatientOrder
                        where mpr.MedicalRecordGenerationTime >= '" + beginTime + "' and mpr.MedicalRecordGenerationTime <='" + endTime + "' ");

            sb.Append(@"  ) t1
                    select isnull(sum(心肺复苏数),0) as 心肺复苏数
                        into #temp3
                        from
                        (select  distinct mprm.TaskCode,(case when mprm.RescueMeasureCode in (341,397,449,450) then 1 else 0 end) as  心肺复苏数
                        from M_PatientRecordMeasure mprm
                        inner join M_PatientRecord mpr on mpr.TaskCode = mprm.TaskCode and mpr.PatientOrder = mprm.PatientOrder
                        where mpr.MedicalRecordGenerationTime >= '" + beginTime + "' and mpr.MedicalRecordGenerationTime <='" + endTime + "' ");

            sb.Append(@"  ) t2
            select 除去拒绝治疗病历数,ROSC数,病历数,有救治措施除去只有搬运和护送,静脉开通数,心肺复苏数
            from  #temp,#temp1,#temp2,#temp3

                     drop table #temp1
                    drop table #temp2
                    drop table #temp3
                    drop table #temp  ");

            using (SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.MainConnectionString, CommandType.Text, sb.ToString(), null))
            {
                TotalStatisticsInfo AEinfo = new TotalStatisticsInfo();
                if (dr.Read())
                {
                    AEinfo.TPRNumberExceptRefuseTreatment = DBConvert.ConvertStringToString(dr["除去拒绝治疗病历数"]);
                    AEinfo.TDisposeNumber = DBConvert.ConvertStringToString(dr["有救治措施除去只有搬运和护送"]);
                    AEinfo.TVeinNumber = DBConvert.ConvertStringToString(dr["静脉开通数"]);
                    AEinfo.TROSCNumber = DBConvert.ConvertStringToString(dr["ROSC数"]);
                    AEinfo.TCPRNumber = DBConvert.ConvertStringToString(dr["心肺复苏数"]);
                    AEinfo.TPRNumber = DBConvert.ConvertStringToString(dr["病历数"]);
                }
                return AEinfo;
            }
        }
        public TotalStatisticsInfo GetTotalStatisticsDD(DateTime beginTime, DateTime endTime)
        {
            DataTable tableall = GetStatisticsDD(beginTime, endTime);

            //在表里循环遍历,当某一行的CenterID跟session 中获取的selfCenterID 相等时,将那一行的数据取出,赋给Model,Return
            TotalStatisticsInfo ATinfo = new TotalStatisticsInfo();
            int STaskTimes = 0; int SFirstAidTimes = 0; int STransTimes = 0; int a = 0; int SGoHomeTimes = 0; int SDays = 0; int STaskTimesEveryDay = 0;
            int SAvgSendTime = 0; int SAvgArriveTime = 0; int SAvgLocalAidTime = 0; int SAvgTransTime = 0; int SAvgHospitalTransTime = 0;
            int SAvgReactTime = 0; int SAvgTurnTime = 0;
            foreach (DataRow dr in tableall.Rows)
            {
                a = a + 1;
                STaskTimes += Convert.ToInt32(dr["SendCarTimes"]);
                SFirstAidTimes += Convert.ToInt32(dr["FirstAidTimes"]);
                STransTimes += Convert.ToInt32(dr["TransTimes"]);
                SGoHomeTimes += Convert.ToInt32(dr["GoHomeTimes"]);
                SDays += Convert.ToInt32(dr["Days"]);
                STaskTimesEveryDay += Convert.ToInt32(dr["AvgDaySendCarTimes"]);
                SAvgSendTime += Convert.ToInt32(dr["AvgSendCarTime"]);
                SAvgArriveTime += Convert.ToInt32(dr["AvgArrivingSceneTime"]);
                SAvgLocalAidTime += Convert.ToInt32(dr["AvgSceneRescueTime"]);
                SAvgTransTime += Convert.ToInt32(dr["AvgTransportTime"]);
                SAvgHospitalTransTime += Convert.ToInt32(dr["AvgHospitalDeliveryTime"]);
                SAvgReactTime += Convert.ToInt32(dr["AvgResponseTime"]);
                SAvgTurnTime += Convert.ToInt32(dr["AvgRevolveTime"]);

            }
            if (a != 0)
            {
                ATinfo.TTaskTimes = Convert.ToString(STaskTimes);
                ATinfo.TFirstAidTimes = Convert.ToString(SFirstAidTimes);
                ATinfo.TTransTimes = Convert.ToString(STransTimes);
                ATinfo.TGoHomeTimes = Convert.ToString(SGoHomeTimes);
                ATinfo.TDays = Convert.ToString(SDays);
                ATinfo.TTaskTimesEveryDay = Convert.ToString(STaskTimesEveryDay / a);
                ATinfo.TAvgSendTime = Convert.ToString(SAvgSendTime / a);
                ATinfo.TAvgArriveTime = Convert.ToString(SAvgArriveTime / a);
                ATinfo.TAvgLocalAidTime = Convert.ToString(SAvgLocalAidTime / a);
                ATinfo.TAvgTransTime = Convert.ToString(SAvgTransTime / a);
                ATinfo.TAvgHospitalTransTime = Convert.ToString(SAvgHospitalTransTime / a);
                ATinfo.TAvgReactTime = Convert.ToString(SAvgReactTime / a);
                ATinfo.TAvgTurnTime = Convert.ToString(SAvgTurnTime / a);

                return ATinfo;
            }
            else {
                return new TotalStatisticsInfo();
            }
        }