コード例 #1
0
        public bool IsPatientDiabetic(FhirClient client, Models.ViewModels.Patient patient)
        {
            bool result = false;

            var query  = new string[] { "patient=" + patient.Id, "category=diagnosis" };
            var bundle = client.Search <Condition>(query);

            //Hl7.Fhir.Model.DiagnosticReport. Condition

            foreach (var item in bundle.Entry)
            {
                Console.WriteLine(item.FhirComments != null ? item.FhirComments.FirstOrDefault() : string.Empty);
            }

            return(result);
        }
コード例 #2
0
        private CernerAuth TokenGettingStuff()
        {
            //Get us some information from the URL
            string authCode = Request.Params["code"];
            string idToken  = Request.Params["id_token"];
            string state    = Request.Params["state"];

            //Have the helper get the meta data from Cerners server.
            myCernerHelper.GetMetaData(idToken);

            // Request an access token
            //We're going to have to do some work here for refreshing the token.
            OAuthHelper oauthHelper = new OAuthHelper(myCernerHelper.cci.AuthorizeUrl, myCernerHelper.cci.TokenUrl, ClientID, myCernerHelper.cci.AppSecret);

            // Dynamically create the redirect based on the current controllers name
            string redirectUri;

            var thisControllerName = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString();
            //var thisActionName = HttpContext.Request.RequestContext.RouteData.Values["action"].ToString();

            var urlBuilder = new System.UriBuilder(Request.Url.AbsoluteUri)
            {
                Path  = thisControllerName, // Url.Action(thisActionName, thisControllerName),
                Query = null,
            };

            //We got's to add the slash at the end to keep the OAuth server happy.
            redirectUri = urlBuilder.Uri.ToString() + @"/";

            HttpSessionStateBase session = this.Session;

            Models.ViewModels.Patient viewPatient = new Models.ViewModels.Patient();

            CernerAuth myCernerAuth = new CernerAuth();

            //Let's go get all of that great tasting OAuth stuff with that OH SO SWEET Auth Token!
            myCernerAuth = oauthHelper.GetTokensFromAuthority(SMARTOnFhirConstants.TokenRequestGrantType, authCode, redirectUri, session);

            return(myCernerAuth);
        }