예제 #1
0
        protected virtual object Visit(openehr.openehr.am.openehr_profile.data_types.text.Impl.C_CODE_PHRASE o, int depth)
        {
            C_CODE_PHRASE result = new C_CODE_PHRASE();

            CloneC_Object(result, o);

            if (o.terminology_id() != null)
            {
                TERMINOLOGY_ID terminologyId = new TERMINOLOGY_ID();
                terminologyId.value   = o.terminology_id().value().ToString();
                result.terminology_id = terminologyId;
            }

            if (o.code_list() != null)
            {
                result.code_list = new string[o.code_list().count()];

                for (int i = 1; i <= result.code_list.Length; i++)
                {
                    result.code_list[i - 1] = o.code_list().i_th(i).ToString();
                }
            }

            if (o.has_assumed_value())
            {
                result.assumed_value = CloneCodePhrase((openehr.openehr.rm.data_types.text.Impl.CODE_PHRASE)o.assumed_value());
            }

            return(result);
        }
예제 #2
0
        private static CCodePhrase Map(this C_CODE_PHRASE model)
        {
            var codePhrase = new CCodePhrase
            {
                Occurences             = model.occurrences.Map(),
                NodeId                 = model.node_id,
                TerminologyId          = new TerminologyId(model.terminology_id.value),
                ReferenceModelTypeName = model.rm_type_name
            };

            if (model.code_list != null)
            {
                foreach (string item in model.code_list)
                {
                    codePhrase.CodeList.Add(item);
                }
            }

            return(codePhrase);
        }
예제 #3
0
        private void AddTerms(ArrayList result, C_OBJECT obj)
        {
            if (obj.GetType() == typeof(C_COMPLEX_OBJECT))
            {
                C_COMPLEX_OBJECT co = (C_COMPLEX_OBJECT)obj;

                //Add the node id
                if (!string.IsNullOrEmpty(obj.node_id) && !result.Contains(obj.node_id))
                {
                    result.Add(obj.node_id);
                }

                if (co.attributes != null)
                {
                    foreach (C_ATTRIBUTE attribute in co.attributes)
                    {
                        if (attribute.children != null)
                        {
                            foreach (C_OBJECT obj_1 in attribute.children)
                            {
                                AddTerms(result, obj_1);
                            }
                        }
                    }
                }
            }
            else if (obj.GetType() == typeof(ARCHETYPE_SLOT))
            {
                if (!string.IsNullOrEmpty(obj.node_id) && !result.Contains(obj.node_id))
                {
                    result.Add(obj.node_id);
                }
            }
            //check for internal codes
            else if (obj.GetType() == typeof(C_CODE_PHRASE))
            {
                C_CODE_PHRASE ct = (C_CODE_PHRASE)obj;

                //Check reference
                if (ct.terminology_id != null)
                {
                    if (ct.terminology_id.value.ToString().ToLowerInvariant() == "local" && ct.code_list != null)
                    {
                        foreach (string code in ct.code_list)
                        {
                            if (!result.Contains(code))
                            {
                                result.Add(code);
                            }
                        }
                    }
                }
            }
            //Ordinals use internal codes
            else if (obj.GetType() == typeof(C_DV_ORDINAL))
            {
                C_DV_ORDINAL co = (C_DV_ORDINAL)obj;

                if (co.list != null && co.list.Length > 0)
                {
                    foreach (DV_ORDINAL o in co.list)
                    {
                        if (o.symbol != null && o.symbol.defining_code != null)
                        {
                            if (!result.Contains(o.symbol.defining_code.code_string))
                            {
                                result.Add(o.symbol.defining_code.code_string);
                            }
                        }
                    }
                }
            }
            //Constraint references us acXXXX codes
            else if (obj.GetType() == typeof(CONSTRAINT_REF))
            {
                CONSTRAINT_REF cr = (CONSTRAINT_REF)obj;

                if (cr.reference != null)
                {
                    if (!result.Contains(cr.reference))
                    {
                        result.Add(cr.reference);
                    }
                }
            }
        }