public List <ScheduleTemplate> SelectScheduleTemplate(Dictionary <string, object> condition)
        {
            var list = new List <ScheduleTemplate>();

            try
            {
                using (SqlCommand sqlcomm = SqlConn.CreateCommand())
                {
                    if (condition == null || condition.Count == 0)
                    {
                        sqlcomm.CommandText =
                            "select * from SCHEDULETEMPLATE order by Date desc;";
                        list = DatabaseOp.ExecuteQuery <ScheduleTemplate>(sqlcomm);
                        return(list);
                    }
                    string sqlcommand = "select * from SCHEDULETEMPLATE where ";
                    DatabaseOp.TransferParameteres(ref sqlcommand, "@", "and", condition, sqlcomm.Parameters);
                    sqlcommand          = sqlcommand.Substring(0, sqlcommand.LastIndexOf("and"));
                    sqlcommand         += " order by Date desc";
                    sqlcomm.CommandText = sqlcommand;

                    list = DatabaseOp.ExecuteQuery <ScheduleTemplate>(sqlcomm);
                    return(list);
                }
            }
            catch (Exception e)
            {
                MainWindow.Log.WriteErrorLog("ScheduleTemplateDao.cs-SelectScheduleTemplate", e);
                return(list);
            }
        }
Beispiel #2
0
        public List <PatientGroupPara> SelectPatientGroupPara(Dictionary <string, object> condition)
        {
            var list = new List <PatientGroupPara>();

            try
            {
                using (SqlCommand sqlcomm = SqlConn.CreateCommand())
                {
                    if (condition == null || condition.Count == 0)
                    {
                        sqlcomm.CommandText =
                            "select * from PATIENTGROUPPARA order by ID asc;";
                        list = DatabaseOp.ExecuteQuery <PatientGroupPara>(sqlcomm);
                        return(list);
                    }
                    string sqlcommand = "select * from PATIENTGROUPPARA where ";
                    DatabaseOp.TransferParameteres(ref sqlcommand, "@", "and", condition, sqlcomm.Parameters);
                    sqlcommand          = sqlcommand.Substring(0, sqlcommand.LastIndexOf("and"));
                    sqlcommand         += " order by ID asc";
                    sqlcomm.CommandText = sqlcommand;

                    list = DatabaseOp.ExecuteQuery <PatientGroupPara>(sqlcomm);
                    return(list);
                }
            }
            catch (Exception e)
            {
                MainWindow.Log.WriteErrorLog("PatientGroupParaDao.cs-SelectPatientGroupPara", e);
                return(list);
            }
        }
        public List <TreatMethod> SelectTreatMethod(Dictionary <string, object> condition)
        {
            var list = new List <TreatMethod>();

            try
            {
                using (SqlCommand sqlcomm = SqlConn.CreateCommand())
                {
                    if (condition == null || condition.Count == 0)
                    {
                        sqlcomm.CommandText =
                            "select * from TREATMETHOD order by ID desc;";
                        list = DatabaseOp.ExecuteQuery <TreatMethod>(sqlcomm);
                        return(list);
                    }
                    string sqlcommand = "select * from TREATMETHOD where ";
                    DatabaseOp.TransferParameteres(ref sqlcommand, "@", "and", condition, sqlcomm.Parameters);
                    sqlcommand          = sqlcommand.Substring(0, sqlcommand.LastIndexOf("and"));
                    sqlcommand         += " order by ID desc";
                    sqlcomm.CommandText = sqlcommand;

                    list = DatabaseOp.ExecuteQuery <TreatMethod>(sqlcomm);
                    return(list);
                }
            }
            catch (Exception e)
            {
                MainWindow.Log.WriteErrorLog("TreatMethodDao.cs-SelectTreatMethod", e);
                return(list);
            }
        }
Beispiel #4
0
        public List <BedDetails> SelectPatient(Dictionary <string, object> condition)
        {
            var list = new List <BedDetails>();

            try
            {
                using (SqlCommand sqlcomm = SqlConn.CreateCommand())
                {
                    //DateTime end = endtemp.AddDays(1);
                    if (condition == null || condition.Count == 0)
                    {
                        /*sqlcomm.CommandText =
                         *  "select * from PATIENT where " + "REGISITDATE between '" +
                         *  begin.ToString("yyyy-MM-dd") +
                         *  "' and  '" + end.ToString("yyyy-MM-dd") + "'" + "order by ID desc;";*/
                        sqlcomm.CommandText =
                            "SELECT Bed.Id, Bed.Name, PatientArea.Type FROM (Bed INNER JOIN PatientRoom ON Bed.PatientRoomId=PatientRoom.Id) INNER JOIN PatientArea ON PatientRoom.PatientAreaId=PatientArea.Id";
                        list = DatabaseOp.ExecuteQuery <BedDetails>(sqlcomm);
                        return(list);
                    }

                    string sqlcommand = "select Bed.Id, Bed.Name, PatientArea.Type FROM (Bed INNER JOIN PatientRoom ON Bed.PatientRoomId=PatientRoom.Id) INNER JOIN PatientArea ON PatientRoom.PatientAreaId=PatientArea.Id where ";
                    //DatabaseOp.TransferParameteres(ref sqlcommand, "@", "and", condition, sqlcomm.Parameters);
                    //sqlcommand = sqlcommand.Substring(0, sqlcommand.LastIndexOf("and"));
                    //sqlcommand += " order by Bed.ID desc";
                    foreach (var v in condition)
                    {
                        sqlcommand += v.Key + "=" + v.Value;
                    }

                    sqlcomm.CommandText = sqlcommand;

                    list = DatabaseOp.ExecuteQuery <BedDetails>(sqlcomm);
                    return(list);
                }
            }
            catch (Exception e)
            {
                MainWindow.Log.WriteErrorLog("ComplexDao.cs-SelectPatient", e);
                return(list);
            }
        }
Beispiel #5
0
        public List <Patient> SelectPatient(Dictionary <string, object> condition, DateTime begin,
                                            DateTime endtemp)
        {
            var list = new List <Patient>();

            try
            {
                using (SqlCommand sqlcomm = SqlConn.CreateCommand())
                {
                    //DateTime end = endtemp.AddDays(1);
                    DateTime end = endtemp;
                    if (condition == null || condition.Count == 0)
                    {
                        sqlcomm.CommandText =
                            "select * from PATIENT where " + "REGISITDATE between '" +
                            begin.ToString("yyyy-MM-dd") +
                            "' and  '" + end.ToString("yyyy-MM-dd") + "'" + "order by ID desc;";
                        list = DatabaseOp.ExecuteQuery <Patient>(sqlcomm);
                        return(list);
                    }

                    string sqlcommand = "select * from PATIENT where ";
                    TransferLikeParameteres(ref sqlcommand, "@", "and", condition, sqlcomm.Parameters);
                    sqlcommand = sqlcommand.Substring(0, sqlcommand.LastIndexOf("and"));

                    sqlcommand += " and REGISITDATE between '" + begin.ToString("yyyy-MM-dd") +
                                  "' and  '" + end.ToString("yyyy-MM-dd") + "'";
                    sqlcommand         += " order by ID desc; ";
                    sqlcomm.CommandText = sqlcommand;

                    list = DatabaseOp.ExecuteQuery <Patient>(sqlcomm);
                    return(list);
                }
            }
            catch (Exception e)
            {
                MainWindow.Log.WriteErrorLog("ComplexDao.cs-SelectPatient", e);
                return(list);
            }
        }
Beispiel #6
0
        public List <Patient> SelectPatientSpecial(List <PatientGroupPara> listinParas)
        {
            var list = new List <Patient>();

            try
            {
                using (SqlCommand sqlcomm = SqlConn.CreateCommand())
                {
                    string condition = string.Empty;
                    foreach (var patientGroupPara in listinParas)
                    {
                        //Key["感染情况"] = "INFECTTYPEID";
                        //Key["治疗状态"] = "TREATSTATUSID";
                        //Key["固定床位"] = "ISFIXEDBED";
                        //Key["所属分区"] = "AERAID";


                        if (patientGroupPara.Value.Contains("%"))
                        {
                            if (patientGroupPara.Key.Equals("所属分区"))
                            {
                                string value = string.Empty;
                                using (PatientAreaDao patientAreaDao = new PatientAreaDao())
                                {
                                    Dictionary <string, object> con = new Dictionary <string, object>();
                                    con["NAME"] = patientGroupPara.Value;
                                    var li = patientAreaDao.SelectPatientArea(con);
                                    value = li[0].Id.ToString();
                                }

                                condition += patientGroupPara.Left.Trim() + " " + MainWindow.Key[patientGroupPara.Key].Trim() + " " +
                                             MainWindow.Symbol[patientGroupPara.Symbol].Trim() + " " + value.Trim() + " " +
                                             patientGroupPara.Right.Trim() + " " + patientGroupPara.Logic.Trim();
                            }
                            else if (patientGroupPara.Key.Equals("治疗状态"))
                            {
                                string value = string.Empty;
                                using (TreatStatusDao treatStatusDao = new TreatStatusDao())
                                {
                                    Dictionary <string, object> con = new Dictionary <string, object>();
                                    con["NAME"] = patientGroupPara.Value;
                                    var li = treatStatusDao.SelectTreatStatus(con);
                                    value = li[0].Id.ToString();
                                }
                                condition += patientGroupPara.Left.Trim() + " " + MainWindow.Key[patientGroupPara.Key].Trim() + " " +
                                             MainWindow.Symbol[patientGroupPara.Symbol].Trim() + " " + value.Trim() + " " +
                                             patientGroupPara.Right.Trim() + " " + patientGroupPara.Logic.Trim();
                            }
                            else if (patientGroupPara.Key.Equals("感染情况"))
                            {
                                if (patientGroupPara.Value.Equals("阴性"))
                                {
                                    condition += patientGroupPara.Left.Trim() + " " + MainWindow.Key[patientGroupPara.Key].Trim() + " " +
                                                 MainWindow.Symbol[patientGroupPara.Symbol].Trim() + " " + "0" + " " +
                                                 patientGroupPara.Right.Trim() + " " + patientGroupPara.Logic.Trim();
                                }
                                else
                                {
                                    string value = string.Empty;
                                    using (InfectTypeDao infectTypeDao = new InfectTypeDao())
                                    {
                                        Dictionary <string, object> con = new Dictionary <string, object>();
                                        con["NAME"] = patientGroupPara.Value;
                                        var li = infectTypeDao.SelectInfectType(con);
                                        value = li[0].Id.ToString();
                                    }
                                    condition += patientGroupPara.Left.Trim() + " " + MainWindow.Key[patientGroupPara.Key].Trim() + " " +
                                                 MainWindow.Symbol[patientGroupPara.Symbol].Trim() + " " + value.Trim() + " " +
                                                 patientGroupPara.Right.Trim() + " " + patientGroupPara.Logic.Trim();
                                }
                            }
                            else if (patientGroupPara.Key.Equals("固定床位"))
                            {
                                condition += patientGroupPara.Left.Trim() + " " + MainWindow.Key[patientGroupPara.Key].Trim() + " " +
                                             MainWindow.Symbol[patientGroupPara.Symbol].Trim() + " " + patientGroupPara.Value.Trim() + " " +
                                             patientGroupPara.Right.Trim() + " " + patientGroupPara.Logic.Trim();
                            }
                            else
                            {
                                condition += patientGroupPara.Left.Trim() + " " + MainWindow.Key[patientGroupPara.Key].Trim() + " " +
                                             MainWindow.Symbol[patientGroupPara.Symbol].Trim() + " \'" + patientGroupPara.Value.Trim() + "\' " +
                                             patientGroupPara.Right.Trim() + " " + patientGroupPara.Logic.Trim();
                            }
                        }
                        else
                        {
                            if (patientGroupPara.Key.Equals("所属分区"))
                            {
                                string value = string.Empty;
                                using (PatientAreaDao patientAreaDao = new PatientAreaDao())
                                {
                                    Dictionary <string, object> con = new Dictionary <string, object>();
                                    con["NAME"] = patientGroupPara.Value;
                                    var li = patientAreaDao.SelectPatientArea(con);
                                    value = li[0].Id.ToString();
                                }
                                condition += patientGroupPara.Left.Trim() + " " +
                                             MainWindow.Key[patientGroupPara.Key].Trim() + " " +
                                             MainWindow.Symbol[patientGroupPara.Symbol].Trim() + " \'" +
                                             value.Trim() + "\' " +
                                             patientGroupPara.Right.Trim() + " " + patientGroupPara.Logic.Trim();
                            }
                            else if (patientGroupPara.Key.Equals("治疗状态"))
                            {
                                if (patientGroupPara.Value.Equals("在治"))
                                {
                                    condition += patientGroupPara.Left.Trim() + " " +
                                                 MainWindow.Key[patientGroupPara.Key].Trim() + " " +
                                                 MainWindow.Symbol[patientGroupPara.Symbol].Trim() + " \'" +
                                                 "0" + "\' " +
                                                 patientGroupPara.Right.Trim() + " " + patientGroupPara.Logic.Trim();
                                }
                                else
                                {
                                    string value = string.Empty;
                                    using (TreatStatusDao treatStatusDao = new TreatStatusDao())
                                    {
                                        Dictionary <string, object> con = new Dictionary <string, object>();
                                        con["NAME"] = patientGroupPara.Value;
                                        var li = treatStatusDao.SelectTreatStatus(con);
                                        value = li[0].Id.ToString();
                                    }
                                    condition += patientGroupPara.Left.Trim() + " " +
                                                 MainWindow.Key[patientGroupPara.Key].Trim() + " " +
                                                 MainWindow.Symbol[patientGroupPara.Symbol].Trim() + " \'" +
                                                 value.Trim() + "\' " +
                                                 patientGroupPara.Right.Trim() + " " + patientGroupPara.Logic.Trim();
                                }
                            }
                            else if (patientGroupPara.Key.Equals("感染情况"))
                            {
                                string value = string.Empty;
                                using (InfectTypeDao infectTypeDao = new InfectTypeDao())
                                {
                                    Dictionary <string, object> con = new Dictionary <string, object>();
                                    con["NAME"] = patientGroupPara.Value;
                                    var li = infectTypeDao.SelectInfectType(con);
                                    value = li[0].Id.ToString();
                                }
                                condition += patientGroupPara.Left.Trim() + " " +
                                             MainWindow.Key[patientGroupPara.Key].Trim() + " " +
                                             MainWindow.Symbol[patientGroupPara.Symbol].Trim() + " \'" +
                                             value.Trim() + "\' " +
                                             patientGroupPara.Right.Trim() + " " + patientGroupPara.Logic.Trim();
                            }
                            else if (patientGroupPara.Key.Equals("固定床位"))
                            {
                                condition += patientGroupPara.Left.Trim() + " " +
                                             MainWindow.Key[patientGroupPara.Key].Trim() + " " +
                                             MainWindow.Symbol[patientGroupPara.Symbol].Trim() + " \'" +
                                             patientGroupPara.Value.Trim() + "\' " +
                                             patientGroupPara.Right.Trim() + " " + patientGroupPara.Logic.Trim();
                            }
                            else
                            {
                                condition += patientGroupPara.Left.Trim() + " " +
                                             MainWindow.Key[patientGroupPara.Key].Trim() + " " +
                                             MainWindow.Symbol[patientGroupPara.Symbol].Trim() + " \'" +
                                             patientGroupPara.Value.Trim() + "\' " +
                                             patientGroupPara.Right.Trim() + " " + patientGroupPara.Logic.Trim();
                            }
                        }
                    }
                    string sqlcommand = "select * from PATIENT where ";
                    sqlcommand         += condition;
                    sqlcommand         += " order by Name asc";
                    sqlcomm.CommandText = sqlcommand;

                    list = DatabaseOp.ExecuteQuery <Patient>(sqlcomm);
                    return(list);
                }
            }
            catch (Exception e)
            {
                MainWindow.Log.WriteErrorLog("PatientDao.cs-SelectPatientSpecial", e);
                return(list);
            }
        }