41 lines
2.0 KiB
Ruby
41 lines
2.0 KiB
Ruby
|
|
module MembersService
|
||
|
|
class Claims
|
||
|
|
|
||
|
|
def initialize(entity, recent = false)
|
||
|
|
if entity.is_a?(Integer)
|
||
|
|
@member = Baclight::Member.find_by(pb_entity_key: entity)
|
||
|
|
else
|
||
|
|
@member = entity
|
||
|
|
end
|
||
|
|
if @member.present?
|
||
|
|
@pl_plan_key = @member.pl_plan_key
|
||
|
|
@family_id = @member.family_id
|
||
|
|
@recent = recent
|
||
|
|
else
|
||
|
|
raise ArgumentError, "Member not found."
|
||
|
|
end
|
||
|
|
|
||
|
|
end
|
||
|
|
|
||
|
|
def call
|
||
|
|
args = {
|
||
|
|
PLPlanKey: @pl_plan_key,
|
||
|
|
FamilyId: @family_id,
|
||
|
|
ProviderTaxId: "",
|
||
|
|
UserID: "JASONJ"
|
||
|
|
}
|
||
|
|
claims_headers = CallStoredProc.new("CPFindClaim", args).call
|
||
|
|
|
||
|
|
ordered_claims_headers = claims_headers.sort_by { |ch| ch['IncurDate'].to_date }.reverse
|
||
|
|
ordered_claims_headers = ordered_claims_headers.first(6) if @recent
|
||
|
|
|
||
|
|
ordered_claims_headers.map { |ch| { claim_number: ch['CPHeaderKey'], visit_date: ch['IncurDate'].strftime("%m-%d-%Y"), claim_status: ch['AdjudicatedStatusShortDesc'], patient_name: ch['FullName'], provider_name: ch['ProviderCompany']} } || []
|
||
|
|
|
||
|
|
end
|
||
|
|
end
|
||
|
|
end
|
||
|
|
|
||
|
|
|
||
|
|
# claimHeaders = _vContext.ClaimHeader.FromSql("dbo.CPFindClaim
|
||
|
|
# @PLPlanKey = {0}, @CSCaseKey = {1}, @PAPriorAuthKey = {2}, @FromDate = {3}, @ToDate = {4}, @FamilyID = {5}, @FirstName = {6}, @LastName = {7}, @SequenceNumber = {8}, @PBEntityKey = {9}, @ProviderIdentifierCode = {10}, @ProviderCompanyName = {11}, @ProviderTaxID = {12}, @HeaderStatusValueID = {13}, @AdjudicatedStatusValueID = {14}, @EventUSUserKey = {15}, @IncludeRestricted = {16}, @ClaimTypeValueID = {17}, @ClaimSource = {18}, @ReceivedFromDate = {19}, @ReceivedToDate = {20}, @DCN = {21}, @SSN = {22}, @SSN_IncFamily = {23}, @SearchAllIDs = {24}, @UserID = {25}, @ExecuteOrDisplay = {26} ",
|
||
|
|
# PlanKey, 0, 0, FromDate, ToDate, FamilyId, "", "", -1, 0, "", "", ProviderTaxId, 0, 0, 0, 0, 0, 2, null, null, null, null, 0, 0, "DAVIDH", 1)
|