Esempio n. 1
0
        public void AddGuiPatient(System.Xml.XmlWriter xmlWriter, Dictionary <string, string> data, string command, string token = "", string h_w_e = "")
        {
            xmlWriter.WriteStartElement("Patient");
            string cip = "";

            if (!token.Equals(""))
            {
                string case_id = SoapClient.CallAdmissionGet(token, data["admission_id"]);
                cip = SoapClient.CallCaseForGetCip(token, case_id);
                xmlWriter.WriteAttributeString("ID", (!cip.Equals("")) ? cip : data["admission_id"]);
            }
            else
            {
                xmlWriter.WriteAttributeString("ID", data["cip"]);
            }
            xmlWriter.WriteElementString("LastName", data["surname"]);
            xmlWriter.WriteElementString("FirstName", data["name"]);
            xmlWriter.WriteStartElement("PatientDataAtPresent");
            xmlWriter.WriteElementString("DateOfBirth", data["bdate"]);
            xmlWriter.WriteElementString("Gender", (data["gender"].Equals("M")) ? "Male" : "Female");
            if (!command.Equals("RemoveWorklist"))
            {
                string[] words  = h_w_e.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

            /*
             * //<Patient ID=""PSM-11213"">
             * //      <LastName>Smith</LastName>
             * //      <FirstName>Peter</FirstName>
             * //</Patient>
             * xmlWriter.WriteStartElement("Patient");
             * if (!String.IsNullOrEmpty(textBoxPatientID.Text))
             * {
             *  xmlWriter.WriteAttributeString("ID", textBoxPatientID.Text);
             * }
             * if (!String.IsNullOrEmpty(textBoxLastname.Text))
             * {
             *  xmlWriter.WriteElementString("LastName", textBoxLastname.Text);
             * }
             * if (!String.IsNullOrEmpty(textBoxLastname.Text))
             * {
             *  xmlWriter.WriteElementString("FirstName", textBoxFirstName.Text);
             * }
             *
             * xmlWriter.WriteStartElement("PatientDataAtPresent");
             * if (!String.IsNullOrEmpty(dateTimePicker1.Text))
             * {
             *  xmlWriter.WriteElementString("DateOfBirth", dateTimePicker1.Value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));
             * }
             * if (!String.IsNullOrEmpty(comboBoxGender.Text))
             * {
             *  xmlWriter.WriteElementString("Gender", comboBoxGender.Text);
             * }
             * if (!String.IsNullOrEmpty(maskedTextBoxHeight.Text))
             * {
             *  double dHeight;
             *  if (Double.TryParse(maskedTextBoxHeight.Text, out dHeight))
             *      xmlWriter.WriteElementString("Height", dHeight.ToString(CultureInfo.InvariantCulture));
             * }
             * if (!String.IsNullOrEmpty(numericUpDownWeight.Text))
             * {
             *  xmlWriter.WriteElementString("Weight", numericUpDownWeight.Text);
             * }
             * if (!String.IsNullOrEmpty(comboBoxEthnicity.Text))
             * {
             *  xmlWriter.WriteElementString("Ethnicity", comboBoxEthnicity.Text);
             * }
             * xmlWriter.WriteEndElement();//PatientDataAtPresent
             *
             * xmlWriter.WriteEndElement();//Patient
             */
        }
Esempio n. 2
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);
        }