Пример #1
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);
            }
        }
Пример #2
0
        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);
            }
        }
        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);
            }
        }
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name="scheduleTemplate">Class instance of PatientArea infomation</param>
        /// <param name="scId">Id of the last insert row id</param>
        /// <returns></returns>
        public bool InsertScheduleTemplate(ScheduleTemplate scheduleTemplate, ref int scId)
        {
            try
            {
                using (SqlCommand sqlcomm = SqlConn.CreateCommand())
                {
                    sqlcomm.CommandText =
                        @"INSERT INTO SCHEDULETEMPLATE ([PATIENTID],[DATE],[AMPME],[METHOD],[DESCRIPTION],[RESERVED],[BEDID],[ISTEMP],[ISAUTO]) VALUES 
                        (@PATIENTID,@DATE,@AMPME,@METHOD,@DESCRIPTION,@RESERVED,@BEDID,@ISTEMP,@ISAUTO) SET @ID = SCOPE_IDENTITY() ";
                    sqlcomm.Parameters.Add("@PATIENTID", DbType.Int32);
                    sqlcomm.Parameters["@PATIENTID"].Value = scheduleTemplate.PatientId;
                    sqlcomm.Parameters.Add("@DATE", DbType.String);
                    if (scheduleTemplate.Date != null)
                    {
                        sqlcomm.Parameters["@DATE"].Value = scheduleTemplate.Date;
                    }
                    sqlcomm.Parameters.Add("@AMPME", DbType.String);
                    if (scheduleTemplate.AmPmE != null)
                    {
                        sqlcomm.Parameters["@AMPME"].Value = scheduleTemplate.AmPmE;
                    }
                    sqlcomm.Parameters.Add("@METHOD", DbType.String);
                    if (scheduleTemplate.Method != null)
                    {
                        sqlcomm.Parameters["@METHOD"].Value = scheduleTemplate.Method;
                    }
                    sqlcomm.Parameters.Add("@DESCRIPTION", DbType.String);
                    if (scheduleTemplate.Description != null)
                    {
                        sqlcomm.Parameters["@DESCRIPTION"].Value = scheduleTemplate.Description;
                    }
                    sqlcomm.Parameters.Add("@RESERVED", DbType.String);
                    if (scheduleTemplate.Reserved != null)
                    {
                        sqlcomm.Parameters["@RESERVED"].Value = scheduleTemplate.Reserved;
                    }
                    sqlcomm.Parameters.Add("@BEDID", DbType.Int32);
                    sqlcomm.Parameters["@BEDID"].Value = scheduleTemplate.BedId;
                    sqlcomm.Parameters.Add("@ISTEMP", DbType.Boolean);
                    sqlcomm.Parameters["@ISTEMP"].Value = scheduleTemplate.IsTemp;
                    sqlcomm.Parameters.Add("@ISAUTO", DbType.Boolean);
                    sqlcomm.Parameters["@ISAUTO"].Value = true;
                    sqlcomm.Parameters.Add("@ID", SqlDbType.Int).Direction = ParameterDirection.Output;

                    DatabaseOp.ExecuteNoneQuery(sqlcomm);

                    scId = (int)sqlcomm.Parameters["@ID"].Value;
                }
            }
            catch (Exception e)
            {
                MainWindow.Log.WriteErrorLog("ScheduleTemplateDao.cs-InsertScheduleTemplate", e);
                return(false);
            }
            return(true);
        }
Пример #5
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name="scheduleType">Class instance of PatientArea infomation</param>
        /// <param name="scId">Id of the last insert row id</param>
        /// <returns></returns>
        public bool InsertScheduleType(ScheduleType scheduleType, ref int scId)
        {
            try
            {
                using (SqlCommand sqlcomm = SqlConn.CreateCommand())
                {
                    sqlcomm.CommandText =
                        @"INSERT INTO SCHEDULETYPE (NAME,PATIENTID,TIMERANGE,TYPE,COLOR,DESCRIPTION,RESERVED) VALUES 
                        (@NAME,@PATIENTID, @TIMERANGE,@TYPE,@COLOR,@DESCRIPTION,@RESERVED) SET @ID = SCOPE_IDENTITY() ";
                    sqlcomm.Parameters.Add("@NAME", DbType.String);
                    if (scheduleType.Name != null)
                    {
                        sqlcomm.Parameters["@NAME"].Value = scheduleType.Name;
                    }
                    sqlcomm.Parameters.Add("@PATIENTID", DbType.Int32);
                    sqlcomm.Parameters["@PATIENTID"].Value = scheduleType.PatientId;
                    sqlcomm.Parameters.Add("@TIMERANGE", DbType.String);
                    if (scheduleType.TimeRange != null)
                    {
                        sqlcomm.Parameters["@TIMERANGE"].Value = scheduleType.TimeRange;
                    }
                    sqlcomm.Parameters.Add("@TYPE", DbType.Int32);
                    sqlcomm.Parameters["@TYPE"].Value = scheduleType.Type;
                    sqlcomm.Parameters.Add("@COLOR", DbType.String);
                    if (scheduleType.Color != null)
                    {
                        sqlcomm.Parameters["@COLOR"].Value = scheduleType.Color;
                    }
                    sqlcomm.Parameters.Add("@DESCRIPTION", DbType.String);
                    if (scheduleType.Description != null)
                    {
                        sqlcomm.Parameters["@DESCRIPTION"].Value = scheduleType.Description;
                    }
                    sqlcomm.Parameters.Add("@RESERVED", DbType.String);
                    if (scheduleType.Reserved != null)
                    {
                        sqlcomm.Parameters["@RESERVED"].Value = scheduleType.Reserved;
                    }
                    sqlcomm.Parameters.Add("@ID", SqlDbType.Int).Direction = ParameterDirection.Output;

                    DatabaseOp.ExecuteNoneQuery(sqlcomm);

                    scId = (int)sqlcomm.Parameters["@ID"].Value;
                }
            }
            catch (Exception e)
            {
                MainWindow.Log.WriteErrorLog("ScheduleTypeDao.cs-InsertScheduleType", e);
                return(false);
            }
            return(true);
        }
Пример #6
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name="patientArea">Class instance of PatientArea infomation</param>
        /// <param name="scId">Id of the last insert row id</param>
        /// <returns></returns>
        public bool InsertPatientArea(PatientArea patientArea, ref int scId)
        {
            try
            {
                using (SqlCommand sqlcomm = SqlConn.CreateCommand())
                {
                    sqlcomm.CommandText =
                        @"INSERT INTO PATIENTAREA (NAME,TYPE,DESCRIPTION,INFECTTYPEID,SEQ,POSITION,RESERVED) VALUES 
                        (@NAME,@TYPE,@DESCRIPTION,@INFECTTYPEID,@SEQ,@POSITION,@RESERVED) SET @ID = SCOPE_IDENTITY() ;";
                    sqlcomm.Parameters.Add("@NAME", DbType.String);
                    if (patientArea.Name != null)
                    {
                        sqlcomm.Parameters["@NAME"].Value = patientArea.Name;
                    }
                    sqlcomm.Parameters.Add("@TYPE", DbType.String);
                    if (patientArea.Type != null)
                    {
                        sqlcomm.Parameters["@TYPE"].Value = patientArea.Type;
                    }
                    sqlcomm.Parameters.Add("@INFECTTYPEID", DbType.Int32);
                    sqlcomm.Parameters["@INFECTTYPEID"].Value = patientArea.InfectTypeId;
                    sqlcomm.Parameters.Add("@SEQ", DbType.Int32);
                    sqlcomm.Parameters["@SEQ"].Value = patientArea.Seq;
                    sqlcomm.Parameters.Add("@POSITION", DbType.String);
                    if (patientArea.Position != null)
                    {
                        sqlcomm.Parameters["@POSITION"].Value = patientArea.Position;
                    }
                    sqlcomm.Parameters.Add("@DESCRIPTION", DbType.String);
                    if (patientArea.Description != null)
                    {
                        sqlcomm.Parameters["@DESCRIPTION"].Value = patientArea.Description;
                    }
                    sqlcomm.Parameters.Add("@RESERVED", DbType.String);
                    if (patientArea.Reserved != null)
                    {
                        sqlcomm.Parameters["@RESERVED"].Value = patientArea.Reserved;
                    }
                    sqlcomm.Parameters.Add("@ID", SqlDbType.Int).Direction = ParameterDirection.Output;

                    DatabaseOp.ExecuteNoneQuery(sqlcomm);

                    scId = (int)sqlcomm.Parameters["@ID"].Value;
                }
            }
            catch (Exception e)
            {
                MainWindow.Log.WriteErrorLog("PatientAreaDao.cs-InsertPatientArea", e);
                return(false);
            }
            return(true);
        }
Пример #7
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name="treatTime">Class instance of infectType infomation</param>
        /// <param name="scId">Id of the last insert row id</param>
        /// <returns></returns>
        public bool InsertTreatTime(TreatTime treatTime, ref int scId)
        {
            try
            {
                using (SqlCommand sqlcomm = SqlConn.CreateCommand())
                {
                    sqlcomm.CommandText =
                        @"INSERT INTO TREATTIME (ACTIVATED,NAME,BEGINTIME,ENDTIME,DESCRIPTION,RESERVED) VALUES 
                        (@ACTIVATED,@NAME,@BEGINTIME,@ENDTIME,@DESCRIPTION,@RESERVED) SET @ID = SCOPE_IDENTITY() ";
                    sqlcomm.Parameters.Add("@NAME", DbType.String);
                    if (treatTime.Name != null)
                    {
                        sqlcomm.Parameters["@NAME"].Value = treatTime.Name;
                    }
                    sqlcomm.Parameters.Add("@ACTIVATED", DbType.Boolean);
                    sqlcomm.Parameters["@ACTIVATED"].Value = treatTime.Activated;
                    sqlcomm.Parameters.Add("@BEGINTIME", DbType.String);
                    if (treatTime.BeginTime != null)
                    {
                        sqlcomm.Parameters["@BEGINTIME"].Value = treatTime.BeginTime;
                    }
                    sqlcomm.Parameters.Add("@ENDTIME", DbType.String);
                    if (treatTime.EndTime != null)
                    {
                        sqlcomm.Parameters["@ENDTIME"].Value = treatTime.EndTime;
                    }
                    sqlcomm.Parameters.Add("@DESCRIPTION", DbType.String);
                    if (treatTime.Description != null)
                    {
                        sqlcomm.Parameters["@DESCRIPTION"].Value = treatTime.Description;
                    }
                    sqlcomm.Parameters.Add("@RESERVED", DbType.String);
                    if (treatTime.Reserved != null)
                    {
                        sqlcomm.Parameters["@RESERVED"].Value = treatTime.Reserved;
                    }

                    sqlcomm.Parameters.Add("@ID", SqlDbType.Int).Direction = ParameterDirection.Output;

                    DatabaseOp.ExecuteNoneQuery(sqlcomm);

                    scId = (int)sqlcomm.Parameters["@ID"].Value;
                }
            }
            catch (Exception e)
            {
                MainWindow.Log.WriteErrorLog("TreatTimeDao.cs-InsertTreatTime", e);
                return(false);
            }
            return(true);
        }
Пример #8
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name="bed">Class instance of bed infomation</param>
        /// <param name="scBedId">Id of the last insert row id</param>
        /// <returns></returns>
        public bool InsertBed(Bed bed, ref int scId)
        {
            try
            {
                using (SqlCommand sqlcomm = SqlConn.CreateCommand())
                {
                    sqlcomm.CommandText =
                        @"INSERT INTO BED (PATIENTAREAID,NAME,TREATTYPEID,ISAVAILABLE, ISOCCUPY,DESCRIPTION,RESERVED,ISTEMP, MACHINETYPEID) VALUES 
                        (@PATIENTAREAID,@NAME,@TREATTYPEID,@ISAVAILABLE,@ISOCCUPY,@DESCRIPTION,@RESERVED,@ISTEMP,@MACHINETYPEID) SET @ID = SCOPE_IDENTITY() ";
                    sqlcomm.Parameters.Add("@NAME", DbType.String);
                    if (bed.Name != null)
                    {
                        sqlcomm.Parameters["@NAME"].Value = bed.Name;
                    }
                    sqlcomm.Parameters.Add("@TREATTYPEID", DbType.Int32);
                    sqlcomm.Parameters["@TREATTYPEID"].Value = bed.TreatTypeId;
                    sqlcomm.Parameters.Add("@ISAVAILABLE", DbType.Boolean);
                    sqlcomm.Parameters["@ISAVAILABLE"].Value = bed.IsAvailable;
                    sqlcomm.Parameters.Add("@ISOCCUPY", DbType.Boolean);
                    sqlcomm.Parameters["@ISOCCUPY"].Value = bed.IsOccupy;
                    sqlcomm.Parameters.Add("@DESCRIPTION", DbType.String);
                    if (bed.Description != null)
                    {
                        sqlcomm.Parameters["@DESCRIPTION"].Value = bed.Description;
                    }
                    sqlcomm.Parameters.Add("@RESERVED", DbType.String);
                    if (bed.Reserved != null)
                    {
                        sqlcomm.Parameters["@RESERVED"].Value = bed.Reserved;
                    }
                    sqlcomm.Parameters.Add("@PATIENTAREAID", DbType.Int32);
                    sqlcomm.Parameters["@PATIENTAREAID"].Value = bed.PatientAreaId;
                    sqlcomm.Parameters.Add("@ISTEMP", DbType.Boolean);
                    sqlcomm.Parameters["@ISTEMP"].Value = bed.IsTemp;
                    sqlcomm.Parameters.Add("@MACHINETYPEID", DbType.Int32);
                    sqlcomm.Parameters["@MACHINETYPEID"].Value             = bed.MachineTypeId;
                    sqlcomm.Parameters.Add("@ID", SqlDbType.Int).Direction = ParameterDirection.Output;

                    DatabaseOp.ExecuteNoneQuery(sqlcomm);

                    scId = (int)sqlcomm.Parameters["@ID"].Value;
                }
            }
            catch (Exception e)
            {
                MainWindow.Log.WriteErrorLog("BedDao.cs-InsertBed", e);
                return(false);
            }
            return(true);
        }
Пример #9
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name="treatMethod">Class instance of infectType infomation</param>
        /// <param name="scId">Id of the last insert row id</param>
        /// <returns></returns>
        public bool InsertTreatMethod(TreatMethod treatMethod, ref int scId)
        {
            try
            {
                using (SqlCommand sqlcomm = SqlConn.CreateCommand())
                {
                    sqlcomm.CommandText =
                        @"INSERT INTO TREATMETHOD (NAME,SINGLEPUMP,DOUBLEPUMP,DESCRIPTION,RESERVED,BGCOLOR,ISAVAILABLE) VALUES 
                        (@NAME,@SINGLEPUMP,@DOUBLEPUMP,@DESCRIPTION,@RESERVED,@BGCOLOR,@ISAVAILABLE) SET @ID = SCOPE_IDENTITY() ";
                    sqlcomm.Parameters.Add("@NAME", DbType.String);
                    if (treatMethod.Name != null)
                    {
                        sqlcomm.Parameters["@NAME"].Value = treatMethod.Name;
                    }
                    sqlcomm.Parameters.Add("@SINGLEPUMP", DbType.Boolean);
                    sqlcomm.Parameters["@SINGLEPUMP"].Value = treatMethod.SinglePump;
                    sqlcomm.Parameters.Add("@DOUBLEPUMP", DbType.Boolean);
                    sqlcomm.Parameters["@DOUBLEPUMP"].Value = treatMethod.DoublePump;
                    sqlcomm.Parameters.Add("@DESCRIPTION", DbType.String);
                    if (treatMethod.Description != null)
                    {
                        sqlcomm.Parameters["@DESCRIPTION"].Value = treatMethod.Description;
                    }
                    sqlcomm.Parameters.Add("@RESERVED", DbType.String);
                    if (treatMethod.Reserved != null)
                    {
                        sqlcomm.Parameters["@RESERVED"].Value = treatMethod.Reserved;
                    }
                    sqlcomm.Parameters.Add("@BGCOLOR", DbType.String);
                    sqlcomm.Parameters["@BGCOLOR"].Value = treatMethod.BgColor;
                    sqlcomm.Parameters.Add("@ISAVAILABLE", DbType.Boolean);
                    sqlcomm.Parameters["@ISAVAILABLE"].Value = treatMethod.IsAvailable;
                    sqlcomm.Parameters.Add("@ID", SqlDbType.Int).Direction = ParameterDirection.Output;

                    DatabaseOp.ExecuteNoneQuery(sqlcomm);

                    scId = (int)sqlcomm.Parameters["@ID"].Value;
                }
            }
            catch (Exception e)
            {
                MainWindow.Log.WriteErrorLog("TreatMethodDao.cs-InsertTreatMethod", e);
                return(false);
            }
            return(true);
        }
Пример #10
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name="interval">Class instance of infectType infomation</param>
        /// <param name="scintervalId">Id of the last insert row id</param>
        /// <returns></returns>
        public bool InsertInterval(MedicalOrderPara interval, ref int scId)
        {
            try
            {
                using (SqlCommand sqlcomm = SqlConn.CreateCommand())
                {
                    sqlcomm.CommandText =
                        @"INSERT INTO MEDICALORDERPARA ([NAME],[TYPE],[COUNT],[DESCRIPTION],[RESERVED]) VALUES 
                        (@NAME,@TYPE,@COUNT,@DESCRIPTION,@RESERVED) SET @ID = SCOPE_IDENTITY() ";
                    sqlcomm.Parameters.Add("@NAME", DbType.String);
                    if (interval.Name != null)
                    {
                        sqlcomm.Parameters["@NAME"].Value = interval.Name;
                    }
                    sqlcomm.Parameters.Add("@TYPE", DbType.String);
                    if (interval.Type != null)
                    {
                        sqlcomm.Parameters["@TYPE"].Value = interval.Type;
                    }
                    sqlcomm.Parameters.Add("@COUNT", DbType.Int32);
                    sqlcomm.Parameters["@COUNT"].Value = interval.Count;
                    sqlcomm.Parameters.Add("@DESCRIPTION", DbType.String);
                    if (interval.Description != null)
                    {
                        sqlcomm.Parameters["@DESCRIPTION"].Value = interval.Description;
                    }
                    sqlcomm.Parameters.Add("@RESERVED", DbType.String);
                    if (interval.Reserved != null)
                    {
                        sqlcomm.Parameters["@RESERVED"].Value = interval.Reserved;
                    }
                    sqlcomm.Parameters.Add("@ID", SqlDbType.Int).Direction = ParameterDirection.Output;

                    DatabaseOp.ExecuteNoneQuery(sqlcomm);

                    scId = (int)sqlcomm.Parameters["@ID"].Value;
                }
            }
            catch (Exception e)
            {
                MainWindow.Log.WriteErrorLog("MedicalOrderParaDao.cs-Insert", e);
                return(false);
            }
            return(true);
        }
Пример #11
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name="MachineType">Class instance of MachineType infomation</param>
        /// <param name="scMachineTypeId">Id of the last insert row id</param>
        /// <returns></returns>
        public bool InsertMachineType(MachineType MachineType, ref int scId)
        {
            try
            {
                using (SqlCommand sqlcomm = SqlConn.CreateCommand())
                {
                    sqlcomm.CommandText =
                        @"INSERT INTO MACHINETYPE (NAME,BGCOLOR,DESCRIPTION,RESERVED) VALUES 
                        (@NAME,@BGCOLOR,@DESCRIPTION,@RESERVED) SET @ID = SCOPE_IDENTITY() ";
                    sqlcomm.Parameters.Add("@NAME", DbType.String);
                    if (MachineType.Name != null)
                    {
                        sqlcomm.Parameters["@NAME"].Value = MachineType.Name;
                    }
                    sqlcomm.Parameters.Add("@BGCOLOR", DbType.String);
                    if (MachineType.BgColor != null)
                    {
                        sqlcomm.Parameters["@BGCOLOR"].Value = MachineType.BgColor;
                    }
                    sqlcomm.Parameters.Add("@DESCRIPTION", DbType.String);
                    if (MachineType.Description != null)
                    {
                        sqlcomm.Parameters["@DESCRIPTION"].Value = MachineType.Description;
                    }
                    sqlcomm.Parameters.Add("@RESERVED", DbType.String);
                    if (MachineType.Reserved != null)
                    {
                        sqlcomm.Parameters["@RESERVED"].Value = MachineType.Reserved;
                    }
                    sqlcomm.Parameters.Add("@ID", SqlDbType.Int).Direction = ParameterDirection.Output;

                    DatabaseOp.ExecuteNoneQuery(sqlcomm);

                    scId = (int)sqlcomm.Parameters["@ID"].Value;
                }
            }
            catch (Exception e)
            {
                MainWindow.Log.WriteErrorLog("MachineTypeDao.cs-InsertMachineType", e);
                return(false);
            }
            return(true);
        }
Пример #12
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);
            }
        }
Пример #13
0
 public bool DeleteTreatType(Int64 scId)
 {
     try
     {
         using (SqlCommand sqlcomm = SqlConn.CreateCommand())
         {
             sqlcomm.CommandText =
                 @"DELETE FROM TREATTYPE WHERE ID = @ID";
             sqlcomm.Parameters.Add("@ID", DbType.Int32);
             sqlcomm.Parameters["@ID"].Value = scId;
             DatabaseOp.ExecuteNoneQuery(sqlcomm);
         }
     }
     catch (Exception e)
     {
         MainWindow.Log.WriteErrorLog("TreatTypeDao.cs-DeleteTreatType", e);
         return(false);
     }
     return(true);
 }
Пример #14
0
 public bool DeleteScheduleTemplate2(int scId)
 {
     try
     {
         using (SqlCommand sqlcomm = SqlConn.CreateCommand())
         {
             sqlcomm.CommandText =
                 @"DELETE FROM SCHEDULETEMPLATE WHERE PatientId = @PatientId";
             sqlcomm.Parameters.Add("@PatientId", DbType.Int32);
             sqlcomm.Parameters["@PatientId"].Value = scId;
             DatabaseOp.ExecuteNoneQuery(sqlcomm);
         }
     }
     catch (Exception e)
     {
         MainWindow.Log.WriteErrorLog("ScheduleTemplateDao.cs-DeleteScheduleTemplate2", e);
         return(false);
     }
     return(true);
 }
Пример #15
0
 public bool DeletePatientGroupPara(Int64 scPatientGroupParaId)
 {
     try
     {
         using (SqlCommand sqlcomm = SqlConn.CreateCommand())
         {
             sqlcomm.CommandText =
                 @"DELETE FROM PATIENTGROUPPARA WHERE ID = @ID";
             sqlcomm.Parameters.Add("@ID", DbType.Int32);
             sqlcomm.Parameters["@ID"].Value = scPatientGroupParaId;
             DatabaseOp.ExecuteNoneQuery(sqlcomm);
         }
     }
     catch (Exception e)
     {
         MainWindow.Log.WriteErrorLog("PatientGroupParaDao.cs-DeletePatientGroupPara", e);
         return(false);
     }
     return(true);
 }
Пример #16
0
 public bool DeleteMedicalOrder2(int patientId)
 {
     try
     {
         using (SqlCommand sqlcomm = SqlConn.CreateCommand())
         {
             sqlcomm.CommandText =
                 @"DELETE FROM MEDICALORDER WHERE PatientId = @PatientId";
             sqlcomm.Parameters.Add("@PatientId", DbType.Int32);
             sqlcomm.Parameters["@PatientId"].Value = patientId;
             DatabaseOp.ExecuteNoneQuery(sqlcomm);
         }
     }
     catch (Exception e)
     {
         MainWindow.Log.WriteErrorLog("MedicalOrderDao.cs-DeleteMedicalOrder", e);
         return(false);
     }
     return(true);
 }
Пример #17
0
 public bool DeleteInterval(Int64 scIntervalId)
 {
     try
     {
         using (SqlCommand sqlcomm = SqlConn.CreateCommand())
         {
             sqlcomm.CommandText =
                 @"DELETE FROM MEDICALORDERPARA WHERE ID = @ID";
             sqlcomm.Parameters.Add("@ID", DbType.Int32);
             sqlcomm.Parameters["@ID"].Value = scIntervalId;
             DatabaseOp.ExecuteNoneQuery(sqlcomm);
         }
     }
     catch (Exception e)
     {
         MainWindow.Log.WriteErrorLog("MedicalOrderParaDao.cs-Delete", e);
         return(false);
     }
     return(true);
 }
Пример #18
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);
            }
        }
Пример #19
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name="PatientGroup">Class instance of PatientGroup infomation</param>
        /// <param name="scPatientGroupId">Id of the last insert row id</param>
        /// <returns></returns>
        public bool InsertPatientGroup(PatientGroup PatientGroup, ref int scId)
        {
            try
            {
                using (SqlCommand sqlcomm = SqlConn.CreateCommand())
                {
                    sqlcomm.CommandText =
                        @"INSERT INTO PATIENTGROUP (NAME,DESCRIPTION,RESERVED) VALUES 
                        (@NAME,@DESCRIPTION,@RESERVED) SET @ID = SCOPE_IDENTITY() ";
                    sqlcomm.Parameters.Add("@NAME", DbType.String);
                    if (PatientGroup.Name != null)
                    {
                        sqlcomm.Parameters["@NAME"].Value = PatientGroup.Name;
                    }
                    sqlcomm.Parameters.Add("@DESCRIPTION", DbType.String);
                    if (PatientGroup.Description != null)
                    {
                        sqlcomm.Parameters["@DESCRIPTION"].Value = PatientGroup.Description;
                    }
                    sqlcomm.Parameters.Add("@RESERVED", DbType.String);
                    if (PatientGroup.Reserved != null)
                    {
                        sqlcomm.Parameters["@RESERVED"].Value = PatientGroup.Reserved;
                    }
                    sqlcomm.Parameters.Add("@ID", SqlDbType.Int).Direction = ParameterDirection.Output;

                    DatabaseOp.ExecuteNoneQuery(sqlcomm);

                    scId = (int)sqlcomm.Parameters["@ID"].Value;
                }
            }
            catch (Exception e)
            {
                MainWindow.Log.WriteErrorLog("PatientGroupDao.cs-InsertPatientGroup", e);
                return(false);
            }
            return(true);
        }
Пример #20
0
 public bool UpdateScheduleTemplate1(string fields, string condition, DateTime begin)
 {
     try
     {
         using (SqlCommand sqlcomm = SqlConn.CreateCommand())
         {
             string sqlcommand = "update SCHEDULETEMPLATE set BedId =";
             sqlcommand += fields;
             sqlcommand += " where BedId =";
             sqlcommand += condition;
             string str = " and Date >= '" + begin.Date.ToString("yyyy-MM-dd") + "' ";
             sqlcommand         += str;
             sqlcomm.CommandText = sqlcommand;
             DatabaseOp.ExecuteNoneQuery(sqlcomm);
         }
     }
     catch (Exception e)
     {
         MainWindow.Log.WriteErrorLog("ScheduleTemplateDao.cs-UpdateScheduleTemplate", e);
         return(false);
     }
     return(true);
 }
Пример #21
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name="TreatTime">Class instance of infectType infomation</param>
        /// <param name="scId">Id of the last insert row id</param>
        /// <returns></returns>
        public bool InsertTreatTime(TreatTime TreatTime, ref int scId)
        {
            try
            {
                using (SQLiteCommand sqlcomm = SqlConn.CreateCommand())
                {
                    sqlcomm.CommandText =
                        @"INSERT INTO TREATTIME (NAME,ACTIVATED,BEGINTIME,ENDTIME,DESCRIPTION,RESERVED) VALUES 
                        (@NAME,@ACTIVATED,@BEGINTIME,@ENDTIME,@DESCRIPTION,@RESERVED)";
                    sqlcomm.Parameters.Add("@NAME", DbType.String);
                    sqlcomm.Parameters["@NAME"].Value = TreatTime.Name;
                    sqlcomm.Parameters.Add("@ACTIVATED", DbType.Boolean);
                    sqlcomm.Parameters["@ACTIVATED"].Value = TreatTime.Activated;
                    sqlcomm.Parameters.Add("@DESCRIPTION", DbType.String);
                    sqlcomm.Parameters["@DESCRIPTION"].Value = TreatTime.Description;
                    sqlcomm.Parameters.Add("@BEGINTIME", DbType.String);
                    sqlcomm.Parameters["@BEGINTIME"].Value = TreatTime.BeginTime;
                    sqlcomm.Parameters.Add("@ENDTIME", DbType.String);
                    sqlcomm.Parameters["@ENDTIME"].Value = TreatTime.EndTime;
                    sqlcomm.Parameters.Add("@RESERVED", DbType.String);
                    sqlcomm.Parameters["@RESERVED"].Value = TreatTime.Reserved;
                    DatabaseOp.ExecuteNoneQuery(sqlcomm);

                    //set last insert id of this table this connection
                    SQLiteCommand comm = SqlConn.CreateCommand();
                    comm.CommandText = "Select last_insert_rowid() as TREATTIME;";
                    scId             = Convert.ToInt32(comm.ExecuteScalar());
                    comm.Dispose();
                }
            }
            catch (Exception e)
            {
                MainWindow.Log.WriteErrorLog("TreatTimeDao.cs-InsertTreatTime", e);
                return(false);
            }
            return(true);
        }
Пример #22
0
 public bool UpdateScheduleTemplate(Dictionary <string, object> fields, Dictionary <string, object> condition)
 {
     try
     {
         using (SqlCommand sqlcomm = SqlConn.CreateCommand())
         {
             string sqlcommand = "update SCHEDULETEMPLATE set ";
             var    parameters = new Dictionary <string, object>();
             DatabaseOp.TransferParameteres(ref sqlcommand, "@", ",", fields, sqlcomm.Parameters);
             sqlcommand  = sqlcommand.Substring(0, sqlcommand.LastIndexOf(","));
             sqlcommand += " where ";
             DatabaseOp.TransferParameteres(ref sqlcommand, "@", "and", condition, sqlcomm.Parameters);
             sqlcommand          = sqlcommand.Substring(0, sqlcommand.LastIndexOf("and"));
             sqlcomm.CommandText = sqlcommand;
             DatabaseOp.ExecuteNoneQuery(sqlcomm);
         }
     }
     catch (Exception e)
     {
         MainWindow.Log.WriteErrorLog("ScheduleTemplateDao.cs-UpdateScheduleTemplate", e);
         return(false);
     }
     return(true);
 }
Пример #23
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);
            }
        }
Пример #24
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name="PatientGroupPara">Class instance of PatientGroupPara infomation</param>
        /// <param name="scPatientGroupParaId">Id of the last insert row id</param>
        /// <returns></returns>
        public bool InsertPatientGroupPara(PatientGroupPara PatientGroupPara, ref int scId)
        {
            try
            {
                using (SqlCommand sqlcomm = SqlConn.CreateCommand())
                {
                    sqlcomm.CommandText =
                        @"INSERT INTO PATIENTGROUPPARA (GROUPID,[LEFT],[KEY],SYMBOL,[VALUE],[RIGHT],LOGIC,DESCRIPTION,RESERVED) VALUES 
                        (@GROUPID,@LEFT,@KEY,@SYMBOL,@VALUE,@RIGHT,@LOGIC,@DESCRIPTION,@RESERVED) SET @ID = SCOPE_IDENTITY() ";
                    sqlcomm.Parameters.Add("@GROUPID", DbType.Int64);
                    sqlcomm.Parameters["@GROUPID"].Value = PatientGroupPara.GroupId;
                    sqlcomm.Parameters.Add("@LEFT", DbType.String);
                    if (PatientGroupPara.Left != null)
                    {
                        sqlcomm.Parameters["@LEFT"].Value = PatientGroupPara.Left;
                    }
                    sqlcomm.Parameters.Add("@KEY", DbType.String);
                    if (PatientGroupPara.Key != null)
                    {
                        sqlcomm.Parameters["@KEY"].Value = PatientGroupPara.Key;
                    }
                    sqlcomm.Parameters.Add("@SYMBOL", DbType.String);
                    if (PatientGroupPara.Symbol != null)
                    {
                        sqlcomm.Parameters["@SYMBOL"].Value = PatientGroupPara.Symbol;
                    }
                    sqlcomm.Parameters.Add("@VALUE", DbType.String);
                    if (PatientGroupPara.Value != null)
                    {
                        sqlcomm.Parameters["@VALUE"].Value = PatientGroupPara.Value;
                    }
                    sqlcomm.Parameters.Add("@RIGHT", DbType.String);
                    if (PatientGroupPara.Right != null)
                    {
                        sqlcomm.Parameters["@RIGHT"].Value = PatientGroupPara.Right;
                    }
                    sqlcomm.Parameters.Add("@LOGIC", DbType.String);
                    if (PatientGroupPara.Logic != null)
                    {
                        sqlcomm.Parameters["@LOGIC"].Value = PatientGroupPara.Logic;
                    }
                    sqlcomm.Parameters.Add("@DESCRIPTION", DbType.String);
                    if (PatientGroupPara.Description != null)
                    {
                        sqlcomm.Parameters["@DESCRIPTION"].Value = PatientGroupPara.Description;
                    }
                    sqlcomm.Parameters.Add("@RESERVED", DbType.String);
                    if (PatientGroupPara.Reserved != null)
                    {
                        sqlcomm.Parameters["@RESERVED"].Value = PatientGroupPara.Reserved;
                    }
                    sqlcomm.Parameters.Add("@ID", SqlDbType.Int).Direction = ParameterDirection.Output;

                    DatabaseOp.ExecuteNoneQuery(sqlcomm);

                    scId = (int)sqlcomm.Parameters["@ID"].Value;
                }
            }
            catch (Exception e)
            {
                MainWindow.Log.WriteErrorLog("PatientGroupParaDao.cs-InsertPatientGroupPara", e);
                return(false);
            }
            return(true);
        }
Пример #25
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name="patient">Class instance of patient infomation</param>
        /// <param name="scPatientId">Id of the last insert row id</param>
        /// <returns></returns>
        public bool InsertPatient(Patient patient, ref int scId)
        {
            try
            {
                using (SqlCommand sqlcomm = SqlConn.CreateCommand())
                {
                    sqlcomm.CommandText =
                        @"INSERT INTO PATIENT (PATIENTID,NAME,DOB,GENDER,NATIONALITY,MARRIAGE,HEIGHT,BLOODTYPE,IDCODE, MOBILE, ORDERS, TREATSTATUSID,REGISITDATE,
                                                AREAID,ZIPCODE,WEIXINHAO,PAYMENT,INFECTTYPEID,ISFIXEDBED,BEDID,ISASSIGNED,DESCRIPTION,RESERVED1,RESERVED2) VALUES 
                                            (@PATIENTID,@NAME,@DOB,@GENDER,@NATIONALITY,@MARRIAGE,@HEIGHT,@BLOODTYPE, @IDCODE, @MOBILE,@ORDERS,@TREATSTATUSID,@REGISITDATE,
                                                @AREAID,@ZIPCODE,@WEIXINHAO,@PAYMENT,@INFECTTYPEID,@ISFIXEDBED,@BEDID,@ISASSIGNED,@DESCRIPTION,@RESERVED1,@RESERVED2) SET @ID = SCOPE_IDENTITY() ";
                    sqlcomm.Parameters.Add("@PATIENTID", DbType.String);
                    sqlcomm.Parameters["@PATIENTID"].Value = patient.PatientId;
                    sqlcomm.Parameters.Add("@NAME", DbType.String);
                    if (patient.Name != null)
                    {
                        sqlcomm.Parameters["@NAME"].Value = patient.Name;
                    }
                    sqlcomm.Parameters.Add("@GENDER", DbType.String);
                    if (patient.Gender != null)
                    {
                        sqlcomm.Parameters["@GENDER"].Value = patient.Gender;
                    }
                    sqlcomm.Parameters.Add("@DOB", DbType.String);
                    if (patient.Dob != null)
                    {
                        sqlcomm.Parameters["@DOB"].Value = patient.Dob;
                    }
                    sqlcomm.Parameters.Add("@NATIONALITY", DbType.String);
                    if (patient.Nationality != null)
                    {
                        sqlcomm.Parameters["@NATIONALITY"].Value = patient.Nationality;
                    }
                    sqlcomm.Parameters.Add("@MARRIAGE", DbType.String);
                    if (patient.Marriage != null)
                    {
                        sqlcomm.Parameters["@MARRIAGE"].Value = patient.Marriage;
                    }
                    sqlcomm.Parameters.Add("@HEIGHT", DbType.String);
                    if (patient.Height != null)
                    {
                        sqlcomm.Parameters["@HEIGHT"].Value = patient.Height;
                    }
                    sqlcomm.Parameters.Add("@BLOODTYPE", DbType.String);
                    if (patient.BloodType != null)
                    {
                        sqlcomm.Parameters["@BLOODTYPE"].Value = patient.BloodType;
                    }
                    sqlcomm.Parameters.Add("@IDCODE", DbType.String);
                    if (patient.IdCode != null)
                    {
                        sqlcomm.Parameters["@IDCODE"].Value = patient.IdCode;
                    }
                    sqlcomm.Parameters.Add("@MOBILE", DbType.String);
                    if (patient.Mobile != null)
                    {
                        sqlcomm.Parameters["@MOBILE"].Value = patient.Mobile;
                    }
                    sqlcomm.Parameters.Add("@ORDERS", DbType.String);
                    if (patient.Orders != null)
                    {
                        sqlcomm.Parameters["@ORDERS"].Value = patient.Orders;
                    }
                    sqlcomm.Parameters.Add("@TREATSTATUSID", DbType.Int32);
                    if (patient.TreatStatusId != null)
                    {
                        sqlcomm.Parameters["@TREATSTATUSID"].Value = patient.TreatStatusId;
                    }
                    sqlcomm.Parameters.Add("@REGISITDATE", DbType.String);
                    if (patient.RegisitDate != null)
                    {
                        sqlcomm.Parameters["@REGISITDATE"].Value = patient.RegisitDate;
                    }
                    sqlcomm.Parameters.Add("@AREAID", DbType.Int32);
                    if (patient.AreaId != null)
                    {
                        sqlcomm.Parameters["@AREAID"].Value = patient.AreaId;
                    }

                    sqlcomm.Parameters.Add("@ZIPCODE", DbType.String);
                    if (patient.ZipCode != null)
                    {
                        sqlcomm.Parameters["@ZIPCODE"].Value = patient.ZipCode;
                    }
                    sqlcomm.Parameters.Add("@WEIXINHAO", DbType.String);
                    if (patient.WeiXinHao != null)
                    {
                        sqlcomm.Parameters["@WEIXINHAO"].Value = patient.WeiXinHao;
                    }
                    sqlcomm.Parameters.Add("@PAYMENT", DbType.String);
                    if (patient.Payment != null)
                    {
                        sqlcomm.Parameters["@PAYMENT"].Value = patient.Payment;
                    }

                    sqlcomm.Parameters.Add("@INFECTTYPEID", DbType.Int32);
                    if (patient.InfectTypeId != null)
                    {
                        sqlcomm.Parameters["@INFECTTYPEID"].Value = patient.InfectTypeId;
                    }
                    sqlcomm.Parameters.Add("@ISFIXEDBED", DbType.Boolean);
                    if (patient.IsFixedBed != null)
                    {
                        sqlcomm.Parameters["@ISFIXEDBED"].Value = patient.IsFixedBed;
                    }
                    sqlcomm.Parameters.Add("@BEDID", DbType.Int32);
                    if (patient.BedId != null)
                    {
                        sqlcomm.Parameters["@BEDID"].Value = patient.BedId;
                    }
                    sqlcomm.Parameters.Add("@ISASSIGNED", DbType.Boolean);
                    if (patient.IsAssigned != null)
                    {
                        sqlcomm.Parameters["@ISASSIGNED"].Value = patient.IsAssigned;
                    }
                    sqlcomm.Parameters.Add("@DESCRIPTION", DbType.String);
                    if (patient.Description != null)
                    {
                        sqlcomm.Parameters["@DESCRIPTION"].Value = patient.Description;
                    }
                    sqlcomm.Parameters.Add("@RESERVED1", DbType.String);
                    if (patient.Reserved1 != null)
                    {
                        sqlcomm.Parameters["@RESERVED1"].Value = patient.Reserved1;
                    }
                    sqlcomm.Parameters.Add("@RESERVED2", DbType.String);
                    if (patient.Reserved2 != null)
                    {
                        sqlcomm.Parameters["@RESERVED2"].Value = patient.Reserved2;
                    }
                    sqlcomm.Parameters.Add("@ID", SqlDbType.Int).Direction = ParameterDirection.Output;

                    DatabaseOp.ExecuteNoneQuery(sqlcomm);

                    scId = (int)sqlcomm.Parameters["@ID"].Value;
                }
            }
            catch (Exception e)
            {
                MainWindow.Log.WriteErrorLog("PatientDao.cs-InsertPatient", e);
                return(false);
            }
            return(true);
        }
Пример #26
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name="medicalOrder">Class instance of Medical Order infomation</param>
        /// <param name="scId">Id of the last insert row id</param>
        /// <returns></returns>
        public bool InsertMedicalOrder(MedicalOrder medicalOrder, ref int scId)
        {
            try
            {
                using (SqlCommand sqlcomm = SqlConn.CreateCommand())
                {
                    sqlcomm.CommandText =
                        @"INSERT INTO MEDICALORDER ([PATIENTID],[ACTIVATED],[SEQ],[PLAN],[METHODID],[INTERVAL],[TIMES],
                           [DESCRIPTION],[RESERVED1],[RESERVED2]) VALUES 
                        (@PATIENTID,@ACTIVATED,@SEQ,@PLAN,@METHODID,@INTERVAL,@TIMES,
                            @DESCRIPTION ,@RESERVED1,@RESERVED2) SET @ID = SCOPE_IDENTITY() ";
                    sqlcomm.Parameters.Add("@PATIENTID", DbType.Int32);
                    sqlcomm.Parameters["@PATIENTID"].Value = medicalOrder.PatientId;

                    sqlcomm.Parameters.Add("@ACTIVATED", DbType.Boolean);
                    sqlcomm.Parameters["@ACTIVATED"].Value = medicalOrder.Activated;
                    sqlcomm.Parameters.Add("@SEQ", DbType.String);
                    if (medicalOrder.Seq != null)
                    {
                        sqlcomm.Parameters["@SEQ"].Value = medicalOrder.Seq;
                    }

                    sqlcomm.Parameters.Add("@PLAN", DbType.String);
                    if (medicalOrder.Plan != null)
                    {
                        sqlcomm.Parameters["@PLAN"].Value = medicalOrder.Plan;
                    }
                    sqlcomm.Parameters.Add("@METHODID", DbType.Int32);
                    sqlcomm.Parameters["@METHODID"].Value = medicalOrder.MethodId;

                    sqlcomm.Parameters.Add("@INTERVAL", DbType.Int32);
                    sqlcomm.Parameters["@INTERVAL"].Value = medicalOrder.Interval;
                    sqlcomm.Parameters.Add("@TIMES", DbType.Int32);
                    sqlcomm.Parameters["@TIMES"].Value = medicalOrder.Times;

                    sqlcomm.Parameters.Add("@DESCRIPTION", DbType.String);
                    if (medicalOrder.Description != null)
                    {
                        sqlcomm.Parameters["@DESCRIPTION"].Value = medicalOrder.Description;
                    }

                    sqlcomm.Parameters.Add("@RESERVED1", DbType.String);
                    if (medicalOrder.Reserved1 != null)
                    {
                        sqlcomm.Parameters["@RESERVED1"].Value = medicalOrder.Reserved1;
                    }
                    sqlcomm.Parameters.Add("@RESERVED2", DbType.String);
                    if (medicalOrder.Reserved2 != null)
                    {
                        sqlcomm.Parameters["@RESERVED2"].Value = medicalOrder.Reserved2;
                    }
                    sqlcomm.Parameters.Add("@ID", SqlDbType.Int).Direction = ParameterDirection.Output;

                    DatabaseOp.ExecuteNoneQuery(sqlcomm);

                    scId = (int)sqlcomm.Parameters["@ID"].Value;
                }
            }
            catch (Exception e)
            {
                MainWindow.Log.WriteErrorLog("MedicalOrderDao.cs-InsertMedicalOrder", e);
                return(false);
            }
            return(true);
        }