Example #1
0
 // C# -> Javascript function is NoIDBridge.postLateralityCaptureSite ( <params> )
 public bool postLateralityCaptureSite(string laterality, string captureSite)
 {
     try
     {
         _captureSite     = FHIRUtilities.StringToCaptureSite(captureSite);
         _laterality      = FHIRUtilities.StringToLaterality(laterality);
         errorDescription = "";
     }
     catch (Exception ex)
     {
         errorDescription = ex.Message;
         return(false);
     }
     return(true);
 }
Example #2
0
        public PatientProfile(string organizationName, Uri fhirAddress, Patient loadPatient, string noidStatus, DateTime checkinDateTime)
        {
            _organizationName = organizationName;
            _fhirAddress      = fhirAddress;
            _noidStatus       = noidStatus;
            _checkinDateTime  = FHIRUtilities.DateTimeToFHIRString(checkinDateTime);
            NewSession();

            if (loadPatient != null)
            {
                _noID = new SourceAFIS.Templates.NoID();

                SetMetaData(loadPatient);       //Sets all the data from the meta area of FHIR message
                SetIdentifierData(loadPatient); //Sets all the data from the identifier area of FHIR message

                // Gets the demographics from the patient FHIR resource class
                _lastName = loadPatient.Name[0].Family.ToString();
                List <string> givenNames = loadPatient.Name[0].Given.ToList();
                _firstName = givenNames[0].ToString();
                if (givenNames.Count > 1)
                {
                    _middleName = givenNames[1].ToString();
                }
                _gender    = loadPatient.Gender.ToString().Substring(0, 1).ToUpper();
                _birthDate = loadPatient.BirthDate.ToString();

                // Gets the address information from the patient FHIR resource class
                if (loadPatient.Address.Count > 0)
                {
                    List <string> addressLines = loadPatient.Address[0].Line.ToList();
                    _streetAddress = addressLines[0].ToString();
                    if (addressLines.Count > 1)
                    {
                        _streetAddress2 = addressLines[1].ToString();
                    }

                    _city       = loadPatient.Address[0].City.ToString();
                    _state      = loadPatient.Address[0].State.ToString();
                    _postalCode = loadPatient.Address[0].PostalCode.ToString();
                    _country    = loadPatient.Address[0].Country.ToString();
                }
                // Gets the contact information from the patient FHIR resource class
                if (loadPatient.Contact.Count > 0)
                {
                    foreach (var contact in loadPatient.Contact)
                    {
                        foreach (var telecom in contact.Telecom)
                        {
                            if (telecom.Use.ToString().ToLower() == "home")
                            {
                                if (telecom.System.ToString().ToLower() == "email")
                                {
                                    EmailAddress = telecom.Value.ToString();
                                }
                                else if (telecom.System.ToString().ToLower() == "phone")
                                {
                                    PhoneHome = telecom.Value.ToString();
                                }
                            }
                            else if (telecom.Use.ToString().ToLower() == "work")
                            {
                                PhoneWork = telecom.Value.ToString();
                            }
                            else if (telecom.Use.ToString().ToLower() == "mobile")
                            {
                                PhoneCell = telecom.Value.ToString();
                            }
                        }
                    }
                }

                if (loadPatient.Photo.Count > 0)
                {
                    foreach (var minutia in loadPatient.Photo)
                    {
                        Attachment mediaAttachment = loadPatient.Photo[0];
                        byte[]     byteMinutias    = mediaAttachment.Data;

                        Stream stream = new MemoryStream(byteMinutias);
                        Media  media  = (Media)FHIRUtilities.StreamToFHIR(new StreamReader(stream));

                        // Get captureSite and laterality from media
                        string captureSiteDescription = media.Extension[1].Value.Extension[1].Value.ToString();
                        string lateralityCode         = media.Extension[1].Value.Extension[2].Value.ToString();
                        string DeviceName             = media.Extension[2].Value.Extension[1].Value.ToString();
                        string OriginalDpi            = media.Extension[2].Value.Extension[2].Value.ToString();
                        string OriginalHeight         = media.Extension[2].Value.Extension[3].Value.ToString();
                        string OriginalWidth          = media.Extension[2].Value.Extension[4].Value.ToString();

                        Template            addMinutia             = ConvertFHIR.FHIRToTemplate(media);
                        FingerPrintMinutias newFingerPrintMinutias = new FingerPrintMinutias(
                            SessionID, addMinutia, FHIRUtilities.SnoMedCodeToLaterality(lateralityCode), FHIRUtilities.StringToCaptureSite(captureSiteDescription));

                        AddFingerPrint(newFingerPrintMinutias, DeviceName, Int32.Parse(OriginalDpi), Int32.Parse(OriginalHeight), Int32.Parse(OriginalWidth));
                    }
                    _biometricsCaptured = GetBiometricsCaptured();
                }
            }
            else
            {
                throw new Exception("Error in PatientProfile constructor.  loadPatient is null.");
            }
        }