示例#1
0
 public static TestCoding BuildCodingFromDataBaseData(string p)
 {
     if (p != "")
     {
         using (NpgsqlConnection connection = Global.GetSqlConnection())
         {
             string findDocument = "SELECT * FROM public.terminology_value WHERE id_terminology_value = '" + p +
                                   "'";
             NpgsqlCommand person = new NpgsqlCommand(findDocument, connection);
             using (NpgsqlDataReader documentReader = person.ExecuteReader())
             {
                 while (documentReader.Read())
                 {
                     Coding x = new Coding();
                     if (documentReader["code"] != DBNull.Value)
                         x.Code = documentReader["code"].ToString();
                     if (documentReader["uri"] != DBNull.Value)
                         x.System = documentReader["uri"].ToString();
                     if (documentReader["version"] != DBNull.Value)
                         x.Version = documentReader["version"].ToString();
                     return new TestCoding(x);
                 }
             }
         }
     }
     return null;
 }
示例#2
0
 public TestCoding(Coding r)
 {
     if (r.Code != null)
     {
         Code = r.Code;
         System = r.System;
         Version = r.Version;
     }
 }
示例#3
0
        public void SearchOne_Full()
        {
            using (TestMqServiceClient mq = new TestMqServiceClient())
            {
                Credentials cr = new Credentials { Organization = idLpu, Token = guid };
                //Регистрируем один случай. Статус направления "Зарегистрировано в РЕГИЗ.УО"
                Referral referral = (new SetData()).FullRegister();
                var result = mq.Register(cr, referral);

                //Задаём Options по зарегистрированному направлению и ищем его
                Coding cod = new Coding { Code = "1", System = Dictionary.REFERRAL_STATUS, Version = "1" };
                Options opt = (new SetData()).GetRefferalReturnOptions_SearchOne(referral, referral.Patient.Privileges, result.IdMq, result.MqReferralStatus);
                var res2 = mq.SearchOne(cr, opt);
            }

            if (Global.errors == "")
                Assert.Pass();
            else
                Assert.Fail(Global.errors);
        }
示例#4
0
 //подумать как сделать лучше!!
 public Coding SetCoding(Coding cod)
 {
     //cod.Version = null;
     return cod;
 }
示例#5
0
        /// <summary>
        /// По заданному Referral'у строит Options для SeacrhOne.
        /// 
        /// Может можно сделать лучше?(проверки на null)
        /// 
        /// </summary>
        public Options GetRefferalReturnOptions_SearchOne(Referral referral, Privilege[] privileges, string idMq, Coding mqReferralStatus)
        {
            Options opt = new Options();
            opt.IdMq = idMq;

            if (referral.ReferralInfo != null)
            {
                opt.ReferralInfo = new ReferralInfo
                {
                    ProfileMedService = referral.ReferralInfo.ProfileMedService,
                    ReferralType = referral.ReferralInfo.ReferralType,
                    MqReferralStatus = mqReferralStatus
                };
            }
            if (referral.Target != null)
            { opt.Target = new ReferralTarget { Lpu = referral.Target.Lpu }; }

            if (referral.Source != null)
            { opt.Source = new ReferralSource { Lpu = referral.Source.Lpu }; }

            if (referral.ReferralSurvey != null)
            {
                opt.Survey = new Survey
                {
                    SurveyType = referral.ReferralSurvey.SurveyType,
                    SurveyOrgan = referral.ReferralSurvey.SurveyOrgan
                };
            }

            if (referral.Patient != null)
            {
                opt.Patient.Person = new Person
                {
                    BirthDate = referral.Patient.Person.BirthDate,
                    IdPatientMis = referral.Patient.Person.IdPatientMis
                };

                if (referral.Patient.Person.HumanName != null)
                {
                    opt.Patient.Person.HumanName = new HumanName
                    {
                        FamilyName = referral.Patient.Person.HumanName.FamilyName,
                        GivenName = referral.Patient.Person.HumanName.GivenName,
                        MiddleName = referral.Patient.Person.HumanName.MiddleName
                    };
                }
            }

            if (privileges != null)
            { opt.Patient.Privileges = (Privilege[])privileges.Clone(); }

            if (referral.EventsInfo != null && referral.EventsInfo.Target != null)
            {
                opt.EventsInfo.Target = new EventTarget
                {
                    IsReferralReviwed = referral.EventsInfo.Target.IsReferralReviwed,
                    ReceptionAppointDate = referral.EventsInfo.Target.ReceptionAppointDate
                };
            }

            OptionData.options = opt;
            return opt;
        }
示例#6
0
        /// <summary>
        /// По заданному Referral'у строит Options для SeacrhMany.
        /// </summary>
        public Options GetRefferalReturnOptions_SearchMany(Referral referral, Privilege[] privileges, Coding mqReferralStatus)
        {
            Options opt = GetRefferalReturnOptions_SearchOne(referral, privileges, null, mqReferralStatus);

            if (referral.EventsInfo != null && referral.EventsInfo.Source != null)
            {
                opt.EventsInfo.Source = new EventSource
                {
                    PlannedDate = referral.EventsInfo.Source.PlannedDate
                };
            }

            OptionData.options = opt;
            return opt;
        }
示例#7
0
 private static List<string> GetCodindId(Coding c)
 {
     List<string> l = new List<string>();
     using (NpgsqlConnection connection = Global.GetSqlConnection())
     {
         string p = "SELECT id_terminology_value FROM public.terminology_value WHERE code = '" + c.Code + "' AND (uri = '" + c.System + "'";
         if (c.Version != null)
             p += " AND version = '" + c.Version + "'";
         p += ")";
         NpgsqlCommand person = new NpgsqlCommand(p, connection);
         using (NpgsqlDataReader documentReader = person.ExecuteReader())
         {
             while (documentReader.Read())
             {
                 l.Add(documentReader["id_terminology_value"].ToString());
             }
         }
     }
     if (l.Count != 0)
         return l;
     else
         throw new Exception("Не надена запись");
 }
示例#8
0
 public TestCoding(Coding r)
 {
     coding = r;
 }