Ejemplo n.º 1
0
        private static void EnterPatient()
        {
            Console.Write("Name of patient? ");
            var name = Console.ReadLine();

            Console.Write("Condition? (F)lu, (B)reast Cancer, (H)eadAndNeck Cancer?");
            var condition = Console.ReadLine();
            PatientCondition patientCondition = PatientCondition.Flu;

            switch (condition.ToUpper())
            {
            case "B":
                patientCondition = PatientCondition.Breast;
                break;

            case "H":
                patientCondition = PatientCondition.HeadAndNeck;
                break;
            }

            var pateint = new Patient(name, patientCondition);

            _client.RegisterPatient(pateint);
            ListPatients();
        }
Ejemplo n.º 2
0
        private void UpdatePatientConditions(string[] selectedOptions, Patient patientToUpdate)
        {
            if (selectedOptions == null)
            {
                patientToUpdate.PatientConditions = new List <PatientCondition>();
                return;
            }

            var selectedOptionsHS = new HashSet <string>(selectedOptions);
            var patientOptionsHS  = new HashSet <int>
                                        (patientToUpdate.PatientConditions.Select(c => c.ConditionID));//IDs of the currently selected conditions

            foreach (var option in _context.Conditions)
            {
                if (selectedOptionsHS.Contains(option.ID.ToString()))
                {
                    if (!patientOptionsHS.Contains(option.ID))
                    {
                        patientToUpdate.PatientConditions.Add(new PatientCondition {
                            PatientID = patientToUpdate.ID, ConditionID = option.ID
                        });
                    }
                }
                else
                {
                    if (patientOptionsHS.Contains(option.ID))
                    {
                        PatientCondition conditionToRemove = patientToUpdate.PatientConditions.SingleOrDefault(c => c.ConditionID == option.ID);
                        _context.Remove(conditionToRemove);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private List <CustomAttributeDTO> getCustomAttributes(PatientCondition patientCondition)
        {
            var extendable = (IExtendable)patientCondition;

            var customAttributes = unitOfWork.Repository <PVIMS.Core.Entities.CustomAttributeConfiguration>()
                                   .Queryable()
                                   .Where(ca => ca.ExtendableTypeName == typeof(PatientCondition).Name)
                                   .ToList();

            return(customAttributes.Select(c => new CustomAttributeDTO
            {
                CustomAttributeConfigId = c.Id,
                AttributeName = c.AttributeKey,
                AttributeTypeName = c.CustomAttributeType.ToString(),
                Category = c.Category,
                EntityName = c.ExtendableTypeName,
                currentValue = GetCustomAttributeVale(extendable, c),
                lastUpdated = extendable.CustomAttributes.GetUpdatedDate(c.AttributeKey),
                lastUpdatedUser = extendable.GetUpdatedByUser(c.AttributeKey),
                Required = c.IsRequired,
                NumericMaxValue = c.NumericMaxValue,
                NumericMinValue = c.NumericMinValue,
                StringMaxLength = c.StringMaxLength,
                FutureDateOnly = c.FutureDateOnly,
                PastDateOnly = c.PastDateOnly,
            })
                   .ToList());
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Get treatment machine capability based on patient condition.
        /// If a patient has cancer, and its topology is breast, machine can be either simple or advanced; therefore return value will just be empty string.
        /// </summary>
        /// <param name="patientCondition"></param>
        /// <returns></returns>
        private List <TreatmentMachine> GetTreatmentMachineBasedOnPatientCondition(PatientCondition patientCondition)
        {
            if (patientCondition == null || PatientSchedulerContext.TreatmentMachines == null)
            {
                return(null);
            }

            //Flu patient doesn't care about treatment machine.
            if (patientCondition.ConditionName.Equals(Properties.Resource.Flu, StringComparison.OrdinalIgnoreCase))
            {
                return(PatientSchedulerContext.TreatmentMachines);
            }

            //Cancer patient has Head & Neck topology needs to have an Advanced machine.
            if (patientCondition.TopologyName.Equals(Properties.Resource.HeadNeck, StringComparison.OrdinalIgnoreCase))
            {
                return
                    (PatientSchedulerContext.TreatmentMachines.Where(
                         t =>
                         !string.IsNullOrEmpty(t.MachineCapability) &&
                         t.MachineCapability.Equals(Properties.Resource.Advanced, StringComparison.OrdinalIgnoreCase)).ToList());
            }

            // All other cancer patients can have either Simple or Advanced machine.
            return
                (PatientSchedulerContext.TreatmentMachines.Where(
                     t =>
                     !string.IsNullOrEmpty(t.MachineCapability) && (
                         t.MachineCapability.Equals(Properties.Resource.Advanced, StringComparison.OrdinalIgnoreCase) ||
                         t.MachineCapability.Equals(Properties.Resource.Simple, StringComparison.OrdinalIgnoreCase))).ToList());
        }
    public static PatientCondition LoadAll(DataRow row)
    {
        PatientCondition patientCondition = Load(row, "patient_condition_");

        patientCondition.Condition            = ConditionDB.Load(row, "condition_");
        patientCondition.Patient              = PatientDB.Load(row, "patient_");
        patientCondition.Patient.Person       = PersonDB.Load(row, "person_", "entity_id");
        patientCondition.Patient.Person.Title = IDandDescrDB.Load(row, "title_title_id", "title_descr");
        return(patientCondition);
    }
Ejemplo n.º 6
0
	void Start()
	{		
		ritual.GetComponent<Button>().interactable = false;
		patientConditionGenerator = FindObjectOfType<PatientCondition>();

		// Store a random answer set
		answerArray = patientConditionGenerator.ChooseCondition();

		loadButtons();
	}
Ejemplo n.º 7
0
 public Patient(string name, PatientCondition condition, ConditionTopography topography = ConditionTopography.None)
 {
     Name      = name;
     Condition = condition;
     if (Condition == PatientCondition.Cancer && topography == ConditionTopography.None)
     {
         throw new ArgumentException("Missing Condition Topography...");
     }
     PatientConditionTopography = topography;
 }
    public static PatientCondition[] GetByPatientID(int patient_id, bool inc_deleted = false)
    {
        DataTable tbl = GetDatatable_ByPatientID(patient_id, inc_deleted);

        PatientCondition[] list = new PatientCondition[tbl.Rows.Count];
        for (int i = 0; i < tbl.Rows.Count; i++)
        {
            list[i] = PatientConditionDB.LoadAll(tbl.Rows[i]);
        }
        return(list);
    }
Ejemplo n.º 9
0
        public IEnumerable <MedicalRecord> FilterRecordsByState(PatientCondition state)
        {
            var allRecordsByState = stream.GetAll().Where(item => item.CurrHealthState == state).ToList();

            foreach (MedicalRecord record in allRecordsByState)
            {
                CompleteObject(record);
            }

            return(allRecordsByState);
        }
Ejemplo n.º 10
0
 public MedicalRecord(PatientCondition currHealthState, BloodType bloodType, string patientId)
 {
     CurrHealthState      = currHealthState;
     BloodType            = bloodType;
     Allergens            = new List <Allergens>();
     Vaccines             = new List <Vaccines>();
     IllnessHistory       = new List <Diagnosis>();
     Therapies            = new List <Therapy>();
     FamilyIllnessHistory = new List <FamilyIllnessHistory>();
     PatientId            = patientId;
 }
Ejemplo n.º 11
0
 public MedicalRecord(BloodType bloodType, Patient patient, PatientCondition patientCondition)
 {
     BloodType            = bloodType;
     Patient              = patient;
     CurrHealthState      = patientCondition;
     Allergies            = new List <Allergens>();
     IllnessHistory       = new List <Diagnosis>();
     FamilyIllnessHistory = new List <FamilyIllnessHistory>();
     Therapies            = new List <Therapy>();
     ListOfResults        = new List <ListOfResults>();
     Vaccines             = new List <Vaccines>();
 }
Ejemplo n.º 12
0
        public async Task <IActionResult> Create([Bind("ID,OHIP,FirstName,MiddleName,LastName,DOB,ExpYrVisits,Phone,eMail,MedicalTrialID,DoctorID")] Patient patient,
                                                 string[] selectedOptions, IFormFile thePicture)
        {
            //Get the URL with the last filter, sort and page parameters
            ViewData["returnURL"] = MaintainURL.ReturnURL(HttpContext, "Patients");

            try
            {
                //Add the selected conditions
                if (selectedOptions != null)
                {
                    foreach (var condition in selectedOptions)
                    {
                        var conditionToAdd = new PatientCondition {
                            PatientID = patient.ID, ConditionID = int.Parse(condition)
                        };
                        patient.PatientConditions.Add(conditionToAdd);
                    }
                }

                if (ModelState.IsValid)
                {
                    await AddPicture(patient, thePicture);

                    _context.Add(patient);
                    await _context.SaveChangesAsync();

                    //Send on to add appointments
                    return(RedirectToAction("Index", "PatientAppt", new { PatientID = patient.ID }));
                }
            }
            catch (RetryLimitExceededException /* dex */)
            {
                ModelState.AddModelError("", "Unable to save changes after multiple attempts. Try again, and if the problem persists, see your system administrator.");
            }
            catch (DbUpdateException dex)
            {
                if (dex.GetBaseException().Message.Contains("UNIQUE constraint failed: Patients.OHIP"))
                {
                    ModelState.AddModelError("OHIP", "Unable to save changes. Remember, you cannot have duplicate OHIP numbers.");
                }
                else
                {
                    ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
                }
            }

            //Validaiton Error so give the user another chance.
            PopulateAssignedConditionData(patient);
            PopulateDropDownLists(patient);
            return(View(patient));
        }
        private void CustomMap(PatientCondition patientConditionFromRepo, PatientConditionDetailDto dto)
        {
            IExtendable patientConditionExtended = patientConditionFromRepo;

            // Map all custom attributes
            dto.ConditionAttributes = _modelExtensionBuilder.BuildModelExtension(patientConditionExtended)
                                      .Select(h => new AttributeValueDto()
            {
                Key            = h.AttributeKey,
                Value          = h.TransformValueToString(),
                Category       = h.Category,
                SelectionValue = GetSelectionValue(h.Type, h.AttributeKey, h.Value.ToString())
            }).Where(s => (s.Value != "0" && !String.IsNullOrWhiteSpace(s.Value)) || !String.IsNullOrWhiteSpace(s.SelectionValue)).ToList();
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Get a list of available treatment rooms based on patient condition
        ///
        /// </summary>
        /// <param name="patientCondition"></param>
        /// <param name="scheduledConsultations"></param>
        /// <returns></returns>
        private List <TreatmentRoom> FindAvailableTreatmentRooms(PatientCondition patientCondition,
                                                                 List <Consultation> scheduledConsultations)
        {
            if (patientCondition == null)
            {
                return(null);
            }

            var scheduledTreatmentRooms = new List <TreatmentRoom>();

            if (scheduledConsultations != null)
            {
                scheduledTreatmentRooms = new List <TreatmentRoom>(scheduledConsultations.Select(r => r.Room).ToList());
            }

            List <TreatmentMachine> machines = GetTreatmentMachineBasedOnPatientCondition(patientCondition);

            // If patient has flu, a treatment without machine is preferred.
            if (patientCondition.ConditionName.Equals(Properties.Resource.Flu, StringComparison.OrdinalIgnoreCase))
            {
                var availableRooms = new List <TreatmentRoom>(
                    PatientSchedulerContext.TreatmentRooms.Except(scheduledTreatmentRooms)
                    .Where(t => t.TreatmentMachine == null || string.IsNullOrEmpty(t.TreatmentMachine.MachineName))
                    .ToList());
                // then any available treatment
                if (!availableRooms.Any())
                {
                    availableRooms =
                        new List <TreatmentRoom>(
                            PatientSchedulerContext.TreatmentRooms.Except(scheduledTreatmentRooms).ToList());
                }

                return(availableRooms);
            }

            List <TreatmentRoom> returnRooms = new List <TreatmentRoom>();
            var rooms = PatientSchedulerContext.TreatmentRooms.Except(scheduledTreatmentRooms);

            foreach (var room in rooms)
            {
                returnRooms.AddRange(from m in machines
                                     where
                                     room.TreatmentMachine.MachineName.Equals(m.MachineName,
                                                                              StringComparison.OrdinalIgnoreCase)
                                     select room);
            }

            return(returnRooms);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Get doctor role based on patient's condition
        /// </summary>
        /// <param name="patientCondition"></param>
        /// <returns></returns>
        private string GetDoctorRoleBasedOnPatientCondition(PatientCondition patientCondition)
        {
            string doctorRole = string.Empty;

            if (patientCondition.ConditionName.Equals(Properties.Resource.Flu, StringComparison.OrdinalIgnoreCase))
            {
                doctorRole = Properties.Resource.GeneralPractitioner;
            }
            else if (patientCondition.ConditionName.Equals(Properties.Resource.Cancer, StringComparison.OrdinalIgnoreCase))
            {
                doctorRole = Properties.Resource.Oncologist;
            }

            return(doctorRole);
        }
        public int Save(PatientCondition _patientCondition)
        {
            int saveIndex = 0;

            try
            {
                _patientCondition.IsActive    = true;
                _patientCondition.Createddate = DateTime.Now;
                saveIndex = _patientConditionRepository.Save(_patientCondition);
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message);
            }
            return(saveIndex);
        }
        public int DeleteCondition(int patientConditionId)
        {
            int deleteIndex = 0;

            try
            {
                PatientCondition patientCondition = GetPatientconditionById(patientConditionId);
                patientCondition.IsActive = false;
                deleteIndex = _patientConditionRepository.Edit(patientCondition);
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message);
            }

            return(deleteIndex);
        }
Ejemplo n.º 18
0
        private void CheckColumnsExist()
        {
            Patient patient = new Patient();

            ProcessEntity(patient, "Patient");
            patient = null;

            PatientMedication patientMedication = new PatientMedication();

            ProcessEntity(patientMedication, "PatientMedication");
            patientMedication = null;

            PatientClinicalEvent patientClinicalEvent = new PatientClinicalEvent();

            ProcessEntity(patientClinicalEvent, "PatientClinicalEvent");
            patientClinicalEvent = null;

            PatientCondition patientCondition = new PatientCondition();

            ProcessEntity(patientCondition, "PatientCondition");
            patientCondition = null;

            PatientLabTest patientLabTest = new PatientLabTest();

            ProcessEntity(patientLabTest, "PatientLabTest");
            patientLabTest = null;

            Encounter encounter = new Encounter(patient);

            ProcessEntity(encounter, "Encounter");
            encounter = null;

            CohortGroupEnrolment cohortGroupEnrolment = new CohortGroupEnrolment();

            ProcessEntity(cohortGroupEnrolment, "CohortGroupEnrolment");
            cohortGroupEnrolment = null;

            PatientFacility patientFacility = new PatientFacility();

            ProcessEntity(patientFacility, "PatientFacility");
            patientFacility = null;

            _summary += String.Format("<li>INFO: All columns checked and verified...</li>");
        }
Ejemplo n.º 19
0
        private void PopulateMetaTables()
        {
            Patient patient = new Patient();

            ProcessInsertEntity(patient, "Patient");
            patient = null;

            PatientMedication patientMedication = new PatientMedication();

            ProcessInsertEntity(patientMedication, "PatientMedication");
            patientMedication = null;

            PatientClinicalEvent patientClinicalEvent = new PatientClinicalEvent();

            ProcessInsertEntity(patientClinicalEvent, "PatientClinicalEvent");
            patientClinicalEvent = null;

            PatientCondition patientCondition = new PatientCondition();

            ProcessInsertEntity(patientCondition, "PatientCondition");
            patientCondition = null;

            PatientLabTest patientLabTest = new PatientLabTest();

            ProcessInsertEntity(patientLabTest, "PatientLabTest");
            patientLabTest = null;

            Encounter encounter = new Encounter(patient);

            ProcessInsertEntity(encounter, "Encounter");
            encounter = null;

            CohortGroupEnrolment cohortGroupEnrolment = new CohortGroupEnrolment();

            ProcessInsertEntity(cohortGroupEnrolment, "CohortGroupEnrolment");
            cohortGroupEnrolment = null;

            PatientFacility patientFacility = new PatientFacility();

            ProcessInsertEntity(patientFacility, "PatientFacility");
            patientFacility = null;

            _summary += String.Format("<li>INFO: All meta data seeded...</li>");
        }
Ejemplo n.º 20
0
        private List <Doctor> FindAvailableDoctors(PatientCondition patientCondition, List <Consultation> scheduledConsultations)
        {
            if (patientCondition == null)
            {
                return(null);
            }

            string doctorType = GetDoctorRoleBasedOnPatientCondition(patientCondition);

            List <Doctor> scheduledDoctors = new List <Doctor>();

            if (scheduledConsultations != null && scheduledConsultations.Count > 0)
            {
                scheduledDoctors = new List <Doctor>(scheduledConsultations.Select(a => a.Doctor).ToList());
            }

            return
                (PatientSchedulerContext.Doctors.Except(scheduledDoctors)
                 .Where(doc => doc.Roles != null && doc.Roles.Contains(doctorType))
                 .ToList());
        }
        public JsonResult Save(PatientConditionViewModel model)
        {
            ModelState.Clear();

            int saveIndex = 0;

            PatientCondition _patientCondition = new PatientCondition();

            _patientCondition.PatientConditionId = model.PatientConditionId;
            _patientCondition.PatienId           = model.PatienId;
            _patientCondition.DiseasesId         = model.DiseasesId;
            _patientCondition.ServiceId          = model.ServiceId;
            _patientCondition.Beforetreatment    = model.Beforetreatment;
            _patientCondition.AfterTreatment     = model.AfterTreatment;
            _patientCondition.Createddate        = model.Createddate;
            _patientCondition.ModifiedDate       = model.ModifiedDate;

            saveIndex = model.PatientConditionId == 0
                ? PatientConditionManager.Save(_patientCondition)
                : PatientConditionManager.Edit(_patientCondition);
            return(Reload(saveIndex));
        }
Ejemplo n.º 22
0
        public ActionResult Edit(PatientConditionViewModel model)
        {
            ModelState.Clear();
            model.Patients = PatientManager.GetAllPatient();
            model.Diseases = DiseasesManager.GetAllDiseases();
            model.Services = ServiceManager.GetAllService();

            if (model.PatientConditionId > 0)
            {
                PatientCondition patientCondition =
                    PatientConditionManager.GetPatientconditionById(model.PatientConditionId);
                model.PatientConditionId = patientCondition.PatientConditionId;
                model.PatienId           = patientCondition.PatienId;
                model.DiseasesId         = patientCondition.DiseasesId;
                model.ServiceId          = patientCondition.ServiceId;
                model.Beforetreatment    = patientCondition.Beforetreatment;
                model.AfterTreatment     = patientCondition.AfterTreatment;
                model.Createddate        = patientCondition.Createddate;
                model.ModifiedDate       = patientCondition.ModifiedDate;
            }
            return(View(model));
        }
Ejemplo n.º 23
0
        public JsonResult Save(PatientConditionViewModel model)
        {
            ModelState.Clear();

            int saveIndex = 0;

            PatientCondition _patientCondition = new PatientCondition();

            _patientCondition.PatientConditionId = model.PatientConditionId;
            _patientCondition.PatienId           = model.PatienId;
            _patientCondition.DiseasesId         = model.DiseasesId;
            _patientCondition.ServiceId          = model.ServiceId;
            _patientCondition.Beforetreatment    = model.Beforetreatment;
            _patientCondition.AfterTreatment     = model.AfterTreatment;
            _patientCondition.Createddate        = model.Createddate;
            _patientCondition.ModifiedDate       = model.ModifiedDate;

            saveIndex = model.PatientConditionId == 0
                ? PatientConditionManager.Save(_patientCondition)
                : PatientConditionManager.Edit(_patientCondition);
            return(Reload(saveIndex));
        } //$.getJSON('/CourseAssignToTeacher/GetTeachersByDepartmentId', { id: deptId }).done(function(data) {
        public int Edit(PatientCondition _patientCondition)
        {
            int editIndex = 0;

            try
            {
                PatientCondition patientCondition = GetPatientconditionById(_patientCondition.PatientConditionId);
                patientCondition.PatientConditionId = _patientCondition.PatientConditionId;
                patientCondition.PatienId           = _patientCondition.PatienId;
                patientCondition.DiseasesId         = _patientCondition.DiseasesId;
                patientCondition.ServiceId          = _patientCondition.ServiceId;
                patientCondition.Beforetreatment    = _patientCondition.Beforetreatment;
                patientCondition.AfterTreatment     = _patientCondition.AfterTreatment;
                //patientCondition.Createddate = DateTime.Now;
                patientCondition.ModifiedDate = DateTime.Now;
                editIndex = _patientConditionRepository.Edit(patientCondition);
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message);
            }
            return(editIndex);
        }
Ejemplo n.º 25
0
 /// <summary>
 /// 初始化所有的属性,包括引用类型的属性自己的属性
 /// </summary>
 public override void ReInitializeAllProperties()
 {
     ReInitializeProperties();
     if (PatientCondition != null)
     {
         PatientCondition.ReInitializeAllProperties();
     }
     if (Medicare != null)
     {
         Medicare.ReInitializeAllProperties();
     }
     if (PaymentKind != null)
     {
         PaymentKind.ReInitializeAllProperties();
     }
     if (PatientSource != null)
     {
         PatientSource.ReInitializeAllProperties();
     }
     if (PatientKind != null)
     {
         PatientKind.ReInitializeAllProperties();
     }
     if (Recorder != null)
     {
         Recorder.ReInitializeAllProperties();
     }
     if (PersonalInformation != null)
     {
         PersonalInformation.ReInitializeAllProperties();
         InitBaseInfo();
     }
     if (InfoOfAdmission != null)
     {
         InfoOfAdmission.ReInitializeAllProperties();
     }
 }
Ejemplo n.º 26
0
        /// <summary>
        /// Prepare patient record with associated conditions
        /// </summary>
        private void AddConditions(Patient patient, List <ConditionDetail> conditions)
        {
            if (patient == null)
            {
                throw new ArgumentNullException(nameof(patient));
            }
            if (conditions == null)
            {
                throw new ArgumentNullException(nameof(conditions));
            }
            if (conditions.Count == 0)
            {
                return;
            }

            foreach (var condition in conditions)
            {
                var treatmentOutcome  = !String.IsNullOrWhiteSpace(condition.TreatmentOutcome) ? _unitOfWork.Repository <TreatmentOutcome>().Get(to => to.Description == condition.TreatmentOutcome) : null;
                var terminologyMedDra = condition.MeddraTermId != null?_unitOfWork.Repository <TerminologyMedDra>().Get(tm => tm.Id == condition.MeddraTermId) : null;

                var patientCondition = new PatientCondition
                {
                    Patient           = patient,
                    ConditionSource   = condition.ConditionSource,
                    TerminologyMedDra = terminologyMedDra,
                    OnsetDate         = Convert.ToDateTime(condition.OnsetDate),
                    TreatmentOutcome  = treatmentOutcome,
                    CaseNumber        = condition.CaseNumber,
                    Comments          = condition.Comments
                };

                // Custom Property handling
                _typeExtensionHandler.UpdateExtendable(patientCondition, condition.CustomAttributes, "Admin");

                patient.PatientConditions.Add(patientCondition);
            }
        }
        public List <PatientCondition> GetAllPatientconditionByPaging(out int totalrecords, PatientCondition model)
        {
            List <PatientCondition> patientConditions;

            try
            {
                patientConditions = _patientConditionRepository.GetAllPatientconditionByPaging(out totalrecords, model);
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message);
            }
            return(patientConditions);
        }
Ejemplo n.º 28
0
 public static PatientCondition[] GetByPatientID(int patient_id, bool inc_deleted = false)
 {
     DataTable tbl = GetDatatable_ByPatientID(patient_id, inc_deleted);
     PatientCondition[] list = new PatientCondition[tbl.Rows.Count];
     for (int i = 0; i < tbl.Rows.Count; i++)
         list[i] = PatientConditionDB.LoadAll(tbl.Rows[i]);
     return list;
 }
Ejemplo n.º 29
0
 public IEnumerable <MedicalRecord> FilterRecordsByState(PatientCondition state, Doctor doctor) => medicalRecordService.FilterRecordsByState(state, doctor);
Ejemplo n.º 30
0
 public MedicalRecord(PatientCondition patientCondition, BloodType bloodType, string patientId)
 {
     CurrHealthState = patientCondition;
     BloodType       = bloodType;
     PatientId       = patientId;
 }
Ejemplo n.º 31
0
        private static void RunTask(int id, StreamWriter logFile, CancellationToken cancelToken)
        {
            ss.Release();
            WriteLine(string.Format("Starting task ID: {0}", id), logFile);
            Thread.Sleep(1000);

            var optionRandom     = new Random();
            var conditionRandom  = new Random();
            var topographyRandom = new Random();
            var nameRandom       = new Random();

            for (int j = 1; j < noOfOperations; j++)
            {
                if (cancelToken.IsCancellationRequested)
                {
                    WriteLine(string.Format("Task [{0}] cancelled", id), logFile);
                    break;
                }
                var option = optionRandom.Next(1, 5);
                switch (option)
                {
                case 1:
                    var cr = conditionRandom.Next(1, 19) % conditionRandom.Next(1, 19);
                    PatientCondition pc = PatientCondition.Flu;
                    if (cr % 2 == 0)
                    {
                        pc = PatientCondition.Cancer;
                    }

                    ConditionTopography ct = ConditionTopography.None;

                    if (pc == PatientCondition.Cancer)
                    {
                        var t = topographyRandom.Next(1, 29) % topographyRandom.Next(1, 29);
                        ct = ConditionTopography.HeadAndNeck;
                        if (t % 3 == 0)
                        {
                            ct = ConditionTopography.Breast;
                        }
                    }

                    var p = new Patient(string.Format("Test_{0} Patient_{1}",
                                                      id * j, id * j + 1), pc, ct);
                    patientNames.TryAdd(p.Name, p.Name);
                    Program.RegisterPatient(p);
                    WriteLine(string.Format("Initiated Registration for Patient '{0}'", p), logFile);
                    break;

                case 2:
                    var names = patientNames.ToList();
                    if (!names.Any())
                    {
                        Thread.Sleep(100);
                        continue;
                    }
                    var nameIndex = nameRandom.Next(0, names.Count);

                    var result = Program.IsRegistrationSuccessful(names[nameIndex].Key);
                    if (!result.Item1)
                    {
                        WriteLine(string.Format("Failed to Register patient: '{0}' will check later",
                                                names[nameIndex].Key), logFile);
                    }

                    break;

                case 3:
                    Program.GetRegisteredPatients(logFile);
                    break;

                case 4:
                    Program.GetScheduledConsultations(logFile);
                    break;

                default:
                    break;
                }
            }
            WriteLine(string.Format("Task [{0}] End", id), logFile);
        }
    protected void FillGrdCondition(Patient patient = null)
    {
        if (patient == null)
        {
            patient = PatientDB.GetByID(GetFormPatientID());
        }

        DataTable dt            = ConditionDB.GetDataTable(false);
        Hashtable conditionHash = ConditionDB.GetHashtable(false);

        Session["patientcondition_data"] = dt;

        if (dt.Rows.Count > 0)
        {
            GrdCondition.DataSource = dt;
            try
            {
                GrdCondition.DataBind();

                Hashtable selectedConditions = PatientConditionDB.GetHashtable_ByPatientID(patient.PatientID, false);
                foreach (GridViewRow row in GrdCondition.Rows)
                {
                    Label        lblId          = row.FindControl("lblId") as Label;
                    CheckBox     chkSelect      = row.FindControl("chkSelect") as CheckBox;
                    DropDownList ddlDate_Day    = (DropDownList)row.FindControl("ddlDate_Day");
                    DropDownList ddlDate_Month  = (DropDownList)row.FindControl("ddlDate_Month");
                    DropDownList ddlDate_Year   = (DropDownList)row.FindControl("ddlDate_Year");
                    DropDownList ddlNbrWeeksDue = (DropDownList)row.FindControl("ddlNbrWeeksDue");

                    Label lblNextDue        = row.FindControl("lblNextDue") as Label;
                    Label lblWeeksLater     = row.FindControl("lblWeeksLater") as Label;
                    Label lblAdditionalInfo = row.FindControl("lblAdditionalInfo") as Label;


                    System.Web.UI.HtmlControls.HtmlControl br_date      = (System.Web.UI.HtmlControls.HtmlControl)row.FindControl("br_date");
                    System.Web.UI.HtmlControls.HtmlControl br_nweeksdue = (System.Web.UI.HtmlControls.HtmlControl)row.FindControl("br_nweeksdue");
                    System.Web.UI.HtmlControls.HtmlControl br_text      = (System.Web.UI.HtmlControls.HtmlControl)row.FindControl("br_text");

                    TextBox txtText = (TextBox)row.FindControl("txtText");

                    if (lblId == null || chkSelect == null)
                    {
                        continue;
                    }

                    Condition condition = (Condition)conditionHash[Convert.ToInt32(lblId.Text)];

                    br_date.Visible           = condition.ShowDate;
                    ddlDate_Day.Visible       = condition.ShowDate;
                    ddlDate_Month.Visible     = condition.ShowDate;
                    ddlDate_Year.Visible      = condition.ShowDate;
                    br_nweeksdue.Visible      = condition.ShowNWeeksDue;
                    ddlNbrWeeksDue.Visible    = condition.ShowNWeeksDue;
                    lblNextDue.Visible        = condition.ShowNWeeksDue;
                    lblWeeksLater.Visible     = condition.ShowNWeeksDue;
                    br_text.Visible           = condition.ShowText;
                    txtText.Visible           = condition.ShowText;
                    lblAdditionalInfo.Visible = condition.ShowText;


                    if (selectedConditions[Convert.ToInt32(lblId.Text)] != null)
                    {
                        PatientCondition ptCondition = (PatientCondition)selectedConditions[Convert.ToInt32(lblId.Text)];

                        chkSelect.Checked = selectedConditions[Convert.ToInt32(lblId.Text)] != null;

                        if (condition.ShowDate)
                        {
                            if (ptCondition.Date != DateTime.MinValue)
                            {
                                ddlDate_Day.SelectedValue   = ptCondition.Date.Day.ToString();
                                ddlDate_Month.SelectedValue = ptCondition.Date.Month.ToString();
                                ddlDate_Year.SelectedValue  = ptCondition.Date.Year.ToString();
                            }
                        }
                        if (condition.ShowNWeeksDue)
                        {
                            ddlNbrWeeksDue.SelectedValue = ptCondition.NWeeksDue.ToString();
                        }
                        if (condition.ShowText)
                        {
                            txtText.Text = ptCondition.Text;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                SetErrorMessage("", ex.ToString());
            }

            //Sort("parent_descr", "ASC");
        }
        else
        {
            dt.Rows.Add(dt.NewRow());
            GrdCondition.DataSource = dt;
            GrdCondition.DataBind();

            int TotalColumns = GrdCondition.Rows[0].Cells.Count;
            GrdCondition.Rows[0].Cells.Clear();
            GrdCondition.Rows[0].Cells.Add(new TableCell());
            GrdCondition.Rows[0].Cells[0].ColumnSpan = TotalColumns;
            GrdCondition.Rows[0].Cells[0].Text       = "No Record Found";
        }
    }