/// <summary> /// 修改病人信息 /// </summary> /// <param name="objPatientInfo"></param> /// <returns></returns> public int UpdatePatientInfo(PatientInfo objPatientInfo) { StringBuilder sqlBuilder = new StringBuilder(); sqlBuilder.Append("update AdditionalPatients set PatientName='{0}',PatientGender='{1}'," + "Patientstarttime='{2}',PatientAge='{3}',PatientDepartment='{4}',PatientNum='{5}'"); sqlBuilder.Append(" where PatientBednum={6} and UseFlag=0"); string sql = string.Format(sqlBuilder.ToString(), objPatientInfo.PatientName, objPatientInfo.PatientGender, objPatientInfo.Patientstarttime, objPatientInfo.PatientAge, objPatientInfo.PatientDepartment, objPatientInfo.PatientNum, objPatientInfo.PatientBednum); try { return(Convert.ToInt32(SQLiteHelper.Update(sql))); } catch (SQLiteException ex) { SQLiteHelper.WriteLog(" public int UpdatePatientInfo(PatientInfo objPatientInfo)", ex.Message); throw new Exception("数据库操作出现异常!具体信息:\r\n" + ex.Message); } catch (Exception ex) { SQLiteHelper.WriteLog(" public int UpdatePatientInfo(PatientInfo objPatientInfo)", ex.Message); throw ex; } }
/// <summary> /// 根据床号查询病人信息 /// </summary> /// <param name="bednum"></param> /// <returns></returns> public PatientInfo GetPatientInfoBybednum(int bednum) { string sql = "select PatientName,PatientAge,PatientGender,Patientstarttime,PatientDepartment," + "PatientNum from AdditionalPatients where PatientBednum=" + bednum.ToString() + " and UseFlag=0"; SQLiteDataReader objReader = SQLiteHelper.GetReader(sql); PatientInfo objPatientInfo = null; try { if (objReader.Read()) { objPatientInfo = new PatientInfo() { PatientBednum = Convert.ToInt16(bednum) > 256 ? "#" + (Convert.ToInt16(bednum) - 256).ToString() : Convert.ToInt16(bednum).ToString(), PatientName = objReader["PatientName"].ToString(), PatientAge = (objReader["PatientAge"]).ToString(), PatientGender = objReader["PatientGender"].ToString(), PatientDepartment = objReader["PatientDepartment"].ToString(), PatientNum = objReader["PatientNum"].ToString(), Patientstarttime = Convert.ToDateTime(objReader["Patientstarttime"]) }; } } catch (Exception ex) { SQLiteHelper.WriteLog(" public PatientInfo GetPatientInfoBybednum(int bednum)", ex.Message); objPatientInfo = new PatientInfo(); objPatientInfo.PatientBednum = bednum.ToString(); objPatientInfo.Patientstarttime = Convert.ToDateTime(objReader["Patientstarttime"]); } objReader.Close(); return(objPatientInfo); }
/// <summary> /// 添加床位信息 /// </summary> public int addBedcount(BedConfigInfo objBedConfigInfo) { string sql = "insert into BedConfig(Bedcount,Bedrows)values({0},{1})"; sql = string.Format(sql, objBedConfigInfo.Bedcount, objBedConfigInfo.Bedrows); try { return(SQLHelper.Update(sql)); } catch (Exception ex) { SQLiteHelper.WriteLog(" public int addBedcount(BedConfigInfo objBedConfigInfo)", ex.Message); throw new Exception("添加数据出错!" + ex.Message); } }
/// <summary> /// 设置出院标志 /// </summary> public int setuseflag(int bednum) { string sql = "update AdditionalPatients set UseFlag = 1 where PatientBednum={0}"; sql = string.Format(sql, bednum); try { return(SQLiteHelper.Update(sql)); } catch (Exception ex) { SQLiteHelper.WriteLog(" public int setuseflag(int bednum)", ex.Message); throw new Exception("添加数据出错!" + ex.Message); } }
public int AddSetInfo(SetInfo objSetInfo) { string sql = "insert into SetInfo(PatientBednum,IsEnable)"; sql += "values({0},{1})"; sql = string.Format(sql, objSetInfo.PatientBednum, objSetInfo.IsEnable); try { return(SQLiteHelper.Update(sql)); } catch (Exception ex) { SQLiteHelper.WriteLog(" public int AddSetInfo(SetInfo objSetInfo)", ex.Message); throw new Exception("添加数据出错!" + ex.Message); } }
public int Addbednum(int bednum) { string sql = "insert into Patients(PatientBednum,UseFlag)"; sql += "values({0},{1})"; sql = string.Format(sql, bednum, 0); try { return(SQLiteHelper.Update(sql)); } catch (Exception ex) { SQLiteHelper.WriteLog(" public int Addbednum(int bednum)", ex.Message); throw new Exception("添加数据出错!" + ex.Message); } }
public int AddUsbPatient(PatientInfo objPatientInfo) { string sql = "insert into Patients(PatientBednum,Patientstarttime,UseFlag)"; sql += " values({0},'{1}',{2})"; sql = string.Format(sql, objPatientInfo.PatientBednum, objPatientInfo.Patientstarttime, 0); try { return(SQLiteHelper.Update(sql)); } catch (Exception ex) { SQLiteHelper.WriteLog(" public int AddUsbPatient(PatientInfo objPatientInfo)", ex.Message); throw new Exception("添加数据出错!" + ex.Message); } }
/// <summary> /// 添加额外新增的病人信息 /// </summary> /// <param name="objPatientInfo"></param> /// <returns></returns> public int Add_AdditionalPatients(PatientInfo objPatientInfo) { string sql = "insert into AdditionalPatients(PatientName,PatientBednum,PatientGender,PatientAge,Patientstarttime,PatientDepartment,PatientNum,UseFlag)"; sql += "values('{0}',{1},'{2}','{3}','{4}','{5}','{6}',{7})"; sql = string.Format(sql, objPatientInfo.PatientName, objPatientInfo.PatientBednum, objPatientInfo.PatientGender, objPatientInfo.PatientAge , objPatientInfo.Patientstarttime, objPatientInfo.PatientDepartment, objPatientInfo.PatientNum, 0); try { return(SQLiteHelper.Update(sql)); } catch (Exception ex) { SQLiteHelper.WriteLog(" public int Add_AdditionalPatients(PatientInfo objPatientInfo)", ex.Message); throw new Exception("添加数据出错!" + ex.Message); } }
public int AddPatientSaveInfo(PatientSaveData objPatientSaveData) { string sql = "insert into PatientSaveData(Time,Mode,Bloodo2,Pluse,Flow,Error,GetO2Time,GetO2AllTime)"; sql += "values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}')"; sql = string.Format(sql, objPatientSaveData.PatientBodyInfotime, objPatientSaveData.Model , objPatientSaveData.BloodO2, objPatientSaveData.Pluse, objPatientSaveData.Flux, objPatientSaveData.Error, objPatientSaveData.GetO2time, objPatientSaveData.GetO2totaltime); try { return(SQLiteHelper.Update(sql)); } catch (Exception ex) { SQLiteHelper.WriteLog(" public int AddPatientSaveInfo(PatientSaveData objPatientSaveData)", ex.Message); throw new Exception("添加数据出错!" + ex.Message); } }
public int SetShowInfo(int a) { string sql = " update ShowInfo set AllOrPart=" + a.ToString(); try { return(Convert.ToInt32(SQLiteHelper.Update(sql))); } catch (SQLiteException ex) { SQLiteHelper.WriteLog(" public int SetShowInfo(int a)", ex.Message); throw new Exception("数据库操作出现异常!具体信息:\r\n" + ex.Message); } catch (Exception ex) { SQLiteHelper.WriteLog(" public int SetShowInfo(int a)", ex.Message); throw ex; } }
/// <summary> /// 出院 /// </summary> /// <param name="budnum"></param> /// <returns></returns> public int addendtime(int budnum) { string sql = " update AdditionalPatients set Patientendtime = '{0}' where PatientBednum=" + budnum.ToString() + " and UseFlag=0"; sql = string.Format(sql, DateTime.Now.ToString()); try { return(Convert.ToInt32(SQLiteHelper.Update(sql))); } catch (SqlException ex) { SQLiteHelper.WriteLog(" public int addendtime(int budnum)", ex.Message); throw new Exception("数据库操作出现异常!具体信息:\r\n" + ex.Message); } catch (Exception ex) { SQLiteHelper.WriteLog(" public int addendtime(int budnum)", ex.Message); throw ex; } }
/// <summary> /// 根据接收到的数据添加到数据库 /// </summary> /// <param name="objPatientBodyInfo"></param> /// <returns></returns> public int AddPatientBodyInfo(PatientBodyInfo objPatientBodyInfo) { if (objPatientBodyInfo == null) { return(0); } string sql = "insert into PatientBodyInfo(PatientBodyInfotime,PatientBednum,BloodO2,Pluse,GetO2time,Flux,Model,Error,GetO2totaltime,UseFlag)"; sql += "values('{0}',{1},'{2}','{3}','{4}','{5}','{6}','{7}','{8}',{9})"; sql = string.Format(sql, objPatientBodyInfo.PatientBodyInfotime, objPatientBodyInfo.PatientBednum, objPatientBodyInfo.BloodO2, objPatientBodyInfo.Pluse, objPatientBodyInfo.GetO2time, objPatientBodyInfo.Flux, objPatientBodyInfo.Model, objPatientBodyInfo.Error, objPatientBodyInfo.GetO2totaltime, objPatientBodyInfo.UseFlag); try { // SQLiteHelper.WriteLog(" public int AddPatientBodyInfo(PatientBodyInfo objPatientBodyInfo)", ex.Message); return(SQLiteHelper.Update(sql)); } catch (Exception ex) { SQLiteHelper.WriteLog(" public int AddPatientBodyInfo(PatientBodyInfo objPatientBodyInfo)", ex.Message); throw new Exception("添加数据出错!" + ex.Message); } }