void _mapModelSelect_Adt_Selected(object sender, Adt adt, FileADT fileadt)
 {
     if (fileadt != null)
     {
         ShellService.Instance.MapModelNameContent.FillADTData(fileadt);
         ShellService.Instance.MapModelNameContent.Show();
     }
 }
Example #2
0
 public AdtTO(Adt mdo)
 {
     if (mdo == null)
     {
         return;
     }
     this.id         = mdo.Id;
     this.patient    = new PatientTO(mdo.Patient);
     this.checkInId  = mdo.CheckInId;
     this.checkOutId = mdo.CheckOutId;
     this.relatedPhysicalMovementId = mdo.RelatedPhysicalMovementId;
     this.transaction            = mdo.Transaction;
     this.movementType           = mdo.MovementType;
     this.timestamp              = mdo.Timestamp.ToString("yyyyMMdd.HHmmss");
     this.diagnosis              = mdo.Diagnosis;
     this.assignedLocation       = new HospitalLocationTO(mdo.AssignedLocation);
     this.provider               = new UserTO(mdo.Provider);
     this.attending              = new UserTO(mdo.Attending);
     this.transferFacility       = mdo.TransferFacility;
     this.specialty              = new TaggedText(mdo.Specialty);
     this.patientTxId            = mdo.PatientTxId;
     this.visitId                = mdo.VisitId;
     this.patientMovementNumber  = mdo.PatientMovementNumber;
     this.nextPatientMovement    = mdo.NextPatientMovement;
     this.enteredBy              = new UserTO(mdo.EnteredBy);
     this.lengthOfStay           = mdo.LengthOfStay;
     this.passDays               = mdo.PassDays;
     this.daysAbsent             = mdo.DaysAbsent;
     this.asihAdmission          = new TaggedText(mdo.AsihAdmission);
     this.asihTransfer           = mdo.AsihTransfer;
     this.asihSequence           = mdo.AsihSequence;
     this.asihDays               = mdo.AsihDays;
     this.absenceReturnDate      = mdo.AbsenceReturnDate.ToString("yyyyMMdd.HHmmss");
     this.admittedForScCondition = mdo.AdmittedForScCondition;
     this.scheduledAdmission     = mdo.ScheduledAdmission;
     this.admissionSource        = mdo.AdmissionSource;
     this.admittingCategory      = mdo.AdmittingCategory;
     this.admittingRegulation    = new TaggedText(mdo.AdmittingRegulation);
     this.admittingEligibility   = new TaggedText(mdo.AdmittingEligibility);
     this.masMovementType        = new TaggedText(mdo.MasMovementType);
     this.lodgingReason          = mdo.LodgingReason;
     this.lodgingComments        = mdo.LodgingComments;
     this.disposition            = mdo.Disposition;
     this.eligibility            = mdo.Eligibility;
     this.preAdmitId             = mdo.PreAdmitId;
     this.referring              = new UserTO(mdo.Referring);
     this.consulting             = new UserTO(mdo.Consulting);
     this.admitting              = new UserTO(mdo.Admitting);
     this.service                = new TaggedText(mdo.Service);
     this.priorLocation          = new HospitalLocationTO(mdo.PriorLocation);
     this.temporaryLocation      = new HospitalLocationTO(mdo.TemporaryLocation);
     this.pendingLocation        = new HospitalLocationTO(mdo.PendingLocation);
     this.patientType            = mdo.PatientType;
     this.admitTimestamp         = mdo.AdmitTimestamp.ToString("yyyyMMdd.HHmmss");
     this.dischargeTimestamp     = mdo.DischargeTimestamp.ToString("yyyyMMdd.HHmmss");
     this.admitReason            = mdo.AdmitReason;
     this.transferReason         = mdo.TransferReason;
 }
Example #3
0
 private static RectangleF GetSceneBounds(Adt adt, float padding)
 {
     return(new RectangleF
     {
         Top = adt.Bounds.Maximum.Y + padding,
         Right = adt.Bounds.Maximum.X + padding,
         Bottom = adt.Bounds.Minimum.Y - padding,
         Left = adt.Bounds.Minimum.X - padding,
     });
 }
Example #4
0
 private static Scene MergeIntoScene(Adt adt, IEnumerable <SceneObject> terrain, IEnumerable <SceneObject> liquids,
                                     IEnumerable <SceneObject> doodads, IEnumerable <SceneObject> wmos)
 {
     return(new Scene
     {
         Adt = adt,
         Terrain = terrain,
         Liquids = liquids,
         Doodads = doodads,
         Wmos = wmos
     });
 }
Example #5
0
 public TaggedAdtArray(string tag, Adt adt)
 {
     this.tag = tag;
     if (adt == null)
     {
         this.count = 0;
         return;
     }
     this.items    = new AdtTO[1];
     this.items[0] = new AdtTO(adt);
     this.count    = 1;
 }
Example #6
0
 public TaggedAdtArray(string tag, Adt adt)
 {
     this.tag = tag;
     if (adt == null)
     {
         this.count = 0;
         return;
     }
     this.items = new AdtTO[1];
     this.items[0] = new AdtTO(adt);
     this.count = 1;
 }
Example #7
0
 public Adt GetAdt(string continent, int x, int y)
 {
     return(TryGetOrCreate(_adtCache, Tuple.Create(continent, x, y), t =>
     {
         var files = MpqFilePaths.GetRelevantAdtFileNames(continent, x, y);
         var adt = new Adt(_reader.Read(files.First()));
         foreach (var secondaryFile in files.Skip(1))
         {
             adt.ParseSecondaryData(_reader.Read(secondaryFile));
         }
         return adt;
     }));
 }
        public Task <Adt> SearchRegistrationDataById(string documentId, Int64 clientId)
        {
            AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
            var registrationChannel = GrpcChannel.ForAddress(_grpcClientAddress);
            var registrationClient  = new RegistrationApiRetrieval.RegistrationApiRetrievalClient(registrationChannel);
            var adtMessageRequest   = new SearchAPIAdtMessageRequest {
                Id = documentId, ClientId = clientId
            };
            var reply   = registrationClient.SearchAPIFindAdtMessageById(adtMessageRequest);
            Adt message = JsonConvert.DeserializeObject <Adt>(reply.AdtMessage);

            return(Task.FromResult(message));
        }
Example #9
0
 public IEnumerable <SceneObject> BuildTerrain(Adt adt, RectangleF bounds)
 {
     foreach (var chunk in adt.MapChunks)
     {
         var offset = chunk.Bounds.Maximum;
         offset.Z = chunk.Bounds.Minimum.Z;
         var meshBuilder = new SquareMeshBuilder(chunk.HeightMap, offset, -MapChunk.TileSize);
         var description = string.Format(DescriptionTemplate, "Terrain", chunk.X, chunk.Y);
         var sceneObject = meshBuilder.BuildSquareMesh(chunk.HasHole, MaterialFlags.None, bounds, description);
         if (sceneObject != null)
         {
             yield return(sceneObject);
         }
     }
 }
Example #10
0
 void _mapModelSelect_Adt_Selected(object sender, Adt adt, FileADT fileadt)
 {
     if (fileadt != null)
     {
         Entry[] entries = new Entry[fileadt.TextureCount];
         for (uint i = 0; i < fileadt.TextureCount; ++i)
         {
             entries[i] = new Entry()
             {
                 Id = (int)i, Name = fileadt.GetTextureFileName(i, false)
             };
         }
         ShellService.Instance.MapTexNameContent.FillMapTexNames(entries);
     }
 }
Example #11
0
 public TaggedAdtArray(string tag, Adt[] mdoItems)
 {
     this.tag = tag;
     if (mdoItems == null)
     {
         this.count = 0;
         return;
     }
     items = new AdtTO[mdoItems.Length];
     for (int i = 0; i < mdoItems.Length; i++)
     {
         items[i] = new AdtTO(mdoItems[i]);
     }
     count = items.Length;
 }
        public async Task Handle(RegistrationReceivedIntegrationEvent @event)
        {
            using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{QAService.API.Program.AppName}"))
            {
                _logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, QAService.API.Program.AppName, @event);


                if (await _grpcClientService.ClientFacilitySubscribesToModuleByFacilityId(@event.ClientId, @event.FacilityId))
                {
                    try
                    {
                        Adt adt = await _grpcRegistrationService.RegistrationDataById(@event.DocumentId, @event.ClientId);


                        bool commandResult = false;

                        string[] format = { "yyyyMMdd" };
                        DateTime date;

                        DateTime.TryParseExact(adt.content.PID[0].dateTimeBirth,
                                               format,
                                               System.Globalization.CultureInfo.InvariantCulture,
                                               System.Globalization.DateTimeStyles.None,
                                               out date);

                        var command = new RunRegistrationRulesCommand(adt.content.PID[0].patientName[0].firstName, "",
                                                                      adt.content.PID[0].patientName[0].lastName,
                                                                      date,
                                                                      adt.content.PID[0].sex, adt.PatientId, adt.PatientVisitId, adt.PatientTransactionId, adt.ClientId);

                        _logger.LogInformation("-----Sending command: RunRegistrationRulesCommand");

                        commandResult = await _mediatr.Send(command);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Error: " + e.Message);
                    }
                }
                await Task.CompletedTask;
            }
        }
        private void LoadADT()
        {
            Adt i = _adtlistview.SelectedItem as Adt;

            if (i == null)
            {
                return;
            }

            FileADT adt = ModelSceneService.Instance.LoadADT(i.Row, i.Col, true);

            Debug.Assert(adt != null);
            if (adt != null)
            {
                if (Adt_Selected != null)
                {
                    Adt_Selected.Invoke(this, i, adt);
                }
            }
        }
Example #14
0
        public IEnumerable <SceneObject> BuildLiquid(Adt adt, RectangleF bounds)
        {
            var chunksWithLiquids = from chunk in adt.MapChunks
                                    where chunk.Liquid != null && chunk.Liquid.HeightMap != null
                                    select chunk;

            foreach (var chunk in chunksWithLiquids)
            {
                var offset = chunk.Bounds.Maximum;
                offset.Z = 0;
                var liquid             = chunk.Liquid;
                var meshBuilder        = new SquareMeshBuilder(liquid.HeightMap, offset, -MapChunk.TileSize);
                var materialProperties = _getLiquidMaterial(liquid.Type);
                var description        = string.Format(DescriptionTemplate, "Liquid", chunk.X, chunk.Y);
                var sceneObject        = meshBuilder.BuildSquareMesh(liquid.HasHole, materialProperties, bounds, description);
                if (sceneObject != null)
                {
                    yield return(sceneObject);
                }
            }
        }
        public async Task Handle(RegistrationReceivedIntegrationEvent @event)
        {
            using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
            {
                Random rnd     = new Random();
                Adt    message = await _grpcRegistrationService.SearchRegistrationDataById(@event.DocumentId, @event.ClientId);

                int      num = rnd.Next(1, 30);
                DateTime date;
                string[] format = { "yyyyMMdd" };
                if (message.content.PV1[0].admitDateTime != null)
                {
                    DateTime.TryParseExact(message.content.PV1[0].admitDateTime,
                                           format,
                                           System.Globalization.CultureInfo.InvariantCulture,
                                           System.Globalization.DateTimeStyles.None,
                                           out date);
                }
                else
                {
                    string str = DateTime.Now.ToString("yyyy-MM-dd'T'HH:mm:ss.fffffff'Z'");
                    date = Convert.ToDateTime(str);
                }


                var command = new CreateUpdatePatientDetailsInESCommand(message.content.PID[0].patientAccountNumber.id, date, "Payer" + "" + num.ToString(),
                                                                        message.content.PID[0].ssn, message.content.PV1[0].financialClass.financialClass,
                                                                        message.content.PV1[0].patientType, message.content.PID[0].internalId[0].id, message.content.PID[0].patientName[0].firstName,
                                                                        message.content.PID[0].patientName[0].lastName, message.content.PV1[0].admissionType,
                                                                        "RED-Flagged", "HAR" + "" + num.ToString(), @event.ClientId.ToString(), @event.PatientVisitId.ToString(),
                                                                        message.content.EVN[0].operatorId.firstName, "DOS" + "" + num.ToString(), message.content.PID[0].sex, message.content.MSH.sendingFacility.namespaceId, @event.ClientName);

                _logger.LogInformation("-----Sending command: CreateUpdatePatientDetailsInESCommand");

                await _mediatr.Publish(command);

                await Task.CompletedTask;
            }
        }
Example #16
0
File: AdtTO.cs Project: OSEHRA/mdws
 public AdtTO(Adt mdo)
 {
     if (mdo == null)
     {
         return;
     }
     this.id = mdo.Id;
     this.patient = new PatientTO(mdo.Patient);
     this.checkInId = mdo.CheckInId;
     this.checkOutId = mdo.CheckOutId;
     this.relatedPhysicalMovementId = mdo.RelatedPhysicalMovementId;
     this.transaction = mdo.Transaction;
     this.movementType = mdo.MovementType;
     this.timestamp = mdo.Timestamp.ToString("yyyyMMdd.HHmmss");
     this.diagnosis = mdo.Diagnosis;
     this.assignedLocation = new HospitalLocationTO(mdo.AssignedLocation);
     this.provider = new UserTO(mdo.Provider);
     this.attending = new UserTO(mdo.Attending);
     this.transferFacility = mdo.TransferFacility;
     this.specialty = new TaggedText(mdo.Specialty);
     this.patientTxId = mdo.PatientTxId;
     this.visitId = mdo.VisitId;
     this.patientMovementNumber = mdo.PatientMovementNumber;
     this.nextPatientMovement = mdo.NextPatientMovement;
     this.enteredBy = new UserTO(mdo.EnteredBy);
     this.lengthOfStay = mdo.LengthOfStay;
     this.passDays = mdo.PassDays;
     this.daysAbsent = mdo.DaysAbsent;
     this.asihAdmission = new TaggedText(mdo.AsihAdmission);
     this.asihTransfer = mdo.AsihTransfer;
     this.asihSequence = mdo.AsihSequence;
     this.asihDays = mdo.AsihDays;
     this.absenceReturnDate = mdo.AbsenceReturnDate.ToString("yyyyMMdd.HHmmss");
     this.admittedForScCondition = mdo.AdmittedForScCondition;
     this.scheduledAdmission = mdo.ScheduledAdmission;
     this.admissionSource = mdo.AdmissionSource;
     this.admittingCategory = mdo.AdmittingCategory;
     this.admittingRegulation = new TaggedText(mdo.AdmittingRegulation);
     this.admittingEligibility = new TaggedText(mdo.AdmittingEligibility);
     this.masMovementType = new TaggedText(mdo.MasMovementType);
     this.lodgingReason = mdo.LodgingReason;
     this.lodgingComments = mdo.LodgingComments;
     this.disposition = mdo.Disposition;
     this.eligibility = mdo.Eligibility;
     this.preAdmitId = mdo.PreAdmitId;
     this.referring = new UserTO(mdo.Referring);
     this.consulting = new UserTO(mdo.Consulting);
     this.admitting = new UserTO(mdo.Admitting);
     this.service = new TaggedText(mdo.Service);
     this.priorLocation = new HospitalLocationTO(mdo.PriorLocation);
     this.temporaryLocation = new HospitalLocationTO(mdo.TemporaryLocation);
     this.pendingLocation = new HospitalLocationTO(mdo.PendingLocation);
     this.patientType = mdo.PatientType;
     this.admitTimestamp = mdo.AdmitTimestamp.ToString("yyyyMMdd.HHmmss");
     this.dischargeTimestamp = mdo.DischargeTimestamp.ToString("yyyyMMdd.HHmmss");
     this.admitReason = mdo.AdmitReason;
     this.transferReason = mdo.TransferReason;
 }
        private bool IsAdtMatch(object adt)
        {
            Adt i = adt as Adt;

            return(-1 != i.Name.IndexOf(_adtfilter.Text, StringComparison.CurrentCultureIgnoreCase));
        }
Example #18
0
        /* Patient Movement Fields
         * 
         *  0:  IEN
         *  1:  DATE/TIME                       .01     Timestamp
         *  2:  TRANSACTION                     .02     Transaction
         *  3:  PATIENT                         .03     Patient.LocalPid
         *  4:  TYPE OF MOVEMENT                .04     MovementType
         *  5:  WARD LOCATION                   .06     AssignedLocation.Id
         *  6:  ROOM-BED                        .07     AssignedLocation.Room, AssignedLocation.Bed
         *  7:  FACILITY TREATING SPECIALTY     .09     Specialty, Service
         *  8:  ADMISSION/CHECK-IN MOVEMENT     .14     CheckInId
         *  9:  DISCHARGE/CHECK-OUT MOVEMENT    .17     CheckOutId
         * 10:  MAS MOVEMENT TYPE               .18     MasMovementType
         * 11:  ATTENDING PHYSICIAN             .19     Attending.Uid
         * 12:  RELATED PHYSICAL MOVEMENT       .24     RelatedPhysicalMovementId
         * 13:  LENGTH OF STAY                  201     LengthOfStay
         * 14:  PASS DAYS                       202     PassDays
         * 15:  DAYS ABSENT                     203     DaysAbsent
         * 16:  DIAGNOSIS [SHORT]               .1      Diagnosis
         * 17:  PTF ENTRY                       .16     PatientTxId
         * 18:  ADMITTED FOR SC CONDITION?      .11     AdmittedForScCondition
         * 19:  SCHEDULED ADMISSION?            .25     ScheduledAdmission
         * 20:  ^VA(200,                        (0,1)   Admitting.Name
         */

        internal Adt[] toAdt(string[] response)
        {
            if (response == null || response.Length == 0)
            {
                return null;
            }
            StringDictionary facilityMovementTypes = cxn.SystemFileHandler.getLookupTable(VistaConstants.FACILITY_MOVEMENT_TYPES);
            StringDictionary masMovementTypes = cxn.SystemFileHandler.getLookupTable(VistaConstants.MAS_MOVEMENT_TYPES);
            //Dictionary<string, TreatingSpecialty> treatingSpecialties = getTreatingSpecialties();
            Dictionary<string, object> treatingSpecialties = cxn.SystemFileHandler.getFile(VistaConstants.TREATING_SPECIALTY); 
            StringDictionary wardLocations = cxn.SystemFileHandler.getLookupTable(VistaConstants.WARD_LOCATIONS);
            StringDictionary roomBeds = cxn.SystemFileHandler.getLookupTable(VistaConstants.ROOM_BEDS);

            Adt[] result = new Adt[response.Length];
            for (int i = 0; i < response.Length; i++)
            {
                string[] flds = StringUtils.split(response[i], StringUtils.CARET);
                result[i] = new Adt();
                result[i].Id = flds[0];
                if (flds[1] != "")
                {
                    result[i].Timestamp = VistaTimestamp.toDateTime(flds[1]);
                }
                result[i].Transaction = decodePatientMovementTransaction(flds[2]);
                result[i].Patient = new Patient();
                result[i].Patient.LocalPid = flds[3];
                if (facilityMovementTypes.ContainsKey(flds[4]))
                {
                    result[i].MovementType = facilityMovementTypes[flds[4]];
                }
                if (wardLocations.ContainsKey(flds[5]))
                {
                    result[i].AssignedLocation = new HospitalLocation();
                    result[i].AssignedLocation.Id = flds[5];
                    result[i].AssignedLocation.Name = wardLocations[flds[5]];
                }
                if (roomBeds.ContainsKey(flds[6]))
                {
                    string[] parts = StringUtils.split(roomBeds[flds[6]], "-");
                    if (result[i].AssignedLocation == null)
                    {
                        result[i].AssignedLocation = new HospitalLocation();
                    }
                    result[i].AssignedLocation.Room = parts[0];
                    result[i].AssignedLocation.Bed = parts[1];
                }
                if (treatingSpecialties.ContainsKey(flds[7]))
                {
                    TreatingSpecialty ts = (TreatingSpecialty)treatingSpecialties[flds[7]];
                    result[i].Specialty = new KeyValuePair<string, string>(flds[7], ts.Name);
                    result[i].Service = new KeyValuePair<string, string>(ts.Service.Key, ts.Service.Value);
                }
                result[i].CheckInId = flds[8];
                result[i].CheckOutId = flds[9];
                if (masMovementTypes.ContainsKey(flds[10]))
                {
                    result[i].MasMovementType = new KeyValuePair<string, string>(flds[10], masMovementTypes[flds[10]]);
                }
                if (flds[11] != "")
                {
                    result[i].Attending = new User();
                    result[i].Attending.Uid = flds[11];
                    if (flds.Length > 19)
                    {
                        result[i].Attending.Name = new PersonName(flds[20]);
                    }
                }
                result[i].RelatedPhysicalMovementId = flds[12];
                result[i].LengthOfStay = flds[13];
                result[i].PassDays = flds[14];
                result[i].DaysAbsent = flds[15];
                result[i].Diagnosis = flds[16];
                result[i].PatientTxId = flds[17];
                result[i].AdmittedForScCondition = (flds[18] == "1" ? true : false);
                result[i].ScheduledAdmission = (flds[19] == "1" ? true : false);
            }
            return result;
        }
Example #19
0
        private static IEnumerable <IModelDefinition> DefinedWmos(Adt adt)
        {
            var allRefs = new HashSet <int>(adt.MapChunks.Where(m => m.WmoReferences != null).SelectMany(m => m.WmoReferences));

            return(adt.WmoDefinitions.Where((d, i) => allRefs.Contains(i)));
        }