Exemple #1
0
        /// <summary>
        /// 解析病历
        /// </summary>
        /// <param name="str">病历数据</param>
        /// <param name="id">患者ID</param>
        /// <param name="recordName">病历名称</param>
        public void JieXi(string str, string id, string recordName)
        {
            JObject obj = JObject.Parse(str);

            foreach (var x in obj)
            {
                if (x.Key.Equals("Result"))
                {
                    str = x.Value.ToString();
                }
            }
            obj = JObject.Parse(str);
            SqlDAL sql = new SqlDAL();
            List <KeyValuePair <string, string> > field = new List <KeyValuePair <string, string> >();

            if (recordName == null)
            {
                foreach (var x in obj)
                {
                    if (x.Key.Equals("DiagTreatModel") || x.Key.Equals("OutModel"))
                    {
                        continue;
                    }
                    field = new List <KeyValuePair <string, string> >();
                    foreach (var y in (JObject)x.Value)
                    {
                        if (y.Value.ToString() == "")
                        {
                            field.Add(new KeyValuePair <string, string>(y.Key, null));
                        }
                        else
                        {
                            field.Add(new KeyValuePair <string, string>(y.Key, y.Value.ToString()));
                        }
                    }
                    sql.SaveData(field, id, x.Key);//存数数据
                }
            }
            else
            {
                foreach (var x in obj)
                {
                    if (x.Value.ToString() == "")
                    {
                        field.Add(new KeyValuePair <string, string>(x.Key, null));
                    }
                    else
                    {
                        field.Add(new KeyValuePair <string, string>(x.Key, x.Value.ToString()));
                    }
                }
                sql.SaveData(field, id, recordName);//存数数据
            }
        }
Exemple #2
0
        /// <summary>
        /// 解析单个患者的病历
        /// </summary>
        /// <param name="str"></param>
        public void JieXiBingLi(string str, string id, bool SaveData)
        {
            JObject obj = JObject.Parse(str);

            foreach (var x in obj)
            {
                if (x.Key.Equals("Result"))
                {
                    str = x.Value.ToString();
                }
            }
            obj = JObject.Parse(str);

            foreach (var x in obj)
            {
                List <KeyValuePair <string, string> > field = new List <KeyValuePair <string, string> >();
                foreach (var y in (JObject)x.Value)
                {
                    if (y.Value.ToString() == "")
                    {
                        field.Add(new KeyValuePair <string, string>(y.Key, null));
                    }
                    else
                    {
                        field.Add(new KeyValuePair <string, string>(y.Key, y.Value.ToString()));
                    }
                }
                SqlDAL sql = new SqlDAL();

                if (SaveData)
                {
                    sql.SaveData(field, id, x.Key);//存数数据
                }
                else
                {
                    sql.SaveField(field, x.Key);//存储字段
                }
            }
        }