public static Resource FileToResource(string fullFileName) { Resource returnValue = null; try { byte[] byteJSON = File.ReadAllBytes(fullFileName); Stream stream = new MemoryStream(byteJSON); returnValue = FHIRUtilities.StreamToFHIR(new StreamReader(stream)); } catch (Exception ex) { throw ex; } return(returnValue); }
public static Patient CreateTestFHIRPatientProfile() { Patient pt = new Patient(); Identifier idSession; Identifier idPatientCertificate; idSession = new Identifier(); idSession.System = "http://www.mynoid.com/fhir/SessionID"; idSession.Value = "S12348"; pt.Identifier.Add(idSession); idPatientCertificate = new Identifier(); idPatientCertificate.System = "http://www.mynoid.com/fhir/PatientCertificateID"; idPatientCertificate.Value = "PT67891"; pt.Identifier.Add(idPatientCertificate); ResourceReference managingOrganization = new ResourceReference(NoID_OID, "Test NoID"); pt.ManagingOrganization = managingOrganization; pt.Language = "English"; pt.BirthDate = "2006-07-03"; pt.Gender = AdministrativeGender.Female; pt.MultipleBirth = new FhirString("No"); // Add patient name HumanName ptName = new HumanName(); ptName.Given = new string[] { "Mary", "J" }; ptName.Family = "Bling"; pt.Name = new List <HumanName> { ptName }; // Add patient address Address address = new Address(); address.Line = new string[] { "300 Exit St", "Unit 5" }; address.City = "New Orleans"; address.State = "LA"; address.Country = "USA"; address.PostalCode = "70112-1202"; pt.Address.Add(address); Attachment attach = new Attachment(); Media media = new Media(); media.AddExtension("Healthcare Node", FHIRUtilities.OrganizationExtension("Test NoID FHIR Message", "noidtest.net", "devtest.noidtest.net")); media.AddExtension("Biometic Capture", FHIRUtilities.CaptureSiteExtension( CaptureSiteSnoMedCode.IndexFinger, LateralitySnoMedCode.Left, "Test Scanner Device", 500, 350, 290)); Extension extFingerPrintMedia = FHIRUtilities.FingerPrintMediaExtension( "123", "211", "43", "0" ); media.Extension.Add(extFingerPrintMedia); extFingerPrintMedia = FHIRUtilities.FingerPrintMediaExtension( "180", "91", "211", "1" ); media.Extension.Add(extFingerPrintMedia); extFingerPrintMedia = FHIRUtilities.FingerPrintMediaExtension( "201", "154", "44", "1" ); media.Extension.Add(extFingerPrintMedia); extFingerPrintMedia = FHIRUtilities.FingerPrintMediaExtension( "21", "279", "310", "0" ); media.Extension.Add(extFingerPrintMedia); attach.Data = FhirSerializer.SerializeToJsonBytes(media, summary: Hl7.Fhir.Rest.SummaryType.False); pt.Photo.Add(attach); return(pt); }