public void GenerateProcedureEntry(ProcedureList patientProcedure, int refid, PatientClinicalInformation patientinfo, III hl7III, Factory hl7factory)
        {
            IEntry Entry = functionalStatus.Section.Entry.Append();

            Entry.AsObservation.MoodCode  = x_ActMoodDocumentObservation.EVN;
            Entry.AsObservation.ClassCode = "OBS";
            hl7III = Entry.AsObservation.TemplateId.Append();
            hl7III.Init("2.16.840.1.113883.10.20.22.4.13");
            hl7III = Entry.AsObservation.Id.Append();
            hl7III.Init(Guid.NewGuid().ToString());
            Entry.AsObservation.Code.Code           = patientProcedure.CPTCodes;
            Entry.AsObservation.Code.CodeSystem     = "2.16.840.1.113883.6.96";
            Entry.AsObservation.Code.CodeSystemName = "CPT";
            Entry.AsObservation.Code.DisplayName    = patientProcedure.Description;
            Entry.AsObservation.Code.OriginalText.Reference.Value = ("#Proc" + (refid + 1).ToString());
            Entry.AsObservation.StatusCode.Code          = "completed";
            Entry.AsObservation.EffectiveTime.NullFlavor = "UNK";
            Entry.AsObservation.PriorityCode.NullFlavor  = "UNK";
            CD obsValueAsCD = new CD();

            obsValueAsCD.OriginalText.Reference.Value = ("#Proc" + (refid + 1).ToString());
            Entry.AsObservation.Value.Add(obsValueAsCD);
            if (patientinfo.ptClinicInformation.ClinicName != null)
            {
                addressphno             = new GenerateAddressPhNo();
                addressinfo             = new AddressModel();///Fill Clinic Address
                addressinfo.street      = patientinfo.ptClinicInformation.ClinicStreeet;
                addressinfo.city        = patientinfo.ptClinicInformation.ClinicCity;
                addressinfo.state       = patientinfo.ptClinicInformation.ClinicState;
                addressinfo.country     = patientinfo.ptClinicInformation.ClinicCountry;
                addressinfo.pinCode     = patientinfo.ptClinicInformation.ClinicZip.ToString();
                contactinfo             = new PhNoModel();///FIll Clinic Contact Number
                contactinfo.telcomUse   = "WP";
                contactinfo.telcomValue = patientinfo.ptClinicInformation.ClinicPhoneNumber;
                contactinfo.nullFlavor  = "UNK";
            }
            var Performer = Entry.AsObservation.Performer.Append();

            hl7III = Performer.AssignedEntity.Id.Append();
            hl7III.Init(Guid.NewGuid().ToString());
            Performer.AssignedEntity.Addr.Add(addressphno.GenerateAddress(addressinfo, hl7factory));
            Performer.AssignedEntity.Telecom.Add(addressphno.GeneratePhNo(contactinfo, hl7factory));
            hl7III = Performer.AssignedEntity.RepresentedOrganization.Id.Append();
            hl7III.Init(Guid.NewGuid().ToString());
            IAD hl7IADInterface = hl7factory.CreateAD();

            hl7IADInterface.NullFlavor = "UNK";
            Performer.AssignedEntity.RepresentedOrganization.Addr.Add(hl7IADInterface);
            ITEL telcom = hl7factory.CreateTEL();

            telcom            = hl7factory.CreateTEL();
            telcom.NullFlavor = "UNK";
            Performer.AssignedEntity.RepresentedOrganization.Telecom.Add(telcom);
        }
        public ITEL GeneratePhNo(PhNoModel telcominfo, Factory hl7factory)
        {
            ITEL telcom = hl7factory.CreateTEL();

            telcom.Use = telcominfo.telcomUse;
            if (telcominfo.telcomValue != "" && telcominfo.telcomValue != null)
            {
                telcom.Value = telcominfo.telcomValue;
            }
            else
            {
                telcom.NullFlavor = telcominfo.nullFlavor;
            }
            return(telcom);
        }