Exemplo n.º 1
0
        private void OpenPediatricGrowthChartApplication(object sender, EventArgs e)
        {
            IPatientData patientData = ActiveMdiChild as IPatientData;

            if (patientData == null)
            {
                MessageBox.Show(this, "No patient has been selected, please select a patient", "No patient selected", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            SMARTForm smartForm = new SMARTForm();

            smartForm.MdiParent   = this;
            smartForm.WindowState = FormWindowState.Maximized;

            string           applicationKey = ReflectionUtility.GetPropertyValue(sender, "Tag", string.Empty) as string;
            SmartApplication application    = Globals.GetSmartApplicationSettings(applicationKey);

            smartForm.Show();
            smartForm.LoadSmartApp(application, Globals.ApplicationSettings.FhirBaseUrl, "0a25036c-ed4c-4fad-a806-3dec4d58bc42");
        }
Exemplo n.º 2
0
        private void smartAppLaunchToolbarItem_Click(object sender, EventArgs e)
        {
            IPatientData patientData = ActiveMdiChild as IPatientData;

            if (patientData == null)
            {
                MessageBox.Show(this, "No patient has been selected, please select a patient", "No patient selected", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            string applicationKey = ReflectionUtility.GetPropertyValue(sender, "Tag", string.Empty) as string;
            SmartApplicationDetails application = Globals.GetSmartApplicationSettings(applicationKey);

            // Read in the clinical context
            var context = new SmartAppContext()
            {
                LaunchContext = Guid.NewGuid().ToFhirId(), PatientNameForDebug = patientData.Patient.Name.FirstOrDefault().Text
            };

            context.ContextProperties.Add(new System.Collections.Generic.KeyValuePair <string, string>("patient", patientData.Patient.Id));

            // Read in the User context
            context.ContextProperties.Add(new System.Collections.Generic.KeyValuePair <string, string>("organization", Globals.ApplicationSettings.organization));
            context.ContextProperties.Add(new System.Collections.Generic.KeyValuePair <string, string>("practitioner", Globals.ApplicationSettings.practitioner));
            context.ContextProperties.Add(new System.Collections.Generic.KeyValuePair <string, string>("practitionerrole", Globals.ApplicationSettings.practitionerrole));

            Console.WriteLine($"Opening Smart App {application.Name}: {context.LaunchContext}             Patient/{patientData.Patient.Id} {patientData.Patient.Name.FirstOrDefault().Text}");
            SMARTForm smartForm = new SMARTForm();

            smartForm.MdiParent   = this;
            smartForm.WindowState = ActiveMdiChild.WindowState; // FormWindowState.Maximized;

            // Open the Smart Host with the selected application and context
            smartForm.LoadSmartApp(application, context);
            smartForm.Show();
        }