Esempio n. 1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            try
            {
                Stream       httpStream       = context.Request.InputStream;
                StreamReader httpStreamReader = new StreamReader(httpStream);
                Resource     newResource      = FHIRUtilities.StreamToFHIR(httpStreamReader);
                _patient = (Patient)newResource;

                //find all patient without fingerprints.  should be a small sample.
                //if found, return localid
                //if not found, return "no match found"
                MongoDBWrapper  dbwrapper = new MongoDBWrapper(NoIDMongoDBAddress, SparkMongoDBAddress);
                AlternateSearch altSearch = GetAlternateFromPatient(_patient);
                string          localNoID = dbwrapper.AlternateSearch(altSearch);
                if (localNoID.ToLower().Contains("noid://") == false)
                {
                    dbwrapper.AddAlternateSearch(altSearch);
                    _responseText = "no match found";
                }
                else
                {
                    _responseText = localNoID;
                }
            }
            catch (Exception ex)
            {
                _responseText = "Error in AltMatchByDemographics::ProcessRequest: " + ex.Message;
                LogUtilities.LogEvent(_responseText);
            }
            context.Response.Write(_responseText);
            context.Response.End();
        }