示例#1
0
        public string GetBiometricsCaptured()
        {
            string biometrics = "";

            if (_fingerPrintMinutiasList.Count > 0)
            {
                foreach (var finger in _fingerPrintMinutiasList)
                {
                    string fingerDesc = FixFingerDescriptions(FHIRUtilities.LateralityToString(finger.LateralitySnoMedCode) + " " + FHIRUtilities.CaptureSiteToString(finger.CaptureSiteSnoMedCode));
                    if (biometrics.Contains(fingerDesc) == false)
                    {
                        if (biometrics.Length > 0)
                        {
                            biometrics = biometrics + " and " + fingerDesc;
                        }
                        else
                        {
                            biometrics = fingerDesc;
                        }
                    }
                }
            }
            return(biometrics);
        }
示例#2
0
        //TODO: Abstract CaptureResult so it will work with any fingerprint scanner.
        private void OnCaptured(CaptureResult captureResult)
        {
            browser.GetMainFrame().ExecuteJavaScriptAsync("showPleaseWait();");
            //mark schroeder20170703
            if (PatientBridge.cannotCaptureLeftFingerprint == true)
            {
                Laterality = FHIRUtilities.LateralitySnoMedCode.Right;
            }

            if (currentCaptureInProcess == false)
            {
                if ((PatientBridge.hasValidLeftFingerprint == true && Laterality == FHIRUtilities.LateralitySnoMedCode.Left) || (PatientBridge.hasValidRightFingerprint == true && Laterality == FHIRUtilities.LateralitySnoMedCode.Right))
                {
                    //mark schroeder 20170701 do not capture more left fingerprints if left is set. Same for right
                    return;
                }
                else
                {
                    try
                    {
                        //mark schroeder 20170701 use this to stop more capture attempts while processing. Added to below if statememt
                        currentCaptureInProcess    = true;
                        maxFingerprintScanAttempts = Convert.ToInt16(System.Configuration.ConfigurationManager.AppSettings["maxFingerprintScanAttempts"].ToString());
                        fingerprintScanAttempts++;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                        return;
                    }

                    if (_patientBridge.captureSite != FHIRUtilities.CaptureSiteSnoMedCode.Unknown && _patientBridge.laterality != FHIRUtilities.LateralitySnoMedCode.Unknown)
                    {
                        if (fingerprintScanAttempts <= maxFingerprintScanAttempts)
                        {
#if NAVIGATE
                            DisplayOutput("Captured finger image....");
#endif
                            // Check capture quality and throw an error if poor or incomplete capture.
                            if (!biometricDevice.CheckCaptureResult(captureResult))
                            {
                                return;
                            }

                            Constants.CaptureQuality quality = captureResult.Quality;
                            if ((int)quality != 0)
                            {
                                //call javascript to inform UI that the capture quality was too low to accept.
#if NAVIGATE
                                DisplayOutput("Fingerprint quality was too low to accept. Quality = " + quality.ToString());
#endif
                                return;
                            }

                            Type   captureResultType = captureResult.GetType();
                            string deviceClassName   = captureResultType.ToString();
                            string deviceName        = "";
                            if (deviceClassName == "DPUruNet.CaptureResult")
                            {
                                deviceName = "DigitalPersona U.Are.U 4500";
                            }

                            SourceAFIS.Simple.Person currentCapture = new SourceAFIS.Simple.Person();

                            Fingerprint newFingerPrint = new Fingerprint();
                            foreach (Fid.Fiv fiv in captureResult.Data.Views)
                            {
                                newFingerPrint.AsBitmap = ImageUtilities.CreateBitmap(fiv.RawImage, fiv.Width, fiv.Height);
                            }
                            currentCapture.Fingerprints.Add(newFingerPrint);
                            Afis.Extract(currentCapture);
                            Template tmpCurrent = newFingerPrint.GetTemplate();

                            if (_minutiaCaptureController.MatchFound == false)
                            {
                                if (_minutiaCaptureController.AddMinutiaTemplateProbe(tmpCurrent) == true)
                                {
                                    // Good pair found.  Query web service for a match.
                                    FingerPrintMinutias newFingerPrintMinutias = new FingerPrintMinutias
                                                                                     (SessionID, _minutiaCaptureController.BestTemplate1, Laterality, CaptureSite);
                                    PatientBridge.PatientFHIRProfile.AddFingerPrint(newFingerPrintMinutias,
                                                                                    deviceName,
                                                                                    _minutiaCaptureController.BestTemplate1.OriginalDpi,
                                                                                    _minutiaCaptureController.BestTemplate1.OriginalHeight,
                                                                                    _minutiaCaptureController.BestTemplate1.OriginalWidth);

                                    newFingerPrintMinutias = new FingerPrintMinutias
                                                                 (SessionID, _minutiaCaptureController.BestTemplate2, Laterality, CaptureSite);
                                    PatientBridge.PatientFHIRProfile.AddFingerPrint(newFingerPrintMinutias,
                                                                                    deviceName,
                                                                                    _minutiaCaptureController.BestTemplate2.OriginalDpi,
                                                                                    _minutiaCaptureController.BestTemplate2.OriginalHeight,
                                                                                    _minutiaCaptureController.BestTemplate2.OriginalWidth);

                                    Media media = PatientBridge.PatientFHIRProfile.FingerPrintFHIRMedia(newFingerPrintMinutias, deviceName, tmpCurrent.OriginalDpi, tmpCurrent.OriginalHeight, tmpCurrent.OriginalWidth);

                                    // TODO: REMOVE THIS LINE!  ONLY FOR TESTING
                                    //FHIRUtilities.SaveJSONFile(media, @"C:\JSONTest");

                                    HttpsClient    dataTransport = new HttpsClient();
                                    Authentication auth;
                                    if (Utilities.Auth == null)
                                    {
                                        auth = SecurityUtilities.GetAuthentication(NoIDServiceName);
                                    }
                                    else
                                    {
                                        auth = Utilities.Auth;
                                    }
                                    PatientBridge.fhirAddress = new Uri(SearchBiometricsUri);
                                    dataTransport.SendFHIRMediaProfile(PatientBridge.fhirAddress, auth, media);
                                    string lateralityString  = FHIRUtilities.LateralityToString(Laterality);
                                    string captureSiteString = FHIRUtilities.CaptureSiteToString(CaptureSite);
#if NAVIGATE
                                    string output = lateralityString + " " + captureSiteString + " fingerprint accepted. Score = " + _minutiaCaptureController.BestScore + ", Fingerprint sent to server: Response = " + dataTransport.ResponseText;
                                    DisplayOutput(output);
#endif
                                    if (dataTransport.ResponseText.ToLower().Contains("error") == true || dataTransport.ResponseText.ToLower().Contains("index") == true)
                                    {
                                        string message = "Critical Identity Error Occured In Fingerprint Capture method. Please contact your adminstrator: " + dataTransport.ResponseText + " Error code = 909";
                                        MessageBox.Show(message);
                                        browser.GetMainFrame().ExecuteJavaScriptAsync("pageRefresh();");
                                        return;
                                    }
                                    if (dataTransport.ResponseText.ToLower().Contains(@"noid://") == true)
                                    {
                                        // Match found, inform JavaScript that this is an returning patient for Identity.
                                        PatientBridge.PatientFHIRProfile.LocalNoID  = dataTransport.ResponseText;                                         //save the localNoID
                                        PatientBridge.PatientFHIRProfile.NoIDStatus = "Pending";
                                        browser.GetMainFrame().ExecuteJavaScriptAsync("showIdentity('" + PatientBridge.PatientFHIRProfile.LocalNoID + "');");
                                    }
                                    else if (dataTransport.ResponseText.ToLower() == "pending")
                                    {
                                        MessageBox.Show("You are already checked in.  If you believe this is an error, please contact staff");
                                        browser.GetMainFrame().ExecuteJavaScriptAsync("pageRefresh();");
                                        return;
                                    }
                                    else
                                    {
                                        if (PatientBridge.hasValidLeftFingerprint == true)
                                        {
                                            if (MatchLeftAndRight() == true)
                                            {
                                                MessageBox.Show("Both right and left capture sites are the same.  Please start over.");
                                                browser.GetMainFrame().ExecuteJavaScriptAsync("pageRefresh();");
                                                return;
                                            }
                                        }
                                        // Match not found, inform JavaScript the capture pair is complete and the patient can move to the next step.
                                        browser.GetMainFrame().ExecuteJavaScriptAsync("showComplete('" + Laterality.ToString() + "');");
                                        if (Laterality == FHIRUtilities.LateralitySnoMedCode.Left)
                                        {
                                            Laterality  = FHIRUtilities.LateralitySnoMedCode.Right;
                                            CaptureSite = FHIRUtilities.CaptureSiteSnoMedCode.IndexFinger;
                                            _firstMinutiaCaptureController        = _minutiaCaptureController;
                                            _minutiaCaptureController             = new MinutiaCaptureController(_minimumAcceptedMatchScore);
                                            PatientBridge.hasValidLeftFingerprint = true;
                                        }
                                        else if (Laterality == FHIRUtilities.LateralitySnoMedCode.Right)
                                        {
                                            Laterality  = FHIRUtilities.LateralitySnoMedCode.Unknown;
                                            CaptureSite = FHIRUtilities.CaptureSiteSnoMedCode.Unknown;
                                            PatientBridge.hasValidRightFingerprint = true;
                                        }
                                        fingerprintScanAttempts = 0;                                         //reset scan attempt count on successful scan
                                    }
                                }
                                else
                                {
                                    // Good fingerprint pairs not found yet.  inform JavaScript to promt the patient to try again.
                                    browser.GetMainFrame().ExecuteJavaScriptAsync("showFail('" + Laterality.ToString() + "');");
#if NAVIGATE
                                    DisplayOutput("Fingerprint NOT accepted. Score = " + _minutiaCaptureController.BestScore);
#endif
                                    currentCaptureInProcess = false;
                                    return;
                                }
                            }
                        }
                        else
                        {
                            //int testy = CaptureSite.ToString().IndexOf("Thumb");
                            if (CaptureSite.ToString().IndexOf("Thumb") == -1)
                            {
                                browser.GetMainFrame().ExecuteJavaScriptAsync("alert('You have exceeded the maximum allowed scan attempts for your " + Laterality.ToString() + " " + CaptureSite + " Lets try another finger.');");
                            }
                            fingerprintScanAttempts = 0;                             //reset scan attempt count on successful scan
                            //get next laterality and capture site. Order of precedence is left, then right. Index, middle, ring, little, thumb
                            switch (Laterality.ToString() + CaptureSite.ToString())
                            {
                            case "LeftIndexFinger":
                                attemptedScannedFingers.Add(Laterality.ToString() + CaptureSite.ToString());
                                browser.GetMainFrame().ExecuteJavaScriptAsync("setLateralitySite('selectLeftMiddle');");
                                CaptureSite = FHIRUtilities.CaptureSiteSnoMedCode.MiddleFinger;
                                Laterality  = FHIRUtilities.LateralitySnoMedCode.Left;
                                break;

                            case "LeftMiddleFinger":
                                attemptedScannedFingers.Add(Laterality.ToString() + CaptureSite.ToString());
                                browser.GetMainFrame().ExecuteJavaScriptAsync("setLateralitySite('selectLeftRing');");
                                CaptureSite = FHIRUtilities.CaptureSiteSnoMedCode.RingFinger;
                                Laterality  = FHIRUtilities.LateralitySnoMedCode.Left;
                                break;

                            case "LeftRingFinger":
                                attemptedScannedFingers.Add(Laterality.ToString() + CaptureSite.ToString());
                                browser.GetMainFrame().ExecuteJavaScriptAsync("setLateralitySite('selectLeftLittle');");
                                CaptureSite = FHIRUtilities.CaptureSiteSnoMedCode.LittleFinger;
                                Laterality  = FHIRUtilities.LateralitySnoMedCode.Left;
                                break;

                            case "LeftLittleFinger":
                                attemptedScannedFingers.Add(Laterality.ToString() + CaptureSite.ToString());
                                browser.GetMainFrame().ExecuteJavaScriptAsync("setLateralitySite('selectLeftThumb');");
                                CaptureSite = FHIRUtilities.CaptureSiteSnoMedCode.Thumb;
                                Laterality  = FHIRUtilities.LateralitySnoMedCode.Left;
                                break;

                            case "LeftThumb":
                                attemptedScannedFingers.Add(Laterality.ToString() + CaptureSite.ToString());
                                browser.GetMainFrame().ExecuteJavaScriptAsync("moveToRightHandScan();");
                                CaptureSite            = FHIRUtilities.CaptureSiteSnoMedCode.IndexFinger;
                                Laterality             = FHIRUtilities.LateralitySnoMedCode.Right;
                                hasLeftFingerprintScan = false;
                                break;

                            case "RightIndexFinger":
                                hasLeftFingerprintScan = _patientBridge.hasValidLeftFingerprint;
                                attemptedScannedFingers.Add(Laterality.ToString() + CaptureSite.ToString());
                                browser.GetMainFrame().ExecuteJavaScriptAsync("setLateralitySite('selectRightMiddle');");
                                CaptureSite = FHIRUtilities.CaptureSiteSnoMedCode.MiddleFinger;
                                Laterality  = FHIRUtilities.LateralitySnoMedCode.Right;
                                break;

                            case "RightMiddleFinger":
                                attemptedScannedFingers.Add(Laterality.ToString() + CaptureSite.ToString());
                                browser.GetMainFrame().ExecuteJavaScriptAsync("setLateralitySite('selectRightRing');");
                                CaptureSite = FHIRUtilities.CaptureSiteSnoMedCode.RingFinger;
                                Laterality  = FHIRUtilities.LateralitySnoMedCode.Right;
                                break;

                            case "RightRingFinger":
                                attemptedScannedFingers.Add(Laterality.ToString() + CaptureSite.ToString());
                                browser.GetMainFrame().ExecuteJavaScriptAsync("setLateralitySite('selectRightLittle');");
                                CaptureSite = FHIRUtilities.CaptureSiteSnoMedCode.LittleFinger;
                                Laterality  = FHIRUtilities.LateralitySnoMedCode.Right;
                                break;

                            case "RightLittleFinger":
                                attemptedScannedFingers.Add(Laterality.ToString() + CaptureSite.ToString());
                                browser.GetMainFrame().ExecuteJavaScriptAsync("setLateralitySite('selectRightThumb');");
                                CaptureSite = FHIRUtilities.CaptureSiteSnoMedCode.Thumb;
                                Laterality  = FHIRUtilities.LateralitySnoMedCode.Right;
                                break;

                            case "RightThumb":
                                attemptedScannedFingers.Add(Laterality.ToString() + CaptureSite.ToString());
                                hasRightFingerprintScan   = false;
                                _minutiaCaptureController = null;
                                if (hasLeftFingerprintScan == false)
                                {
                                    _firstMinutiaCaptureController = null;
                                }
                                CaptureSite = FHIRUtilities.CaptureSiteSnoMedCode.Unknown;
                                Laterality  = FHIRUtilities.LateralitySnoMedCode.Unknown;
                                browser.GetMainFrame().ExecuteJavaScriptAsync("clickNoRightHandFingerPrint();");
                                break;

                            default:
                                break;
                            }
                            //define walk through fingers and ability to override
                        }
                    }
                    else
                    {
                        if (hasLeftFingerprintScan == true && hasRightFingerprintScan == true)
                        {
                            browser.GetMainFrame().ExecuteJavaScriptAsync("alert('You have successfully completed this step. Please proceed to the next page by clicking the NEXT button below');");
                        }
                        else
                        {
                            browser.GetMainFrame().ExecuteJavaScriptAsync("alert('Must be on the correct page to accept a fingerprint scan. Please follow the instructions on the screen.');");
                        }
#if NAVIGATE
                        DisplayOutput("Must be on the correct page to accept a fingerprint scan.");
#endif
                    }
                    currentCaptureInProcess = false;
                }
            }
            else
            {
                browser.GetMainFrame().ExecuteJavaScriptAsync("alert('Current Scan In Process. Please wait and follow the on screen instructions.');");
            }
        }
示例#3
0
        private CodeableConcept GetBodySite(FHIRUtilities.CaptureSiteSnoMedCode captureSite, FHIRUtilities.LateralitySnoMedCode laterality)
        {
            int             captureSiteCode = (int)captureSite;
            int             lateralityCode  = (int)laterality;
            CodeableConcept bodyCaptureSite = new CodeableConcept("SNOMED", captureSiteCode.ToString(), FHIRUtilities.CaptureSiteToString(captureSite));
            Extension       extLaterality   = new Extension(lateralityCode.ToString(), new FhirString(FHIRUtilities.LateralityToString(laterality)));

            bodyCaptureSite.AddExtension("Laterality", extLaterality);
            return(bodyCaptureSite);
        }