Exemplo n.º 1
0
        public Media FingerPrintFHIRMedia(FingerPrintMinutias fingerPrints, string deviceName, int originalDPI, int originalHeight, int originalWidth)
        {
            Media FingerPrintMedia = null;

            try
            {
                if ((fingerPrints != null))
                {
                    //TODO: add capture date/time to message
                    FingerPrintMedia = new Media(); //Creates the fingerprint minutia template FHIR object as media type.
                    FingerPrintMedia.AddExtension("Healthcare Node", FHIRUtilities.OrganizationExtension(OrganizationName, DomainName, ServerName));
                    FingerPrintMedia.AddExtension("Biometic Capture", FHIRUtilities.CaptureSiteExtension(fingerPrints.CaptureSiteSnoMedCode, fingerPrints.LateralitySnoMedCode, deviceName, originalDPI, originalHeight, originalWidth));

                    FingerPrintMedia.Identifier = new List <Identifier>();

                    Identifier idSession;
                    Identifier idPatientCertificate;
                    if ((SessionID != null))
                    {
                        if (SessionID.Length > 0)
                        {
                            idSession        = new Identifier();
                            idSession.System = ServerName + "/fhir/SessionID";
                            idSession.Value  = SessionID;
                            FingerPrintMedia.Identifier.Add(idSession);
                        }
                        else
                        {
                            //TODO this is a critical error.  all need a unique session id.
                        }
                    }
                    else
                    {
                        //TODO this is critical.  all need a unique session id.
                    }
                    if (LocalNoID != null)
                    {
                        if (LocalNoID.Length > 0)
                        {
                            idPatientCertificate        = new Identifier();
                            idPatientCertificate.System = ServerName + "/fhir/LocalNoID";
                            idPatientCertificate.Value  = LocalNoID;
                            FingerPrintMedia.Identifier.Add(idPatientCertificate);
                        }
                    }
                    // TODO: Add RemoteNoID.

                    foreach (var Minutia in fingerPrints.Minutiae)
                    {
                        if (FingerPrintMedia is null)
                        {
                            FingerPrintMedia = new Media();
                        }

                        Extension extFingerPrintMedia = FHIRUtilities.FingerPrintMediaExtension(
                            Minutia.PositionX.ToString(),
                            Minutia.PositionY.ToString(),
                            Minutia.Direction.ToString(),
                            Minutia.Type.ToString()
                            );

                        FingerPrintMedia.AddExtension("Biometrics", extFingerPrintMedia);
                    }
                }
            }
            catch (Exception ex)
            {
                BaseException = ex;
            }
            return(FingerPrintMedia);
        }