Example #1
0
        public ServiceResponseData InsertPluRecord()
        {
            try
            {
                int          workid    = requestData.GetData <int>(0);
                IP_PluRecord pluRecord = requestData.GetData <IP_PluRecord>(1);
                if (pluRecord == null)
                {
                    throw new Exception("没有测量数据");
                }
                if (pluRecord.PatlistID == 0)
                {
                    throw new Exception("病人ID不能为0");
                }
                SetWorkId(workid);//设置WorkID

                int ID = NewDao <IHISBloodGlucoseDao>().GetPluRecordID(pluRecord);
                pluRecord.ID = ID;
                this.BindDb(pluRecord);
                pluRecord.save();
                responseData.AddData(true);
                return(responseData);
            }
            catch (Exception e)
            {
                throw new Exception("血糖数据错误:" + e.Message);
            }
        }
        /// <summary>
        /// 获取血糖记录ID
        /// </summary>
        /// <param name="record">血糖记录</param>
        /// <returns></returns>
        public int GetPluRecordID(IP_PluRecord record)
        {
            string strsql = @"SELECT top 1 ID FROM IP_PluRecord WHERE PatlistID={0}  AND BloodID={1}";
            object val    = oleDb.GetDataResult(string.Format(strsql, record.PatlistID, record.BloodID));

            if (val == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(val));
            }
        }
        public bool PostPluRecord(int iWorkId, [FromBody] IP_PluRecord pluRecord)
        {
            try
            {
                Action <ClientRequestData> requestAction = ((ClientRequestData request) =>
                {
                    request.AddData(iWorkId);
                    request.AddData(pluRecord);
                });

                ServiceResponseData retdata = InvokeWcfService("BGProject.Service", "HISBloodGlucoseController", "InsertPluRecord", requestAction);
                bool result = retdata.GetData <bool>(0);
                return(result);
            }
            catch
            {
                return(false);
            }
        }