public async Task <IActionResult> UpdatePatientQueueLocation(string patientId, int locationId, int accountId, int hospitalUnitId, int newHospitalUnitId, int encounterId) { try { await _patientQueueRepository.UpdatePatientLocation(patientId, locationId, accountId, hospitalUnitId, newHospitalUnitId, encounterId); MiniResponseBase response = new MiniResponseBase { ErrorMessage = "Success", status = true }; return(Ok(response)); } catch (Exception ex) { MiniResponseBase response = new MiniResponseBase { ErrorMessage = "failed", status = false }; return(BadRequest(response)); } }
public async Task <IActionResult> CheckPatientIn(int locationId, int providerId, string patientId, int userid) { try { var result = await _checkInRepository.CreaateCheckIn(patientId, providerId, locationId, userid); // check that check-In was successfull if (result.Item2) { var patient = await _patientRepo.GetPatientById(patientId, providerId); var plantype = await _patientRepo.GetPatientPlantype(patient.Plantype); if (plantype != null) { // checks if its a private patient if (plantype.payerid == 1162 && plantype.plantypeid == 32) { // check if this private patient has ever been billed for registration var regBill = await _billingRepository.CheckPrivatePatientBillForRegistration(patientId, providerId); if (regBill == null) { // if there is no registration bill record for this private // patient a reg bill is added for him or her // add bill BillingInvoice regBillingInvoice = new BillingInvoice() { patientid = patientId, ProviderID = providerId, locationid = locationId, encodedby = userid, encounterId = result.Item3 }; var regBillResult = await _billingRepository.WritePatientRegistrationBill(regBillingInvoice); } // add bill BillingInvoice billingInvoice = new BillingInvoice() { patientid = patientId, ProviderID = providerId, locationid = locationId, encodedby = userid, encounterId = result.Item3 }; // adds consultation bill for this private patieny var billResult = await _billingRepository.WritePatientConsultationBill(billingInvoice); } } } MiniResponseBase response = new MiniResponseBase { ErrorMessage = result.Item1, status = result.Item2 }; return(Ok(response)); } catch (Exception ex) { MiniResponseBase response = new MiniResponseBase { ErrorMessage = "An Error Occured patient check-In failed", status = false }; return(BadRequest(response)); } }