private static hcpartyType BuildApplication(string name = null) { var hcPartyType = new hcpartyType { cd = new CDHCPARTY[1] { new CDHCPARTY { SV = KmehrConstant.ReferenceVersion.CD_HCPARTY_VERSION, S = CDHCPARTYschemes.CDHCPARTY, Value = KmehrConstant.HealthCarePartTypeNames.APPLICATION } } }; if (!string.IsNullOrWhiteSpace(name)) { hcPartyType.ItemsElementName = new ItemsChoiceType[1] { ItemsChoiceType.name }; hcPartyType.Items = new string[1] { name }; } return(hcPartyType); }
public KmehrTransactionItemBuilder AddAuthor(string id, string type, string firstname, string lastname) { List <hcpartyType> authors; if (_obj.author == null) { authors = new List <hcpartyType>(); } else { authors = _obj.author.ToList(); } var hcParty = new hcpartyType { cd = new CDHCPARTY[1] { new CDHCPARTY { SV = KmehrConstant.ReferenceVersion.CD_HCPARTY_VERSION, S = CDHCPARTYschemes.CDHCPARTY, Value = type } }, id = new IDHCPARTY[1] { new IDHCPARTY { SV = KmehrConstant.ReferenceVersion.ID_KMEHR_VERSION, S = IDHCPARTYschemes.IDHCPARTY, Value = id } } }; var choices = new List <ItemsChoiceType>(); var items = new List <string>(); if (!string.IsNullOrWhiteSpace(firstname)) { choices.Add(ItemsChoiceType.firstname); items.Add(firstname); } if (!string.IsNullOrWhiteSpace(lastname)) { choices.Add(ItemsChoiceType.familyname); items.Add(lastname); } hcParty.ItemsElementName = choices.ToArray(); hcParty.Items = items.ToArray(); authors.Add(hcParty); _obj.author = authors.ToArray(); return(this); }
private static hcpartyType BuildPerson(string id, string personType, string firstname, string lastname) { var hcPartyType = new hcpartyType { cd = new CDHCPARTY[1] { new CDHCPARTY { SV = KmehrConstant.ReferenceVersion.CD_HCPARTY_VERSION, S = CDHCPARTYschemes.CDHCPARTY, Value = personType } }, id = new IDHCPARTY[1] { new IDHCPARTY { SV = KmehrConstant.ReferenceVersion.ID_KMEHR_VERSION, S = IDHCPARTYschemes.IDHCPARTY, Value = id } } }; var choices = new List <ItemsChoiceType>(); var items = new List <string>(); if (!string.IsNullOrWhiteSpace(firstname)) { choices.Add(ItemsChoiceType.firstname); items.Add(firstname); } if (!string.IsNullOrWhiteSpace(lastname)) { choices.Add(ItemsChoiceType.familyname); items.Add(lastname); } hcPartyType.ItemsElementName = choices.ToArray(); hcPartyType.Items = items.ToArray(); return(hcPartyType); }
private static hcpartyType BuildOrganization(string id, string organizationType, string name = null) { var hcPartyType = new hcpartyType { cd = new CDHCPARTY[1] { new CDHCPARTY { SV = KmehrConstant.ReferenceVersion.CD_HCPARTY_VERSION, S = CDHCPARTYschemes.CDHCPARTY, Value = organizationType } }, id = new IDHCPARTY[1] { new IDHCPARTY { SV = KmehrConstant.ReferenceVersion.ID_KMEHR_VERSION, S = IDHCPARTYschemes.IDHCPARTY, Value = id } } }; if (!string.IsNullOrWhiteSpace(name)) { hcPartyType.ItemsElementName = new ItemsChoiceType[1] { ItemsChoiceType.name }; hcPartyType.Items = new string[1] { name }; } return(hcPartyType); }
private static hcpartyType BuildHealthCareWorker(string healthCarePartyType, string hcPartyId = null, string niss = null, string firstName = null, string familyName = null) { var hcPartyType = new hcpartyType { cd = new CDHCPARTY[1] { new CDHCPARTY { SV = KmehrConstant.ReferenceVersion.CD_HCPARTY_VERSION, S = CDHCPARTYschemes.CDHCPARTY, Value = healthCarePartyType } } }; var ids = new List <IDHCPARTY>(); if (!string.IsNullOrWhiteSpace(hcPartyId)) { ids.Add(new IDHCPARTY { SV = KmehrConstant.ReferenceVersion.ID_KMEHR_VERSION, S = IDHCPARTYschemes.IDHCPARTY, Value = hcPartyId }); } if (!string.IsNullOrWhiteSpace(niss)) { ids.Add(new IDHCPARTY { SV = KmehrConstant.ReferenceVersion.ID_KMEHR_VERSION, S = IDHCPARTYschemes.INSS, Value = niss }); } hcPartyType.id = ids.ToArray(); var itemChoiceTypes = new List <ItemsChoiceType>(); if (!string.IsNullOrWhiteSpace(firstName)) { itemChoiceTypes.Add(ItemsChoiceType.firstname); } if (!string.IsNullOrWhiteSpace(familyName)) { itemChoiceTypes.Add(ItemsChoiceType.familyname); } hcPartyType.Items = new string[itemChoiceTypes.Count]; hcPartyType.ItemsElementName = new ItemsChoiceType[itemChoiceTypes.Count]; int i = 0; foreach (var itemChoiceType in itemChoiceTypes) { switch (itemChoiceType) { case ItemsChoiceType.firstname: hcPartyType.Items[i] = firstName; break; case ItemsChoiceType.familyname: hcPartyType.Items[i] = familyName; break; } i++; } return(hcPartyType); }