Ejemplo n.º 1
0
        public bool GetPatientDetails(ViewModel.Presenter Presenter)
        {
            FhirApi          FhirApi          = new FhirApi(FhirGatewayEndpoint);
            ApiRequestHeader ApiRequestHeader = new ApiRequestHeader(Presenter.CurrentUserAccount.AccessToken, this.ApplicationStore.App_id, this.ApplicationStore.App_Version);

            FhirApi.ApiRequestHeader = ApiRequestHeader;
            try
            {
                PatientDetailsResponse PatientDetailsResponse = FhirApi.GetPatientDetails(Presenter.CurrentUserAccount.SelectedUserAccountRecord.Ihi);
                Presenter.PatientBanerViewModel = new ViewModel.PatientBanerViewModel();
                if (PatientDetailsResponse.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    if (PatientDetailsResponse.ApiPatient.Dob.HasValue)
                    {
                        Presenter.PatientBanerViewModel.Dob = PatientDetailsResponse.ApiPatient.Dob.Value.ToShortDateString();
                    }
                    else
                    {
                        Presenter.PatientBanerViewModel.Dob = "Unknown";
                    }
                    Presenter.PatientBanerViewModel.Family           = PatientDetailsResponse.ApiPatient.Family;
                    Presenter.PatientBanerViewModel.Given            = PatientDetailsResponse.ApiPatient.Given;
                    Presenter.PatientBanerViewModel.Sex              = PatientDetailsResponse.ApiPatient.Sex;
                    Presenter.PatientBanerViewModel.Ihi              = PatientDetailsResponse.ApiPatient.Ihi;
                    Presenter.PatientBanerViewModel.IndigenousStatus = PatientDetailsResponse.ApiPatient.IndigenousStatusDescription;
                    //Not that RelationshipDescription and RelationshipType is not returned by GetPatient only by GetRecordLisy
                    if (PatientDetailsResponse.Format == FhirApi.FhirFormat.Xml)
                    {
                        Presenter.TextEditorViewModel.FormatType = Extensions.AvalonEditSyntaxTypes.Xml;
                    }
                    else if (PatientDetailsResponse.Format == FhirApi.FhirFormat.Json)
                    {
                        Presenter.TextEditorViewModel.FormatType = Extensions.AvalonEditSyntaxTypes.Json;
                    }
                    else
                    {
                        Presenter.TextEditorViewModel.FormatType = Extensions.AvalonEditSyntaxTypes.None;
                    }
                    Presenter.TextEditorViewModel.Text = PatientDetailsResponse.Body;
                    //PatientDetailsResponse.ApiPatient.RelationshipDescription;
                    return(true);
                }
                else
                {
                    if (PatientDetailsResponse.ErrorResponse != null)
                    {
                        Presenter.PatientBanerViewModel.Family = PatientDetailsResponse.ErrorResponse.Description;
                    }
                    else
                    {
                        Presenter.PatientBanerViewModel.Family = $"Unknown error, HTTPStatus: {PatientDetailsResponse.StatusCode.ToString()}";
                    }
                    return(true);
                }
            }
            catch (Exception Exec)
            {
                throw new Exception("GetPatientDetails failed.", Exec);
            }
        }
Ejemplo n.º 2
0
        public void GetPbsItems(ViewModel.Presenter Presenter)
        {
            FhirApi          FhirApi          = new FhirApi(FhirGatewayEndpoint);
            ApiRequestHeader ApiRequestHeader = new ApiRequestHeader(Presenter.CurrentUserAccount.AccessToken, this.ApplicationStore.App_id, this.ApplicationStore.App_Version);

            FhirApi.ApiRequestHeader = ApiRequestHeader;
            PbsItemsResponse PbsItemsResponse = FhirApi.GetPbsItems(Presenter.CurrentUserAccount.SelectedUserAccountRecord.Ihi, null, null);
        }
Ejemplo n.º 3
0
        public bool GetRecordList(ViewModel.UserAccountView UserAccountView, ViewModel.Presenter Presenter)
        {
            FhirApi          FhirApi          = new FhirApi(FhirGatewayEndpoint);
            ApiRequestHeader ApiRequestHeader = new ApiRequestHeader(UserAccountView.AccessToken, this.ApplicationStore.App_id, this.ApplicationStore.App_Version);

            FhirApi.ApiRequestHeader = ApiRequestHeader;

            RecordListResponse RecordListResponse = FhirApi.GetRecordList();

            if (RecordListResponse.StatusCode == System.Net.HttpStatusCode.OK)
            {
                if (RecordListResponse.Format == FhirApi.FhirFormat.Xml)
                {
                    Presenter.TextEditorViewModel.FormatType = Extensions.AvalonEditSyntaxTypes.Xml;
                }
                else if (RecordListResponse.Format == FhirApi.FhirFormat.Json)
                {
                    Presenter.TextEditorViewModel.FormatType = Extensions.AvalonEditSyntaxTypes.Json;
                }
                else
                {
                    Presenter.TextEditorViewModel.FormatType = Extensions.AvalonEditSyntaxTypes.None;
                }
                Presenter.TextEditorViewModel.Text = RecordListResponse.Body;
                Presenter.CurrentUserAccount.UserAccountRecordList = new System.Collections.ObjectModel.ObservableCollection <ViewModel.UserAccountRecord>();
                foreach (var Person in RecordListResponse.ApiRelatedPersonList)
                {
                    var RecordItem = new ViewModel.UserAccountRecord();
                    RecordItem.Family = Person.Family;
                    RecordItem.Given  = Person.Given;
                    RecordItem.Ihi    = Person.Ihi;
                    RecordItem.RelationshipTypeDescription = Person.RelationshipDescription;
                    Presenter.CurrentUserAccount.UserAccountRecordList.Add(RecordItem);
                }
                if (Presenter.CurrentUserAccount != null && Presenter.CurrentUserAccount.UserAccountRecordList != null && Presenter.CurrentUserAccount.UserAccountRecordList.Count > 0)
                {
                    Presenter.CurrentUserAccount.SelectedUserAccountRecord = Presenter.CurrentUserAccount.UserAccountRecordList[0];
                }
                return(true);
            }
            else
            {
                if (RecordListResponse.ErrorResponse != null)
                {
                    Presenter.TextEditorViewModel.FormatType = Extensions.AvalonEditSyntaxTypes.None;
                    Presenter.TextEditorViewModel.Text       = RecordListResponse.ErrorResponse.Description;
                    return(false);
                }
                else
                {
                    Presenter.TextEditorViewModel.FormatType = Extensions.AvalonEditSyntaxTypes.None;
                    Presenter.TextEditorViewModel.Text       = $"Unknown Error, Status code {RecordListResponse.StatusCode.ToString()}";
                    return(false);
                }
            }
        }
Ejemplo n.º 4
0
 public MainWindow()
 {
     InitializeComponent();
     //RightPanleStateList = new List<UIElement>();
     Presenter           = new ViewModel.Presenter();
     UiService           = new UiService();
     Presenter.MainGrid  = GridMain;
     Presenter.UiService = UiService;
     DataContext         = Presenter;
 }
Ejemplo n.º 5
0
        public void UpdateView(ViewModel.Presenter Presenter)
        {
            Presenter.Client_id     = ApplicationStore.App_id;
            Presenter.Client_secret = ApplicationStore.App_secret;

            foreach (var x in this.ApplicationStore.UserList)
            {
                var User = new ViewModel.UserAccountView()
                {
                    AccessExpires     = x.AccessExpires,
                    AccessToken       = x.AccessToken,
                    AuthorisationCode = x.AuthorisationCode,
                    RefreshExpires    = x.RefreshExpires,
                    RefreshToken      = x.RefreshToken,
                    Scope             = x.Scope,
                    Username          = x.Username
                };
                Presenter.AddUserAccountViewList.Add(User);
            }
            if (Presenter.UserAccountViewList.Count > 0)
            {
                Presenter.CurrentUserAccount = Presenter.UserAccountViewList[0];
            }
        }