Esempio n. 1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sAppUser"></param>
        /// <param name="patientID"></param>
        /// <returns></returns>
        public async Task<PatientScheduleItem> GetPatientHub(string sAppUser, string patientID)
        {
            PatientScheduleItem patienthub = new PatientScheduleItem();

            string sJson = await UnityDataService.Magic(UnityDataAccessActions.GetPatient, sAppUser, UnityDataService.UnityAppName, patientID, UnityDataService.Token, "Y", "png", "100", "100", "", "", "");

            JArray obj = Newtonsoft.Json.Linq.JArray.Parse(sJson);
            foreach (JObject jo in obj)
            {
                JToken table = jo.SelectToken("getpatientinfo", false);
                if (!table.ToString().Equals(UnityDataService.EMPTY_JSON_TABLE))
                {

                    foreach (JToken joRow in table)
                    {
                        //ID lastname  firstname    middlename     gender   dateofbirth    ssn     AddressLine1 AddressLine2  City   State ZipCode   HomePhone  WorkPhone   PhoneNumber   ageMRNOtherNumber   orgid
                        patienthub.ID = joRow["ID"].ToString();
                        patienthub.shortTitle = joRow["LastName"].ToString().ToUpper() + ", " + joRow["Firstname"].ToString();
                        patienthub.FirstName = joRow["Firstname"].ToString();
                        patienthub.LastName = joRow["LastName"].ToString();
                        patienthub.LastFI = joRow["LastName"].ToString();
                        if (joRow["Firstname"].ToString().Length > 0)
                        {
                            patienthub.LastFI = patienthub.LastFI + ", " + joRow["Firstname"].ToString().Substring(0, 1);
                        }
                        string gender = (joRow["gender"].ToString().ToLower().Equals("male") ? "M" : "F");
                        if (gender.Equals("M"))
                        {
                            patienthub.GenderPathGray = @"/Assets/gender/male_gray_small.png";
                            patienthub.GenderPathWhite = @"/Assets/gender/male_white_small.png";
                            patienthub.GenderPathBlack = @"/Assets/gender/male_black_small.png";
                        }
                        else
                        {
                            patienthub.GenderPathGray = @"/Assets/gender/female_gray_small.png";
                            patienthub.GenderPathWhite = @"/Assets/gender/female_white_small.png";
                            patienthub.GenderPathBlack = @"/Assets/gender/female_black_small.png";
                        }
                        // if (joRow["age"].ToString().Length > 2)
                        // {
                        //     patienthub.Age = joRow["age"].ToString().Substring(0, 2);

                        //  }
                        //  else
                        //  {
                        patienthub.Age = joRow["age"].ToString();
                        //  }


                        string base64string = joRow["base64image"].ToString();
                        if (!string.IsNullOrEmpty(base64string)) //Note: always set to empty.string
                        {
                            Utility util = new Utility();
                            patienthub.Img = await util.Base64ToBitmapImage(joRow["base64image"].ToString());
                        }


                        List<ChartSectionItem> lstChartSection = await GetChartSections(UnityDataService.UnityAppUser, patientID, "problems");

                        int upperBounds = lstChartSection.Count - 1;

                        for (int i = 0; i < upperBounds & i < 4; i++) //we only want the first 4 items
                        {

                            switch (i)
                            {
                                case 0:
                                    patienthub.problem1 = lstChartSection[i].expdescription; //description;
                                    break;
                                case 1:
                                    patienthub.problem2 = lstChartSection[i].expdescription; //description;
                                    break;
                                case 2:
                                    patienthub.problem3 = lstChartSection[i].expdescription; //description;
                                    break;
                                case 3:
                                    patienthub.problem4 = lstChartSection[i].expdescription; //description;
                                    break;
                                default:
                                    break;
                            }
                        }


                    }
                }
            }


            return patienthub;
        }
Esempio n. 2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="UnityDataService.UnityAppUser"></param>
        /// <param name="sSearch"></param>
        /// <returns>List of PatientSearchResultItems</returns>
        /// <remarks>ToDo: Add image functionality.</remarks>
        /// <author>2012 DZ</author>
        /// <revisions>20120803 BD</revisions>
        public async Task<Collection<PatientItem>> SearchPatients(string user, string sSearch)
        {
            Collection<PatientItem> colPatients = new Collection<PatientItem>();
            string sJson = await UnityDataService.Magic(UnityDataAccessActions.SearchPatients, user, UnityDataService.UnityAppName, "", UnityDataService.Token, sSearch, "Y", "png", "100", "100", "", "");

            //PatientSearchResultItem

            JArray obj = Newtonsoft.Json.Linq.JArray.Parse(sJson);
            foreach (JObject jo in obj)
            {
                JToken table = jo.SelectToken("searchpatientsinfo", false);
                if (!table.ToString().Equals(UnityDataService.EMPTY_JSON_TABLE))
                {

                    foreach (JToken joRow in table)
                    {
                        PatientItem patient = new PatientItem();

                        //ID lastname  firstname    middlename     gender   dateofbirth    ssn     AddressLine1 AddressLine2  City   State ZipCode   HomePhone  WorkPhone   PhoneNumber   ageMRNOtherNumber   orgid

                        patient.ID = joRow["ID"].ToString();
                        patient.shortTitle = joRow["lastname"].ToString() + ", " + joRow["firstname"].ToString() + " " + joRow["middlename"].ToString();

                        string gender = (joRow["gender"].ToString().ToLower().Equals("male") ? "M" : "F");

                        if (gender.Equals("M"))
                        {
                            patient.GenderPath = "Assets//gender/male_white_small.png";
                        }
                        else
                        {
                            patient.GenderPath = "Assets//gender/female_white_small.png";

                        }


                        string displayAge = joRow["age"].ToString();
                        /*
                        if (joRow["dateofbirth"].ToString().Length > 0)
                        {
                            DateTime date1 = DateTime.Now;
                            DateTime date2 = Convert.ToDateTime(joRow["dateofbirth"].ToString());
                            TimeSpan datedifference = date1.Subtract(date2);
                            int age = 0;
                                    
                            if (datedifference.Days > 364)
                            {
                                age = datedifference.Days / 365;
                                displayAge = age.ToString();
                            }
                            else if (datedifference.Days < 30)
                            {
                                displayAge = datedifference.Days.ToString() + " days";
                            }
                            else
                            {
                                age = datedifference.Days / 30;
                                displayAge = age.ToString() + " months";
                            }
                        }
                        */
                        string city = joRow["City"].ToString();
                        if (city.Length > 0)
                        { city += ", "; }

                        patient.Subtitle = " " + displayAge + " " + city + joRow["State"].ToString();

                        string base64string = joRow["base64image"].ToString();

                        if (!string.IsNullOrEmpty(base64string)) //Note: always set to empty.string
                        {
                            Utility util = new Utility();


                            patient.Img = await util.Base64ToBitmapImage(joRow["base64image"].ToString());
                        }

                        colPatients.Add(patient);
                    }
                }

            }



            return colPatients;
        }
Esempio n. 3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="user"></param>
        /// <param name="patientID"></param>
        /// <param name="returnpicture"></param>
        /// <returns></returns>
        public async Task<PatientItem> GetPatient(string user, string patientID, bool returnpicture)
        {
            string sPic = "N";

            sPic = (returnpicture == true ? "Y" : "N");

            PatientItem patient = new PatientItem();

            string sJson = await UnityDataService.Magic(UnityDataAccessActions.GetPatient, user, UnityDataService.UnityAppName, patientID, UnityDataService.Token, sPic, "png", "100", "100", "", "", "");

            JArray obj = Newtonsoft.Json.Linq.JArray.Parse(sJson);
            foreach (JObject jo in obj)
            {
                JToken table = jo.SelectToken("getpatientinfo", false);
                if (!table.ToString().Equals(UnityDataService.EMPTY_JSON_TABLE))
                {

                    foreach (JToken joRow in table)
                    {


                        //ID lastname  firstname    middlename     gender   dateofbirth    ssn     AddressLine1 AddressLine2  City   State ZipCode   HomePhone  WorkPhone   PhoneNumber   ageMRNOtherNumber   orgid

                        patient.ID = joRow["ID"].ToString();
                        patient.shortTitle = joRow["LastName"].ToString() + ", " + joRow["Firstname"].ToString() + " " + joRow["middlename"].ToString();

                        string gender = (joRow["gender"].ToString().ToLower().Equals("male") ? "M" : "F");

                        if (gender.Equals("M"))
                        {
                            patient.GenderPath = @"Assets/gender/male_white_small.png";
                        }
                        else
                        {
                            patient.GenderPath = @"Assets/gender/female_white_small.png";
                        }


                        string displayAge = joRow["age"].ToString();
                        patient.Age = displayAge;

                        string city = joRow["City"].ToString();
                        if (city.Length > 0)
                        { city += ", "; }

                        patient.Subtitle = " " + displayAge + " " + city + joRow["State"].ToString();

                        string base64string = joRow["base64image"].ToString();

                        if (!string.IsNullOrEmpty(base64string)) //Note: always set to empty.string
                        {
                            Utility util = new Utility();


                            patient.Img = await util.Base64ToBitmapImage(joRow["base64image"].ToString());
                            base64string = "";

                        }
                    }
                }

            }



            return patient;
        }
Esempio n. 4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="appUser"></param>
        /// <param name="patientid"></param>
        /// <returns></returns>
        public async Task<List<DocumentListItem>> GetDocumentList(string appUser, string patientid)
        {

            List<DocumentListItem> lstDocuments = new List<DocumentListItem>();

            string sJson = await UnityDataService.Magic(UnityDataAccessActions.GetDocuments, appUser, UnityDataService.UnityAppName, patientid, UnityDataService.Token, "", null, "", "", "", "", "");


            JArray obj = Newtonsoft.Json.Linq.JArray.Parse(sJson);
            foreach (JObject jo in obj)
            {
                JToken table = jo.SelectToken("getdocumentsinfo", false);
                if (!table.ToString().Equals(UnityDataService.EMPTY_JSON_TABLE))
                {
                    foreach (JToken joRow in table)
                    {
                        DocumentListItem dli = new DocumentListItem();
                        dli.AuthorName = joRow["AuthorName"].ToString();
                        dli.DisplayName = joRow["DisplayName"].ToString();
                        dli.DocStatus = joRow["DocStatus"].ToString();
                        dli.DocumentID = joRow["DocumentID"].ToString();
                        dli.DocumentType = joRow["DocumentType"].ToString();
                        dli.SortDate = joRow["SortDate"].ToString();

                        string sThumbnail = await GetDocumentImage(appUser, patientid, dli.DocumentID, dli.DocumentType, "PNG", true);

                        if (!string.IsNullOrEmpty(sThumbnail)) //Note: always set to empty.string
                        {
                            Utility util = new Utility();

                            dli.Img = await util.Base64ToBitmapImage(sThumbnail);
                        }
                        lstDocuments.Add(dli);
                    }
                }
            }
            return lstDocuments;
        }