CREATE VIEW [dbo].[pal_vAccountClaimResponseHeader]
AS

SELECT	R.recId
		,R.claimLogId
		,R.claimRefNo
		,CASE R.responseLevelInd
			WHEN '01' THEN 'Patient record'
			WHEN '02' THEN 'Treatment record'
			WHEN '03' THEN 'Item record'
			END AS ResponseLevel
		,CASE R.responseResultCode
			WHEN '01' THEN 'Claim Accepted for delivery'
			WHEN '02' THEN 'Claim Accepted for processing'
			WHEN '03' THEN 'Claim Rejected'
			WHEN '04' THEN 'Claim Approved for Payment'
			WHEN '05' THEN 'Claim Approved for Part Payment'
			WHEN '06' THEN 'Claim Reversal Accepted'
			WHEN '07' THEN 'Claim Reversal Rejected'
			END AS ResponseResult
		,CASE R.respondingParty
			WHEN '01' THEN 'MediSwitch'
			WHEN '02' THEN 'Medical Scheme / Administrator'
			END AS RespondingParty
		,CASE R.msDeliveryTypeInd
			WHEN '01' THEN 'Real-Time'
			WHEN '02' THEN 'Batched'
			WHEN '03' THEN 'Queued'
			WHEN '04' THEN 'Rejected'
			END AS DeliveryType
FROM	pal_MSClaimResponse R


GO


