コード例 #1
0
        public Patient getPatient(string ssn)
        {
            string     queryString = "getPatient";
            SqlCommand command     = new SqlCommand(queryString, conn);

            command.CommandType = System.Data.CommandType.StoredProcedure;
            command.Parameters.Add(new SqlParameter("@ssn", ssn));
            command.Connection = conn;
            SqlDataReader reader = command.ExecuteReader();

            reader.Read();
            string patientSSN = reader.GetString((int)PCol.SSN);

            if (patientSSN != ssn)
            {
                throw new Exception("Exception: Patient not found!");
            }
            Patient patient = new Patient(patientSSN);

            if (!reader.IsDBNull((int)PCol.LastName))
            {
                patient.setLastName(reader.GetString((int)PCol.LastName));
            }
            if (!reader.IsDBNull((int)PCol.FirstName))
            {
                patient.setFirstName(reader.GetString((int)PCol.FirstName));
            }
            if (!reader.IsDBNull((int)PCol.MiddleInitial))
            {
                patient.setMiddleInitial(reader.GetString((int)PCol.MiddleInitial)[0]);
            }
            if (!reader.IsDBNull((int)PCol.AddressLine1))
            {
                patient.setAddressLine1(reader.GetString((int)PCol.AddressLine1));
            }
            if (!reader.IsDBNull((int)PCol.AddressLine2))
            {
                patient.setAddressLine2(reader.GetString((int)PCol.AddressLine2));
            }
            if (!reader.IsDBNull((int)PCol.City))
            {
                patient.setCity(reader.GetString((int)PCol.City));
            }
            if (!reader.IsDBNull((int)PCol.State))
            {
                patient.setState(reader.GetString((int)PCol.State));
            }
            if (!reader.IsDBNull((int)PCol.ZipCode))
            {
                patient.setZipcode(reader.GetString((int)PCol.ZipCode));
            }
            if (!reader.IsDBNull((int)PCol.Gender))
            {
                patient.setGender(reader.GetString((int)PCol.Gender)[0]);
            }
            if (!reader.IsDBNull((int)PCol.BirthDate))
            {
                patient.setBirthDate(reader.GetDateTime((int)PCol.BirthDate));
            }
            if (!reader.IsDBNull((int)PCol.InsurerID))
            {
                patient.setInsurer(reader.GetString((int)PCol.InsurerID));
            }
            if (!reader.IsDBNull((int)PCol.DnrStatus))
            {
                patient.setDoNotResuscitateStatus(reader.GetBoolean((int)PCol.DnrStatus));
            }
            if (!reader.IsDBNull((int)PCol.OrganDonor))
            {
                patient.setOrganDonorStatus(reader.GetBoolean((int)PCol.OrganDonor));
            }

            reader.Close();

            getVisits(ref patient);

            return(patient);
        }
コード例 #2
0
        private void saveCurrentPatient()
        {
            DBConnectionObject conn = DBConnectionObject.getInstance();

            selectedPatient.setFirstName(patientFirstNameTextBox.Text);
            selectedPatient.setMiddleInitial(PatientMiddleInitialTextBox.Text[0]);
            selectedPatient.setFirstName(patientFirstNameTextBox.Text);
            selectedPatient.setLastName(patientLastNameTextBox.Text);
            selectedPatient.setAddressLine1(patientAddressLine1TextBox.Text);
            selectedPatient.setAddressLine2(patientAddressLine2TextBox.Text);
            selectedPatient.setCity(patientCityTextBox.Text);
            selectedPatient.setState(patientStateTextBox.Text);
            selectedPatient.setZipcode(patientZipTextBox.Text);
            selectedPatient.setGender(patientGenderTextBox.Text[0]);
            selectedPatient.setInsurer(patientInsurerID.Text);

            if (patientDNR.Text == "True")
            {
                selectedPatient.setDoNotResuscitateStatus(true);
            }
            else if (patientDNR.Text == "False")
            {
                selectedPatient.setDoNotResuscitateStatus(false);
            }

            if (patientOrganDonor.Text == "True")
            {
                selectedPatient.setOrganDonorStatus(true);
            }
            else if (patientOrganDonor.Text == "False")
            {
                selectedPatient.setOrganDonorStatus(false);
            }



            selectedPatient.setBirthDate(dateBirthdate.Value);

            conn.updatePatient(selectedPatient);

            if (selectedVisit != null)
            {
                selectedVisit.setEntryDate(EntryDatePicker.Value);
                selectedVisit.setAttendingPhysician(textAttendingPhy.Text);
                selectedVisit.changeDiagnosis(VisitDiagnosisTextBox.Text);
                selectedVisit.setNote(visitNotes.Text);

                for (int i = 0; i < textSymptoms.Lines.Length; i++)
                {
                    bool hasSymptom = false;;
                    foreach (string s in selectedVisit.getSymptomList())
                    {
                        if (textSymptoms.Lines[i].Trim() == s)
                        {
                            hasSymptom = true;
                        }
                    }
                    if (hasSymptom == false)
                    {
                        conn.addSymptom(selectedPatient, selectedVisit, textSymptoms.Lines[i].Trim());
                    }
                }

                conn.updateVisit(selectedVisit, selectedPatient);
            }
        }