示例#1
0
        public void LeerICSFromOracle()
        {
            #region ICS
            ICSOracle = new Dictionary <string, ICS>();

            #region Query a ejecutar (carga inicial o incremental)
            string queryTot = Oracle.QueryICS;

            if (!ComunGlobal.FechaFinIncremental.Equals("0") && !ComunGlobal.FechaIniIncremental.Equals("0"))
            {
                queryTot = queryTot + " WHERE " + NombresCamposICS.Aen_Fecha_ActualizacionORACLE + " BETWEEN '" + ComunGlobal.FechaIniIncremental + "' AND '" + ComunGlobal.FechaFinIncremental + "'";
            }

            #endregion Query a ejecutar  (carga inicial o incremental)

            OracleDataAdapter oda = new OracleDataAdapter(queryTot, ComunGlobal.ConnStringOracle);
            DataTable         dt  = new DataTable();
            oda.Fill(dt);

            foreach (DataRow fila in dt.Rows)
            {
                ICS icsAux = new ICS();
                icsAux.ICSFromOracle(fila, MaestroICSCRM);
                if (icsAux != null)
                {
                    ICSOracle.Add(icsAux.Aen_Codigo_Ics, icsAux);
                }
            }
            #endregion ICS
        }
        public void PublishResult() // list passed as parameter is the list returned by the parsing method
        {
            while (true)
            {
                List <Log> result = new List <Log>(Parser.RunParser(filePath));
                foreach (ICallbackService ICS in Subscribers)//foreach connection
                {
                    try
                    {
                        lock (result)//lock the list in case of new one arrives
                        {
                            if ((((IChannel)ICS).State == CommunicationState.Opened))
                            {
                                ICS.CallbackPublishResult(result);// pass the list to the callback contract
                            }
                            else
                            {
                                Subscribers.Remove(ICS);//remove the instance in case of losing connection
                            }
                        }
                    }

                    catch (Exception)
                    {
                    }
                }
                Thread.Sleep(5000);
            }
        }
示例#3
0
 public frmAddEditICS(ICS item, MethodType methodType)
 {
     InitializeComponent();
     this.item       = item;
     this.methodType = methodType;
     this.Init();
 }
示例#4
0
        void Init()
        {
            try
            {
                if (methodType == MethodType.Edit)
                {
                    this.isClosed = true;
                    this.Details(new UnitOfWork().ICSRepo.Find(x => x.Id == item.Id));
                    return;
                }

                item = new ICS()
                {
                    Date      = DateTime.Now,
                    CreatedBy = User.UserId,
                };

                UnitOfWork unitOfWork = new UnitOfWork();
                unitOfWork.ICSRepo.Insert(item);
                unitOfWork.Save();
                Details(item);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#5
0
        private IndicAkshar[] LeftTrimLines(IndicAkshar[] input)
        {
            List <IndicAkshar> List = new List <IndicAkshar>();
            bool newLineFound       = false;

            foreach (IndicAkshar ICS in input)
            {
                if (ICS.ToString2() == Constants.NewLine)
                {
                    newLineFound = true;
                    List.Add(ICS);
                    continue;
                }
                if (newLineFound)
                {
                    if (ICS.ToString2() == Constants.Space)
                    {
                        continue;
                    }
                }
                newLineFound = false;
                List.Add(ICS);
            }
            IndicAkshar[] output = new IndicAkshar[List.Count];
            for (int i = 0; i < List.Count; i++)
            {
                output[i] = List[i];
            }
            return(output);
        }
示例#6
0
        public static bool hInternetCS() //IMPORT_DEBUGGER_PRESENT
        {
            ICS             ICS         = CreateAPI <ICS>("wininet", "InternetGetConnectedState");
            ConnectionState Description = 0;

            return(ICS(ref Description, 0));
        }
示例#7
0
        /* Func Chat
         * Chat main loop
         *
         * @param user String representing the username
         * @param obj The remote object held by the server
         */
        public static void chat(string user, ICS obj)
        {
            string msg;

            while (true)
            {
                Console.Write(user + "> ");
                msg = Console.ReadLine();
                obj.SendMsg(user, msg);
            }
        }
示例#8
0
        public void Run(string[] args) {
            var kommandozeile = new Kommandozeile();
            var fileIo = new FileIO();
            var termine = new Termine();
            var ics = new ICS();

            var csv_dateiname = kommandozeile.CSV_Dateiname_ermitteln(args);
            var ics_dateiname = kommandozeile.ICS_Dateiname_ermitteln(args);
            var dateiinhalt = fileIo.Datei_einlesen(csv_dateiname);
            var alle_termine = termine.Termine_erzeugen(dateiinhalt);
            ics.Termine_in_ICS_Datei_speichern(alle_termine, ics_dateiname);
        } 
        public void GenerateProblemEntryEmpty(string refId, III hl7III, Factory hl7Factory)
        {
            IEntry entry = functionalStatus.Section.Entry.Append();

            entry.TypeCode        = x_ActRelationshipEntry.DRIV;
            entry.AsAct.ClassCode = x_ActClassDocumentEntryAct.ACT;
            entry.AsAct.MoodCode  = x_DocumentActMood.EVN;
            IIVXB_TS TS = hl7Factory.CreateIVXB_TS();

            hl7III = entry.AsAct.Id.Append();
            hl7III.Init(Convert.ToString(Guid.NewGuid()));
            hl7III = entry.AsAct.TemplateId.Append();
            hl7III.Init("2.16.840.1.113883.10.20.22.4.3");
            entry.AsAct.Code.Code           = "CONC";
            entry.AsAct.Code.CodeSystem     = "2.16.840.1.113883.5.6";
            entry.AsAct.Code.CodeSystemName = "HL7ActClass";
            entry.AsAct.Code.DisplayName    = "Concern";
            entry.AsAct.StatusCode.Init("completed");
            entry.AsAct.EffectiveTime = new IVL_TS().Init(low: new IVXB_TS());
            IEntryRelationship entryRel = entry.AsAct.EntryRelationship.Append();

            entryRel.TypeCode = x_ActRelationshipEntryRelationship.SUBJ;
            entryRel.AsObservation.ClassCode            = "OBS";
            entryRel.AsObservation.MoodCode             = x_ActMoodDocumentObservation.EVN;
            entryRel.AsObservation.NegationInd          = true;
            entryRel.AsObservation.NegationIndSpecified = true;
            III TempId = entryRel.AsObservation.TemplateId.Append();

            TempId.Root = "2.16.840.1.113883.10.20.22.4.4";
            hl7III      = entryRel.AsObservation.Id.Append();
            hl7III.Root = Guid.NewGuid().ToString();
            entryRel.AsObservation.Code.Code           = "55607006";
            entryRel.AsObservation.Code.CodeSystem     = "2.16.840.1.113883.6.96";
            entryRel.AsObservation.Code.DisplayName    = "Problem";
            entryRel.AsObservation.Code.CodeSystemName = "SNOMED CT";
            IED ED = hl7Factory.CreateED();

            ED.Reference.Value          = refId;
            entryRel.AsObservation.Text = ED;
            ICS CS = hl7Factory.CreateCS();

            CS.Init("completed");
            entryRel.AsObservation.StatusCode    = CS;
            entryRel.AsObservation.EffectiveTime = new IVL_TS().Init(low: new IVXB_TS(), high: new IVXB_TS());
            ICD CD = hl7Factory.CreateCD();

            CD.Code           = "55607006";
            CD.CodeSystem     = "2.16.840.1.113883.6.96";
            CD.CodeSystemName = "SNOMED CT";
            CD.DisplayName    = Convert.ToString("Problem");
            entryRel.AsObservation.Value.Add(CD);
        }
示例#10
0
 void Details(ICS item)
 {
     try
     {
         UnitOfWork unitOfWork = new UnitOfWork();
         this.ItemsGridControl.DataSource =
             new BindingList <ICSDetails>(unitOfWork.ICSDetailsRepo.Get(x => x.ICSId == item.Id));
         this.employeesBindingSource.DataSource   = unitOfWork.EmployeesRepo.Get();
         this.signatoriesBindingSource.DataSource = unitOfWork.Signatories.Get();
         this.dtDate.EditValue      = item.Date;
         this.cboIssuer.EditValue   = item.Issuer;
         this.cboReceiver.EditValue = item.Receiver;
         this.cboPGSO.EditValue     = item.PGSO;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#11
0
        static void Main()
        {
            // Read client port
            Console.Write("Type in your port: ");
            string port = Console.ReadLine();

            // Open and bind the channel for communication
            TcpChannel channel = new TcpChannel(Convert.ToInt32(port));

            ChannelServices.RegisterChannel(channel, true);

            // Register client object
            RemotingConfiguration.RegisterWellKnownServiceType(
                typeof(ChatObject),
                "ChatObject",
                WellKnownObjectMode.Singleton);

            // Get server object
            ICS obj = (ICS)Activator.GetObject(
                typeof(ICS),
                "tcp://localhost:8086/ChatRoom");

            // Query the client's username
            Console.Write("Type username: "******"Could not locate server");
            }
        }
示例#12
0
        public void GenerateAllergyEntry(PatientAllergies patientAllergies, III hl7III, Factory hl7factory)
        {
            IEntry entry = functionalStatus.Section.Entry.Append();

            entry.TypeCode        = x_ActRelationshipEntry.DRIV;
            entry.AsAct.ClassCode = x_ActClassDocumentEntryAct.ACT;
            entry.AsAct.MoodCode  = x_DocumentActMood.EVN;
            hl7III = entry.AsAct.Id.Append();
            hl7III.Init("36e3e930-7b14-11db-9fe1-0800200c9a66");
            hl7III = entry.AsAct.TemplateId.Append();
            hl7III.Init("2.16.840.1.113883.10.20.22.4.30");
            entry.AsAct.Code.Code           = "48765-2";
            entry.AsAct.Code.CodeSystem     = "2.16.840.1.113883.6.1";
            entry.AsAct.Code.CodeSystemName = "LOINC";

            entry.AsAct.Code.DisplayName = "Allergies, adverse reactions, alerts";

            entry.AsAct.StatusCode.Code = Convert.ToString(patientAllergies.status).ToLower();

            if (Convert.ToString(patientAllergies.status) == "Active")
            {
                entry.AsAct.EffectiveTime = new IVL_TS().Init(low: new IVXB_TS());
                // If Status Active
            }
            else
            {
                entry.AsAct.EffectiveTime = new IVL_TS().Init(high: new IVXB_TS());
                // If Status is Not Active
            }

            IEntryRelationship entryRel = entry.AsAct.EntryRelationship.Append();

            entryRel.TypeCode = x_ActRelationshipEntryRelationship.SUBJ;
            entryRel.AsObservation.ClassCode = "OBS";
            entryRel.AsObservation.MoodCode  = x_ActMoodDocumentObservation.EVN;
            III TempId = entryRel.AsObservation.TemplateId.Append();

            TempId.Root = "2.16.840.1.113883.10.20.22.4.7";
            entryRel.AsObservation.StatusCode.Code = "completed";
            hl7III      = entryRel.AsObservation.Id.Append();
            hl7III.Root = "4adc1020-7b14-11db-9fe1-0800200c9a66";
            entryRel.AsObservation.Code.Code       = "ASSERTION";
            entryRel.AsObservation.Code.CodeSystem = "2.16.840.1.113883.5.4";
            ICS CS = hl7factory.CreateCS();

            CS.Init("completed");

            entryRel.AsObservation.EffectiveTime.NullFlavor = "UNK";
            // Because Allergy Start Date is Missing.
            CD obsValueAsCD = new CD();
            CE obsValueAsCE = new CE();

            //obsValueAsCD.Code = patientAllergies.AllergyType == "Medication" ? "416098002" : patientAllergies.AllergyType == "Food" ? "414285001" : patientAllergies.AllergyType == "Environmental" ? "419199007" : "420134006";//(patientAllergies.AllergyType == "Medication" ? "416098002" : (patientAllergies.AllergyType == "Food" ? "414285001" : (patientAllergies.AllergyType == "Environmental" ? "426232007" : "106190000")));
            //// Allergy Type SNOMED Code(Environmental Alergy:426232007, Food Allergy: 414285001, Medication Allergy: 416098002, Other Allergy: 106190000)
            //obsValueAsCD.DisplayName = (patientAllergies.AllergyType == "Medication" ? "Drug allergy" : (patientAllergies.AllergyType == "Food" ? "Food allergy" : (patientAllergies.AllergyType == "Environmental" ? "Environmental allergy" : "Other allergy")));

            obsValueAsCD.CodeSystem     = "2.16.840.1.113883.6.96";
            obsValueAsCD.CodeSystemName = "SNOMED CT";
            obsValueAsCD.OriginalText.Reference.Value = "#" + Convert.ToString(patientAllergies.allergyId);
            // "#reaction1" ' Dynamic Value
            entryRel.AsObservation.Value.Add(obsValueAsCD);
            PN pn = new PN();

            pn.Text = patientAllergies.substance;
            IParticipant2 parti = hl7factory.CreateParticipant2();

            parti.TypeCode = "CSM";
            parti.ParticipantRole.ClassCode = "MANU";
            parti.ParticipantRole.AsPlayingEntity.ClassCode = "MMAT";
            parti.ParticipantRole.AsPlayingEntity.Code.Code = Convert.ToString(patientAllergies.rxNorm);
            //"314422" ' Dynamic Value
            parti.ParticipantRole.AsPlayingEntity.Code.DisplayName = patientAllergies.substance;
            //"ALLERGENIC EXTRACT, PENICILLIN" ' Dynamic Value
            parti.ParticipantRole.AsPlayingEntity.Code.CodeSystem     = "2.16.840.1.113883.6.88";
            parti.ParticipantRole.AsPlayingEntity.Code.CodeSystemName = "RxNorm";
            parti.ParticipantRole.AsPlayingEntity.Code.OriginalText.Reference.Value = "";
            //"#" & Convert.ToString(dtRow("ReactionID"))
            parti.ParticipantRole.AsPlayingEntity.Name.Add(pn);
            entryRel.AsObservation.Participant.Add(parti);

            ///'' Allergy Status Observation '''''''''''
            IEntryRelationship obs_EntryRel = entryRel.AsObservation.EntryRelationship.Append();

            obs_EntryRel.TypeCode                = x_ActRelationshipEntryRelationship.SUBJ;
            obs_EntryRel.InversionInd            = true;
            obs_EntryRel.InversionIndSpecified   = true;
            obs_EntryRel.AsObservation.ClassCode = "OBS";
            obs_EntryRel.AsObservation.MoodCode  = x_ActMoodDocumentObservation.EVN;
            hl7III      = obs_EntryRel.AsObservation.TemplateId.Append();
            hl7III.Root = "2.16.840.1.113883.10.20.22.4.28";
            obs_EntryRel.AsObservation.Code.Code           = "33999-4";
            obs_EntryRel.AsObservation.Code.CodeSystem     = "2.16.840.1.113883.6.1";
            obs_EntryRel.AsObservation.Code.CodeSystemName = "LOINC";
            obs_EntryRel.AsObservation.Code.DisplayName    = "Status";
            obs_EntryRel.AsObservation.StatusCode.Code     = "completed";


            obsValueAsCE             = new CE();
            obsValueAsCE.Code        = Convert.ToString(patientAllergies.status) == "Active" ? "55561003" : patientAllergies.status == "Inactive" ? "73425007" : "413322009";
            obsValueAsCE.DisplayName = Convert.ToString(patientAllergies.status);
            obsValueAsCE.CodeSystem  = "2.16.840.1.113883.6.96";

            obs_EntryRel.AsObservation.Value.Add(obsValueAsCE);
            obs_EntryRel.InversionInd          = true;
            obs_EntryRel.InversionIndSpecified = true;
            ///' Allergy Reaction Observation
            if (!string.IsNullOrEmpty(patientAllergies.reaction))
            {
                obs_EntryRel                         = entryRel.AsObservation.EntryRelationship.Append();
                obs_EntryRel.TypeCode                = x_ActRelationshipEntryRelationship.MFST;
                obs_EntryRel.InversionInd            = true;
                obs_EntryRel.InversionIndSpecified   = true;
                obs_EntryRel.AsObservation.ClassCode = "OBS";
                obs_EntryRel.AsObservation.MoodCode  = x_ActMoodDocumentObservation.EVN;
                hl7III = obs_EntryRel.AsObservation.TemplateId.Append();
                hl7III.Init("2.16.840.1.113883.10.20.22.4.9");
                hl7III = obs_EntryRel.AsObservation.Id.Append();
                hl7III.Init("4adc1020-7b14-11db-9fe1-0800200c9a64");
                obs_EntryRel.AsObservation.Code.NullFlavor = "UNK";
                //obs_EntryRel.AsObservation.Text.Reference.Value = "#" & Convert.ToString(dtRow("ReactionID")) '"#reaction1"
                obs_EntryRel.AsObservation.StatusCode.Code = "completed";
                obs_EntryRel.AsObservation.EffectiveTime   = new IVL_TS().Init(low: new IVXB_TS(), high: new IVXB_TS());
                obsValueAsCD = new CD();
                if (!string.IsNullOrEmpty(GetSNOMED(patientAllergies.reaction)))
                {
                    obsValueAsCD.Code = GetSNOMED(patientAllergies.reaction);
                    // Dynamic Value ''
                }

                obsValueAsCD.DisplayName = patientAllergies.reaction;
                //"Hives"
                obsValueAsCD.CodeSystem = "2.16.840.1.113883.6.96";
                obsValueAsCD.OriginalText.Reference.Value = "#" + Convert.ToString(patientAllergies.allergyId);
                obs_EntryRel.AsObservation.Value.Add(obsValueAsCD);
            }

            ///' Allergy Severity Observation
            if (!string.IsNullOrEmpty(patientAllergies.reaction))
            {
                obs_EntryRel                         = entryRel.AsObservation.EntryRelationship.Append();
                obs_EntryRel.TypeCode                = x_ActRelationshipEntryRelationship.SUBJ;
                obs_EntryRel.InversionInd            = true;
                obs_EntryRel.InversionIndSpecified   = true;
                obs_EntryRel.AsObservation.ClassCode = "OBS";
                obs_EntryRel.AsObservation.MoodCode  = x_ActMoodDocumentObservation.EVN;
                hl7III = obs_EntryRel.AsObservation.TemplateId.Append();
                hl7III.Init("2.16.840.1.113883.10.20.22.4.8");
                obs_EntryRel.AsObservation.Code.Code           = "SEV";
                obs_EntryRel.AsObservation.Code.DisplayName    = "Severity Observation";
                obs_EntryRel.AsObservation.Code.CodeSystem     = "2.16.840.1.113883.5.4";
                obs_EntryRel.AsObservation.Code.CodeSystemName = "ActCode";
                //obs_EntryRel.AsObservation.Text.Reference.Value = "#severity1"
                obs_EntryRel.AsObservation.StatusCode.Code = "completed";
                obsValueAsCD             = new CD();
                obsValueAsCD.Code        = (Convert.ToString(patientAllergies.reaction) == "Mild" ? "255604002" : (Convert.ToString(patientAllergies.reaction) == "Moderate" ? "6736007" : "24484000"));
                obsValueAsCD.DisplayName = patientAllergies.reaction;
                // Moderate or Mild or severe"
                obsValueAsCD.CodeSystem     = "2.16.840.1.113883.6.96";
                obsValueAsCD.CodeSystemName = "SNOMED CT";
                obsValueAsCD.OriginalText.Reference.Value = "#" + Convert.ToString(patientAllergies.allergyId);
                obs_EntryRel.AsObservation.Value.Add(obsValueAsCD);
            }
        }
示例#13
0
        public string BindHeader(string title, ClinicalDocument clinicalDoc, Factory hl7factory, ICS realmCode)
        {
            string docheader = String.Empty;

            header                     = new CCDAHeader();
            realmCode_code             = new RealmCode();
            typeId                     = new TypeId();
            templateId                 = new TemplateId();
            id                         = new Id();
            code                       = new Code();
            effectiveTime              = new EffectiveTime();
            confidentialityCode        = new ConfidentialityCode();
            languageCode               = new LanguageCode();
            setId                      = new SetId();
            versionNumber              = new VersionNumber();
            header.Id                  = id;
            header.languageCode        = languageCode;
            header.realmCode           = realmCode_code;
            header.code                = code;
            header.effectiveTime       = effectiveTime;
            header.confidentialityCode = confidentialityCode;
            header.setId               = setId;
            header.versionNumber       = versionNumber;
            header.TemplateId          = templateId;
            header.typeId              = typeId;
            header.title               = title;
            realmCode                  = hl7factory.CreateCS();
            realmCode                  = hl7factory.CreateCS();
            realmCode.Code             = header.realmCode.code;
            clinicalDoc.RealmCode.Add(realmCode);
            // Manage Clinical Report Header
            //Manage TypeId
            clinicalDoc.TypeId.Root      = header.typeId.root;
            clinicalDoc.TypeId.Extension = header.typeId.extension;
            //END
            //Manage template Id
            clinicalDoc.TemplateId.Append().Root = header.TemplateId.root;
            //END
            //Manage Header Id
            clinicalDoc.Id.Init(header.Id.root, header.Id.extension);
            //END
            //Manage Header Code
            clinicalDoc.Code.Code           = header.code.code;
            clinicalDoc.Code.CodeSystemName = header.code.codeSystemName;
            clinicalDoc.Code.DisplayName    = header.code.displayName;
            clinicalDoc.Code.CodeSystem     = header.code.codeSystem;
            //END
            //Manage Header Title
            clinicalDoc.Title.Text = header.title;
            //END
            //Manage Header Effective Date
            clinicalDoc.EffectiveTime.AsDateTime = Convert.ToDateTime(header.effectiveTime.value);
            //END
            //Manage Header Confidencial Code
            clinicalDoc.ConfidentialityCode.Code       = header.confidentialityCode.code;
            clinicalDoc.ConfidentialityCode.CodeSystem = header.confidentialityCode.codeSystem;
            //END
            //Manage Header Language Code
            clinicalDoc.LanguageCode.Code = header.languageCode.code;
            //END
            //Manage Header SetId
            clinicalDoc.SetId.Root      = header.setId.root;
            clinicalDoc.SetId.Extension = header.setId.extension;
            //END
            //Manage Header Version
            clinicalDoc.VersionNumber.Value = header.versionNumber.value;
            //END
            //END
            //docheader = "<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet type='text/xsl' href='CDA.xsl'?>"+clinicalDoc.Xml;
            docheader = clinicalDoc.Xml;

            return(docheader.ToString());
        }
示例#14
0
 /* Func regUser
  * A function to register a new user to the chat room
  *
  * @param user String representing the username
  * @param port String of an integer representing the port this client is listening
  * @param obj The remote object held by the server
  */
 public static void regUser(string user, string port, ICS obj)
 {
     obj.Reg(user, "tcp://localhost:" + port + "/ChatObject");
 }
示例#15
0
        List <KeyValuePair <string, string> > EmparentarICS;   //Comite , Comite padre.
        #endregion PROPIEDADES


        #region METODOS
        public Dictionary <string, Guid> Iniciar(Oracle ora, Comun com, Crm crm)
        {
            try
            {
                OracleGlobal = ora;
                ComunGlobal  = com;
                CrmGlobal    = crm;


                //1. Leer ICS de Oracle y CRM
                //Inicializa PFECore
                CrmGlobal.InicializarPFE(OracleGlobal);
                LeerICSFromCRM();
                LeerICSFromOracle();


                //2. Cargar iCS sin ics padre (son ICS padres)   |
                //3. Cargar Resto de ICSs                        |  Cargar todos y emparentar despues
                if (ICSOracle.Any())
                {
                    ComunGlobal.LogText("----   Iniciando sincronización ICS   ------");
                    ComunGlobal.LogText("****   Registros a cotejar: " + ICSOracle.Count);
                    #region PROCESA ICS
                    bool   ok;
                    ICS    auxICSCRM = new ICS();
                    Entity icsUpdate;

                    foreach (var ics in ICSOracle)
                    {
                        ok = ICSCRM.TryGetValue(ics.Value.Aen_Codigo_Ics, out auxICSCRM);

                        try
                        {
                            if (ok) // Existe, actualizamos
                            {
                                icsUpdate = new Entity(NombresCamposICS.EntityName);

                                bool res = ics.Value.ICSIguales(auxICSCRM, ref icsUpdate);

                                if (res)
                                {
                                    //Emparentar en update (por si el padre del ICS se crea en este bloque también)
                                    //if (!ics.Value.Aen_Codigo_Ics_PadreSTR.Equals(string.Empty) && ics.Value.Aen_Codigo_Ics_Padre.Equals(Guid.Empty))
                                    //    EmparentarICS.Add(new KeyValuePair<string, string>(ics.Value.Aen_Codigo_Ics, ics.Value.Aen_Codigo_Ics_PadreSTR));

                                    CrmGlobal.AnadirElementoEmr(new UpdateRequest {
                                        Target = icsUpdate
                                    });
                                }
                                else
                                {
                                    CrmGlobal.Iguales++;
                                }
                            }
                            else //No existe, creamos
                            {
                                Entity newI = ics.Value.GetEntity();

                                //Emparentar post-creación
                                if (!ics.Value.Aen_Codigo_Ics_PadreSTR.Equals(string.Empty) && ics.Value.Aen_Codigo_Ics_Padre.Equals(Guid.Empty))
                                {
                                    EmparentarICS.Add(new KeyValuePair <string, string>(ics.Value.Aen_Codigo_Ics, ics.Value.Aen_Codigo_Ics_PadreSTR));
                                }

                                CrmGlobal.AnadirElementoEmr(new CreateRequest {
                                    Target = newI
                                });
                            }
                        }
                        catch (Exception e)
                        {
                            ComunGlobal.LogText("ERROR con el ICS " + ics.Value.Aen_Codigo_Ics + " ::: " + e.ToString());
                        }
                    }
                    CrmGlobal.ProcesarUltimosEmr();
                    #endregion PROCESA ICS
                    CrmGlobal.MostrarEstadisticas("ICS");
                    ComunGlobal.LogText("----   FIN sincronización ICS   ------");
                }
                else
                {
                    ComunGlobal.LogText("No hay ICS en origen, terminamos");
                }



                //4. Indexar Comités <códigoComite, Guid>
                CargaDiccionarioGuidsICS();

                //5. Emparentar Comités
                EmparentacionDeICS();

                LimpiezaDiccionarios();

                return(MaestroICSCRM);
            }
            catch (Exception e)
            {
                ComunGlobal.LogText("ERROR en Lanzador de ICS ::: " + e.ToString());
                if (OracleGlobal != null && OracleGlobal.OraConnParaLog.State == ConnectionState.Open)
                {
                    OracleGlobal.OraConnParaLog.Dispose();
                }

                return(null);
            }
        }
示例#16
0
        public void LeerICSFromCRM()
        {
            ICSCRM        = new Dictionary <string, ICS>();
            MaestroICSCRM = new Dictionary <string, Guid>();
            EmparentarICS = new List <KeyValuePair <string, string> >();

            string[] campos =
            {
                NombresCamposICS.EntityId,
                NombresCamposICS.Aen_Codigo_IcsCRM,     NombresCamposICS.Aen_Codigo_Ics_PadreCRM,
                NombresCamposICS.Aen_Descripcion_IcsCRM,NombresCamposICS.Aen_Descripcion_IcsENCRM,
                NombresCamposICS.Aen_Ics_ActivoCRM
            };
            string entityName = NombresCamposICS.EntityName;

            #region Query
            FilterExpression    filter           = new FilterExpression();
            ConditionExpression conditionNotNull = new ConditionExpression();
            conditionNotNull.AttributeName = NombresCamposICS.Aen_Codigo_IcsCRM;
            conditionNotNull.Operator      = ConditionOperator.NotNull;
            filter.Conditions.Add(conditionNotNull);

            QueryExpression query = new QueryExpression(entityName);
            query.ColumnSet.AddColumns(campos);
            query.Criteria.AddFilter(filter);
            #endregion Query
            #region PagingCookie
            int fetchCount = 5000;
            int pageNumber = 1;

            query.PageInfo              = new PagingInfo();
            query.PageInfo.Count        = fetchCount;
            query.PageInfo.PageNumber   = pageNumber;
            query.PageInfo.PagingCookie = null;
            #endregion PagingCookie

            while (true)
            {
                EntityCollection icsColeccion = CrmGlobal.GetIOS().RetrieveMultiple(query);

                if (icsColeccion.Entities.Count > 0)
                {
                    //2.Construir a partir de la lista ICS CRM, el diccionario
                    foreach (Entity icCRM in icsColeccion.Entities)
                    {
                        ICS i = new ICS();
                        i.ICSFromCRM(icCRM);
                        ICSCRM.Add(i.Aen_Codigo_Ics, i);
                        MaestroICSCRM.Add(i.Aen_Codigo_Ics, i.Aen_ICSGUID);
                    }
                }

                if (icsColeccion.MoreRecords)
                {
                    query.PageInfo.PageNumber++;
                    query.PageInfo.PagingCookie = icsColeccion.PagingCookie;
                }
                else
                {
                    break;
                }
            }
        }
        public void GenerateProblemEntry(PatientProblemes patientProblem, string refId, DateTime dateofbirth, III hl7III, Factory hl7Factory)
        {
            IEntry entry = functionalStatus.Section.Entry.Append();

            entry.TypeCode        = x_ActRelationshipEntry.DRIV;
            entry.AsAct.ClassCode = x_ActClassDocumentEntryAct.ACT;
            entry.AsAct.MoodCode  = x_DocumentActMood.EVN;
            IIVXB_TS TS = hl7Factory.CreateIVXB_TS();

            hl7III = entry.AsAct.Id.Append();

            hl7III.Init(Convert.ToString(patientProblem.PatientGuid));
            hl7III = entry.AsAct.TemplateId.Append();
            hl7III.Init("2.16.840.1.113883.10.20.22.4.3");
            entry.AsAct.Code.Code           = "CONC";
            entry.AsAct.Code.CodeSystem     = "2.16.840.1.113883.5.6";
            entry.AsAct.Code.CodeSystemName = "LOINC";

            entry.AsAct.StatusCode.Init((Convert.ToString(patientProblem.Status) == "Active" ? "active" : "completed"));
            if (patientProblem.DateDiagnosed != null)
            {
                entry.AsAct.EffectiveTime = new IVL_TS().Init(low: new IVXB_TS());
            }
            else
            {
                entry.AsAct.EffectiveTime = new IVL_TS().Init(low: new IVXB_TS());
                //entry.AsAct.EffectiveTime.NullFlavor = "UNK";

                /* Not Compiled
                 * entry.AsAct.EffectiveTime = new IVL_TS().Init(Value:null, low:new IVXB_TS().Init(Convert.ToDateTime(patientProblem.DateDiagnosed)),high:null,width:null,center:null);*/
                // Setting the DateTime.
            }

            IEntryRelationship entryRel = entry.AsAct.EntryRelationship.Append();

            entryRel.TypeCode = x_ActRelationshipEntryRelationship.SUBJ;
            entryRel.AsObservation.ClassCode = "OBS";
            entryRel.AsObservation.MoodCode  = x_ActMoodDocumentObservation.EVN;
            III TempId = entryRel.AsObservation.TemplateId.Append();

            TempId.Root = "2.16.840.1.113883.10.20.22.4.4";
            hl7III      = entryRel.AsObservation.Id.Append();
            hl7III.Root = Guid.NewGuid().ToString();

            entryRel.AsObservation.Code.Code        = Convert.ToString(patientProblem.Description).ToLower().Contains("finding") ? "404684003" : Convert.ToString(patientProblem.Description).ToLower().Contains("disease") ? "282291009" : "409586006";
            entryRel.AsObservation.Code.CodeSystem  = "2.16.840.1.113883.6.96";
            entryRel.AsObservation.Code.DisplayName = Convert.ToString(patientProblem.Description).ToLower().Contains("finding") ? "Finding" : Convert.ToString(patientProblem.Description).ToLower().Contains("disease") ? "Diagnosis" : "Complaint";


            IED ED = hl7Factory.CreateED();

            ED.Reference.Value          = refId;
            entryRel.AsObservation.Text = ED;
            ICS CS = hl7Factory.CreateCS();

            CS.Init("completed");
            entryRel.AsObservation.StatusCode = CS;

            if (Convert.ToString(patientProblem.Status) == "Resolved")
            {
                if (object.ReferenceEquals(patientProblem.DateDiagnosed, DBNull.Value))
                {
                    entry.AsObservation.EffectiveTime = new IVL_TS().Init(low: new IVXB_TS());
                }
                else
                {
                    entry.AsObservation.EffectiveTime = new IVL_TS().Init(low: new IVXB_TS());
                    //entryRel.AsObservation.EffectiveTime.NullFlavor = "UNK";

                    /* Not Compiled
                     * entryRel.AsObservation.EffectiveTime.Init(low: new IVXB_TS().Init(Convert.ToDateTime(patientProblem.DateDiagnosed)), high: new IVXB_TS());
                     * // Because Allergy Start Date is Missing.
                     *
                     * entryRel.AsObservation.EffectiveTime.High.NullFlavor = "UNK";*/
                }
            }
            else
            {
                if (object.ReferenceEquals(patientProblem.DateDiagnosed, DBNull.Value))
                {
                    entryRel.AsObservation.EffectiveTime = new IVL_TS().Init(low: new IVXB_TS());
                    //entryRel.AsObservation.EffectiveTime.NullFlavor = "UNK";
                }
                else
                {
                    entryRel.AsObservation.EffectiveTime = new IVL_TS().Init(low: new IVXB_TS());
                    //entryRel.AsObservation.EffectiveTime.NullFlavor = "UNK";

                    /* Not Compiled
                     * entryRel.AsObservation.EffectiveTime.Init(low: new IVXB_TS().Init(Convert.ToDateTime(patientProblem.DateDiagnosed)), high: new IVXB_TS());
                     * entryRel.AsObservation.EffectiveTime.High.NullFlavor = "UNK";*/
                }
            }

            ICD CD = hl7Factory.CreateCD();

            string snomedCode = GetSNOMED(Convert.ToString(patientProblem.Description));

            if (string.IsNullOrEmpty(snomedCode))
            {
                CD.NullFlavor = "UNK";
            }
            else
            {
                CD.Code           = snomedCode;
                CD.CodeSystem     = "2.16.840.1.113883.6.96";
                CD.CodeSystemName = "SNOMED CT";
                CD.DisplayName    = Convert.ToString(patientProblem.Description);
            }

            entryRel.AsObservation.Value.Add(CD);

            ///''''''''''''Problem Observation''''''''''''''''''
            IEntryRelationship entryProblemObs = entryRel.AsObservation.EntryRelationship.Append();

            entryProblemObs.TypeCode = x_ActRelationshipEntryRelationship.SUBJ;
            entryProblemObs.AsObservation.ClassCode = "OBS";
            entryProblemObs.AsObservation.MoodCode  = x_ActMoodDocumentObservation.EVN;
            TempId      = entryProblemObs.AsObservation.TemplateId.Append();
            TempId.Root = "2.16.840.1.113883.10.20.22.4.4";
            hl7III      = entryProblemObs.AsObservation.Id.Append();
            hl7III.Root = Guid.NewGuid().ToString();

            entryProblemObs.AsObservation.Code.Code        = Convert.ToString(patientProblem.Description).ToLower().Contains("finding") ? "404684003" : Convert.ToString(patientProblem.Description).ToLower().Contains("disease") ? "282291009" : "409586006";
            entryProblemObs.AsObservation.Code.CodeSystem  = "2.16.840.1.113883.6.96";
            entryProblemObs.AsObservation.Code.DisplayName = Convert.ToString(patientProblem.Description).ToLower().Contains("finding") ? "Finding" : Convert.ToString(patientProblem.Description).ToLower().Contains("disease") ? "Diagnosis" : "Complaint";

            ED = hl7Factory.CreateED();
            ED.Reference.Value = refId;
            entryProblemObs.AsObservation.Text = ED;
            CS = hl7Factory.CreateCS();
            CS.Init("completed");
            entryProblemObs.AsObservation.StatusCode = CS;

            if (Convert.ToString(patientProblem.Status) == "Resolved")
            {
                if (object.ReferenceEquals(patientProblem.DateDiagnosed, DBNull.Value))
                {
                    entryProblemObs.AsObservation.EffectiveTime = new IVL_TS().Init(low: new IVXB_TS());
                    //entryProblemObs.AsObservation.EffectiveTime.NullFlavor = "UNK";
                }
                else
                {
                    entryProblemObs.AsObservation.EffectiveTime = new IVL_TS().Init(low: new IVXB_TS());

                    /* Not Compiled
                     * entryProblemObs.AsObservation.EffectiveTime.Init(low: new IVXB_TS().Init(Convert.ToDateTime(patientProblem.DateDiagnosed)), high: new IVXB_TS());
                     * // Because Allergy Start Date is Missing.
                     * entryProblemObs.AsObservation.EffectiveTime.High.NullFlavor = "UNK";*/
                }
            }
            else
            {
                if (object.ReferenceEquals(patientProblem.DateDiagnosed, DBNull.Value))
                {
                    entryProblemObs.AsObservation.EffectiveTime = new IVL_TS().Init(low: new IVXB_TS());
                }
                else
                {
                    entryProblemObs.AsObservation.EffectiveTime = new IVL_TS().Init(low: new IVXB_TS());

                    /* Not Compiled
                     * entryProblemObs.AsObservation.EffectiveTime.Init(low: new IVXB_TS().Init(Convert.ToDateTime(patientProblem.DateDiagnosed)), high: new IVXB_TS());
                     * entryProblemObs.AsObservation.EffectiveTime.High.NullFlavor = "UNK";*/
                }
            }

            CD         = hl7Factory.CreateCD();
            snomedCode = GetSNOMED(Convert.ToString(patientProblem.Description));
            if (string.IsNullOrEmpty(snomedCode))
            {
                CD.NullFlavor = "UNK";
            }
            else
            {
                CD.Code        = snomedCode;
                CD.CodeSystem  = "2.16.840.1.113883.6.96";
                CD.DisplayName = Convert.ToString(patientProblem.Description);
            }

            entryProblemObs.AsObservation.Value.Add(CD);


            ///'''''''''''' Age Observation''''''''''''''''''

            if ((!object.ReferenceEquals(patientProblem.DateDiagnosed, DBNull.Value)))
            {
                IEntryRelationship age_EntryRel = entryRel.AsObservation.EntryRelationship.Append();
                age_EntryRel.TypeCode                = x_ActRelationshipEntryRelationship.SUBJ;
                age_EntryRel.InversionInd            = true;
                age_EntryRel.InversionIndSpecified   = true;
                age_EntryRel.AsObservation.ClassCode = "OBS";
                age_EntryRel.AsObservation.MoodCode  = x_ActMoodDocumentObservation.EVN;
                hl7III = age_EntryRel.AsObservation.TemplateId.Append();
                hl7III.Init("2.16.840.1.113883.10.20.22.4.31");
                CD = hl7Factory.CreateCD();
                CD.Init("445518008", "2.16.840.1.113883.6.96", "", "Age");
                age_EntryRel.AsObservation.Code = CD;
                age_EntryRel.AsObservation.StatusCode.Init("completed");
                IPQ PQ = hl7Factory.CreatePQ();
                PQ.Value = calcYear(Convert.ToDateTime(patientProblem.DateDiagnosed), dateofbirth);
                PQ.Unit  = "a";
                age_EntryRel.AsObservation.Value.Add(PQ);
            }

            ///'''''''''''' Problem Status Observation'''''''''''''
            IEntryRelationship problemStatus_EntryRel = entryRel.AsObservation.EntryRelationship.Append();

            problemStatus_EntryRel.TypeCode                = x_ActRelationshipEntryRelationship.REFR;
            problemStatus_EntryRel.InversionInd            = true;
            problemStatus_EntryRel.InversionIndSpecified   = true;
            problemStatus_EntryRel.AsObservation.ClassCode = "OBS";
            problemStatus_EntryRel.AsObservation.MoodCode  = x_ActMoodDocumentObservation.EVN;
            hl7III = problemStatus_EntryRel.AsObservation.TemplateId.Append();
            hl7III.Init("2.16.840.1.113883.10.20.22.4.6");

            CD = hl7Factory.CreateCD();
            CD.Init("33999-4", "2.16.840.1.113883.6.1", "LOINC", "Status");
            problemStatus_EntryRel.AsObservation.Code = CD;
            problemStatus_EntryRel.AsObservation.StatusCode.Init("completed");
            //55561003-Active, 73425007-Inactive, 413322009- Resolved
            CD = hl7Factory.CreateCD();

            CD.Init((Convert.ToString(patientProblem.Status) == "Active" ? "55561003" : (Convert.ToString(patientProblem.Status) == "Inactive" ? "73425007" : "413322009")), "2.16.840.1.113883.6.96", "SNOMED CT", Convert.ToString(patientProblem.Status));
            problemStatus_EntryRel.AsObservation.Value.Add(CD);
        }
示例#18
0
 public frmAddFromPO(ICS item)
 {
     InitializeComponent();
     this.item = item;
     Init();
 }