/// <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);
            }
        }
        /// <summary>
        /// 封装要存入数据库的信息
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static PatientBodyInfo ProtocolaSqldata(int[] data)
        {
            string          str = "";
            PatientBodyInfo objPatientBodyInfo = new PatientBodyInfo();

            if ((data[0] == 0xff) && (data[1] == 0xff) && (data[2] == 0xff) & (data[3] == 0xff))
            {
                str = "连接断开,";
            }
            if ((data[6] & 2) == 2)
            {
                objPatientBodyInfo.PatientBednum  = Convert.ToInt16(data[4]);
                objPatientBodyInfo.BloodO2        = data[0].ToString();
                objPatientBodyInfo.Flux           = (data[2] / 10.0).ToString();
                objPatientBodyInfo.Pluse          = (data[1]).ToString();
                objPatientBodyInfo.GetO2time      = (data[7] / 10.0).ToString();
                objPatientBodyInfo.GetO2totaltime = (data[3] / 10.0).ToString();

                if ((data[6] & 1) == 1)
                {
                    objPatientBodyInfo.Model = "智能模式";
                }
                else
                {
                    objPatientBodyInfo.Model = "人工模式";
                }
                //if ((data[6] & 4) == 4)
                //{
                //    str += "吸氧时间到,";
                //}
                if ((data[6] & 8) == 8)
                {
                    str += "电池电压低,";
                }
                //if ((data[6] & 16) == 16)
                //{
                //    str += "湿化瓶错误,";
                //}
                if ((data[6] & 32) == 32)
                {
                    str += "压力异常,";
                }
                if ((data[6] & 64) == 64)
                {
                    str += "血氧饱和度异常,";
                }
                if ((data[6] & 128) == 128)
                {
                    str += "血氧探头脱落,";
                }
                if ((data[6] & 256) == 256)
                {
                    str += "运动干扰,";
                }
                if ((data[6] & 512) == 512)
                {
                    str += "低灌注";
                }
                if (str.Length == 0)
                {
                    str = "正常";
                }
            }
            else
            {
                if ((data[6] & 4) == 4)
                {
                    str += "吸氧时间到,";
                }
                if ((data[6] & 16) == 16)
                {
                    str += "湿化瓶错误,";
                }
                str += "手动暂停";
            }
            objPatientBodyInfo.Error               = str;
            objPatientBodyInfo.PatientBednum       = Convert.ToInt16(data[4]);
            objPatientBodyInfo.PatientBodyInfotime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm"));
            objPatientBodyInfo.UseFlag             = 0;
            return(objPatientBodyInfo);
        }