private LabTest BuildLabTest(LabSpecimen labSpecimen, LabTestName labTestNameCodedConcept) { var labTest = labSpecimen.AddLabTest(new LabTestInfoBuilder().WithLabTestName(labTestNameCodedConcept)); Session.SaveOrUpdate(labTest); return(labTest); }
public bool DeleteLabtestName(LabTestName c) { try { string delete = "Delete from LabTest where ID=" + c.ID + ""; con = new OleDbConnection(); this.readconfile = new ReadConfigFile(); con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile); con.Open(); tran = con.BeginTransaction(); cmd = new OleDbCommand(delete, con); cmd.Transaction = tran; cmd.ExecuteNonQuery(); tran.Commit(); return(true); } catch (Exception ex) { throw ex; } finally { con.Close(); } }
public List <LabTestName> GetLabTestNames() { ltn = new List <LabTestName>(); try { string Get = " Select * from LabTest "; con = new OleDbConnection(); this.readconfile = new ReadConfigFile(); con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile); con.Open(); tran = con.BeginTransaction(); cmd = new OleDbCommand(Get, con); cmd.Transaction = tran; dr = cmd.ExecuteReader(); while (dr.Read()) { LabTestName c = new LabTestName(); c.ID = dr["ID"] == System.DBNull.Value? 0: Convert.ToInt32(dr["ID"]); c.TestName = dr["Test (A-Z)"] == System.DBNull.Value ? "" : Convert.ToString(dr["Test (A-Z)"]); c.Sample = dr["Sample"] == System.DBNull.Value ? "" : Convert.ToString(dr["Sample"]); c.Performed = dr["Performed"] == System.DBNull.Value ? "" : Convert.ToString(dr["Performed"]); c.Report = dr["Report"] == System.DBNull.Value ? "" : Convert.ToString(dr["Report"]); c.Deserving = dr["Deserving"] == System.DBNull.Value ? 0 : Convert.ToDecimal(dr["Deserving"]); c.Poor = dr["Poor"] == System.DBNull.Value ? 0 : Convert.ToDecimal(dr["Poor"]); c.YCDO = dr["YCDO"] == System.DBNull.Value ? 0 : Convert.ToDecimal(dr["YCDO"]); c.General = dr["Generall"] == System.DBNull.Value ? 0 : Convert.ToDecimal(dr["Generall"]); c.Shahab = dr["Shahab"] == System.DBNull.Value ? 0 : Convert.ToDecimal(dr["Shahab"]); c.Ghori = dr["Ghori"] == System.DBNull.Value ? 0 : Convert.ToDecimal(dr["Ghori"]); c.Unit = dr["Unit"] == System.DBNull.Value ? string.Empty : dr["Unit"].ToString(); c.IsMedicine = Convert.ToBoolean(dr["IsMedicine"]); c.IsRsTenInjection = Convert.ToBoolean(dr["IsRsTenInjection"]); c.IsAlwaysPaid = Convert.ToBoolean(dr["IsAlwaysPaid"]); c.IsOd = Convert.ToBoolean(dr["IsOd"]); c.PurchasePrice = dr["PurchasePrice"] == DBNull.Value ? 0 : Convert.ToDouble(dr["PurchasePrice"]); c.RetailPrice = dr["RetailPrice"] == DBNull.Value ? 0 : Convert.ToDouble(dr["RetailPrice"]); try { c.FixedLimit = Convert.ToInt32(dr["FixLimit"]); } catch (Exception) { } ltn.Add(c); } dr.Close(); tran.Commit(); return(ltn); } catch (Exception ex) { throw ex; } finally { con.Close(); } }
public bool SaveLabtestname(LabTestName c) { try { con = new OleDbConnection(); this.readconfile = new ReadConfigFile(); con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile); con.Open(); tran = con.BeginTransaction(); string insert; int VID = 0; if (c.ID == 0) { cmd = new OleDbCommand("Select Max(ID) From LabTest", con); cmd.Transaction = tran; VID = Convert.ToInt32(cmd.ExecuteScalar()); c.ID = VID + 1; ////-------------- Insert without ID ------- Asif - 29-05-19 // insert = " Insert into LabTest (ID,[Test (A-Z)],Sample,Performed,Report,Deserving,Poor,YCDO,Generall,Shahab,Ghori,IsMedicine,Unit,IsRsTenInjection,IsAlwaysPaid,IsOd,PurchasePrice,RetailPrice,FixLimit)" // + " values (" + c.ID + ",'" + c.TestName + "','" + c.Sample + "','" + c.Performed + "'," //+ "'" + c.Report + "'," + c.Deserving + "," + c.Poor + "," + c.YCDO + "," + c.General + "," //+ " " + c.Shahab + "," + c.Ghori + "," + Convert.ToInt16(c.IsMedicine) + ",'" + c.Unit + "'," + Convert.ToInt16(c.IsRsTenInjection) + "," + Convert.ToInt16(c.IsAlwaysPaid) + "," + Convert.ToInt16(c.IsOd) + "," + c.PurchasePrice + "," + c.RetailPrice + "," + c.FixedLimit + ")"; insert = " Insert into LabTest ([Test (A-Z)],Sample,Performed,Report,Deserving,Poor,YCDO,Generall,Shahab,Ghori,IsMedicine,Unit,IsRsTenInjection,IsAlwaysPaid,IsOd,PurchasePrice,RetailPrice,FixLimit)" + " values ('" + c.TestName + "','" + c.Sample + "','" + c.Performed + "'," + "'" + c.Report + "'," + c.Deserving + "," + c.Poor + "," + c.YCDO + "," + c.General + "," + " " + c.Shahab + "," + c.Ghori + "," + Convert.ToInt16(c.IsMedicine) + ",'" + c.Unit + "'," + Convert.ToInt16(c.IsRsTenInjection) + "," + Convert.ToInt16(c.IsAlwaysPaid) + "," + Convert.ToInt16(c.IsOd) + "," + c.PurchasePrice + "," + c.RetailPrice + "," + c.FixedLimit + ")"; } else { insert = "Update LabTest set [Test (A-Z)]='" + c.TestName + "',Sample='" + c.Sample + "',Performed='" + c.Performed + "',Report='" + c.Report + "',Deserving=" + c.Deserving + ",Poor=" + c.Poor + ",YCDO=" + c.YCDO + ",Generall=" + c.General + ",Shahab=" + c.Shahab + ",Ghori=" + c.Ghori + ",IsMedicine=" + Convert.ToInt16(c.IsMedicine) + ",Unit='" + c.Unit + "',IsAlwaysPaid=" + Convert.ToInt16(c.IsAlwaysPaid) + ",IsRsTenInjection=" + Convert.ToInt16(c.IsRsTenInjection) + ",IsOd=" + Convert.ToInt16(c.IsOd) + ",PurchasePrice=" + c.PurchasePrice + ",RetailPrice=" + c.RetailPrice + " ,Fixlimit=" + c.FixedLimit + " where ID=" + c.ID; } cmd = new OleDbCommand(insert, con); cmd.Transaction = tran; cmd.ExecuteNonQuery(); tran.Commit(); return(true); } catch (Exception ex) { throw ex; } finally { con.Close(); } }
private void DGVCountry_DoubleClick(object sender, EventArgs e) { if (DGVCountry.CurrentRow != null) { if (DGVCountry.CurrentRow.Cells[0].Value != null) { if (SubLabnames != null) { this.CurrentLabName = SubLabnames[DGVCountry.CurrentRow.Index]; } else { this.CurrentLabName = Labnames[DGVCountry.CurrentRow.Index]; } } } this.Close(); }
private void tsDelete_Click(object sender, EventArgs e) { ltn = new LabTestName(); if (frm.CurrentLabName != null) { ltn.ID = frm.CurrentLabName.ID; if (new LabTestNameBLL().DeleteLabtestName(ltn) == true) { if (MessageBox.Show("Do You Really Want to Delete", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == System.Windows.Forms.DialogResult.Yes) { MessageBox.Show("LabTestName Deleted Successfully", "Message"); } ClearControls(); } else { ClearControls(); } } }
public bool DeleteLabtestName(LabTestName c) { return(new LabTestNameDAL().DeleteLabtestName(c)); }
public bool SaveLabtestname(LabTestName c) { return(new LabTestNameDAL().SaveLabtestname(c)); }
private void tsEdit_Click(object sender, EventArgs e) { LabTestName ltn = new LabTestName(); if (this.rbMedicine.Checked == true) { frm.IsMedicine = true; } else { frm.IsMedicine = false; } if (this.chxOd.Checked == true) { frm.IsOd = true; } else { frm.IsOd = false; } if (this.rbTenInjection.Checked == true) { frm.IsTenInjection = true; } else { frm.IsTenInjection = false; } if (this.rbAlwaysPaid.Checked == true) { frm.IsAlwaysPaid = true; } else { frm.IsAlwaysPaid = false; } frm.ShowDialog(); if (frm.CurrentLabName != null) { this.txtid.Text = frm.CurrentLabName.ID.ToString("00000"); this.txtTestName.Text = frm.CurrentLabName.TestName; txtPurchasePrice.Text = frm.CurrentLabName.PurchasePrice.ToString(); txtRetailPrice.Text = frm.CurrentLabName.RetailPrice.ToString(); this.txtPerformed.Text = frm.CurrentLabName.Performed; this.txtreport.Text = frm.CurrentLabName.Report; this.txtsample.Text = frm.CurrentLabName.Sample; this.txtPoor.Text = frm.CurrentLabName.Poor.ToString(); this.txtDeserving.Text = frm.CurrentLabName.Deserving.ToString(); this.txtYCDO.Text = frm.CurrentLabName.YCDO.ToString(); this.txtgeneral.Text = frm.CurrentLabName.General.ToString(); this.txtshahab.Text = frm.CurrentLabName.Shahab.ToString(); this.txtGhori.Text = frm.CurrentLabName.Ghori.ToString(); if (frm.CurrentLabName.IsMedicine) { this.rbMedicine.Checked = frm.CurrentLabName.IsMedicine; } else { this.rbLabTest.Checked = true; } this.txtUnit.Text = frm.CurrentLabName.Unit; this.rbAlwaysPaid.Checked = frm.CurrentLabName.IsAlwaysPaid; this.rbTenInjection.Checked = frm.CurrentLabName.IsRsTenInjection; this.txtFixedLimit.Text = frm.CurrentLabName.FixedLimit.ToString(); this.chxOd.Checked = frm.CurrentLabName.IsOd; } }
private void tsSave_Click_1(object sender, EventArgs e) { try { if (txtTestName.Text.Length > 0) { LabTestName ltn = new LabTestName(); ltn.TestName = txtTestName.Text.Trim(); ltn.Sample = txtsample.Text.Trim(); ltn.Performed = txtPerformed.Text.Trim(); ltn.Report = txtreport.Text.Trim(); if (rbMedicine.Checked) { ltn.IsMedicine = true; } ltn.IsOd = this.chxOd.Checked; Decimal poor; Decimal.TryParse(this.txtPoor.Text, out poor); ltn.Poor = poor; Decimal deserving; Decimal.TryParse(this.txtDeserving.Text, out deserving); ltn.Deserving = deserving; Decimal ycdo; Decimal.TryParse(this.txtYCDO.Text, out ycdo); ltn.YCDO = ycdo; Decimal general; Decimal.TryParse(this.txtgeneral.Text, out general); ltn.General = general; if (txtFixedLimit.Text != "") { ltn.FixedLimit = Convert.ToInt32(txtFixedLimit.Text); } Decimal ghori; Decimal.TryParse(this.txtGhori.Text, out ghori); ltn.Ghori = ghori; Decimal shahab; Decimal.TryParse(this.txtshahab.Text, out shahab); ltn.Shahab = shahab; ltn.Unit = this.txtUnit.Text.Trim(); ltn.IsRsTenInjection = this.rbTenInjection.Checked; ltn.IsAlwaysPaid = this.rbAlwaysPaid.Checked; ltn.PurchasePrice = Convert.ToDouble(txtPurchasePrice.Text); ltn.RetailPrice = Convert.ToDouble(txtRetailPrice.Text); if (frm.CurrentLabName != null) { ltn.ID = frm.CurrentLabName.ID; } if (new LabTestNameBLL().SaveLabtestname(ltn)) { MessageBox.Show("Lab Test Name Saved Successfully", "Success"); this.txtid.Text = new LabTestNameBLL().GetNextLabTestId().ToString("00000"); ClearControls(); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// Handles the specified request. /// </summary> /// <param name="request">The request.</param> /// <returns>A <see cref="Agatha.Common.Response"/></returns> public override Response Handle(SaveLabResultRequest request) { var response = CreateTypedResponse(); response.ErrorMessages = new List <string> (); var parser = new PipeParser(); var encoding = new UTF8Encoding(); var decodedMessage = encoding.GetString(request.HL7Message); var hl7Message = parser.Parse(decodedMessage); if (hl7Message.Version != "2.5.1") { response.ErrorMessages.Add("Lab Result is using the version other than 2.5.1"); return(response); } var message = ( ORU_R01 )hl7Message; var patientResult = message.GetPATIENT_RESULT(); var pidSegment = patientResult.PATIENT.PID; var observation = patientResult.GetORDER_OBSERVATION(); var specimentSegment = observation.SPECIMEN.SPM; var obResultSegment = observation.OBSERVATION.OBX; var obRequest = observation.OBR; if (pidSegment == null) { response.ErrorMessages.Add("PID segment is missing"); return(response); } if (pidSegment.PatientID.IDNumber.Value == null) { response.ErrorMessages.Add(string.Format("Patient Id is missing")); return(response); } var patient = Session.Get <Patient> (Convert.ToInt64(pidSegment.PatientID.IDNumber.Value)); if (patient == null) { response.ErrorMessages.Add(string.Format("Patient not found with id : {0}", pidSegment.PatientID.IDNumber.Value)); return(response); } var clinicalCaseCriteria = DetachedCriteria.For <ClinicalCase> ().SetProjection(Projections.Id()).Add( Restrictions.Eq( Projections.Property <ClinicalCase> (p => p.Patient.Key), pidSegment.PatientID.IDNumber.Value)); var checkedInStatus = _visitStatusRepository.GetByWellKnownName(WellKnownNames.VisitModule.VisitStatus.CheckedIn); var visitCriteria = Session.CreateCriteria <Visit> ().Add(Subqueries.PropertyIn("ClinicalCase.Key", clinicalCaseCriteria)) ////.Add(Restrictions.Eq(Projections.Property<Visit>(v => v.VisitStatus), checkedInStatus )) ////TODO: Right now, the CheckedInDateTime is the time when the user click the button to change the VisitStatus. This is not right .Add( Restrictions.Eq(Projections.Property <Visit> (v => v.CheckedInDateTime), obRequest.ObservationDateTime.Time.GetAsDate())); var visitList = visitCriteria.List(); if (visitList.Count > 0) { var visit = ( Visit )visitList[0]; var labSpecimenType = _labSpecimenTypeRepository.GetByCodedConceptCode(specimentSegment.SpecimenType.Identifier.Value); if (labSpecimenType == null) { labSpecimenType = new LabSpecimenType { CodedConceptCode = specimentSegment.SpecimenType.Identifier.Value, Name = specimentSegment.SpecimenType.Text.Value, EffectiveDateRange = new DateRange(DateTime.Now, null) }; labSpecimenType = _labSpecimenTypeRepository.MakePersistent(labSpecimenType); } var labSpecimen = _labSpecimenFactory.CreateLabSpecimen( visit); labSpecimen.ReviseLabSpecimenType(labSpecimenType); var labFacility = new LabFacility( obResultSegment.PerformingOrganizationName.OrganizationName.Value, obResultSegment.PerformingOrganizationAddress.StreetAddress.StreetOrMailingAddress.Value, obResultSegment.PerformingOrganizationAddress.City.Value, obResultSegment.PerformingOrganizationAddress.StateOrProvince.Value, obResultSegment.PerformingOrganizationAddress.ZipOrPostalCode.Value); labSpecimen.ReviseLabFacility(labFacility); if (specimentSegment.GetSpecimenRejectReason().Count() > 0) { labSpecimen.ReviseTestNotCompletedReasonDescription(specimentSegment.GetSpecimenRejectReason().FirstOrDefault().Text.Value); } var testName = _labTestNameRepository.GetByCodedConceptCode(obRequest.UniversalServiceIdentifier.Identifier.Value); if (testName == null) { testName = new LabTestName { CodedConceptCode = obRequest.UniversalServiceIdentifier.Identifier.Value, Name = obRequest.UniversalServiceIdentifier.Text.Value, EffectiveDateRange = new DateRange(DateTime.Now, null) }; testName = _labTestNameRepository.MakePersistent(testName); } CodedConcept interpretationCodeCodedConcept = null; if (obResultSegment.ValueType.Value != "TX") { var abnormalFlagIS = obResultSegment.GetAbnormalFlags().FirstOrDefault(); if (abnormalFlagIS != null) { var abnormalFlagCode = abnormalFlagIS.Value; var abnormalFlag = AbnormalFlag.GetAbnormalFlagByCode(abnormalFlagCode); if (abnormalFlag != null) { interpretationCodeCodedConcept = new CodedConceptBuilder() .WithCodedConceptCode(abnormalFlagCode) .WithDisplayName(abnormalFlag.WellKnownName) .WithCodeSystemIdentifier(AbnormalFlag.CodeSystemIdentifier) .WithCodeSystemName(AbnormalFlag.CodeSystemName); } } } var labTest = labSpecimen.AddLabTest( new LabTestInfoBuilder() .WithLabTestName(testName) .WithTestReportDate(obRequest.ObservationDateTime.Time.GetAsDate()) .WithNormalRangeDescription(obResultSegment.ReferencesRange.Value) .WithInterpretationCodedConcept(interpretationCodeCodedConcept)); var resultTestName = new CodedConceptBuilder() .WithCodedConceptCode(obResultSegment.ObservationIdentifier.Identifier.Value) .WithDisplayName(obResultSegment.ObservationIdentifier.Text.Value); double?value = null; double tempValue; if (double.TryParse(obResultSegment.GetObservationValue().FirstOrDefault().Data.ToString(), out tempValue)) { value = tempValue; } var labResult = new LabResultBuilder() .WithLabTestResultNameCodedConcept(resultTestName) .WithUnitOfMeasureCode(obResultSegment.Units.Identifier.Value) .WithValue(value); labTest.AddLabResult(labResult); } else { response.ErrorMessages.Add( string.Format( "Visit not found for Patient id: {0} and Visit Date: {1}", pidSegment.PatientID.IDNumber.Value, obRequest.ObservationDateTime.Time.GetAsDate())); } if (response.ErrorMessages.Count > 0) { response.Exception = new ExceptionInfo(new Exception("SaveLabResult failed, transaction is going to be rollback.")); response.ExceptionType = ExceptionType.Unknown; } return(response); }
/// <summary> /// Revises the name of the lab test. /// </summary> /// <param name="labTestName">Name of the lab test.</param> public virtual void ReviseLabTestName(LabTestName labTestName) { _labTestName = labTestName; }
protected override void OnSetup() { base.OnSetup(); var accessControlManagerMock = new Mock <IAccessControlManager> (); accessControlManagerMock.Setup(p => p.CanAccess(It.IsAny <ResourceRequest> ())).Returns(true); AccessControlManager = accessControlManagerMock.Object; using (ITransaction trans = Session.BeginTransaction()) { // Agency Types TreatmentProviderAgencyType = BuildLookup <AgencyType> ("Treatment Provider"); CriminalJusticeAgencyType = BuildLookup <AgencyType> ("Criminal Justice"); SingleStateAgencyAgencyType = BuildLookup <AgencyType> ("Single State Agency"); RecoverySupportServicesProviderAgencyType = BuildLookup <AgencyType> ("Recovery Support Services Provider"); SystemTestingAgencyType = BuildLookup <AgencyType> ("System Testing Agency"); StateAgencyAgencyType = BuildLookup <AgencyType> ("State Agency"); // Agency Address Types AdministrationAgencyAddressType = BuildLookup <AgencyAddressType> ("Administration"); // Agency Address Phone Types TollFreeAgencyPhoneType = BuildLookup <AgencyPhoneType> ("Toll Free"); FaxAgencyPhoneType = BuildLookup <AgencyPhoneType> ("Fax"); MainAgencPhoneType = BuildLookup <AgencyPhoneType> ("Main"); EmergencyAgencyPhoneType = BuildLookup <AgencyPhoneType> ("Emergency"); // Agency Contact Types BillingAgencyContactType = BuildLookup <AgencyContactType> ("Billing"); EdiAgencyContactType = BuildLookup <AgencyContactType> ("EDI"); FiscalAdminAgencyContactType = BuildLookup <AgencyContactType> ("Fiscal/Contract Administration"); ExecutiveContactType = BuildLookup <AgencyContactType> ("Executive"); CeoAgencyContactType = BuildLookup <AgencyContactType> ("CEO"); // Agency Identifier Types NpiAgencyIdentifierType = BuildLookup <AgencyIdentifierType> ("NPI"); // Countries UnitedStatesCountry = BuildLookup <Country> ("United States"); // State Provinces MarylandStateProvince = new StateProvince(UnitedStatesCountry) { Name = "Maryland" }; Session.SaveOrUpdate(MarylandStateProvince); // Gender var maleAdministrativeGender = BuildCodedConceptLookup <AdministrativeGender> ("M", "Male", "M"); var femaleAdministrativeGender = BuildCodedConceptLookup <AdministrativeGender> ("F", "Female", "F"); MaleGender = new PatientGender(maleAdministrativeGender) { Name = "Female Becoming Male" }; FemaleGender = new PatientGender(femaleAdministrativeGender) { Name = "Male Becoming Female" }; Session.SaveOrUpdate(MaleGender); Session.SaveOrUpdate(FemaleGender); // PatientAddressType HomePatientAddressType = BuildLookup <PatientAddressType> ("Home", WellKnownNames.PatientModule.PatientAddressType.Home); // PatientPhoneType HomePatientPhoneType = BuildLookup <PatientPhoneType> ("Home", WellKnownNames.PatientModule.PatientPhoneType.Home); // Race WhiteRace = BuildLookup <Race> ("White"); // PatientAliasType NicknamePatientAliasType = BuildLookup <PatientAliasType> ("Nickname"); // Disability DeafDisability = BuildLookup <Disability> ("Deaf"); // Allergy Status ActiveAllergyStatus = BuildCodedConceptLookup <AllergyStatus> ("55561003", "Active"); // PatientAccessEventTypes BuildLookup <PatientAccessEventType> ("Insert", "Insert"); BuildLookup <PatientAccessEventType> ("Update", "Update"); BuildLookup <PatientAccessEventType> ("Delete", "Delete"); BuildLookup <PatientAccessEventType> ("Read", "Read"); // CodedConcepts AllergenCodedConcept = BuildCodedConcept("Allergen"); MedicationCodeCodedConcept = BuildCodedConcept("Med Code"); ProblemCodeCodedConcept = BuildCodedConcept("P Code"); LabTestResultNameCodedConcept = BuildCodedConcept("LTRN Code"); MmrVaccineCodedConcept = BuildCodedConcept("03", "measles, mumps and rubella virus vaccine"); // VisitStatus ScheduledVisitStatus = BuildLookup <VisitStatus> ("Scheduled", WellKnownNames.VisitModule.VisitStatus.Scheduled); CheckedInVisitStatus = BuildLookup <VisitStatus> ("CheckedIn", WellKnownNames.VisitModule.VisitStatus.CheckedIn); // ProblemStatus ActiveProblemStatus = BuildCodedConceptLookup <ProblemStatus>("Active", "ACTIVE", "Active"); // ActivityType VitalSignActivityType = BuildLookup <ActivityType> ("VitalSign", WellKnownNames.VisitModule.ActivityType.VitalSign); LabSpecimentActivityType = BuildLookup <ActivityType> ("Lab Speciment", WellKnownNames.VisitModule.ActivityType.LabSpecimen); ImmunizationActivityType = BuildLookup <ActivityType>("Immunization", WellKnownNames.VisitModule.ActivityType.Immunization); //LabTestName LabTestNameCodedConcept = BuildCodedConceptLookup <LabTestName> ("55561003", "LTN Code"); trans.Commit(); } Session.Clear(); }