Exemple #1
0
        /**
         * A method that allows us to determine the stage of the breast cancer. Stages are computed based on the rules given by Digital Health Assistant.
         */
        internal short DetermineStage(DistantMetastasisState distantMetastasis, PrimaryTumorState primaryTumor, RegionalLymphNodesState regionalLymphNodes)
        {
            // Stage 4 cancer
            if (distantMetastasis == DistantMetastasisState.M1)
            {
                return(4);
            }

            // Stage 0 cancer
            if (regionalLymphNodes == RegionalLymphNodesState.N0 && primaryTumor == PrimaryTumorState.T0)
            {
                return(0);
            }

            // Stage 1 cancer
            if ((regionalLymphNodes == RegionalLymphNodesState.N1 && primaryTumor == PrimaryTumorState.T0) ||
                (regionalLymphNodes == RegionalLymphNodesState.N1 && primaryTumor == PrimaryTumorState.T1) ||
                (regionalLymphNodes == RegionalLymphNodesState.N1 && primaryTumor == PrimaryTumorState.T1))
            {
                return(1);
            }

            // Stage 2 cancer
            if ((regionalLymphNodes == RegionalLymphNodesState.N1 && primaryTumor == PrimaryTumorState.T1) ||
                (regionalLymphNodes == RegionalLymphNodesState.N0 && primaryTumor == PrimaryTumorState.T2) ||
                (regionalLymphNodes == RegionalLymphNodesState.N1 && primaryTumor == PrimaryTumorState.T2) ||
                (regionalLymphNodes == RegionalLymphNodesState.N0 && primaryTumor == PrimaryTumorState.T3))
            {
                return(2);
            }

            // Everything inbetween falls into the Stage 3 category
            return(3);
        }
Exemple #2
0
        public static string TranslateMetastatsisState(DistantMetastasisState state)
        {
            var distantMetastasisState = "";

            if (state == DistantMetastasisState.M0)
            {
                distantMetastasisState += "M0 no evidence of distant metastases";
            }
            else if (state == DistantMetastasisState.M1)
            {
                distantMetastasisState += "M2 distant detectable metastases as determined by clinical and radiographic means";
            }

            return(distantMetastasisState);
        }
Exemple #3
0
        public async Task <IActionResult> CreateAsync(string patientId, PrimaryTumorState primaryTumor, DistantMetastasisState distantMetastasis, RegionalLymphNodesState regionalLymphNodes)
        {
            Patient patient = await _patientService.GetByIdAsync(patientId);

            Doctor doctor = await _doctorService.GetByUserIdAsync(_userManager.GetUserId(HttpContext.User));

            if (patient.ActiveDiagnoseId != 0)
            {
                var oldDiagnose = await _diagnoseService.GetByIdAsync(patient.ActiveDiagnoseId);

                if (oldDiagnose != null && oldDiagnose.Treatment != null)
                {
                    oldDiagnose.Treatment.End = DateTime.Now;
                    await _diagnoseService.UpdateAsync();
                }
            }

            Diagnose diagnose = new Diagnose()
            {
                Patient            = patient,
                Doctor             = doctor,
                DistantMetastasis  = distantMetastasis,
                PrimaryTumor       = primaryTumor,
                RegionalLymphNodes = regionalLymphNodes,
                Stage = _diagnoseService.DetermineStage(distantMetastasis, primaryTumor, regionalLymphNodes)
            };

            HealthCheck healthCheck = new HealthCheck()
            {
                Diagnose  = diagnose,
                Timestamp = DateTime.Now
            };

            var healthCheckId = await _healthCheckService.CreateAsync(healthCheck);

            healthCheck = await _healthCheckService.GetByIdAsync(healthCheckId);

            patient.ActiveDiagnoseId = healthCheck.Diagnose.Id;

            await _patientService.UpdateAsync();

            return(RedirectToAction("", "DoctorDashboard"));
        }