Пример #1
0
        private async void GetPatientData(string sPatientID, string datatype)
        {
            try
            {
                PatientObject po = new PatientObject();
                List<DocumentListItem> lstDocuments = await PatientDataService.GetDocumentList(UnityDataService.UnityAppUser, sPatientID);

                List<ChartSectionItem> lstChartSection = await PatientDataService.GetChartSections(UnityDataService.UnityAppUser, sPatientID, datatype);


                //MEDS SECTION
                ChartItemCategory listMeds = new ChartItemCategory("Medications");
                //Allergies SECTION
                ChartItemCategory listAllergy = new ChartItemCategory("Allergies");
                //PROBLEM SECTION
                ChartItemCategory listProblems = new ChartItemCategory("Problems");
                //Vitals SECTION
                ChartItemCategory listVitals = new ChartItemCategory("Vitals");
                //Immunizations SECTION
                ChartItemCategory listImmunizations = new ChartItemCategory("Immunizations");
                //History SECTION
                ChartItemCategory listHistory = new ChartItemCategory("History");


                ChartItemCategory listAll = new ChartItemCategory("Test");
                ChartItemCategory listDocuments = new ChartItemCategory("Documents");

                //Documents Section some hardcodes for demo
                if (lstDocuments.Count > 0)
                {

                    foreach (DocumentListItem doc in lstDocuments)
                    {
                        DocumentChartItem newDoc = new DocumentChartItem(doc.DocumentID, doc.DisplayName + " " + doc.SortDate, doc.AuthorName, doc.DocumentType, "Y", "0", doc.Img);
                        listDocuments.AddChartItem(newDoc);
                        listAll.AddChartItem(newDoc);

                    }
                }
                //TODO: replace this with faster LINQ query.
                foreach (ChartSectionItem csi in lstChartSection)
                {
                    ProblemItem pi = new ProblemItem(csi.transid, csi.expdescription, csi.level1);

                    DateTime vitalsDateTime = DateTime.Now;
                    if ((csi.level1.ToUpper() != "Y") && (csi.section.ToUpper() != "VITALS"))//this is skipping vitals...
                    {
                        continue;
                    }
                    switch (csi.section)
                    {
                        case "medications":
                            MedicationChartItem newMed = new MedicationChartItem(csi.transid, csi.expdescription, csi.exp2description, csi.exp2detail, csi.level1, csi.sortorder);
                            listMeds.AddChartItem(newMed);
                            listAll.AddChartItem(newMed);
                            break;
                        case "allergies":
                            AllergyChartItem newAllergy = new AllergyChartItem(csi.transid, csi.expdescription, csi.exp2description, csi.exp2detail, csi.level1, csi.sortorder);
                            listAllergy.AddChartItem(newAllergy);
                            listAll.AddChartItem(newAllergy);
                            break;
                        case "problems":
                            ProblemChartItem newProblem = new ProblemChartItem(csi.transid, csi.expdescription, csi.exp2description, csi.exp2detail, csi.level1, csi.sortorder);
                            listProblems.AddChartItem(newProblem);
                            listAll.AddChartItem(newProblem);
                            break;
                        case "immunizations":
                            ImmunizationChartItem newImmunization = new ImmunizationChartItem(csi.transid, csi.expdescription, csi.exp2description, csi.exp2detail, csi.level1, csi.sortorder);
                            listImmunizations.AddChartItem(newImmunization);
                            listAll.AddChartItem(newImmunization);
                            break;
                        case "history":
                            HistoryChartItem newHistory = new HistoryChartItem(csi.transid, csi.expdescription, csi.exp2description, csi.exp2detail, csi.level1, csi.sortorder);
                            listHistory.AddChartItem(newHistory);
                            break;
                        case "vitals":
                            if (csi.description.ToLower() != "other")
                            {
                                VitalChartItem newVitals = new VitalChartItem("0", csi.description, csi.detail, csi.expright, csi.level1, csi.sortorder);
                                listVitals.AddChartItem(newVitals);
                            }
                            break;
                        default:
                            break;
                    }

                }

                ObservableCollection<ChartItemCategory> newChart = new ObservableCollection<ChartItemCategory>();
                newChart.Add(listProblems);
                newChart.Add(listVitals);
                newChart.Add(listAllergy);
                newChart.Add(listMeds);
                newChart.Add(listDocuments);
                newChart.Add(listImmunizations);
                newChart.Add(listHistory);

                ChartItems cis = new ChartItems();
                cis.AddChartItemCategory(listProblems);
                cis.AddChartItemCategory(listVitals);
                cis.AddChartItemCategory(listAllergy);
                cis.AddChartItemCategory(listMeds);

                if (lstDocuments.Count > 0)
                    cis.AddChartItemCategory(listDocuments);

                cis.AddChartItemCategory(listImmunizations);
                cis.AddChartItemCategory(listHistory);

                ChartItemSource = new ObservableCollection<ChartItemCategory>(cis.Items);


                //This may seem redundant but it prevents the gridview from auto-selecting the first item.
                //gvChartItems.SelectionMode = ListViewSelectionMode.None;
                //gvChartItems.SelectionMode = ListViewSelectionMode.Single;
                //lvChartItems.SelectionMode = ListViewSelectionMode.None;

                //Add context for semantic zoom out.
                //var groupedChartItems = chartItemsViewSource.View.CollectionGroups;
                //var groupedChartItems = chartItemGroupViewSource.View.CollectionGroups;
                //lvChartItems.ItemsSource = cis.Items; 

            }
            catch (Exception ex)
            {
                ErrorHandler eh = new ErrorHandler(ex, "PatientOverview GetData");
                eh.ShowErrorDialog();
            }

        }
Пример #2
0
 public void AddChartItemCategory(ChartItemCategory cic)
 {
     cic.SortChartItems();
     this.Items.Add(cic);
 }