Esempio n. 1
0
        private static void returnTestResult(string cip, string strXmlMessage)
        {
            string token = SoapClient.CallSessionDiscover();

            SoapClient.CallSessionLanguage(token, "EN");
            SoapClient.CallSessionGetRoleList(token);
            SoapClient.CallSessionRole(token);
            SoapClient.CallSessionGetTeamList(token);
            SoapClient.CallSessionSetTeam(token);
            string case_id = SoapClient.CallCaseInsert(cip, token);
            Dictionary <string, string> patient_finded = SoapClient.CallCaseGet(token, case_id);
            string admission_id = SoapClient.CallAdmissionListCase(case_id, token);
            //MessageBox.Show("admission_id: " + admission_id);
            //la siguiente llamada es para añadir la tarea de PRE-CDA
            string task_id_CDA = SoapClient.CallTaskInsertByTaskCode(admission_id, token, "PRE_CDA_TASK");
            //MessageBox.Show("task_id_CDA: " + task_id_CDA);
            string task_id = SoapClient.CallTaskInsertByTaskCode(admission_id, token);
            //MessageBox.Show("task_id: " + task_id);
            string form_id = SoapClient.CallTaskFormList(task_id, token);
            //MessageBox.Show("form_id: " + form_id);
            string answer_id = SoapClient.CallFormGetSummary(form_id, token);

            //MessageBox.Show("answer_id: " + answer_id);
            SoapClient.CallFormSetAnswer(token, form_id, answer_id, admission_id, strXmlMessage);
            //MessageBox.Show("Form " + form_id + " updated.");

            form_id = "";
            Dictionary <string, string>[] data = SoapClient.CallTaskListOverdue(token);
            for (int i = 0; i < data.Length; i++)
            {
                if ((data[i] != null) && (data[i]["admission_id"].Equals(admission_id)))
                {
                    form_id = SoapClient.CallTaskFormList(data[i]["task_id"], token, "true");
                    SoapClient.CallFormSetAnswer(token, form_id, "1", data[i]["admission_id"], "S", "true");
                    //MessageBox.Show("Form bucle " + form_id + " updated.");
                }
            }
            //MessageBox.Show("Form2 " + form_id + " updated.");
        }
Esempio n. 2
0
        /// <summary>
        /// Example of SearchPatient Result</summary>
        /// <param name="parameters">Search criterias</param>
        protected virtual string ReturnSearchPatientResult(Dictionary <string, string> parameters)
        {
            //TODO: add your query here !!!

            string token = SoapClient.CallSessionDiscover();

            SoapClient.CallSessionLanguage(token, "EN");
            SoapClient.CallSessionGetRoleList(token);
            SoapClient.CallSessionRole(token);
            SoapClient.CallSessionGetTeamList(token);
            SoapClient.CallSessionSetTeam(token);
            string cip     = parameters["PatientID"];
            string case_id = SoapClient.CallCaseInsert(cip, token);
            Dictionary <string, string> patient_finded = SoapClient.CallCaseGet(token, case_id);
            string admission_id = SoapClient.CallAdmissionListCase(case_id, token);

            patient_finded.Add("admission_id", admission_id);
            patient_finded.Add("cip", cip);

            if (!patient_finded["admission_id"].Equals(""))
            {
                var cmdParameters = new Dictionary <string, string>();

                string form_request_id        = SoapClient.CallTaskFormList(patient_finded["task_id"], token, "true");
                string height_weight_etnicity = SoapClient.CallFormulaExec(token, form_request_id);
                SoapClient.CheckPatient(cip, patient_finded);

                cmdParameters.Clear();
                cmdParameters.Add(Commands.AddToWorklist.OrderID, patient_finded["cip"]);
                SendCommand(Commands.AddToWorklist.Command, cmdParameters, patient_finded, height_weight_etnicity);

                using (System.Xml.XmlWriter xmlWriter = new System.Xml.XmlTextWriter(XmlExchangeFile, Encoding.UTF8))
                {
                    try
                    {
                        xmlWriter.WriteStartDocument();
                        xmlWriter.WriteStartElement("ndd");
                        xmlWriter.WriteStartElement("Command");
                        xmlWriter.WriteAttributeString("Type", Commands.SearchPatientsResult.Command);
                        xmlWriter.WriteEndElement();//command
                        xmlWriter.WriteStartElement("Patients");

                        //TODO: fill patient list with your data !!
                        //MessageBox.Show("Querying EMR system for patients is not implemented.");
                        MessageBox.Show("Patient added to Worklist.");
                        xmlWriter.WriteStartElement("Patient");
                        xmlWriter.WriteAttributeString("ID", patient_finded["cip"]);
                        xmlWriter.WriteElementString("LastName", patient_finded["surname"]);
                        xmlWriter.WriteElementString("FirstName", patient_finded["name"]);

                        xmlWriter.WriteStartElement("PatientDataAtPresent");

                        xmlWriter.WriteElementString("DateOfBirth", patient_finded["bdate"]);
                        xmlWriter.WriteElementString("Gender", (patient_finded["gender"].Equals("M")) ? "Male" : "Female");
                        string[] words  = height_weight_etnicity.Split('|');
                        string   height = words[1];
                        height = transformHeightFormat(height);
                        string weight   = words[0].Substring(0, words[0].Length - 2);
                        string etnicity = ethnicityDiscover(words[2]);
                        xmlWriter.WriteElementString("Height", height);
                        xmlWriter.WriteElementString("Weight", weight);
                        xmlWriter.WriteElementString("Ethnicity", etnicity);
                        //xmlWriter.WriteElementString("Height", "182");
                        //xmlWriter.WriteElementString("Weight", "64");
                        //xmlWriter.WriteElementString("Ethnicity", "Caucasian");
                        xmlWriter.WriteEndElement(); //PatientDataAtPresent

                        xmlWriter.WriteEndElement(); //Patient
                        xmlWriter.WriteEndElement(); //Patients
                        xmlWriter.WriteEndElement();
                        xmlWriter.WriteEndDocument();
                        //                xmlWriter.WriteString(@"
                        //<ndd>
                        //<command>Test xml data</command><Patients>
                        //    <Patient ID=""PSM-11213"">
                        //      <LastName>Smith</LastName>
                        //      <FirstName>Peter</FirstName></Patient>
                        //</Patients>
                        //</ndd>");
                        xmlWriter.Flush();
                        xmlWriter.Close();
                    }
                    finally
                    {
                        xmlWriter.Close();
                    }
                }
            }
            else
            {
                MessageBox.Show("Patient not found.");
            }
            return(XmlExchangeFile);
        }
Esempio n. 3
0
        /// <summary>
        /// Initialization and starting EMR Module</summary>
        /// <param name="configValues">saved configuration values, <see cref="UserControlEmrConfig"/></param>
        /// <returns>true if successfull</returns>
        /// <remarks>required</remarks>
        public virtual bool Initialize(Dictionary <string, string> configValues)
        {
            SoapClient.readConfigurationFile();
            //load saved configuration values
            LoadingConfigValues(configValues);

            //configuration must be sent to EasyWarePro prior sending commands like PerformTest
            //sending them here fullfills that requirement (this a workaround of a known limitation of the current interface)
            SendMessage(ReturnConfiguration());
            SendMessage(ReturnSupportedFeatures());

            //starts watching for files, this could initiate a call
            StartPlugIn();

            //PROGRAMAR
            string token = SoapClient.CallSessionDiscover();

            SoapClient.CallSessionLanguage(token, "EN");
            SoapClient.CallSessionGetRoleList(token);
            SoapClient.CallSessionRole(token);
            SoapClient.CallSessionGetTeamList(token);
            SoapClient.CallSessionSetTeam(token);
            Dictionary <string, string>[] data = SoapClient.CallTaskListOverdue(token);
            //string admission_id = SoapClient.CallAdmissionListCase(admission_id, token);

            var cmdParameters = new Dictionary <string, string>();

            //if (!String.IsNullOrEmpty(textBoxOrderID.Text))

            //por cada una de las tareas, hacer un AddWorkList
            for (int i = 0; i < data.Length; i++)
            {
                if (data[i] != null)
                {
                    //esta dos llamadas siguientes son para conseguir el cip
                    string case_id                = SoapClient.CallAdmissionGet(token, data[i]["admission_id"]);
                    string cip                    = SoapClient.CallCaseForGetCip(token, case_id);
                    string form_request_id        = SoapClient.CallTaskFormList(data[i]["task_id"], token, "true");
                    string height_weight_etnicity = SoapClient.CallFormulaExec(token, form_request_id);
                    SoapClient.CheckPatient(cip, data[i]);

                    cmdParameters.Clear();
                    //aqui en vez de cip, antes habia data[i][case_id]
                    cmdParameters.Add(Commands.AddToWorklist.OrderID, cip);
                    SendCommand(Commands.AddToWorklist.Command, cmdParameters, data[i], token, height_weight_etnicity);
                    data[i].Add("cip", cip);
                    //cmdParameters.Add(Commands.RemoveWorklist.OrderID, cip);
                    //SendCommand(Commands.RemoveWorklist.Command, cmdParameters, data[i], token);
                }
            }

            Dictionary <string, string>[] patients_in_file    = SoapClient.ReadPatientFile(data.Length);
            Dictionary <string, string>[] patients_for_remove = SoapClient.ComparePatientsLists(data, patients_in_file);

            foreach (Dictionary <string, string> patient in patients_for_remove)
            {
                cmdParameters.Clear();
                cmdParameters.Add(Commands.RemoveWorklist.OrderID, patient["cip"]);
                SendCommand(Commands.RemoveWorklist.Command, cmdParameters, patient, token);
                SoapClient.RemoveFromFile(patient);
            }

            return(true);
        }