| [613] | 1 | SCDXUTL3 ;ALB/JRP - ACRP ERROR CODE UTILITIES;08-OCT-1996
 | 
|---|
 | 2 |  ;;5.3;Scheduling;**68**;AUG 13, 1993
 | 
|---|
 | 3 | DEMOCODE(PTRCODE) ;Determine if NPCDB error code is related to a
 | 
|---|
 | 4 |  ; patient's demographic data or if it is related to the encounter data
 | 
|---|
 | 5 |  ;
 | 
|---|
 | 6 |  ;Input  : PTRCODE - Pointer to entry in TRANSMITTED OUTPATIENT
 | 
|---|
 | 7 |  ;                   ENCOUNTER ERROR CODE file (#409.76)
 | 
|---|
 | 8 |  ;Output : 1 - Error is related to patient's demographic data
 | 
|---|
 | 9 |  ;         0 - Error is related to the encounter data
 | 
|---|
 | 10 |  ;         0 - Bad input
 | 
|---|
 | 11 |  ;
 | 
|---|
 | 12 |  ;Check input
 | 
|---|
 | 13 |  S PTRCODE=+$G(PTRCODE)
 | 
|---|
 | 14 |  Q:('$D(^SD(409.76,PTRCODE,0))) 0
 | 
|---|
 | 15 |  ;Declare variables
 | 
|---|
 | 16 |  N ERRCODE,TMP,DEMOCODE,DEMOGRP
 | 
|---|
 | 17 |  ;Convert pointer to error code
 | 
|---|
 | 18 |  S ERRCODE=$P($G(^SD(409.76,PTRCODE,0)),"^",1)
 | 
|---|
 | 19 |  Q:(ERRCODE="") 0
 | 
|---|
 | 20 |  ;Establish series of codes that relate to patient demographic data
 | 
|---|
 | 21 |  F TMP=200,300,400,700,800,"000","B00","C00" S DEMOGRP(TMP)=1
 | 
|---|
 | 22 |  ;Convert error code to it's series range and determine if that range
 | 
|---|
 | 23 |  ;relates to patient demographic data
 | 
|---|
 | 24 |  S TMP=$E(ERRCODE,1)_"00"
 | 
|---|
 | 25 |  S DEMOCODE=+$G(DEMOGRP(TMP))
 | 
|---|
 | 26 |  ;Done
 | 
|---|
 | 27 |  Q DEMOCODE
 | 
|---|
 | 28 |  ;
 | 
|---|
 | 29 | DEMOERR(PTRERR) ;Determine if error is related to a patient's demographic
 | 
|---|
 | 30 |  ; data or if it is related to the encounter data
 | 
|---|
 | 31 |  ;
 | 
|---|
 | 32 |  ;Input  : PTRERR - Pointer to entry in TRANSMITTED OUTPATIENT
 | 
|---|
 | 33 |  ;                  ENCOUNTER ERROR file (#409.75)
 | 
|---|
 | 34 |  ;Output : 1 - Error is related to patient's demographic data
 | 
|---|
 | 35 |  ;         0 - Error is related to the encounter data
 | 
|---|
 | 36 |  ;         0 - Bad input
 | 
|---|
 | 37 |  ;
 | 
|---|
 | 38 |  ;Check input
 | 
|---|
 | 39 |  S PTRERR=+$G(PTRERR)
 | 
|---|
 | 40 |  Q:('$D(^SD(409.75,PTRERR,0))) 0
 | 
|---|
 | 41 |  ;Declare variables
 | 
|---|
 | 42 |  N PTRCODE,NODE
 | 
|---|
 | 43 |  ;Get pointer to TRANSMITTED OUTPATIENT ENCOUNTER ERROR CODE file
 | 
|---|
 | 44 |  S NODE=$G(^SD(409.75,PTRERR,0))
 | 
|---|
 | 45 |  S PTRCODE=+$P(NODE,"^",2)
 | 
|---|
 | 46 |  ;Return whether or not error code is related to demographic data
 | 
|---|
 | 47 |  Q $$DEMOCODE(PTRCODE)
 | 
|---|
 | 48 |  ;
 | 
|---|
 | 49 | REJ4DEMO(XMITPTR) ;Determine if encounter was rejected due to a
 | 
|---|
 | 50 |  ; demographic error
 | 
|---|
 | 51 |  ;
 | 
|---|
 | 52 |  ;Input  : XMITPTR - Pointer to TRANSMITTED OUTPATIENT ENCOUNTER
 | 
|---|
 | 53 |  ;                   file (#409.73)
 | 
|---|
 | 54 |  ;Output : 1 - At least one of the error codes listed for the
 | 
|---|
 | 55 |  ;             encounter is related to the patient's demographic data
 | 
|---|
 | 56 |  ;         0 - None of the error codes listed for the encounter are
 | 
|---|
 | 57 |  ;             related to the patient's demographic data
 | 
|---|
 | 58 |  ;         0 - Bad input/no error codes listed
 | 
|---|
 | 59 |  ;
 | 
|---|
 | 60 |  ;Check input
 | 
|---|
 | 61 |  S XMITPTR=+$G(XMITPTR)
 | 
|---|
 | 62 |  Q:('$D(^SD(409.73,XMITPTR,0))) 0
 | 
|---|
 | 63 |  ;Declare variables
 | 
|---|
 | 64 |  N PTRERR,PTRCODE,NODE,REJ4DEMO
 | 
|---|
 | 65 |  S REJ4DEMO=0
 | 
|---|
 | 66 |  ;Loop through TRANSMITTED OUTPATIENT ENCOUNTER ERROR file (#409.75)
 | 
|---|
 | 67 |  S PTRERR=""
 | 
|---|
 | 68 |  F  S PTRERR=+$O(^SD(409.75,"B",XMITPTR,PTRERR)) Q:('PTRERR)  D  Q:(REJ4DEMO)
 | 
|---|
 | 69 |  .;Get pointer to error code
 | 
|---|
 | 70 |  .S NODE=$G(^SD(409.75,PTRERR,0))
 | 
|---|
 | 71 |  .S PTRCODE=+$P(NODE,"^",2)
 | 
|---|
 | 72 |  .Q:('PTRCODE)
 | 
|---|
 | 73 |  .;Determine if code is based on demographic data
 | 
|---|
 | 74 |  .S REJ4DEMO=+$$DEMOCODE(PTRCODE)
 | 
|---|
 | 75 |  ;Done
 | 
|---|
 | 76 |  Q REJ4DEMO
 | 
|---|