public CheckInPopUpViewModel()
        {
            CheckInPatient = new Command(AddPatientToList);

            //temp code
            ClosePopup = new Command(CloseThePopUp);

            MessagingCenter.Subscribe <CheckInViewModel, PatientMeta>(this, MessagingKeys.PopUpObject, (obj, sender) =>
            {
                //subcribe to messging center
                patientObj = sender;

                //Set the values for the popup
                UserName       = sender.FullName;
                ProfilePicture = sender.ProfilePicture;

                if (sender.IsDependent.Equals(true))
                {
                    Visibility = true;
                }
                else
                {
                    Visibility = false;
                }
            });
        }
示例#2
0
        //Used for editing a patient object in the local database
        public static Task SaveItemAsync(PatientMeta patientLocal)
        {
            using (SQLiteConnection conn = new SQLiteConnection(database))
            {
                //1)Check if the item present
                conn.CreateTable <PatientMeta>();

                foreach (var patient in conn.Table <PatientMeta>().ToList())
                {
                    if (patient.LocalId == patientLocal.LocalId)
                    {
                        //edit the patient and save
                        var p = conn.Table <PatientMeta>().FirstOrDefault();

                        p = new PatientMeta
                        {
                            LineNumber = patientLocal.LineNumber
                        };

                        return(Task.FromResult(conn.Update(p)));
                    }
                    else
                    {
                        //insert the patient in the local database
                        return(Task.FromResult(conn.Insert(patientLocal)));
                    }
                }

                return(null);
            }
        }
示例#3
0
 //Add the pateint to the local database
 public static void InsertPatient(PatientMeta patientMetaData)
 {
     using (SQLiteConnection conn = new SQLiteConnection(database))
     {
         conn.CreateTable <PatientMeta>();
         conn.Insert(patientMetaData);
     }
 }
示例#4
0
    public Patient( PatientMeta meta )
        : base(meta)
    {
        PatientEventSystem.stopListening (PatientEventSystem.Event.PATIENT_FinishedLoading, finishedLoading);	// if we were listening already, stop
        PatientEventSystem.startListening (PatientEventSystem.Event.PATIENT_FinishedLoading, finishedLoading);
        PatientEventSystem.startListening (PatientEventSystem.Event.PATIENT_Closed, closePatient);

        ThreadUtil t = new ThreadUtil(this.PatientLoaderWorker, this.PatientLoaderCallback);
        t.Run();
    }
示例#5
0
        //Remove a patient from the local SQlite database
        public static Task DeletePatientAsync(PatientMeta localId)
        {
            using (SQLiteConnection conn = new SQLiteConnection(database))
            {
                conn.CreateTable <PatientMeta>();
                var patient = conn.Table <PatientMeta>().Where(i => i.LocalId == localId.LocalId).FirstOrDefault();

                return(Task.FromResult(conn.Delete <PatientMeta>(patient)));
            }
        }
示例#6
0
        //Get all the patients saved in the SQLIte database
        public static Task <PatientMeta> GetItemAsync(PatientMeta patientLocalDbId)
        {
            int id = patientLocalDbId.LocalId;

            using (SQLiteConnection conn = new SQLiteConnection(database))
            {
                conn.CreateTable <PatientMeta>();
                var patient = conn.Table <PatientMeta>().Where(i => i.LocalId == id).FirstOrDefault();

                return(Task.FromResult(patient));
            }
        }
示例#7
0
    // Called when a new patient is being loaded:
    void loadingStarted(object obj)
    {
        // The passed object should be the patient entry of the patient to be loaded:
        PatientMeta patientEntry = obj as PatientMeta;

        if (patientEntry != null)
        {
            mTextPatientName.text = patientEntry.name;
        }

        //mTextLoadingProcess.text = "Started Loading\n";
        LoadingScreenWidget.SetActive(true);
    }
示例#8
0
        public static void RemoveFromList(PatientMeta patient)
        {
            var indexOfPatient = PatientsBooked.IndexOf(patient);

            try
            {
                var element = PatientsBooked.Where(x => x.FullName == patient.FullName);

                PatientsBooked.Remove(element.FirstOrDefault());
            }
            catch (TimeoutException timeout)
            {
                throw timeout.InnerException;
            }

            UpdateList();
        }
示例#9
0
 // Copy constructor:
 public PatientMeta(PatientMeta toCopy)
 {
     firstName         = toCopy.firstName;
     lastName          = toCopy.lastName;
     birthDate         = toCopy.birthDate;
     birthDateDT       = toCopy.birthDateDT;
     operationDate     = toCopy.operationDate;
     diagnosis         = toCopy.diagnosis;
     details           = toCopy.details;
     sex               = toCopy.sex;
     path              = toCopy.path;
     dicomPath         = toCopy.dicomPath;
     meshPath          = toCopy.meshPath;
     age               = toCopy.age;
     operationBodyPart = toCopy.operationBodyPart;
     warnings          = new List <string> (toCopy.warnings);
 }
    /*! Starts processing the new path, by searching the subfolders for patients. */
    public static void setPath(string newPath)
    {
        //Debug.Log( "Current working directory:\n" + Directory.GetCurrentDirectory() );

        if (!Directory.Exists(newPath))
        {
            throw (new System.Exception("Invalid path given: " + newPath));
        }

        // While parsing a directory, don't start parsing another one:
        if (!currentlyLoading)
        {
            currentlyLoading = true;

            // remove previously found patient entries:
            mPatientEntries.Clear();

            currentPath = newPath;

            Debug.Log("Looking for Patients in:\n" + currentPath);

            string[] folders = Directory.GetDirectories(currentPath);

            foreach (string folder in folders)
            {
                // Attempt to load the directorie's contents as a patient:
                PatientMeta newPatient = PatientMeta.createFromFolder(folder);
                if (newPatient != null)
                {
                    mPatientEntries.Add(newPatient);

                    // Let listeners know there's a new patient entry by firing an event:
                    PatientEventSystem.triggerEvent(
                        PatientEventSystem.Event.PATIENT_NewPatientDirectoryFound
                        );
                }
            }

            // Done parsing, unlock:
            currentlyLoading = false;
        }
    }
示例#11
0
    void addPatientEntry(object obj = null)
    {
        bool found = false;

        for (int index = 0; index < PatientDirectoryLoader.getCount(); index++)
        {
            PatientMeta patient    = PatientDirectoryLoader.getEntry(index);
            string      folderName = Path.GetFileName(patient.path);
            if (folderName == patientFolderName)
            {
                Debug.Log("Found patient " + patientFolderName);
                PatientDirectoryLoader.loadPatient(index);
                found = true;
                break;
            }
        }
        if (!found)
        {
            Debug.LogWarning("Patient '" + patientFolderName + "' not found! Make sure to enter valid Patient folder in 'Patient Folder Name'!");
            patientSelector.SetActive(true);
        }
    }
    public static void loadPatient(int index)
    {
        if (loadingLock)
        {
            Debug.LogWarning("[PatientDirectoryLoader.cs] Loading aborted. Still loading other patient");
            return;
        }

        loadingLock = true;
        if (index >= 0 && index < mPatientEntries.Count)
        {
            entry = mPatientEntries[index];

            PatientEventSystem.triggerEvent(PatientEventSystem.Event.PATIENT_StartLoading, entry);

            new Patient(entry);
        }
        else
        {
            throw (new System.Exception("Could not find patient with index " + index.ToString()));
        }
    }
        private ObservableCollection <PatientMeta> InitailizeList()
        {
            DiagnoseList = new ObservableCollection <PatientMeta>();

            PatientMeta meta;

            foreach (var item in PatientsWaintingLineDb.GetPatientsAsync().Result)
            {
                meta = new PatientMeta()
                {
                    FullName       = item.FullName,
                    ProfilePicture = item.ProfilePicture,
                    Appointment    = item.Appointment,
                    LineNumber     = lineNumber
                };

                lineNumber++;

                DiagnoseList.Add(meta);
            }

            return(DiagnoseList);
        }
示例#14
0
 public static void AddPatient(PatientMeta patient)
 {
     PatientsBooked.Add(patient);
     UpdateList();
 }
示例#15
0
    void addPatientEntry(object obj = null)
    {
        // Remove all entries in the list:
        foreach (Transform child in defaultPatientButton.transform.parent)
        {
            //Debug.Log (child.name);
            // Remove all buttons except for the default button:
            if (child.gameObject.activeSelf)
            {
                Destroy(child.gameObject);
            }
        }

        // Add all new entries:
        for (int index = 0; index < PatientDirectoryLoader.getCount(); index++)
        {
            PatientMeta patient = PatientDirectoryLoader.getEntry(index);

            // Create a new instance of the list button:
            GameObject newButton = Instantiate(defaultPatientButton);
            newButton.SetActive(true);

            // Attach the new button to the list:
            newButton.transform.SetParent(defaultPatientButton.transform.parent, false);

            // Fill button's text object:
            Text t = newButton.transform.Find("Text").GetComponent <Text>();
            t.text = patient.name + "\n  <color=#DDDDDD>" + patient.birthDate + "</color>";

            newButton.transform.Find("ImageFemale").gameObject.SetActive(false);
            newButton.transform.Find("ImageMale").gameObject.SetActive(false);
            if (patient.sex == "f")
            {
                newButton.transform.Find("ImageFemale").gameObject.SetActive(true);
            }
            else if (patient.sex == "m")
            {
                newButton.transform.Find("ImageMale").gameObject.SetActive(true);
            }

            Text ageText = newButton.transform.Find("AgeText").GetComponent <Text>();
            if (patient.age >= 0)
            {
                ageText.text = patient.age + " a";
            }
            else
            {
                ageText.text = "";
            }

            Text detailsText = newButton.transform.Find("TextDetails").GetComponent <Text>();
            detailsText.text = patient.diagnosis + "\n  <color=#DDDDDD>" + patient.details + "</color>";

            Image operationTypeImage = newButton.transform.Find("IconBackground/OperationTypeImage").GetComponent <Image> ();
            if (operationTypeImage != null)
            {
                operationTypeImage.sprite = spriteForOperatedBodyPart(patient.operationBodyPart);
            }
            else
            {
                operationTypeImage.gameObject.SetActive(false);
            }

            if (patient.warnings.Count > 0)
            {
                string warnings = "";
                for (int i = 0; i < patient.warnings.Count; i++)
                {
                    warnings = warnings + patient.warnings [i] + "\n";
                }
                Text warningsText = newButton.transform.Find("TextWarnings").GetComponent <Text>();
                warningsText.text = warnings;
            }

            // Set up events:
            int    capturedIndex = index;
            Button b             = newButton.GetComponent <Button>();
            b.onClick.AddListener(() => ChoosePatient(capturedIndex));
            b.onClick.AddListener(() => gameObject.SetActive(false));
        }

        /*RectTransform rectTf = defaultPatientButton.transform.parent.GetComponent<RectTransform>();
         * RectTransform buttonRectTF = defaultPatientButton.transform.GetComponent<RectTransform>();
         * float newWidth = PatientDirectoryLoader.getCount () * (buttonRectTF.rect.width + 2.0f);
         * rectTf.SetSizeWithCurrentAnchors (RectTransform.Axis.Horizontal, newWidth);*/

        // Set the scroll view position:
        //Vector2 currentScrollPos = mScrollView.GetComponent<ScrollRect>().normalizedPosition;
        //mScrollView.GetComponent<ScrollRect>().normalizedPosition = new Vector2(0,currentScrollPos.y);
    }