/// <summary>
        /// Handles the request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="response">The response.</param>
        protected override void HandleRequest(CreateNewPatientRequest request, CreateNewPatientResponse response)
        {
            var session = SessionProvider.GetSession();
            var agency  = session.Load <Agency> (request.AgencyKey);

            var name = new PersonNameBuilder()
                       .WithFirst(request.FirstName)
                       .WithMiddle(request.MiddleName)
                       .WithLast(request.LastName)
                       .WithSuffix(request.Suffix == null ? null : request.Suffix.Name)
                       .Build();

            PatientGender patientGender = null;

            if (request.Gender != null)
            {
                patientGender = _mappingHelper.MapLookupField <PatientGender> (request.Gender);
            }

            var patientProfile = new PatientProfileBuilder()
                                 .WithPatientGender(patientGender)
                                 .WithBirthDate(request.BirthDate)
                                 .Build();

            var patient = _patientFactory.CreatePatient(agency, name, patientProfile);

            if (Success)
            {
                response.PatientDto = Mapper.Map <Patient, PatientDto> (patient);
            }
        }
Exemple #2
0
        public void GenderTest()
        {
            PatientBanner banner    = new PatientBanner();
            PatientGender testValue = PatientGender.Female;

            Assert.AreEqual(banner.Gender, PatientGender.NotKnown, "Expected Gender to initially be NotSpecified");
            banner.Gender = testValue;
            Assert.AreEqual <PatientGender>(banner.Gender, testValue, "Gender property not set as expected");
        }
Exemple #3
0
 private string ConvertGender(PatientGender gender)
 {
     if(gender==PatientGender.Female) {
         return "F";
     }
     if(gender==PatientGender.Male) {
         return "M";
     }
     return "U";
 }
Exemple #4
0
 private string ConvertGender(PatientGender gender)
 {
     if (gender == PatientGender.Female)
     {
         return("F");
     }
     if (gender == PatientGender.Male)
     {
         return("M");
     }
     return("U");
 }
Exemple #5
0
        ///<summary>Type IS.  Writes a string corresponding to table HL70001 into the fieldIndex field for the current segment.</summary>
        private void WriteGender(int fieldIndex, PatientGender gender)
        {
            string strGenderCode = "U";          //unknown

            if (gender == PatientGender.Female)
            {
                strGenderCode = "F";
            }
            if (gender == PatientGender.Male)
            {
                strGenderCode = "M";
            }
            _seg.SetField(fieldIndex, strGenderCode);
        }
Exemple #6
0
        public void ValueTest()
        {
            GenderLabel target = new GenderLabel();

            PatientGender val = PatientGender.Male;

            target.Value = val;
            Assert.AreEqual <PatientGender>(val, target.Value, "NhsCui.Toolkit.WinForms.GenderLabel.Value was not set correctly.");

            val          = PatientGender.Female;
            target.Value = val;
            Assert.AreEqual <PatientGender>(val, target.Value, "NhsCui.Toolkit.WinForms.GenderLabel.Value was not set correctly.");

            val          = PatientGender.NotKnown;
            target.Value = val;
            Assert.AreEqual <PatientGender>(val, target.Value, "NhsCui.Toolkit.WinForms.GenderLabel.Value was not set correctly.");
        }
        private bool UpdatePatient()
        {
            PatientGender gender = (PatientGender)(-1);

            if (radioButtonGenderMale.Checked)
            {
                gender = PatientGender.Male;
            }
            else if (radioButtonGenderFemale.Checked)
            {
                gender = PatientGender.Female;
            }

            PatientModel localPatient = new PatientModel
            {
                Id        = patientId,
                FirstName = textBoxFirstName.Text,
                LastName  = textBoxLastName.Text,
                Birthdate = dateTimePickerBirthdate.Value.ToShortDateString(),
                Gender    = gender
            };

            PatientValidator validator = new PatientValidator();

            ValidationResult results = validator.Validate(localPatient);

            if (results.IsValid == false)
            {
                MessageBox.Show(results.Errors[0].ToString());

                return(false);
            }

            patient = localPatient;

            SqliteDataAccess.UpdatePatient(localPatient);

            return(true);
        }
Exemple #8
0
		///<summary>Type IS (guide page 68).  Writes a string corresponding to table HL70001 (guide page 193) into the fieldIndex field for the current segment.</summary>
		private void WriteGender(int fieldIndex,PatientGender gender) {
			string strGenderCode="U";//unknown
			if(gender==PatientGender.Female) {
				strGenderCode="F";
			}
			if(gender==PatientGender.Male) {
				strGenderCode="M";
			}
			_seg.SetField(fieldIndex,strGenderCode);
		}
Exemple #9
0
 /// <summary>
 /// Converts to HL7.
 /// </summary>
 /// <param name="patientGender">The patient gender.</param>
 /// <returns>A <see cref="HL7Generator.Infrastructure.Table.GenderCodeset"/></returns>
 internal static GenderCodeset ConvertToHl7(PatientGender patientGender)
 {
     return(patientGender != null?ConvertToHl7(patientGender.AdministrativeGender) : GenderCodeset.Unknown);
 }
Exemple #10
0
		private static string GetGender(PatientGender patGender) {
			switch(patGender) {
				case PatientGender.Male:
					return "M";
				case PatientGender.Female:
					return "F";
				case PatientGender.Unknown:
					return "U";
			}
			return "";
		}
		///<summary>The gender of a person used for adminstrative purposes (as opposed to clinical gender). Empty string/value is allowed.</summary>
		public string administrativeGenderCodeHelper(PatientGender patientGender) {
			switch(patientGender) {
				case PatientGender.Female:
					return "F";
				case PatientGender.Male:
					return "M";
				case PatientGender.Unknown:
					return "UN";
				default://should never happen
					return " ";
			}
		} 
Exemple #12
0
 ///<summary>Gets the total number of patients with completed procedures between dateFrom and dateTo who are at least agelow and strictly younger than agehigh.</summary>
 public static int GetAgeGenderCount(int agelow,int agehigh,PatientGender gender,DateTime dateFrom, DateTime dateTo)
 {
     bool male=true;//Since all the numbers must add up to equal, we count unknown and other genders as female.
     if(gender!=0) {
         male=false;
     }
     string command="SELECT COUNT(*) "
         +"FROM patient pat "
         +"WHERE PatNum IN ( "
             +"SELECT DISTINCT PatNum FROM procedurelog "
             +"WHERE ProcStatus="+POut.Int((int)ProcStat.C)+" "
             +"AND DateEntryC >= "+POut.Date(dateFrom)+" "
             +"AND DateEntryC <= "+POut.Date(dateTo)+") "
         +"AND Gender"+(male?"=0":"!=0")+" "
         +"AND Birthdate<=SUBDATE(CURDATE(),INTERVAL "+agelow+" YEAR) "//Born before this date
         +"AND Birthdate>SUBDATE(CURDATE(),INTERVAL "+agehigh+" YEAR)";//Born after this date
     return PIn.Int(Db.GetCount(command));
 }
 /// <summary>
 /// Constructs a PatientBannerEventArgs object with the given Identifier and Patient gender
 /// </summary>
 /// <param name="identifier">Identifier</param>
 /// <param name="gender">Patient gender</param>
 public PatientBannerEventArgs(string identifier, PatientGender gender)
 {
     this.identifier = identifier;
     this.gender     = gender;
 }
        protected override void OnSetup()
        {
            base.OnSetup();

            var accessControlManagerMock = new Mock <IAccessControlManager> ();

            accessControlManagerMock.Setup(p => p.CanAccess(It.IsAny <ResourceRequest> ())).Returns(true);
            AccessControlManager = accessControlManagerMock.Object;

            using (ITransaction trans = Session.BeginTransaction())
            {
                // Agency Types
                TreatmentProviderAgencyType = BuildLookup <AgencyType> ("Treatment Provider");
                CriminalJusticeAgencyType   = BuildLookup <AgencyType> ("Criminal Justice");
                SingleStateAgencyAgencyType = BuildLookup <AgencyType> ("Single State Agency");
                RecoverySupportServicesProviderAgencyType = BuildLookup <AgencyType> ("Recovery Support Services Provider");
                SystemTestingAgencyType = BuildLookup <AgencyType> ("System Testing Agency");
                StateAgencyAgencyType   = BuildLookup <AgencyType> ("State Agency");

                // Agency Address Types
                AdministrationAgencyAddressType = BuildLookup <AgencyAddressType> ("Administration");

                // Agency Address Phone Types
                TollFreeAgencyPhoneType  = BuildLookup <AgencyPhoneType> ("Toll Free");
                FaxAgencyPhoneType       = BuildLookup <AgencyPhoneType> ("Fax");
                MainAgencPhoneType       = BuildLookup <AgencyPhoneType> ("Main");
                EmergencyAgencyPhoneType = BuildLookup <AgencyPhoneType> ("Emergency");

                // Agency Contact Types
                BillingAgencyContactType     = BuildLookup <AgencyContactType> ("Billing");
                EdiAgencyContactType         = BuildLookup <AgencyContactType> ("EDI");
                FiscalAdminAgencyContactType = BuildLookup <AgencyContactType> ("Fiscal/Contract Administration");
                ExecutiveContactType         = BuildLookup <AgencyContactType> ("Executive");
                CeoAgencyContactType         = BuildLookup <AgencyContactType> ("CEO");

                // Agency Identifier Types
                NpiAgencyIdentifierType = BuildLookup <AgencyIdentifierType> ("NPI");

                // Countries
                UnitedStatesCountry = BuildLookup <Country> ("United States");

                // State Provinces
                MarylandStateProvince = new StateProvince(UnitedStatesCountry)
                {
                    Name = "Maryland"
                };
                Session.SaveOrUpdate(MarylandStateProvince);

                // Gender
                var maleAdministrativeGender   = BuildCodedConceptLookup <AdministrativeGender> ("M", "Male", "M");
                var femaleAdministrativeGender = BuildCodedConceptLookup <AdministrativeGender> ("F", "Female", "F");
                MaleGender = new PatientGender(maleAdministrativeGender)
                {
                    Name = "Female Becoming Male"
                };
                FemaleGender = new PatientGender(femaleAdministrativeGender)
                {
                    Name = "Male Becoming Female"
                };
                Session.SaveOrUpdate(MaleGender);
                Session.SaveOrUpdate(FemaleGender);

                // PatientAddressType
                HomePatientAddressType = BuildLookup <PatientAddressType> ("Home", WellKnownNames.PatientModule.PatientAddressType.Home);

                // PatientPhoneType
                HomePatientPhoneType = BuildLookup <PatientPhoneType> ("Home", WellKnownNames.PatientModule.PatientPhoneType.Home);

                // Race
                WhiteRace = BuildLookup <Race> ("White");

                // PatientAliasType
                NicknamePatientAliasType = BuildLookup <PatientAliasType> ("Nickname");

                // Disability
                DeafDisability = BuildLookup <Disability> ("Deaf");

                // Allergy Status
                ActiveAllergyStatus = BuildCodedConceptLookup <AllergyStatus> ("55561003", "Active");

                // PatientAccessEventTypes
                BuildLookup <PatientAccessEventType> ("Insert", "Insert");
                BuildLookup <PatientAccessEventType> ("Update", "Update");
                BuildLookup <PatientAccessEventType> ("Delete", "Delete");
                BuildLookup <PatientAccessEventType> ("Read", "Read");

                // CodedConcepts
                AllergenCodedConcept          = BuildCodedConcept("Allergen");
                MedicationCodeCodedConcept    = BuildCodedConcept("Med Code");
                ProblemCodeCodedConcept       = BuildCodedConcept("P Code");
                LabTestResultNameCodedConcept = BuildCodedConcept("LTRN Code");
                MmrVaccineCodedConcept        = BuildCodedConcept("03", "measles, mumps and rubella virus vaccine");

                // VisitStatus
                ScheduledVisitStatus = BuildLookup <VisitStatus> ("Scheduled", WellKnownNames.VisitModule.VisitStatus.Scheduled);
                CheckedInVisitStatus = BuildLookup <VisitStatus> ("CheckedIn", WellKnownNames.VisitModule.VisitStatus.CheckedIn);

                // ProblemStatus
                ActiveProblemStatus = BuildCodedConceptLookup <ProblemStatus>("Active", "ACTIVE", "Active");

                // ActivityType
                VitalSignActivityType    = BuildLookup <ActivityType> ("VitalSign", WellKnownNames.VisitModule.ActivityType.VitalSign);
                LabSpecimentActivityType = BuildLookup <ActivityType> ("Lab Speciment", WellKnownNames.VisitModule.ActivityType.LabSpecimen);
                ImmunizationActivityType = BuildLookup <ActivityType>("Immunization", WellKnownNames.VisitModule.ActivityType.Immunization);

                //LabTestName
                LabTestNameCodedConcept = BuildCodedConceptLookup <LabTestName> ("55561003", "LTN Code");

                trans.Commit();
            }

            Session.Clear();
        }
 /// <summary>
 /// Constructs a PatientBannerEventArgs object with the given Identifier and Patient gender
 /// </summary>
 /// <param name="identifier">Identifier</param>
 /// <param name="gender">Patient gender</param>
 public PatientBannerEventArgs(string identifier, PatientGender gender)
 {
     this.identifier = identifier;            
     this.gender = gender;
 }
		///<summary>The gender of a person used for adminstrative purposes (as opposed to clinical gender). Empty string/value is allowed.</summary>
		public string administrativeGenderNameHelper(PatientGender patientGender) {
			switch(patientGender) {
				case PatientGender.Female:
					return "Female";
				case PatientGender.Male:
					return "Male";
				case PatientGender.Unknown:
					return "Undifferentiated";
				default://should never happen
					return "";
			}
		}
Exemple #17
0
 private GenderType TransformGenderType(PatientGender gender)
 {
     return(gender.WellKnownName == Gender.Male ? GenderType.M : GenderType.F);
 }