コード例 #1
0
        public void ConfigureServices(IServiceCollection services)
        {
            // Examinations
            IExaminationRepository        examinationRepository        = new ExaminationSqlRepository(GetContextFactory());
            IShiftRepository              shiftRepository              = new ShiftSqlRepository(GetContextFactory());
            IExaminationSchedulingService examinationSchedulingService =
                new ExaminationSchedulingService(examinationRepository, shiftRepository);

            DoctorAvailabilityService availabilityService = new DoctorAvailabilityService(shiftRepository, examinationRepository);
            ExaminationService        examinationService  = new ExaminationService(examinationRepository, shiftRepository);

            IConnection             patientConnection       = CreateConnection(UserUrl, "user/patient");
            IConnection             doctorConnection        = CreateConnection(UserUrl, "user/doctor");
            IConnection             roomConnection          = CreateConnection(HospitalUrl, "hospital/room");
            ExaminationServiceProxy examinationServiceProxy =
                new ExaminationServiceProxy(
                    examinationService,
                    roomConnection, doctorConnection, patientConnection);

            // Recommendations
            IRecommendationService recommendationService =
                new RecommendationService(examinationRepository, shiftRepository, doctorConnection);

            // Diagnoses
            IDiagnosisRepository diagnosisRepository = new DiagnosisSqlRepository(GetContextFactory());
            IDiagnosisService    diagnosisService    = new DiagnosisService(diagnosisRepository);

            services.Add(new ServiceDescriptor(typeof(IDiagnosisService), diagnosisService));
            services.Add(new ServiceDescriptor(typeof(ExaminationServiceProxy), examinationServiceProxy));
            services.Add(new ServiceDescriptor(typeof(RecommendationService), recommendationService));
            services.Add(new ServiceDescriptor(typeof(DoctorAvailabilityService), availabilityService));
            services.Add(new ServiceDescriptor(typeof(IExaminationSchedulingService), examinationSchedulingService));

            services.AddControllers().AddNewtonsoftJson(x => x.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore);
        }
コード例 #2
0
        // ReSharper disable once UnusedMember.Local
        public static void Main()
        {
            // Breaking the rules for the examine event because the result of the services is used in the following
            // service call. We still signal an event for this, but in general all of the logic should go into this method.

            using (new Profiler(nameof(mod_on_examine)))
            {
                NWPlayer examiner       = (_.OBJECT_SELF);
                NWObject examinedObject = NWNXObject.StringToObject(NWNXEvents.GetEventData("EXAMINEE_OBJECT_ID"));
                if (ExaminationService.OnModuleExamine(examiner, examinedObject))
                {
                    MessageHub.Instance.Publish(new OnModuleExamine());
                    return;
                }

                string description;

                if (_.GetIsPC(examinedObject.Object) == true)
                {
                    // https://github.com/zunath/SWLOR_NWN/issues/853
                    // safest probably to get the modified (non-original) description only for players
                    // may want to always get the modified description for later flexibility?
                    description = _.GetDescription(examinedObject.Object, false) + "\n\n";
                }
                else
                {
                    description = _.GetDescription(examinedObject.Object, true) + "\n\n";
                }

                if (examinedObject.IsCreature)
                {
                    var    racialID   = Convert.ToInt32(_.Get2DAString("racialtypes", "Name", (int)_.GetRacialType(examinedObject)));
                    string racialtype = _.GetStringByStrRef(racialID);
                    if (!description.Contains(ColorTokenService.Green("Racial Type: ") + racialtype))
                    {
                        description += ColorTokenService.Green("Racial Type: ") + racialtype;
                    }
                }

                description = ModService.OnModuleExamine(description, examiner, examinedObject);
                description = ItemService.OnModuleExamine(description, examinedObject);
                description = DurabilityService.OnModuleExamine(description, examinedObject);

                if (!string.IsNullOrWhiteSpace(description))
                {
                    _.SetDescription(examinedObject.Object, description, false);
                    _.SetDescription(examinedObject.Object, description);
                }
            }

            MessageHub.Instance.Publish(new OnModuleExamine());
        }
コード例 #3
0
        public ActionResult <PagedResult <ExaminationResponse> > GetExaminations([FromQuery] string password,
                                                                                 [FromQuery] int page,
                                                                                 [FromQuery] int count,
                                                                                 [FromQuery] double[] age,
                                                                                 [FromQuery] Gender?gender,
                                                                                 [FromQuery] Consistency[] consistency,
                                                                                 [FromQuery] double[] ph,
                                                                                 [FromQuery] ExaminationStatus[] akkermansiaMuciniphila,
                                                                                 [FromQuery] ExaminationStatus[] faecalibactriumPrausnitzii)
        {
            try
            {
                var service      = new ExaminationService(password, "5432");
                var examinations = service.GetAllExaminations(page, count, gender, age, ph, consistency, akkermansiaMuciniphila, faecalibactriumPrausnitzii);

                return(examinations);
            }
            catch (AuthorizationException)
            {
                return(Unauthorized());
            }
        }
コード例 #4
0
        // ReSharper disable once UnusedMember.Local
        private static void Main()
        {
            // Breaking the rules for the examine event because the result of the services is used in the following
            // service call. We still signal an event for this, but in general all of the logic should go into this method.

            using (new Profiler(nameof(mod_on_examine)))
            {
                NWPlayer examiner       = (Object.OBJECT_SELF);
                NWObject examinedObject = NWNXEvents.OnExamineObject_GetTarget();
                if (ExaminationService.OnModuleExamine(examiner, examinedObject))
                {
                    MessageHub.Instance.Publish(new OnModuleExamine());
                    return;
                }

                string description = _.GetDescription(examinedObject.Object, _.TRUE) + "\n\n";

                if (examinedObject.IsCreature)
                {
                    int    racialID   = Convert.ToInt32(_.Get2DAString("racialtypes", "Name", _.GetRacialType(examinedObject)));
                    string racialtype = _.GetStringByStrRef(racialID);
                    description += ColorTokenService.Green("Racial Type: ") + racialtype;
                }

                description = ModService.OnModuleExamine(description, examiner, examinedObject);
                description = ItemService.OnModuleExamine(description, examiner, examinedObject);
                description = DurabilityService.OnModuleExamine(description, examinedObject);
                description = FarmingService.OnModuleExamine(description, examinedObject);

                if (!string.IsNullOrWhiteSpace(description))
                {
                    _.SetDescription(examinedObject.Object, description, _.FALSE);
                    _.SetDescription(examinedObject.Object, description);
                }
            }

            MessageHub.Instance.Publish(new OnModuleExamine());
        }
コード例 #5
0
        internal async Task Run(IClientProxy websocketToAll)
        {
            var reader             = new ExaminationReader.ExaminationReader();
            var examinationService = new ExaminationService(_password, _port);

            int TOTAL_COUNT = _filePaths.Length;
            int count       = 0;

            foreach (string path in _filePaths)
            {
                var result = new Progress
                {
                    FileName   = Path.GetFileName(path),
                    FileNumber = ++count,
                    TotalCount = TOTAL_COUNT,
                    Error      = null
                };

                string fileName = Path.GetFileName(path);
                await websocketToAll.SendAsync("ReadingFile", fileName);

                try
                {
                    Examination examination = reader.Read(path);
                    ValidateAndFixResults(examination.Results, fileName);
                    Domain.Examination dbExamination = Converter.PrepareEntity(examination);
                    examinationService.AddExamination(dbExamination);
                }
                catch (Exception e)
                {
                    _logger.FileError(fileName, e);
                    result.FileName += " UWAGA BŁĄD";
                    result.Error     = e.Message;
                }
                await websocketToAll.SendAsync("FileProcessed", result);
            }
        }
コード例 #6
0
 public ExaminationController(ExaminationService examinationService)
 {
     _examinationService = examinationService;
 }