Example #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;
 }
Example #2
0
 public TestCoding(Coding r)
 {
     if (r.Code != null)
     {
         Code = r.Code;
         System = r.System;
         Version = r.Version;
     }
 }
Example #3
0
        public void Test_Coding_TokenIndexSetter_OnlyCode()
        {
            //Arrange
            string TheCode = "SomeCode";

            var Coding = new Coding();

            Coding.Code = TheCode;
            TokenIndex Index = new TokenIndex();

            //Act
            Index = IndexSetterFactory.Create(typeof(TokenIndex)).Set(Coding, Index) as TokenIndex;

            //Assert
            Assert.AreEqual(Index.Code, TheCode);
            Assert.IsNull(Index.System);
        }
        //+ Methods
        // DefineBase.cs:155
        /// <summary>
        /// Method to create fixed value
        /// </summary>
        public CodeableConcept FixedValue_CompositionType()                                                                                               // FhirConstruct.cs:759
        {                                                                                                                                                 // FhirConstruct.cs:760
            CodeableConcept retVal = new CodeableConcept();                                                                                               // FhirConstruct.cs:761

            retVal.Coding = new List <Coding>();                                                                                                          // FhirConstruct.cs:767
            {                                                                                                                                             // FhirConstruct.cs:770
                var temp4 = new Coding();                                                                                                                 // FhirConstruct.cs:771
                temp4.SystemElement       = new FhirUri();                                                                                                // FhirConstruct.cs:774
                temp4.SystemElement.Value = "http://loinc.org";                                                                                           // FhirConstruct.cs:776
                temp4.CodeElement         = new Code();                                                                                                   // FhirConstruct.cs:790
                temp4.CodeElement.Value   = "42132-1";                                                                                                    // FhirConstruct.cs:792
                retVal.Coding.Add(temp4);                                                                                                                 // FhirConstruct.cs:819
            }                                                                                                                                             // FhirConstruct.cs:820
            retVal.TextElement       = new FhirString();                                                                                                  // FhirConstruct.cs:825
            retVal.TextElement.Value = "US Breast screening";                                                                                             // FhirConstruct.cs:827
            return(retVal);                                                                                                                               // FhirConstruct.cs:835
        }                                                                                                                                                 // FhirConstruct.cs:836
        public void CodingViewModel_Returns_ValidViewModel_Full()
        {
            var model = new Coding
            {
                Code    = "Code1",
                Display = "Display1",
                System  = "System1"
            };

            var viewModel = model.ToCodingViewModel();

            Assert.NotNull(viewModel);

            Assert.Equal("Code1", viewModel.Code);
            Assert.Equal("Display1", viewModel.Display);
            Assert.Equal("System1", viewModel.System);
        }
Example #6
0
        public static Parameters ConceptLookup(this FhirClient client, Coding coding, FhirDateTime date = null)
        {
            if (coding == null)
            {
                throw Error.ArgumentNull("coding");
            }

            var par = new Parameters();

            par.Add("coding", coding);
            if (date != null)
            {
                par.Add("date", date);
            }

            return(expect <Parameters>(client.TypeOperation <ValueSet>(Operation.CONCEPT_LOOKUP, par)));
        }
Example #7
0
        /// <summary>
        /// Calls the login wei chat.获取到微信id后调用
        /// </summary>
        /// <param name="weChatID">We chat I.</param>
        public void CallLoginWeiChat(string weChatID)
        {
            var loginData = new LoginVo();

            loginData.password   = "";
            loginData.phone      = "";
            loginData.playerType = 1;
            loginData.serverName = "";
            loginData.weChatId   = weChatID;

            GameModel.HttpAcount = weChatID;

            _localConfig.SaveValue("curServer", _currentSever);
            var tmp = Coding <LoginVo> .encode(loginData);

            HttpRequestManager.GetInstance().GetLoginData(tmp, _loginSuccess);
        }
Example #8
0
        private List<CodeableConcept> SetCategory()
        {
            var category = new List<CodeableConcept>();
            var codeableConcept = new CodeableConcept();
            var code = new Coding
            {
                System = "http://loinc.org",
                Code = "74468-0",
                Display = "Questionnaire form definition Document"
            };

            codeableConcept.Coding = new List<Coding>() { code };
            codeableConcept.Text = "Questionnaire form definition Document";
            category.Add(codeableConcept);

            return category;
        }
        public void TestCodingValidation()
        {
            var val     = new BindingValidator(_termService, "Demo");
            var binding = new ElementDefinition.BindingComponent
            {
                ValueSet = new ResourceReference("http://hl7.org/fhir/ValueSet/data-absent-reason"),
                Strength = BindingStrength.Required
            };

            var c      = new Coding("http://hl7.org/fhir/data-absent-reason", "NaN");
            var result = val.ValidateBinding(c, binding);

            Assert.True(result.Success);

            c.Code = "NaNX";
            result = val.ValidateBinding(c, binding);
            Assert.False(result.Success);

            c.Code           = "NaN";
            binding.Strength = null;
            result           = val.ValidateBinding(c, binding);
            Assert.True(result.Success);
            Assert.Equal(1, result.Warnings);  // missing binding strength

            c.Display        = "Not a Number";
            binding.Strength = BindingStrength.Required;
            result           = val.ValidateBinding(c, binding);
            Assert.True(result.Success);

            c.Display = "Not a NumberX";
            result    = val.ValidateBinding(c, binding);
            Assert.False(result.Success);

            // But this won't, it's also a composition, but without expansion - the local term server won't help you here
            var binding2 = new ElementDefinition.BindingComponent
            {
                ValueSet = new FhirUri("http://hl7.org/fhir/ValueSet/allergyintolerance-substance-code"),
                Strength = BindingStrength.Required
            };

            c      = new Coding("http://snomed.info/sct", "160244002");
            result = val.ValidateBinding(c, binding2);
            Assert.True(result.Success);
            Assert.NotEmpty(result.Where(type: OperationOutcome.IssueType.NotSupported));
        }
Example #10
0
        public void Serialize(object instance, Rest.SummaryType summary, bool contained = false, string root = null)
        {
            if (instance == null)
            {
                throw Error.ArgumentNull(nameof(instance));
            }

            var mapping = _inspector.ImportType(instance.GetType());

            var rootName = root ?? mapping.Name;

            _writer.WriteStartRootObject(rootName, contained);

            var    complexSerializer = new ComplexTypeWriter(_writer);
            Coding subsettedTag      = null;

            if (summary != Rest.SummaryType.False && instance is Resource)
            {
                Resource r = (instance as Resource);
                if (r != null)
                {
                    // If we are subsetting the instance during serialization, ensure that there
                    // is a meta element with that subsetting in it
                    // (Helps make it easier to create conformant instances)
                    if (r.Meta == null)
                    {
                        r.Meta = new Meta();
                    }
                    if (r.Meta.Tag.Where(t => t.System == "http://hl7.org/fhir/v3/ObservationValue" && t.Code == "SUBSETTED").Count() == 0)
                    {
                        subsettedTag = new Coding("http://hl7.org/fhir/v3/ObservationValue", "SUBSETTED");
                        r.Meta.Tag.Add(subsettedTag);
                    }
                }
            }
            complexSerializer.Serialize(mapping, instance, summary);

            if (subsettedTag != null)
            {
                Resource r = (instance as Resource);
                r.Meta.Tag.Remove(subsettedTag);
            }

            _writer.WriteEndRootObject(contained);
        }
Example #11
0
        public static void LoadRoleData_Item(GameBase.Network.Internal.ROLEDATA_ITEM info)
        {
            MySqlCommand command;
            String       _key = String.Format(MysqlString.LOADROLEDATA_ITEM, info.playerid);

            command = new MySqlCommand(_key, MysqlConn.GetConn());
            MysqlConn.Conn_Open();
            MySqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                if (!reader.HasRows)
                {
                    break;
                }
                GameBase.Network.Internal.RoleData_Item item = new GameBase.Network.Internal.RoleData_Item();
                item.id       = reader.GetUInt32("id");
                item.playerid = reader.GetInt32("playerid");
                item.itemid   = reader.GetUInt32("itemid");
                item.postion  = reader.GetUInt16("postion");
                item.stronglv = reader.GetByte("stronglv");

                item.gem1      = reader.GetByte("gem1");
                item.gem2      = reader.GetByte("gem2");
                item.forgename = reader.GetString("forgename");
                if (item.forgename.Length > 0)
                {
                    item.forgename = Coding.Latin1ToGB2312(item.forgename);
                }
                item.amount        = reader.GetUInt16("amount");
                item.war_ghost_exp = reader.GetInt32("war_ghost_exp");
                item.di_attack     = reader.GetByte("di_attack");
                item.shui_attack   = reader.GetByte("shui_attack");
                item.huo_attack    = reader.GetByte("huo_attack");
                item.feng_attack   = reader.GetByte("feng_attack");
                item.property      = reader.GetInt32("property");
                item.gem3          = reader.GetByte("gem3");
                item.god_exp       = reader.GetInt32("god_exp");
                item.god_strong    = reader.GetInt32("god_strong");

                info.mListItem.Add(item);
            }
            MysqlConn.Conn_Close();
            command.Dispose();
        }
        private CodeableConcept GetProblems(List <MedicalConditionEntity> medicalConditionList)
        {
            var problem    = new CodeableConcept();
            var codingList = new List <Coding>();

            foreach (var item in medicalConditionList)
            {
                var code = new Coding
                {
                    Display = item.Text,
                };

                codingList.Add(code);
            }

            problem.Coding = codingList;
            return(problem);
        }
            }                                                                                                                               // GenerateFhirPathSearch.cs:166

            // CSSliceCreator.cs:409
            /// <summary>
            /// Create and initialize a new item
            /// </summary>
            protected override Observation.ComponentComponent Create()                                                                      // CSSliceCreator.cs:413
            {                                                                                                                               // CSSliceCreator.cs:414
                Observation.ComponentComponent retVal = new Observation.ComponentComponent();                                               // CSSliceCreator.cs:415
                {                                                                                                                           // ElementFixCode.cs:767
                    CodeableConcept temp = new CodeableConcept();                                                                           // ElementFixCode.cs:768
                    temp.Coding = new List <Coding>();                                                                                      // ElementFixCode.cs:774
                    {                                                                                                                       // ElementFixCode.cs:777
                        var temp2 = new Coding();                                                                                           // ElementFixCode.cs:778
                        temp2.SystemElement       = new FhirUri();                                                                          // ElementFixCode.cs:781
                        temp2.SystemElement.Value = "http://www.test.com/SliceSystem";                                                      // ElementFixCode.cs:783
                        temp2.CodeElement         = new Code();                                                                             // ElementFixCode.cs:797
                        temp2.CodeElement.Value   = "Slice2Code";                                                                           // ElementFixCode.cs:799
                        temp.Coding.Add(temp2);                                                                                             // ElementFixCode.cs:826
                    }                                                                                                                       // ElementFixCode.cs:827
                    retVal.Code = temp;                                                                                                     // ElementFixCode.cs:842
                }                                                                                                                           // ElementFixCode.cs:843
                return(retVal);                                                                                                             // CSSliceCreator.cs:419
            }                                                                                                                               // CSSliceCreator.cs:420
        public void AddAnInvalidExtensionWithCodeOnlyToTheCreatedAppointment()
        {
            var coding = new Coding
            {
                Code = "TEL"
            };

            var codableConcept = new CodeableConcept();

            codableConcept.Coding.Add(coding);

            var extension = new Extension
            {
                Value = codableConcept
            };

            _fhirResourceRepository.Appointment.Extension.Add(extension);
        }
Example #15
0
        public static Coding MakeCoding(Coding cd, string s, string c, string d)
        {
            Coding coding = cd ?? new Coding();

            if (s != null)
            {
                coding.System = s;
            }
            if (c != null)
            {
                coding.Code = c;
            }
            if (d != null)
            {
                coding.Display = d;
            }
            return(coding);
        }
Example #16
0
        public static bool SaveRoleData_Attr(GameBase.Network.Internal.SaveRoleData_Attr info)
        {
            //加一个判断弥补之前的bug--负数 2016.1.25
            if (info.gamegold < 0)
            {
                info.gamegold = 0;
            }
            if (info.gold < 0)
            {
                info.gold = 0;
            }
            MySqlCommand command     = null;
            String       name_latin1 = Coding.GB2312ToLatin1(info.name);
            String       sql         = "";

            try
            {
                sql = String.Format(MysqlString.SAVEROLE_ATTR, name_latin1, info.lookface, info.hair, info.level, info.exp, info.life, info.mana, info.profession,
                                    info.pk, info.gold, info.gamegold, info.stronggold, info.mapid, info.x, info.y, info.hotkey, info.guanjue, info.godlevel, info.maxeudemon, info.accountid);
                String utf_sql = sql;
                command = new MySqlCommand(utf_sql, MysqlConn.GetConn());
                MysqlConn.Conn_Open();
                command.ExecuteNonQuery();
                MysqlConn.Conn_Close();
                command.Dispose();
            }
            catch (System.Exception ex)
            {
                Log.Instance().WriteLog("SaveRoleData_Attr error!");
                Log.Instance().WriteLog(ex.Message);
                Log.Instance().WriteLog(ex.StackTrace);
                Log.Instance().WriteLog("sql语句:" + sql);
                // if (MysqlConn.GetConn().State == ConnectionState.Open)
                //  {
                //    MysqlConn.GetConn().Close();
                //  }
                if (command != null)
                {
                    command.Dispose();
                }
                return(false);
            }
            return(true);
        }
Example #17
0
        public void AAATest_Address_TokenIndexSetter_GoodFormat()
        {
            //Arrange

            string CodeString = "Bla";

            var Code = new Coding();

            Code.Code = CodeString;

            Pyro.DataModel.DatabaseModel.Res_Account_Index__security Index = new Pyro.DataModel.DatabaseModel.Res_Account_Index__security();

            //Act
            Index = IndexSetterFactory.Create(typeof(TokenIndex)).Set(Code, Index) as Pyro.DataModel.DatabaseModel.Res_Account_Index__security;

            //Assert
            Assert.AreEqual(Index.Code, CodeString);
            Assert.IsNull(Index.System);
        }
        private static Extension GetCodingExtension(string extensionUrl, string codingUrl, string code, string display)
        {
            var coding = new Coding
            {
                Code    = code,
                Display = display,
                System  = codingUrl
            };

            var reason = new CodeableConcept();

            reason.Coding.Add(coding);

            return(new Extension
            {
                Url = extensionUrl,
                Value = reason
            });
        }
Example #19
0
        //+ Methods
        // DefineBase.cs:155
        /// <summary>
        /// Method to create fixed value
        /// </summary>
        public CodeableConcept FixedValue_ObservationCode()                                                                                               // FhirConstruct.cs:759
        {                                                                                                                                                 // FhirConstruct.cs:760
            CodeableConcept retVal = new CodeableConcept();                                                                                               // FhirConstruct.cs:761

            retVal.Coding = new List <Coding>();                                                                                                          // FhirConstruct.cs:767
            {                                                                                                                                             // FhirConstruct.cs:770
                var temp4 = new Coding();                                                                                                                 // FhirConstruct.cs:771
                temp4.SystemElement        = new FhirUri();                                                                                               // FhirConstruct.cs:774
                temp4.SystemElement.Value  = "http://hl7.org/fhir/us/breast-radiology/CodeSystem/ObservationCodes";                                       // FhirConstruct.cs:776
                temp4.CodeElement          = new Code();                                                                                                  // FhirConstruct.cs:790
                temp4.CodeElement.Value    = "mgAbnormalityArchitecturalDistortionObservation";                                                           // FhirConstruct.cs:792
                temp4.DisplayElement       = new FhirString();                                                                                            // FhirConstruct.cs:798
                temp4.DisplayElement.Value = "Abnormality Architectural Distortion observation";                                                          // FhirConstruct.cs:800
                retVal.Coding.Add(temp4);                                                                                                                 // FhirConstruct.cs:819
            }                                                                                                                                             // FhirConstruct.cs:820
            retVal.TextElement       = new FhirString();                                                                                                  // FhirConstruct.cs:825
            retVal.TextElement.Value = "Abnormality Architectural Distortion observation";                                                                // FhirConstruct.cs:827
            return(retVal);                                                                                                                               // FhirConstruct.cs:835
        }                                                                                                                                                 // FhirConstruct.cs:836
        }                                                                                                                                                 // FhirConstruct.cs:836

        // DefineBase.cs:155
        /// <summary>
        /// Method to create fixed value
        /// </summary>
        public CodeableConcept FixedValue_ObservationBodySite()                                                                                           // FhirConstruct.cs:759
        {                                                                                                                                                 // FhirConstruct.cs:760
            CodeableConcept retVal = new CodeableConcept();                                                                                               // FhirConstruct.cs:761

            retVal.Coding = new List <Coding>();                                                                                                          // FhirConstruct.cs:767
            {                                                                                                                                             // FhirConstruct.cs:770
                var temp4 = new Coding();                                                                                                                 // FhirConstruct.cs:771
                temp4.SystemElement        = new FhirUri();                                                                                               // FhirConstruct.cs:774
                temp4.SystemElement.Value  = "http://snomed.info/sct";                                                                                    // FhirConstruct.cs:776
                temp4.CodeElement          = new Code();                                                                                                  // FhirConstruct.cs:790
                temp4.CodeElement.Value    = "73056007";                                                                                                  // FhirConstruct.cs:792
                temp4.DisplayElement       = new FhirString();                                                                                            // FhirConstruct.cs:798
                temp4.DisplayElement.Value = "Right breast structure (body structure)";                                                                   // FhirConstruct.cs:800
                retVal.Coding.Add(temp4);                                                                                                                 // FhirConstruct.cs:819
            }                                                                                                                                             // FhirConstruct.cs:820
            retVal.TextElement       = new FhirString();                                                                                                  // FhirConstruct.cs:825
            retVal.TextElement.Value = "Right breast structure (body structure)";                                                                         // FhirConstruct.cs:827
            return(retVal);                                                                                                                               // FhirConstruct.cs:835
        }                                                                                                                                                 // FhirConstruct.cs:836
Example #21
0
        public OperationOutcome ValidateCode(string canonical = null, string context = null, ValueSet valueSet = null,
                                             string code      = null, string system  = null, string version    = null, string display = null,
                                             Coding coding    = null, CodeableConcept codeableConcept = null, FhirDateTime date = null,
                                             bool? @abstract  = null, string displayLanguage          = null)
        {
            if (valueSet == null)
            {
                if (canonical == null)
                {
                    throw Error.Argument("Have to supply either a canonical url or a valueset.");
                }

                try
                {
                    valueSet = _resolver.FindValueSet(canonical);
                }
                catch
                {
                    // valueSet remains null
                }

                if (valueSet == null)
                {
                    throw new ValueSetUnknownException($"Cannot retrieve valueset '{canonical}'");
                }
            }

            var outcome = new OperationOutcome();

            if (codeableConcept != null)
            {
                return(validateCodeVS(valueSet, codeableConcept, @abstract));
            }
            else if (coding != null)
            {
                return(validateCodeVS(valueSet, coding, @abstract));
            }
            else
            {
                return(validateCodeVS(valueSet, code, system, display, @abstract));
            }
        }
Example #22
0
        /// <summary>
        /// 确定按钮
        /// </summary>
        /// <param name="go"></param>
        private void _OnSureHandler(GameObject go)
        {
            if (txt_input.text == "")
            {
                Console.WriteLine("请输入反馈建议");
                return;
            }

            var tmpData = new FankuiVo();

            tmpData.input = txt_input.text;

            var str = Coding <FankuiVo> .encode(tmpData);

            //MessageHint.Show (str);

            //var backStr =  HttpRequestHelp.GetInstance ().GetFeedBackData (str);

            //var backStr = "";

            //HttpRequestManager.GetInstance ().GetFeedBackData (str,_handlScuccess);

            //MessageHint.Show (backStr);


//			return;
//
//			var backVo = Coding<FankuiBackVo>.decode (backStr);
//
//			if (backVo.status == 0)//成功
//			{
//				txt_input.text = "";
//			}
//			else
//			{
//				//失败
//			}
//
//			//Console.WriteLine (backStr);
//
//			MessageHint.Show (backVo.msg);
        }
Example #23
0
        public static void SaveRoleData_Friend(GameBase.Network.Internal.ROLEDATA_FRIEND info)
        {
            MySqlCommand command;
            String       sql   = "";
            bool         bSave = false;

            for (int i = 0; i < info.list_item.Count; i++)
            {
                GameBase.Network.Internal.RoleData_Friend friend = info.list_item[i];


                if (friend.id == -1)
                {
                    //先删除己方-
                    sql     = String.Format(MysqlString.DELETEROLEDATA_FRIEND, friend.friendid, info.playerid);
                    command = new MySqlCommand(sql, MysqlConn.GetConn());
                    MysqlConn.Conn_Open();
                    command.ExecuteNonQuery();
                    MysqlConn.Conn_Close();
                    command.Dispose();

                    //删除自己
                    sql   = String.Format(MysqlString.DELETEROLEDATA_FRIEND, info.playerid, friend.friendid);
                    bSave = true;
                }
                else if (friend.id == 0)
                {
                    friend.friendname = Coding.GB2312ToLatin1(friend.friendname);
                    sql   = String.Format(MysqlString.SAVEROLEDATA_FRIEND, info.playerid, friend.friendtype, friend.friendid, friend.friendname);
                    bSave = true;
                }
                if (!bSave)
                {
                    continue;
                }
                command = new MySqlCommand(sql, MysqlConn.GetConn());
                MysqlConn.Conn_Open();
                command.ExecuteNonQuery();
                MysqlConn.Conn_Close();
                command.Dispose();
            }
        }
Example #24
0
        //更新军团成员信息
        public static uint UpdateLegionMembers(uint legion_id, LegionMember member)
        {
            member.members_name = Coding.GB2312ToLatin1(member.members_name);
            //插入
            MySqlCommand command;
            String       sql = "";

            if (member.id == 0)
            {
                sql = string.Format(MysqlString.CREATE_LEGION_MEMBERS, legion_id, member.members_name, member.money, member.rank);
            }
            else
            {
                sql = string.Format(MysqlString.UPDATE_LEGION_MEMBERS, member.money, member.rank, legion_id, member.members_name);
            }
            command = new MySqlCommand(sql, MysqlConn.GetConn());
            MysqlConn.Conn_Open();
            command.ExecuteNonQuery();
            MysqlConn.Conn_Close();
            command.Dispose();
            if (member.id != 0)
            {
                return(member.id);
            }

            //取主键-- 不能用于多线程或者多个程序操作该数据库。。切记
            uint   ret  = 0;
            String _key = "select max(id) from cq_legion_members";

            command = new MySqlCommand(_key, MysqlConn.GetConn());
            MysqlConn.Conn_Open();
            MySqlDataReader reader = command.ExecuteReader();

            reader.Read();
            if (reader.HasRows)
            {
                ret = Convert.ToUInt32(reader[0].ToString());
            }
            MysqlConn.Conn_Close();
            command.Dispose();
            return(ret);
        }
Example #25
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);
        }
Example #26
0
        public async Task GivenListOfResources_WhenSearchedWithTotalTypeEstimate_ThenExceptionShouldBeThrown()
        {
            const int numberOfResources = 5;

            var tag = new Coding(string.Empty, Guid.NewGuid().ToString());

            Patient patient = Samples.GetDefaultPatient().ToPoco <Patient>();

            for (int i = 0; i < numberOfResources; i++)
            {
                patient.Meta = new Meta();
                patient.Meta.Tag.Add(tag);

                await Client.CreateAsync(patient);
            }

            FhirException ex = await Assert.ThrowsAsync <FhirException>(() => Client.SearchAsync($"Patient?_total=estimate"));

            Assert.Equal(HttpStatusCode.Forbidden, ex.StatusCode);
        }
        public void AddAnInvalidExtensionWithUrlCodeAndDisplayToTheCreatedAppointment()
        {
            var coding = new Coding
            {
                Code    = "TEL",
                Display = "Telephone"
            };

            var codableConcept = new CodeableConcept();

            codableConcept.Coding.Add(coding);

            var extension = new Extension
            {
                Url   = "http://fhir.nhs.uk/StructureDefinition/extension-gpconnect-appointment-notanextension-1",
                Value = codableConcept
            };

            _fhirResourceRepository.Appointment.Extension.Add(extension);
        }
Example #28
0
 void ask()
 {
     HttpReqHelper.requestSync(AppConst.WebUrl + "buildHelper?protocol=1", delegate(string res)
     {
         try
         {
             buildModel = Coding <BuildModel> .decode(res);
             mainform.clearLogSafePost();
             mainform.showLogSafePost("开始执行任务:" + buildModel.Filename + "   " + buildModel.Name);
             startMissionSafePost();
         }
         catch (Exception err)
         {
             mainform.showLogSafePost(res + "  " + err.ToString());
             mainform.showLogSafePost("暂无任务...");
             Thread.Sleep(3000);
             ask();
         }
     });
 }
Example #29
0
        public OperationOutcome ValidateCode(string canonical = null, string context = null, ValueSet valueSet = null,
                                             string code      = null, string system  = null, string version    = null, string display = null,
                                             Coding coding    = null, CodeableConcept codeableConcept = null, FhirDateTime date = null,
                                             bool? @abstract  = null, string displayLanguage          = null)
        {
            if (!String.IsNullOrEmpty(displayLanguage))
            {
                throw Error.NotSupported($"The '{nameof(displayLanguage)}' parameter is not supported in DSTU2 terminology services.");
            }

            try
            {
                var resultValidateCode =
                    Endpoint.ValidateCode(
                        identifier: canonical != null ? new FhirUri(canonical) : null,
                        context: context != null ? new FhirUri(context) : null,
                        valueSet: valueSet,
                        code: code != null ? new Code(code) : null,
                        system: system != null ? new FhirUri(system) : null,
                        version: version != null ? new FhirString(version) : null,
                        display: display != null ? new FhirString(display) : null,
                        coding: coding, codeableConcept: codeableConcept, date: date,
                        @abstract: @abstract != null ? new FhirBoolean(@abstract) : null);

                OperationOutcome outcome = processResult(code, system, display, coding, codeableConcept, resultValidateCode);

                return(outcome);
            }
            catch (FhirOperationException ex)
            {
                // Special case, if term service returns 404, turn that into a more explicit exception
                if (ex.Status == System.Net.HttpStatusCode.NotFound)
                {
                    throw new ValueSetUnknownException(ex.Message);
                }
                else
                {
                    return(ex.Outcome);
                }
            }
        }
Example #30
0
        public static void SaveRoleData_Item(GameBase.Network.Internal.ROLEDATA_ITEM info)
        {
            try
            {
                MySqlCommand command;
                String       sql;
                for (int i = 0; i < info.mListItem.Count; i++)
                {
                    GameBase.Network.Internal.RoleData_Item item = info.mListItem[i];
                    if (item.forgename.Length > 0)
                    {
                        item.forgename = Coding.GB2312ToLatin1(item.forgename);
                    }
                    if (item.id == 0) //id为0就插入
                    {
                        sql = String.Format(MysqlString.SAVEROLE_ITEM, info.playerid, item.itemid, item.postion, item.stronglv, item.gem1,
                                            item.gem2, item.forgename, item.amount, item.war_ghost_exp, item.di_attack, item.shui_attack, item.huo_attack, item.feng_attack,
                                            item.property, item.gem3, item.god_exp, item.god_strong);
                    }
                    else
                    {
                        sql = String.Format(MysqlString.UPDATEROLE_ITEM, item.itemid, item.postion, item.stronglv, item.gem1, item.gem2, item.forgename,
                                            item.amount, item.war_ghost_exp, item.di_attack, item.shui_attack, item.huo_attack, item.feng_attack, item.property, item.gem3, item.god_exp, item.god_strong, info.playerid, item.id);
                    }
                    command = new MySqlCommand(sql, MysqlConn.GetConn());
                    MysqlConn.Conn_Open();
                    command.ExecuteNonQuery();

                    MysqlConn.Conn_Close();
                    command.Dispose();
                }
            }
            catch (System.Exception ex)
            {
                Log.Instance().WriteLog("---------------------------------------------------------------------------");
                Log.Instance().WriteLog("保存角色道具信息失败.角色id:" + info.playerid.ToString());
                Log.Instance().WriteLog(ex.Message);
                Log.Instance().WriteLog(ex.StackTrace);
                Log.Instance().WriteLog("---------------------------------------------------------------------------");
            }
        }
Example #31
0
        public IActionResult Unknown(string flag)
        {
            switch (flag)
            {
            case "friends":
                if (_levelProcessRepository.CheckAuthority(Request.Cookies["token"], 5))
                {
                    _logger.LogInformation("===LEVEL===> [" + Request.Cookies["token"].Substring(0, 6) + "]@"
                                           + HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString() + " => [LEVEL#Fans] SUCCESS.");
                    return(View("Fans"));
                }
                return(new NotFoundResult());

            case "what":
                if (_levelProcessRepository.CheckAuthority(Request.Cookies["token"], 6))
                {
                    _logger.LogInformation("===LEVEL===> [" + Request.Cookies["token"].Substring(0, 6) + "]@"
                                           + HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString() + " => [LEVEL#Excel] SUCCESS.");
                    return(View("Excel"));
                }
                return(new NotFoundResult());

            case "next":
                if (_levelProcessRepository.CheckAuthority(Request.Cookies["token"], 7))
                {
                    string token    = Request.Cookies["token"];
                    string key      = Assets.GenOriginalCodeKey(token);
                    string userstr  = "Your Key is: [" + key + "]";
                    string codedstr = Assets.GenCodedString(userstr);
                    _codeKeyRepository.SaveCodeKey(token, Coding.MD5(key));
                    ViewData["code"] = codedstr;
                    _logger.LogInformation("===LEVEL===> [" + Request.Cookies["token"].Substring(0, 6) + "]@"
                                           + HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString() + " => [LEVEL#Code] SUCCESS.");
                    return(View("Code"));
                }
                return(new NotFoundResult());

            default:
                return(new NotFoundResult());
            }
        }
Example #32
0
        public string GetHumanReadbleContent()
        {
            var common = new Common();
            var sb     = new StringBuilder();

            sb.AppendFormat("{0:X8}, Opcode = {1:X2}, ", BitConverter.ToString(Coding.ToArray()), OpCode);

            switch (Type)
            {
            case InstructionType.R_Type:
                sb.AppendFormat("Type = R\tRd = {0}\tf3 = {1:X}\tRs1 = {2}\tRs2 = {3}\tf7 = {4:X}", common.DecocdeRegisterIndex(Rd), Funct3, common.DecocdeRegisterIndex(Rs1), common.DecocdeRegisterIndex(Rs2), Funct7);
                break;

            case InstructionType.I_Type:
                sb.AppendFormat("Type = I\tRd = {0}\tf3 = {1:X}\tRs1 = {2}\tSigned Imm = {3:X}\tUnsigned Imm = {4:X}", common.DecocdeRegisterIndex(Rd), Funct3, common.DecocdeRegisterIndex(Rs1), SignedImmediate, UnsignedImmediate);
                break;

            case InstructionType.S_Type:
                sb.AppendFormat("Type = S\tf3 = {0:X}\tRs1 = {1}\tRs2 = {2}\tSigned Imm = {3:X}", Funct3, common.DecocdeRegisterIndex(Rs1), common.DecocdeRegisterIndex(Rs2), SignedImmediate);
                break;

            case InstructionType.U_Type:
                sb.AppendFormat("Type = U\tRd = {0}\tUnsigned Imm = {1:X}", common.DecocdeRegisterIndex(Rd), SignedImmediate, UnsignedImmediate);
                break;

            case InstructionType.B_Type:
                sb.AppendFormat("Type = B\tF3 = {0:X}\tRs1 = {1}\tRs2 = {2}\tSigned Immediate = {3:X}", Funct3, common.DecocdeRegisterIndex(Rs1), common.DecocdeRegisterIndex(Rs2), SignedImmediate);
                break;

            case InstructionType.J_Type:
                sb.AppendFormat("Type = J\tRd = {0}\tImmediate = {1:X}", common.DecocdeRegisterIndex(Rd), SignedImmediate);
                break;

            default:
                sb.AppendFormat("Type = Unknown, Opcode={0:X}\tRd = {1}", OpCode, common.DecocdeRegisterIndex(Rd));
                break;
            }

            Logger.Info(sb.ToString());
            return(sb.ToString());
        }
Example #33
0
        /// <summary>
        /// Parses a bindeable type into either a Coding (code, Coding, Quantity, string, uri) or CodeableConcept
        /// </summary>
        /// <param name="instance"></param>
        /// <param name="codedType"></param>
        /// <returns>An object, which is either a Coding or CodeableConcept</returns>
        public static object ParseBindable(this IElementNavigator instance, FHIRDefinedType codedType)
        {
            // 'code','Coding','CodeableConcept','Quantity','Extension', 'string', 'uri'

            if (codedType == FHIRDefinedType.Code)
            {
                return(instance.ParsePrimitiveCode());
            }
            else if (codedType == FHIRDefinedType.Coding)
            {
                return(instance.ParseCoding());
            }
            else if (codedType == FHIRDefinedType.CodeableConcept)
            {
                return(instance.ParseCodeableConcept());
            }
            else if (codedType == FHIRDefinedType.Quantity)
            {
                var newCoding = new Coding();
                var q         = instance.ParseQuantity();
                newCoding.Code   = q.Unit;
                newCoding.System = q.System;
                return(newCoding);
            }
            else if (codedType == FHIRDefinedType.String)
            {
                return(instance.ParsePrimitiveCode());
            }
            else if (codedType == FHIRDefinedType.Uri)
            {
                return(instance.ParsePrimitiveCode());
            }
            else if (codedType == FHIRDefinedType.Extension)
            {
                throw new NotSupportedException($"The validator does not support binding to Extension values");
            }
            else
            {
                throw new NotSupportedException($"FHIR type '{codedType}' is not bindeable");
            }
        }
Example #34
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("Не надена запись");
 }
Example #35
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;
        }
Example #36
0
 //подумать как сделать лучше!!
 public Coding SetCoding(Coding cod)
 {
     //cod.Version = null;
     return cod;
 }
Example #37
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;
        }
Example #38
0
 public TestCoding(Coding r)
 {
     coding = r;
 }