예제 #1
0
        public ActionResult IpdCountElderly()
        {
            IpdCountModel     model  = new IpdCountModel();
            IpdCountProviders IpdPro = new IpdCountProviders();

            model.TotalIpdPatient       = IpdPro.GetTotalIpdPatient();
            model.TotalIpdMalePatient   = IpdPro.GetTotalIpdMalePatient();
            model.TotalIpdFemalePatient = IpdPro.GetTotalIpdFemalePatient();
            return(View(model));
        }
예제 #2
0
        public ActionResult IpdCountElderly(string year, int month)
        {
            IpdCountModel     model  = new IpdCountModel();
            IpdCountProviders IpdPro = new IpdCountProviders();

            model = IpdPro.getjanuarycount(year, month);

            model.TotalIpdPatient = IpdPro.GetTotalIpdPatient();
            model.Year            = year;

            model.Month = month;
            model.TotalIpdMalePatient   = IpdPro.GetTotalIpdMalePatient();
            model.TotalIpdFemalePatient = IpdPro.GetTotalIpdFemalePatient();


            return(View(model));
        }
예제 #3
0
        public IpdCountModel getjanuarycount(string year, int Month)
        {
            DateTime      startdate;
            DateTime      enddate;
            int           y     = Convert.ToInt32(year);
            EHMSEntities  ent   = new EHMSEntities();
            IpdCountModel model = new IpdCountModel();



            //for (int i = 1; i <= 12; i++)
            //{
            int lastdate = 0;

            if (Month == 2)
            {
                lastdate = 28;
            }

            //else { lastdate = 30; }
            else if (Month == 1 || Month == 3 || Month == 5 || Month == 7 || Month == 10 || Month == 12)
            {
                lastdate = 31;
            }
            else
            {
                lastdate = 30;
            }

            if (Month == 0)
            {
                startdate = Convert.ToDateTime(y + "/" + 1 + "/" + "1");

                enddate = Convert.ToDateTime(y + "/" + 12 + "/" + "31");
            }
            else
            {
                startdate = Convert.ToDateTime(y + "/" + Month + "/" + "1");

                enddate = Convert.ToDateTime(y + "/" + Month + "/" + lastdate);
            }



            var GetMaleCountFromEM = (from b in ent.OpdMasters
                                      join l in ent.IpdRegistrationMasters on b.OpdID equals l.OpdNoEmergencyNo
                                      where l.RegistrationDate >= startdate && l.RegistrationDate <= enddate && b.Sex == "Male" && b.AgeYear >= 60 && b.AgeYear <= 64 && l.DepartmentID == 1
                                      select b).Count();

            var GetMaleCountFromOM = (from b in ent.OpdMasters
                                      join l in ent.IpdRegistrationMasters on b.OpdID equals l.OpdNoEmergencyNo
                                      where b.RegistrationDate >= startdate && b.RegistrationDate <= enddate && b.Sex == "Male" && b.AgeYear >= 60 && b.AgeYear <= 64 && l.DepartmentID == 2
                                      select b).Count();

            var totalMalecountbetween = GetMaleCountFromEM + GetMaleCountFromOM;

            model.MaleNobetn = totalMalecountbetween;

            var GetFemaleCountFromEM = (from b in ent.OpdMasters
                                        join l in ent.IpdRegistrationMasters on b.OpdID equals l.OpdNoEmergencyNo
                                        where l.RegistrationDate >= startdate && l.RegistrationDate <= enddate && b.Sex == "Female" && b.AgeYear >= 60 && b.AgeYear <= 64 && l.DepartmentID == 1
                                        select b).Count();


            var GetFemaleCountFromOM = (from b in ent.OpdMasters
                                        join l in ent.IpdRegistrationMasters on b.OpdID equals l.OpdNoEmergencyNo
                                        where l.RegistrationDate >= startdate && l.RegistrationDate <= enddate && b.Sex == "Female" && b.AgeYear >= 60 && b.AgeYear <= 64 && l.DepartmentID == 2
                                        select b).Count();
            var totalFemalecountBetn = GetFemaleCountFromOM + GetFemaleCountFromEM;

            model.FemaleNobetn = totalFemalecountBetn;

            var GetMaleCountFromEMAbove = (from b in ent.OpdMasters
                                           join l in ent.IpdRegistrationMasters on b.OpdID equals l.OpdNoEmergencyNo
                                           where l.RegistrationDate >= startdate && l.RegistrationDate <= enddate && b.Sex == "Male" && b.AgeYear > 64 && l.DepartmentID == 1
                                           select b).Count();

            var GetMaleCountFromOMAbove = (from b in ent.OpdMasters
                                           join l in ent.IpdRegistrationMasters on b.OpdID equals l.OpdNoEmergencyNo
                                           where l.RegistrationDate >= startdate && l.RegistrationDate <= enddate && b.Sex == "Male" && b.AgeYear > 64 && l.DepartmentID == 2
                                           select b).Count();

            var totalMaleCountAbove = GetMaleCountFromEMAbove + GetMaleCountFromOMAbove;

            model.MaleNoAbove = totalMaleCountAbove;

            var GetFemaleCountFromEMAbove = (from b in ent.OpdMasters
                                             join l in ent.IpdRegistrationMasters on b.OpdID equals l.OpdNoEmergencyNo
                                             where l.RegistrationDate >= startdate.Date && l.RegistrationDate <= enddate && b.Sex == "Female" && b.AgeYear > 64 && l.DepartmentID == 1
                                             select b).Count();

            var GetFemaleCountFromOMAbove = (from b in ent.OpdMasters
                                             join l in ent.IpdRegistrationMasters on b.OpdID equals l.OpdNoEmergencyNo
                                             where l.RegistrationDate >= startdate && l.RegistrationDate <= enddate && b.Sex == "Female" && b.AgeYear > 64 && l.DepartmentID == 2
                                             select b).Count();

            var totalcountFemaleAbove = GetFemaleCountFromEMAbove + GetFemaleCountFromOMAbove;

            model.FemaleNoAbove = totalcountFemaleAbove;

            var GetTotalCountFromEM = (from b in ent.OpdMasters
                                       join l in ent.IpdRegistrationMasters on b.OpdID equals l.OpdNoEmergencyNo
                                       where l.RegistrationDate >= startdate && l.RegistrationDate <= enddate && b.AgeYear >= 60 && b.AgeYear <= 64 && l.DepartmentID == 1
                                       select b).Count();

            var GetTotalCountFromOM = (from b in ent.OpdMasters
                                       join l in ent.IpdRegistrationMasters on b.OpdID equals l.OpdNoEmergencyNo
                                       where l.RegistrationDate >= startdate && l.RegistrationDate <= enddate && b.AgeYear >= 60 && b.AgeYear <= 64 && l.DepartmentID == 2
                                       select b).Count();
            var totalcountBetween = GetTotalCountFromOM + GetTotalCountFromEM;



            model.TotalNoBetn = totalcountBetween;

            var GetTotalCountFromEMAbove = (from b in ent.OpdMasters
                                            join l in ent.IpdRegistrationMasters on b.OpdID equals l.OpdNoEmergencyNo
                                            where l.RegistrationDate >= startdate && l.RegistrationDate <= enddate && b.AgeYear > 64 && l.DepartmentID == 1
                                            select b).Count();

            var GetTotalCountFromOMAbove = (from b in ent.OpdMasters
                                            join l in ent.IpdRegistrationMasters on b.OpdID equals l.OpdNoEmergencyNo
                                            where l.RegistrationDate >= startdate && l.RegistrationDate <= enddate && b.AgeYear > 64 && l.DepartmentID == 2
                                            select b).Count();

            var totalcountAbove = GetTotalCountFromEM + GetTotalCountFromOM;

            model.TotalNoAbove = totalMaleCountAbove;


            var GetGrandTotalCountFromEM = (from b in ent.OpdMasters
                                            join l in ent.IpdRegistrationMasters on b.OpdID equals l.OpdNoEmergencyNo
                                            where l.RegistrationDate >= startdate && l.RegistrationDate <= enddate && l.DepartmentID == 1 && b.AgeYear >= 60
                                            select b).Count();

            var GetGrandotalCountFromOM = (from b in ent.OpdMasters
                                           join l in ent.IpdRegistrationMasters on b.OpdID equals l.OpdNoEmergencyNo
                                           where l.RegistrationDate >= startdate && l.RegistrationDate <= enddate && l.DepartmentID == 2 && b.AgeYear >= 60
                                           select b).Count();



            var totalGrandcount = GetGrandTotalCountFromEM + GetGrandotalCountFromOM;

            model.GrandTotalElder = totalGrandcount;
            //}


            return(model);
        }