コード例 #1
0
        private void btnGo_Click(object sender, EventArgs e)
        {
            try
            {
                Patient.__send_eof = chkSendEOF.Checked;

                if ((cbDelimitedTestRecord.Checked || cbTaggedTestRecord.Checked) && txtFileName.Text.Length > 0)
                {
                    List <KeyValuePair <string, string> > __key_data = new List <KeyValuePair <string, string> >();
                    var __output = new motFormattedFileOutput();

                    if (!Directory.Exists("C:/Records"))
                    {
                        Directory.CreateDirectory("C:/Records");
                    }

                    if (cbDelimitedTestRecord.Checked)
                    {
                        __key_data.Add(new KeyValuePair <string, string>("TableType", "A" + __action.ToUpper().Substring(0, 1)));
                    }

                    __key_data.Add(new KeyValuePair <string, string>("RxSys_PatID", txtRxSys_PatID.Text));
                    __key_data.Add(new KeyValuePair <string, string>("LastName", txtLastName.Text));
                    __key_data.Add(new KeyValuePair <string, string>("FirstName", txtFirstName.Text));
                    __key_data.Add(new KeyValuePair <string, string>("MiddleInitial", txtMiddleInitial.Text));
                    __key_data.Add(new KeyValuePair <string, string>("Address1", txtAddress1.Text));
                    __key_data.Add(new KeyValuePair <string, string>("Address2", txtAddress2.Text));
                    __key_data.Add(new KeyValuePair <string, string>("City", txtCity.Text));
                    __key_data.Add(new KeyValuePair <string, string>("State", txtState.Text));
                    __key_data.Add(new KeyValuePair <string, string>("Zip", txtZip.Text));
                    __key_data.Add(new KeyValuePair <string, string>("Phone1", txtPhone1.Text));
                    __key_data.Add(new KeyValuePair <string, string>("Phone2", txtPhone2.Text));
                    __key_data.Add(new KeyValuePair <string, string>("WorkPhone", txtWorkPhone.Text));
                    __key_data.Add(new KeyValuePair <string, string>("RxSys_LocID", txtRxSys_LocID.Text));
                    __key_data.Add(new KeyValuePair <string, string>("Room", txtRoom.Text));
                    __key_data.Add(new KeyValuePair <string, string>("Comments", txtComments.Text));
                    __key_data.Add(new KeyValuePair <string, string>("Gender", txtGender.Text));
                    __key_data.Add(new KeyValuePair <string, string>("Status", txtStatus.Text));
                    __key_data.Add(new KeyValuePair <string, string>("CycleDate", txtCycleDate.Text));
                    __key_data.Add(new KeyValuePair <string, string>("CycleDays", txtCycleDays.Text));
                    __key_data.Add(new KeyValuePair <string, string>("CycleType", txtCycleType.Text));
                    __key_data.Add(new KeyValuePair <string, string>("Status", txtStatus.Text));
                    __key_data.Add(new KeyValuePair <string, string>("RxSys_LastDoc", txtRxSys_LastDoc.Text));
                    __key_data.Add(new KeyValuePair <string, string>("RxSys_PrimaryDoc", txtRxSys_PrimaryDoc.Text));
                    __key_data.Add(new KeyValuePair <string, string>("RxSys_AltDoc", txtRxSys_AltDoc.Text));
                    __key_data.Add(new KeyValuePair <string, string>("SSN", txtSSN.Text));
                    __key_data.Add(new KeyValuePair <string, string>("Allergies", txtAllergies.Text));
                    __key_data.Add(new KeyValuePair <string, string>("Diet", txtDiet.Text));
                    __key_data.Add(new KeyValuePair <string, string>("DxNotes", txtDxNote.Text));
                    __key_data.Add(new KeyValuePair <string, string>("TreatmentNotes", txtTreatmentNotes.Text));
                    __key_data.Add(new KeyValuePair <string, string>("DOB", txtDOB.Text));
                    __key_data.Add(new KeyValuePair <string, string>("Height", txtHeight.Text));
                    __key_data.Add(new KeyValuePair <string, string>("Weight", txtWeight.Text));
                    __key_data.Add(new KeyValuePair <string, string>("ResponsibleName", txtResponsibleName.Text));
                    __key_data.Add(new KeyValuePair <string, string>("InsName", txtInsName.Text));
                    __key_data.Add(new KeyValuePair <string, string>("InsPNo", txtInsPNo.Text));
                    __key_data.Add(new KeyValuePair <string, string>("AltInsName", txtAltInsName.Text));
                    __key_data.Add(new KeyValuePair <string, string>("AltInsPNo", txtAltInsPNo.Text));
                    __key_data.Add(new KeyValuePair <string, string>("MCareNum", txtMCareNum.Text));
                    __key_data.Add(new KeyValuePair <string, string>("MCaidNum", txtMCaidNum.Text));
                    __key_data.Add(new KeyValuePair <string, string>("AdmitDate", txtAdmitDate.Text));
                    __key_data.Add(new KeyValuePair <string, string>("ChartOnly", txtChartOnly.Text));

                    if (cbDelimitedTestRecord.Checked)
                    {
                        byte[] __record = __output.WriteDelimitedFile(@"C:\Records\" + txtFileName.Text, __key_data);

                        if (cbSendDelimitedRecord.Checked)
                        {
                            __execute.__p.write(__record);
                        }
                    }

                    if (cbTaggedTestRecord.Checked)
                    {
                        if (cbDelimitedTestRecord.Checked)
                        {
                            __key_data.RemoveAt(0);
                        }

                        string __record = __output.WriteTaggedFile(@"C:\Records\" + txtFileName.Text, __key_data, "Patient", __action);

                        if (cbSendTaggedRecord.Checked)
                        {
                            __execute.__p.write(__record);
                        }
                    }
                }
                else
                {
                    Patient.setField("Action", __action);

                    // Assign all the values and write
                    Patient.RxSys_PatID   = txtRxSys_PatID.Text;
                    Patient.LastName      = txtLastName.Text;
                    Patient.MiddleInitial = txtMiddleInitial.Text;
                    Patient.FirstName     = txtFirstName.Text;
                    Patient.Address1      = txtAddress1.Text;
                    Patient.Address2      = txtAddress2.Text;
                    Patient.City          = txtCity.Text;
                    Patient.PostalCode    = txtZip.Text;
                    Patient.Phone1        = txtPhone1.Text;
                    Patient.Phone2        = txtPhone2.Text;
                    Patient.WorkPhone     = txtWorkPhone.Text;
                    Patient.Room          = txtRoom.Text;

                    Patient.Comments        = txtComments.Text;
                    Patient.Allergies       = txtAllergies.Text;
                    Patient.Diet            = txtDiet.Text;
                    Patient.DxNotes         = txtDxNote.Text;
                    Patient.TreatmentNotes  = txtTreatmentNotes.Text;
                    Patient.ResponisbleName = txtResponsibleName.Text;

                    Patient.DOB    = txtDOB.Text;
                    Patient.Height = Convert.ToInt32(txtHeight.Text);
                    Patient.Weight = Convert.ToInt32(txtWeight.Text);

                    Patient.InsName     = txtInsName.Text;
                    Patient.AltInsName  = txtAltInsName.Text;
                    Patient.InsPNo      = txtAltInsName.Text;
                    Patient.AltInsPNo   = txtAltInsPNo.Text;
                    Patient.MedicareNum = txtMCareNum.Text;
                    Patient.MedicaidNum = txtMCaidNum.Text;

                    Patient.CycleDate = txtCycleDate.Text;
                    Patient.CycleDays = Convert.ToInt32(txtCycleDays.Text);
                    Patient.CycleType = Convert.ToInt32(txtCycleType.Text);

                    Patient.Status = Convert.ToInt32(txtStatus.Text);
                    Patient.SSN    = txtSSN.Text;

                    Patient.AdmitDate = txtAdmitDate.Text;
                    Patient.ChartOnly = txtChartOnly.Text;
                    Patient.Gender    = txtGender.Text;

                    Patient.RxSys_PatID      = txtRxSys_PatID.Text;
                    Patient.RxSys_LocID      = txtRxSys_LocID.Text;
                    Patient.RxSys_PrimaryDoc = txtRxSys_PrimaryDoc.Text;
                    Patient.RxSys_LastDoc    = txtRxSys_LastDoc.Text;
                    Patient.RxSys_AltDoc     = txtRxSys_AltDoc.Text;

                    __execute.__update_event_ui("Patient field assignment complete ...");

                    try
                    {
                        Patient.Write(__execute.__p);
                    }
                    catch (Exception ex)
                    {
                        __execute.__update_error_ui(string.Format("Patient record write error: {0}", ex.Message));
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                __execute.__update_error_ui(string.Format("Patient record field assignment error: {0}", ex.Message));
                return;
            }

            __execute.__update_event_ui("Patient write record complete ...");
        }
コード例 #2
0
        // Do the real work here - call delegates to update UI

        void __parsePioneerRxRecord(XmlDocument __xdoc)
        {
            //__gateway = new motPort();  // Clever way to turn off gateway for testing

            // The interesting parts of PioneerRx XML are:
            //          Pharmacy
            //          Prescribers<Prescriber>
            //          Patient
            //          Facility
            //          Rx

            try
            {
                XmlNode __pharmacy = __xdoc.SelectSingleNode("//Pharmacy");


                motStoreRecord __store = new motStoreRecord("Add", __args.__auto_truncate);

                __store.StoreName     = __pharmacy.SelectSingleNode("PharmacyName").InnerText;
                __store.RxSys_StoreID = __pharmacy.SelectSingleNode("Identification/PioneerRxID").InnerText;
                __store.DEANum        = __pharmacy.SelectSingleNode("Identification/DEA").InnerText;
                __store.Address1      = __pharmacy.SelectSingleNode("//Address/AddressLine1").InnerText;
                __store.Address2      = __pharmacy.SelectSingleNode("//Address/AddressLine2").InnerText;
                __store.City          = __pharmacy.SelectSingleNode("//Address/City").InnerText;
                __store.State         = __pharmacy.SelectSingleNode("//Address/StateCode").InnerText;
                __store.Zip           = __pharmacy.SelectSingleNode("//Address/ZipCode").InnerText;

                XmlNodeList __phone_node_list = __pharmacy.SelectNodes("PhoneNumbers/PhoneNumber");
                foreach (XmlNode __num in __phone_node_list)
                {
                    if (__num["Type"].InnerText.ToLower() == "fax")
                    {
                        __store.Fax = __num["AreaCode"].InnerText + __num["Number"].InnerText;
                    }
                    else
                    {
                        __store.Phone = __num["AreaCode"].InnerText + __num["Number"].InnerText;
                    }
                }

                __store.Write(__gateway);
                __show_common_event("Added Store: " + __store.StoreName);
            }
            catch (Exception ex)
            {
                __show_error_event("Failed writing Store Record: " + ex.Message);
            }

            try
            {
                XmlNodeList __prescribers = __xdoc.SelectNodes("//Prescribers/Prescriber");

                foreach (XmlNode __prescriber in __prescribers)
                {
                    var __doc = new motPrescriberRecord("Add", __args.__auto_truncate);

                    // its odd.  The PrescriberID is writen like this:
                    //      <PresccriberID>
                    //          <GUID/>40DE86C9-FD69-44D7-9DA4-4D2A3194DE49
                    //      </PrescriberID>
                    // and I can't find a way to get at the XPath lets me get the node but no value
                    //__doc.RxSys_DocID = __prescriber.SelectSingleNode("Identification/PrescriberID").ChildNodes[1].InnerText;

                    __doc.RxSys_DocID   = __prescriber.SelectSingleNode("Identification/PrescriberID/GUID").InnerText;
                    __doc.DEA_ID        = __prescriber.SelectSingleNode("Identification/DEA").InnerText;
                    __doc.FirstName     = __prescriber.SelectSingleNode("Name/FirstName").InnerText;
                    __doc.LastName      = __prescriber.SelectSingleNode("Name/LastName").InnerText;
                    __doc.MiddleInitial = __prescriber.SelectSingleNode("Name/MiddleName").InnerText;

                    // We can only take a single address, so just take the first one
                    __doc.Address1   = __prescriber.SelectSingleNode("//Address/AddressLine1").InnerText;
                    __doc.Address2   = __prescriber.SelectSingleNode("//Address/AddressLine2").InnerText;
                    __doc.City       = __prescriber.SelectSingleNode("//Address/City").InnerText;
                    __doc.State      = __prescriber.SelectSingleNode("//Address/StateCode").InnerText;
                    __doc.PostalCode = __prescriber.SelectSingleNode("//Address/City").InnerText;
                    __doc.Specialty  = string.IsNullOrEmpty(__prescriber["PrimarySpecializationID"].InnerText) ? 0 : Convert.ToInt32(__prescriber["PrimarySpecializationID"].InnerText);

                    XmlNodeList __phone_node_list = __prescriber.SelectNodes("PhoneNumbers/PhoneNumber");
                    foreach (XmlNode __num in __phone_node_list)
                    {
                        if (__num["Type"].InnerText.ToLower() == "fax")
                        {
                            __doc.Fax = __num["AreaCode"].InnerText + __num["Number"].InnerText;
                        }
                        else
                        {
                            __doc.Phone = __num["AreaCode"].InnerText + __num["Number"].InnerText;
                        }
                    }

                    __doc.Email     = __prescriber.SelectSingleNode("Email").InnerText;
                    __doc.Comments += __prescriber.SelectSingleNode("Comments/Informational").InnerText + "\n";
                    __doc.Comments += __prescriber.SelectSingleNode("Comments/Critical").InnerText + "\n";
                    __doc.Comments += __prescriber.SelectSingleNode("Comments/PointOfSale").InnerText + "\n";

                    __doc.Write(__gateway);

                    __show_common_event("Added Prescriber: " + __doc.FirstName + " " + __doc.LastName);
                }
            }
            catch (Exception ex)
            {
                __show_error_event("Failed Writing Records: " + ex.Message);
                throw;
            }


            try
            {
                var __patient = __xdoc.SelectSingleNode("//Patient");
                var __pat     = new motPatientRecord("Add", __args.__auto_truncate);
                List <motPrescriptionRecord> __rx_list = new List <motPrescriptionRecord>();

                __pat.RxSys_PatID   = __patient?.SelectSingleNode("//Identification/PatientID/Guid").InnerText;
                __pat.SSN           = __patient?.SelectSingleNode("//Identification/SSN").InnerText;
                __pat.DOB           = __patient?.SelectSingleNode("DateOfBirth/Date").InnerText;
                __pat.FirstName     = __patient?.SelectSingleNode("Name/FirstName").InnerText;
                __pat.LastName      = __patient?.SelectSingleNode("Name/LastName").InnerText;
                __pat.MiddleInitial = __patient?.SelectSingleNode("Name/MiddleName").InnerText;
                __pat.Gender        = __patient?.SelectSingleNode("Gender").InnerText;
                __pat.Height        = string.IsNullOrEmpty(__patient?.SelectSingleNode("HeightInches").InnerText) ? 0 : Convert.ToInt32(__patient?.SelectSingleNode("HeightInches").InnerText);
                __pat.Weight        = string.IsNullOrEmpty(__patient?.SelectSingleNode("WeightOz").InnerText) ? 0 : Convert.ToInt32(__patient?.SelectSingleNode("WeightOz").InnerText);

                // We can only take a single address, so just take the first one
                __pat.Address1 = __patient?.SelectSingleNode("//Address/AddressLine1").InnerText;
                __pat.Address2 = __patient?.SelectSingleNode("//Address/AddressLine2").InnerText;
                __pat.City     = __patient?.SelectSingleNode("//Address/City").InnerText;
                __pat.State    = __patient?.SelectSingleNode("//Address/StateCode").InnerText;
                __pat.Zip      = __patient?.SelectSingleNode("//Address/City").InnerText;

                __pat.Email = __patient?.SelectSingleNode("Email").InnerText;

                __pat.Comments += __patient?.SelectSingleNode("Comments/Informational").InnerText + "\n";
                __pat.Comments += __patient?.SelectSingleNode("Comments/Critical").InnerText + "\n";
                __pat.Comments += __patient?.SelectSingleNode("Comments/PointOfSale").InnerText + "\n";
                __pat.Comments += __patient?.SelectSingleNode("Comments/LastMTMComment").InnerText + "\n";

                XmlNodeList __phone_node_list = __patient?.SelectNodes("PhoneNumbers/PhoneNumber");
                foreach (XmlNode __num in __phone_node_list)
                {
                    if (__num["SequenceNumber"].InnerText == "1")
                    {
                        __pat.Phone1 = __num["AreaCode"].InnerText + __num["Number"].InnerText;
                    }
                    else if (__num["SequenceNumber"].InnerText == "2")
                    {
                        __pat.Phone2 = __num["AreaCode"].InnerText + __num["Number"].InnerText;
                    }
                }

                __pat.RxSys_DocID = __patient?.SelectSingleNode("PatientPrimaryPrescriberID").InnerText;

                XmlNodeList __allergy_node_list = __patient?.SelectNodes("Allergies/Allergy");
                int         i = 1;
                foreach (XmlNode __allergy in __allergy_node_list)
                {
                    __pat.Allergies += string.Format("{0}) {1}, MedID: {2}, IDType: {3}\n", i++, __allergy["Description"].InnerText, __allergy["MedicationID"].InnerText, __allergy["MedicationIDType"].InnerText);
                }

                XmlNodeList __scrip_node_list = __patient?.SelectNodes("OtherMedications/Medication");
                foreach (XmlNode __scrip in __scrip_node_list)
                {
                    var __new_scrip = new motPrescriptionRecord("Add", __args.__auto_truncate);

                    __new_scrip.RxSys_RxNum  = __scrip["RxNumber"].InnerText;
                    __new_scrip.RxSys_DocID  = __scrip["Prescriber"].InnerText;
                    __new_scrip.RxSys_DrugID = __scrip["DrugNDC"].InnerText;
                    __new_scrip.QtyDispensed = __scrip["DaysSupply"].InnerText;
                    __new_scrip.RxStartDate  = __scrip["LastDateFilled"].InnerText;
                    __new_scrip.Refills      = __scrip["RefillsRemaining"].InnerText;

                    __new_scrip.RxSys_PatID = __pat.RxSys_PatID;
                    __new_scrip.RxType      = "0";

                    __rx_list.Add(__new_scrip);
                }

                __pat.Write(__gateway);
                __show_common_event("Added Patient: " + __pat.FirstName + " " + __pat.LastName);
                foreach (motPrescriptionRecord __scp in __rx_list)
                {
                    __scp.Write(__gateway);
                    __show_common_event("Added Scrip: " + __scp.RxSys_RxNum + " for " + __pat.FirstName + " " + __pat.LastName);
                }
            }
            catch (Exception ex)
            {
                __show_error_event("Failed Writing Records: " + ex.Message);
                throw;
            }

            // Facility
            // RX
        }