Exemplo n.º 1
0
 public Job Clone()
 {
     Job result = new Job();
     result.JobID = this.JobID;
     result.FileID = this.FileID;
     result.Description = this.Description;
     result.StartDT = this.StartDT;
     result.EndDT = this.EndDT;
     result.ApplicationID = this.ApplicationID;
     result.RunBy = this.RunBy;
     result.Successful = this.Successful;
     result.ProcessFileTypeID = this.ProcessFileTypeID;
     result.ErrorCodeID = this.ErrorCodeID;
     return result;
 }
Exemplo n.º 2
0
 public void Execute(ref Job job)
 {
     Parameters.AddWithValue("@FileID", job.FileID);
     Parameters.AddWithValue("@Description", job.Description);
     Parameters.AddWithValue("@StartDT", job.StartDT);
     //TODO: Fix ApplicationID
     Parameters.AddWithValue("@ApplicationID", 0);//job.Application.ApplicationID);
     Parameters.AddWithValue("@RunBy", job.RunBy);
     Parameters.AddWithValue("@ProcessFileTypeID", job.ProcessFileTypeID);
     DataTable t = ExecuteReader();
     if (t.Rows.Count > 0)
     {
         decimal jobid = t.Rows[0].Field<decimal>("JobID");
         job.JobID = Convert.ToInt32(jobid);
     }
 }
 public void JobSave(ref Job job)
 {
     spAddJob proc = new spAddJob(this.ConnectionString);
     proc.Execute(ref job);
 }
 public Job JobStart(ImportedFileStatus file)
 {
     Job result = new Job()
     { 
         /*TODO: Set ApplicationID*/ 
         /*Application = new Application();*/ 
         /*Application.RegisterApplication();*/
         FileID = file.ImportedFileStatusID,
         RunBy = Environment.UserName,
         Successful = false,
         Description = Path.GetFileName(file.FileName),
         ProcessFileTypeID = file.ProcessFileTypeID,
         StartDT = DateTime.Now,
         
     };
     this.JobSave(ref result);
     return result;
 }
Exemplo n.º 5
0
        public void SaveToStaging(Job job, int lineNumber, string rawLine, IClientDataProvider DataProvider)
        {
            // parse the appropriate objects out and save to the database
            EncounterImport import = new EncounterImport()
            {
                FileID = job.FileID,
                EncounterNumber = this.EncounterNumber,
                PatientNumber = this.PatientNumber,
                Facility = this.Facility,
                RawLine = rawLine,
                RowNumber = lineNumber
            };
            DataProvider.EncounterImportSave(ref import);
            this.EncounterImportID = import.EncounterImportID;

            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    StagingAddress address = GetAddressValues(job);
                    address.EncounterImportID = this.EncounterImportID;
                    DataProvider.StagingAddressSave(ref address);

                    StagingEncounterFile encounter = GetEncounterValues(job);
                    encounter.EncounterImportID = this.EncounterImportID;
                    DataProvider.StagingEncounterFileSave(ref encounter);

                    StagingPerson person = GetPersonValues(job);
                    person.EncounterImportID = this.EncounterImportID;
                    DataProvider.StagingPersonSave(ref person);

                    //throw new Exception("Test transaction handling");
                    StagingPatient patient = GetPatientValues(job);
                    patient.EncounterImportID = this.EncounterImportID;
                    DataProvider.StagingPatientSave(ref patient);

                    StagingEncounterPayment payment = GetPaymentValues(job);
                    payment.EncounterImportID = this.EncounterImportID;
                    DataProvider.StagingEncounterPaymentSave(ref payment);

                    scope.Complete();
                }
            }
            catch (TransactionAbortedException ex)
            {
                log.Error(ex);
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }
        }
Exemplo n.º 6
0
        public StagingPatient GetPatientValues(Job job)
        {
            StagingPatient result = new StagingPatient()
            {
                PatientNumber = this.PatientNumber, 
                /*result.ClientOrganizationID = */
                EncounterImportID = this.EncounterImportID,
                Facility = this.Facility,
                FileID = job.FileID.Value,
                JobID = job.JobID
            };
            //result.PatientID

            //

            return result;
        }
Exemplo n.º 7
0
 public StagingAddress GetAddressValues(Job job)
 {
     StagingAddress result = new StagingAddress()
     {
         City = this.City,
         State = this.State,
         PatientNumber = this.PatientNumber,
         RawAddress = this.Address,
         RawAddress2 = this.Address2,
         ZipCode = GetZip5(),
         ZipFour = GetZip4(),
         FileID = job.FileID,
         JobID = job.JobID,
         EncounterImportID = this.EncounterImportID
     };
     return result;
 }
Exemplo n.º 8
0
        public StagingPerson GetPersonValues(Job job)
        {
            StagingPerson result = new StagingPerson()
            {
                FirstName = this.FirstName,
                MiddleInitial = GetMiddleInitial().ToString(),
                LastName = this.LastName,
                LastNameSuffix = this.LastNameSuffix,
                Title = this.Title,
                DateOfBirth = this.DateOfBirth,
                PatientNumber = this.PatientNumber, 
                Gender = MapGender().ToString(),
                Phone = this.Phone,
                Email = this.Email,
                FileID = job.FileID,
                JobID = job.JobID,
                EncounterImportID = this.EncounterImportID
            };

            return result;
        }
Exemplo n.º 9
0
        public StagingEncounterPayment GetPaymentValues(Job job)
        {
            if (!string.IsNullOrEmpty(this.PayerCode))
            {
                StagingEncounterPayment result = new StagingEncounterPayment()
                {
                    Charge = this.Charge,
                    PayerCode = this.PayerCode,
                    Payment = this.Payment,
                    EncounterNumber = this.EncounterNumber,
                    FileID = job.FileID,
                    JobID = job.JobID,
                    EncounterImportID = this.EncounterImportID
                };
                return result;
            }

            return null;
        }
Exemplo n.º 10
0
        public StagingEncounterFile GetEncounterValues(Job job, int clientOrganizationID)
        {
            StagingEncounterFile result = new StagingEncounterFile()
            {
                AdmitDT = this.AdmitDateTime,
                AdmitType = this.AdmitType,
                AttendingPhysician = this.AttendingPhysician,
                Cost = this.Cost,
                DiagnosisCode = this.DiagnosisCode,
                DiagnosisType = this.DiagnosisType,
                DischargeDT = this.DischargeDateTime,
                EncounterNumber = this.EncounterNumber,
                Facility = this.Facility,
                FileID = job.FileID,
                JobID = job.JobID,
                PatientNumber = this.PatientNumber,
                PresentOnAdmission = this.POA,
                ProcedureCode = this.ProcedureCode,
                ProcedureType = this.ProcedureType,
                ReAdmission = this.ReadmitFlag,
                ReferringPhysician = this.ReferringPhysician,
                Source = this.Source,
                Version = this.Version,
                ClientOrganizationID = clientOrganizationID,
                EncounterImportID = this.EncounterImportID
            };

            //result.LookupIDs();

            //Task# 995 - CF
            if (result.AdmitDT == libc.Constants.MinDateValue &&
                result.DischargeDT == libc.Constants.MinDateValue)
            {
                return null; 
            }
            return result;
        }
Exemplo n.º 11
0
 public StagingEncounterFile GetEncounterValues(Job job)
 {
     StagingEncounterFile result = new StagingEncounterFile();
     result.AdmitDT = this.AdmitDateTime;
     result.AdmitType = this.AdmitType;
     result.AttendingPhysician = this.AttendingPhysician;
     result.Cost = this.Cost;
     result.DiagnosisCode = this.DiagnosisCode;
     result.DiagnosisType = this.DiagnosisType;
     result.DischargeDT = this.DischargeDateTime;
     result.EncounterNumber = this.EncounterNumber;
     result.Facility = this.Facility;
     result.FileID = job.FileID;
     result.JobID = job.JobID;
     result.PatientNumber = this.PatientNumber;
     result.PresentOnAdmission = this.POA;
     result.ProcedureCode = this.ProcedureCode;
     result.ProcedureType = this.ProcedureType;
     result.ReAdmission = this.ReadmitFlag;
     result.ReferringPhysician = this.ReferringPhysician;
     result.Source = this.Source;
     int triagecode = 0;
     if (int.TryParse(this.TriageCode, out triagecode))
     {
         result.TriageCode = triagecode;
     }
     else
     {
         result.TriageCode = 0;
     }             
     result.Version = this.Version;
     result.EncounterImportID = this.EncounterImportID;
     return result;
 }
Exemplo n.º 12
0
        protected void ImportBegin()
        {
            job = SystemDataProvider.ClientDataProvider.JobStart(file);

            clientOrg.LoadInProgress = true;
            SystemDataProvider.ClientDataProvider.ClientOrganizationSave(ref clientOrg);

            file.ProcessTypeID = (int)ProcessType.FileLoad;
            SystemDataProvider.ClientDataProvider.ImportedFileStatusSave(ref file);
        }