public ActionResult ValidateMrNumber(string mrn) { string vunetId = User.Identity.Name; PatientFill fill = null; RetrieveCensusInformation censusinfo = new RetrieveCensusInformation(); int censusRecords = censusinfo.GetCensusCount(mrn); if (censusRecords > 0) { RetrieveCoverageAndInsurance covandins = new RetrieveCoverageAndInsurance(); var ins = covandins.GetInsurances(mrn, vunetId).Where(i => i.EffectiveDate <= DateTime.Today && (i.TerminationDate >= DateTime.Today || i.TerminationDate == null)).FirstOrDefault(); long insId = 0; if (ins != null) { insId = ins.InsuranceId; } RetrievePatientInformation patientinfo = new RetrievePatientInformation(); Patient patient = patientinfo.GetPatient(mrn, vunetId); fill = new PatientFill() { MrNumberFromEpi = string.IsNullOrEmpty(patient.MRN) ? "0" : patient.MRN, PatientFName = patient.FirstName, PatientLName = patient.LastName, InsuranceIdFromEpi = insId }; } return(Json(fill, JsonRequestBehavior.AllowGet)); }
/// <summary> /// /// </summary> /// <param name="mrNumber"></param> /// <returns></returns> private GenServiceModel RetrieveDataFromGenServices(string mrNumber, string vunetId) { GenServiceModel gsm = new GenServiceModel(); RetrieveCoverageAndInsurance coverageinfo = new RetrieveCoverageAndInsurance(); RetrievePatientInformation patientinfo = new RetrievePatientInformation(); RetrieveCensusInformation censusinfo = new RetrieveCensusInformation(); CoverageInfo coverages = coverageinfo.GetCoverageAndInsurance(mrNumber, vunetId).Where(c => c.IsActive == true).FirstOrDefault(); InsuranceInformation insurances = coverageinfo.GetInsurances(mrNumber, vunetId).Where(i => i.EffectiveDate <= DateTime.Today && (i.TerminationDate >= DateTime.Today || i.TerminationDate == null)).FirstOrDefault(); Patient patient = patientinfo.GetPatient(mrNumber, vunetId); CensusModel census = censusinfo.GetCensusRecords(mrNumber, vunetId).FirstOrDefault(); gsm.PatientDemographics = patient; gsm.Coverages = coverages; gsm.Insurances = insurances; gsm.Census = census; return(gsm); }