private void DoOrg(int b, List <string> rx)
        {
            organisation.Id = FhirHelper.MakeId();
            organisation.Identifier.Add(FhirHelper.MakeIdentifier("https://fhir.nhs.uk/Id/ods-organization-code", rx[b + EMUData.SDSORGANISATIONID]));
            ContactPoint cp = new ContactPoint
            {
                System = ContactPoint.ContactPointSystem.Phone,
                Use    = ContactPoint.ContactPointUse.Work,
                Value  = rx[b + EMUData.ORGANISATIONTELECOM]
            };

            organisation.Telecom.Add(cp);
            CodeableConcept cc = new CodeableConcept();

            cc.Coding.Add(FhirHelper.MakeCoding("https://fhir.nhs.uk/R4/CodeSystem/organisation-type", rx[b + EMUData.ORGANISATIONTYPE], null));
            organisation.Type.Add(cc);
            organisation.Name = rx[b + EMUData.ORGANISATIONNAME];
            organisation.Address.Add(MakeAddress(b, rx));
            Identifier        pct    = FhirHelper.MakeIdentifier("https://fhir.nhs.uk/Id/ods-organization-code", rx[b + EMUData.PCTORGANISATIONSDSID]);
            ResourceReference pctref = new ResourceReference
            {
                Identifier = pct
            };

            organisation.PartOf = pctref;
        }
        private static CodeableConcept DoMedication(System.Collections.Generic.List <string> item)
        {
            CodeableConcept cc = new CodeableConcept();

            cc.Coding.Add(FhirHelper.MakeCoding("http://snomed.info/sct", item[EMUData.SUBSTANCECODE], item[EMUData.DISPLAYNAME]));
            return(cc);
        }
        private static MedicationRequest.DispenseRequestComponent MakeDispenseRequest(ResourceReference nom, System.Collections.Generic.List <string> rx,
                                                                                      System.Collections.Generic.List <string> item)
        {
            MedicationRequest.DispenseRequestComponent dr = new MedicationRequest.DispenseRequestComponent();
            Extension e = FhirHelper.MakeExtension(null, "https://fhir.nhs.uk/R4/StructureDefinition/Extension-performerType",
                                                   FhirHelper.MakeCoding("https://fhir.nhs.uk/R4/CodeSystem/dispensing-site-preference", rx[EMUData.DISPENSINGSITEPREFERENCE], null));

            try
            {
                dr.Quantity = new SimpleQuantity
                {
                    Code   = item[EMUData.QUANTITYCODE],
                    System = "http://snomed.info/sct",
                    Unit   = item[EMUData.QUANTITYTEXT],
                    Value  = Convert.ToDecimal(item[EMUData.QUANTITYCOUNT])
                };
            }
            catch (Exception ex)
            {
#pragma warning disable CA2241 // Provide correct arguments to formatting methods
                Console.WriteLine("Exception: {ex} making SimpleQuantity: {value}", ex.Message, item[EMUData.QUANTITYCOUNT]);
#pragma warning restore CA2241 // Provide correct arguments to formatting methods
            }
            if (nom != null)
            {
                dr.Performer = nom;
            }
            dr.Extension.Add(e);
            return(dr);
        }
        private static void DoPrescriptionType(MedicationRequest m, System.Collections.Generic.List <string> rx)
        {
            Coding ptc = FhirHelper.MakeCoding("https://fhir.nhs.uk/R4/CodeSystem/prescription-type", rx[EMUData.PRESCRIPTIONTYPE], null);

            if (rx[EMUData.PRESCRIPTIONTYPE].Equals("0001"))
            {
                ptc.Display = "General Practitioner Prescribing";
            }
            Extension e = FhirHelper.MakeExtension(null, "https://fhir.nhs.uk/R4/StructureDefinition/Extension-prescriptionType", ptc);

            m.Extension.Add(e);
        }
        private static MessageHeader MakeMessageHeader(ParticipantMaker a)
        {
            MessageHeader header = new MessageHeader
            {
                Id     = FhirHelper.MakeId(),
                Event  = FhirHelper.MakeCoding("https://fhir.nhs.uk/R4/CodeSystem/message-event", "prescription-order", "Prescription Order"),
                Sender = FhirHelper.MakeInternalReference(a.Role)
            };

            header.Sender.Display = a.Practitioner.Name[0].Text;
            header.Source         = MakeSource();
            return(header);
        }
        private static void AddNhsNumber(Patient p, System.Collections.Generic.List <string> rx)
        {
            currentNhsNumber = rx[EMUData.PATIENTID];
            Identifier n   = FhirHelper.MakeIdentifier("https://fhir.nhs.uk/Id/nhs-number", rx[EMUData.PATIENTID]);
            Extension  evs = new Extension
            {
                Url = "https://fhir.nhs.uk/R4/StructureDefinition/Extension-UKCore-NHSNumberVerificationStatus"
            };
            CodeableConcept vccvs = new CodeableConcept();

            vccvs.Coding.Add(FhirHelper.MakeCoding("https://fhir.nhs.uk/R4/CodeSystem/UKCore-NHSNumberVerificationStatus",
                                                   "01", "Number present and verified"));
            evs.Value = vccvs;
            n.Extension.Add(evs);
            p.Identifier.Add(n);
        }