public string GetAllProtocols(PatientArgs args)
        {
            //Also contains indicator as to whether protocol has been assigned to a given patient
            Dictionary<string, object> results = new Dictionary<string, object>();
            PTDoctor d = PTDatabase.GetDoctor(args.authentication.email, args.authentication.password);
            List<PTProtocolTemplate> protocolTemplates;

            if (d == null)
            {
                results["error"] = "Invalid username or password";
            }
            else if (args.patientID.HasValue)
            {
                protocolTemplates = PTDatabase.GetProtocolsForDoctor(d.ID, args.patientID);
                if (protocolTemplates != null)
                {
                    //TODO: check if is empty what it returns
                    results["protocolTemplates"] = protocolTemplates;
                }
                else
                {
                    results["error"] = "No protocols for this doctor.";
                }
            }
            else
            {
                results["error"] = "No such patient for this doctor.";
            }

            return new JavaScriptSerializer().Serialize(results);
        }
Example #2
0
 /// <summary>
 /// 执行病人改变事件
 /// </summary>
 /// <param name="e">病人</param>
 public void ExecutePatientChangeEvent(PatientArgs e)
 {
     if (PatientChanged != null)
     {
         PatientChanged(null, e);
     }
 }
Example #3
0
 void plg_PatientChanged(object Sender, PatientArgs arg)
 {
     if (webBrowser1 == null)
     {
         webBrowser1 = new WebBrowser();
     }
     webBrowser1.Navigate("http://localhost:3531/EHRDefault.aspx?SkipLogin=true&username="******"&patid=" + m_host.CurrentPatientInfo.NoOfHisFirstPage + "&StartPage=/Views/InpatientList.xaml&StartPagePathExecute=/Views/PathEnForce.xaml");
 }
Example #4
0
        //todo
        public void DoPatientChanged(object Sender, PatientArgs arg)
        {
            m_AdviceEditor.CheckCanExitOrSwitch(arg.PatInfo);
            if (!IsDisposed)
            {
                m_AdviceEditor.CallShowPatientOrder(arg.PatInfo);

                //m_SuiteToolBox.LoadPatientAgeSex();
            }
        }
Example #5
0
 void plg_PatientChanged(object Sender, PatientArgs arg)
 {
     try
     {
         m_UCEmrInput.PatientChanged(m_app.CurrentPatientInfo);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        public string GetMessages(PatientArgs args)
        {
            Dictionary<string, object> results = new Dictionary<string, object>();
            PTDoctor d = PTDatabase.GetDoctor(args.authentication.email, args.authentication.password);
            List<PTMessage> messages;

            if (d == null)
            {
                results["error"] = "Invalid username or password";
            }
            else if (args.patientID.HasValue && args.lastTime.HasValue)
            {
                List<PTProtocol> protocols = PTDatabase.GetProtocolsForPatient(args.patientID.Value);
                if (protocols.Count() > 0)
                {
                    messages = PTDatabase.GetMessages(protocols.FirstOrDefault().ID, args.lastTime.Value);
                    if (messages != null)
                    {
                        results["messages"] = messages;
                    }
                    else
                    {
                        results["error"] = "Error getting messages from the database.";
                    }
                }
                else
                {
                    results["error"] = "No protocol/patient selected.";
                }
            }
            else
            {
                results["error"] = "No such patient for this doctor.";
            }

            return new JavaScriptSerializer().Serialize(results);
        }
Example #7
0
 void plg_PatientChanged(object Sender, PatientArgs arg)
 {
     m_UCEmrInput.PatientChanged(m_app.CurrentPatientInfo);
 }
        public string GetPatientProtocols(PatientArgs args)
        {
            Dictionary<string, object> results = new Dictionary<string, object>();
            PTDoctor d = PTDatabase.GetDoctor(args.authentication.email, args.authentication.password);
            PTPatient patient;

            if (d == null)
            {
                results["error"] = "Invalid username or password";
            }
            else if (args.patientID.HasValue)
            {
                patient = PTDatabase.GetPatient(d.ID, args.patientID.Value);
                if (patient != null)
                {
                    //TODO: check if is empty what it returns
                    results["patientProtocols"] = patient.protocols;
                }
                else
                {
                    results["error"] = "No such patient for this doctor.";
                }
            }
            else
            {
                results["error"] = "No such patient for this doctor.";
            }

            return new JavaScriptSerializer().Serialize(results);
        }
        public string SendMessage(PatientArgs args)
        {
            Dictionary<string, object> results = new Dictionary<string, object>();
            PTDoctor d = PTDatabase.GetDoctor(args.authentication.email, args.authentication.password);
            PTMessage message;

            if (d == null)
            {
                results["error"] = "Invalid username or password";
            }
            else if (args.patientID.HasValue)
            {
                //TODO: this should be reworked
                PTMessage messageArg = new PTMessage();
                PTProtocol tempProtocol = PTDatabase.GetProtocolsForPatient(args.patientID.Value).FirstOrDefault();
                messageArg.protocolID = tempProtocol.ID;
                messageArg.exerciseID = tempProtocol.exercises.First().ID;
                messageArg.senderID = d.ID;
                messageArg.text = args.message;
                messageArg.timestamp = args.lastTime.Value;
                messageArg.type = "Text";
                message = PTDatabase.AddMessage(messageArg, null);
                if (message != null)
                {
                    //TODO: check if is empty what it returns
                    //TODO: should it return message
                    //TODO: need to handle images
                    results["message"] = message;
                }
                else
                {
                    results["error"] = "Error adding message to the database.";
                }
            }
            else
            {
                results["error"] = "No such patient for this doctor.";
            }

            return new JavaScriptSerializer().Serialize(results);
        }
 public string GetPatientsForDoctor(PatientArgs args)
 {
     Dictionary<string, object> results = new Dictionary<string, object>();
     PTDoctor d = PTDatabase.GetDoctor(args.authentication.email, args.authentication.password);
     List<PTPatient> patients;
     if (d == null)
     {
         results["error"] = "Invalid username or password";
     }
     else
     {
         if (args.lastTime.HasValue)
         {
             patients = PTDatabase.GetPatientsForDoctor(d.ID, args.lastTime.Value);
         }
         else
         {
             //TODO: hardcoded to next year
             patients = PTDatabase.GetPatientsForDoctor(d.ID, 1398228388);
         }
         if (patients != null)
         {
             //TODO: check if patient list is empty (none assigned), what it returns
             results["patients"] = patients;
         }
         else
         {
             results["error"] = "Invalid username or password";
         }
     }
     return new JavaScriptSerializer().Serialize(results);
 }
Example #11
0
 void plg_PatientChanged(object Sender, PatientArgs arg)
 {
     m_UCEmrInput.PatientChanged();
 }
Example #12
0
 void plg_PatientChanged(object Sender, PatientArgs arg)
 {
     //UCEmrInput uCEmr = new UCEmrInput();
     m_UcMainNurse.PatientChanged(m_app.CurrentPatientInfo);
 }