[613] | 1 | ACKQPCE2 ; HCIOFO/AG - Quasar/PCE Interface - Error Processing; August 1999
|
---|
| 2 | ;;3.0;QUASAR;;Feb 11, 2000
|
---|
| 3 | Q
|
---|
| 4 | ;
|
---|
| 5 | CONVERT(ACKPROB,ACKAPI,ACKRSN) ; convert the error array ACKPROB into a list of errors
|
---|
| 6 | ;
|
---|
| 7 | ; this label is called from the main Overnight Interface program
|
---|
| 8 | ; ^ACKQPCE if the DATA2PCE^PXAPI returns any errors or warnings.
|
---|
| 9 | ; this routine will format the errors and place them in the local
|
---|
| 10 | ; array ACKRSN. a separate call to label FILE will add them on the
|
---|
| 11 | ; database.
|
---|
| 12 | ;
|
---|
| 13 | ; requires ACKPROB - array generated by DATA2PCE^PXAPI
|
---|
| 14 | ; ACKAPI - global ref of encounter data passed in to DATA2PCE
|
---|
| 15 | ; .ACKRSN - (by reference) - the output array
|
---|
| 16 | ;
|
---|
| 17 | ; returns ACKRSN=n and ACKRSN(n)=text where each error is formatted
|
---|
| 18 | ; to FIELD^INTERNAL VALUE^EXTERNAL VALUE^ERROR/WARNING MESSAGE
|
---|
| 19 | ; eg ACKRSN(1)="PRIMARY PROVIDER^1234^BLOGGS,FRED^The Provider...
|
---|
| 20 | ; ...does not have an ACTIVE person class!
|
---|
| 21 | ;
|
---|
| 22 | N ACKI
|
---|
| 23 | N ACKDEBUG S ACKDEBUG="CONVERT"
|
---|
| 24 | K ACKRSN S ACKRSN=0
|
---|
| 25 | F ACKI=1:1 Q:'$D(ACKPROB($J,ACKI)) D
|
---|
| 26 | . I $D(ACKPROB($J,ACKI,"ERROR1")) D ERROR1
|
---|
| 27 | . K ACKPROB($J,ACKI) ; only error1 messages are kept, all others ignored
|
---|
| 28 | Q
|
---|
| 29 | ;
|
---|
| 30 | ERROR1 ; process an Error 1
|
---|
| 31 | N ACKMSG,ACKEXT,ACKINT,ACKNUM,ACKTYP,ACKFLD,ACKSUB
|
---|
| 32 | ;
|
---|
| 33 | ; check for error with visit date
|
---|
| 34 | I $D(ACKPROB($J,ACKI,"ERROR1","ENCOUNTER","ENC D/T",1)) D
|
---|
| 35 | . S ACKINT=@ACKAPI@("ENCOUNTER",1,"ENC D/T")
|
---|
| 36 | . S ACKEXT=$$DATETIME(ACKINT)
|
---|
| 37 | . S ACKMSG=ACKPROB($J,ACKI,"ERROR1","ENCOUNTER","ENC D/T",1)
|
---|
| 38 | . D ADDRSN("ENC D/T",ACKINT,ACKEXT,ACKMSG,.ACKRSN)
|
---|
| 39 | . K ACKPROB($J,ACKI,"ERROR1","ENCOUNTER","ENC D/T",1)
|
---|
| 40 | ;
|
---|
| 41 | ; check for error with patient
|
---|
| 42 | I $D(ACKPROB($J,ACKI,"ERROR1","ENCOUNTER","PATIENT",1)) D
|
---|
| 43 | . S ACKINT=@ACKAPI@("ENCOUNTER",1,"PATIENT")
|
---|
| 44 | . S ACKEXT=$$PATIENT(ACKINT)
|
---|
| 45 | . S ACKMSG=ACKPROB($J,ACKI,"ERROR1","ENCOUNTER","PATIENT",1)
|
---|
| 46 | . D ADDRSN("PATIENT",ACKINT,ACKEXT,ACKMSG,.ACKRSN)
|
---|
| 47 | . K ACKPROB($J,ACKI,"ERROR1","ENCOUNTER","PATIENT",1)
|
---|
| 48 | ;
|
---|
| 49 | ; check for error with clinic
|
---|
| 50 | I $D(ACKPROB($J,ACKI,"ERROR1","ENCOUNTER","HOS LOC",1)) D
|
---|
| 51 | . S ACKINT=@ACKAPI@("ENCOUNTER",1,"HOS LOC")
|
---|
| 52 | . S ACKEXT=$$CLINIC(ACKINT)
|
---|
| 53 | . S ACKMSG=ACKPROB($J,ACKI,"ERROR1","ENCOUNTER","HOS LOC",1)
|
---|
| 54 | . D ADDRSN("CLINIC",ACKINT,ACKEXT,ACKMSG,.ACKRSN)
|
---|
| 55 | . K ACKPROB($J,ACKI,"ERROR1","ENCOUNTER","HOS LOC",1)
|
---|
| 56 | ;
|
---|
| 57 | ; check for any other "ENCOUNTER" errors
|
---|
| 58 | S ACKFLD="" F S ACKFLD=$O(ACKPROB($J,ACKI,"ERROR1","ENCOUNTER",ACKFLD)) Q:ACKFLD="" D
|
---|
| 59 | . I $D(ACKPROB($J,ACKI,"ERROR1","ENCOUNTER",ACKFLD,1))#10=0 Q
|
---|
| 60 | . I $D(@ACKAPI@("ENCOUNTER",1,ACKFLD))#10=0 Q
|
---|
| 61 | . S ACKMSG=ACKPROB($J,ACKI,"ERROR1","ENCOUNTER",ACKFLD,1)
|
---|
| 62 | . S ACKINT=@ACKAPI@("ENCOUNTER",1,ACKFLD)
|
---|
| 63 | . D ADDRSN(ACKFLD,ACKINT,"",ACKMSG,.ACKRSN)
|
---|
| 64 | . K ACKPROB($J,ACKI,"ERROR1","ENCOUNTER",ACKFLD,1)
|
---|
| 65 | ;
|
---|
| 66 | ; check for provider name errors
|
---|
| 67 | I $D(ACKPROB($J,ACKI,"ERROR1","PROVIDER","NAME")) D
|
---|
| 68 | . S ACKNUM="" F S ACKNUM=$O(ACKPROB($J,ACKI,"ERROR1","PROVIDER","NAME",ACKNUM)) Q:ACKNUM="" D
|
---|
| 69 | . . S ACKINT=@ACKAPI@("PROVIDER",ACKNUM,"NAME")
|
---|
| 70 | . . S ACKEXT=$$PRVNAME(ACKINT)
|
---|
| 71 | . . S ACKMSG=ACKPROB($J,ACKI,"ERROR1","PROVIDER","NAME",ACKNUM)
|
---|
| 72 | . . S ACKFLD=$S($D(@ACKAPI@("PROVIDER",ACKNUM,"PRIMARY")):"PRIMARY ",1:"")_"PROVIDER"
|
---|
| 73 | . . D ADDRSN(ACKFLD,ACKINT,ACKEXT,ACKMSG,.ACKRSN)
|
---|
| 74 | . . K ACKPROB($J,ACKI,"ERROR1","PROVIDER","NAME",ACKNUM)
|
---|
| 75 | ;
|
---|
| 76 | ; check for Procedure code errors
|
---|
| 77 | I $D(ACKPROB($J,ACKI,"ERROR1","PROCEDURE","PROCEDURE")) D
|
---|
| 78 | . S ACKNUM="" F S ACKNUM=$O(ACKPROB($J,ACKI,"ERROR1","PROCEDURE","PROCEDURE",ACKNUM)) Q:ACKNUM="" D
|
---|
| 79 | . . S ACKINT=@ACKAPI@("PROCEDURE",ACKNUM,"PROCEDURE")
|
---|
| 80 | . . S ACKEXT=$$CPTNAME(ACKINT)
|
---|
| 81 | . . S ACKMSG=ACKPROB($J,ACKI,"ERROR1","PROCEDURE","PROCEDURE",ACKNUM)
|
---|
| 82 | . . D ADDRSN("PROCEDURE",ACKINT,ACKEXT,ACKMSG,.ACKRSN)
|
---|
| 83 | . . K ACKPROB($J,ACKI,"ERROR1","PROCEDURE","PROCEDURE",ACKNUM)
|
---|
| 84 | ;
|
---|
| 85 | ; check for Modifier errors
|
---|
| 86 | S ACKSUB="MODIFIER"
|
---|
| 87 | F S ACKSUB=$O(ACKPROB($J,ACKI,"ERROR1","PROCEDURE",ACKSUB)) Q:$E(ACKSUB,1,8)'="MODIFIER" D
|
---|
| 88 | . S ACKNUM="" F S ACKNUM=$O(ACKPROB($J,ACKI,"ERROR1","PROCEDURE",ACKSUB,ACKNUM)) Q:ACKNUM="" D
|
---|
| 89 | . . S ACKINT="",ACKEXT=$P(ACKSUB,",",2)
|
---|
| 90 | . . S ACKMSG=ACKPROB($J,ACKI,"ERROR1","PROCEDURE",ACKSUB,ACKNUM)
|
---|
| 91 | . . S ACKMSG=ACKMSG_" (Procedure="_$G(@ACKAPI@("PROCEDURE",ACKNUM,"PROCEDURE"))_")"
|
---|
| 92 | . . D ADDRSN("MODIFIER",ACKINT,ACKEXT,ACKMSG,.ACKRSN)
|
---|
| 93 | . . K ACKPROB($J,ACKI,"ERROR1","PROCEDURE",ACKSUB,ACKNUM)
|
---|
| 94 | ;
|
---|
| 95 | ; check for Diagnosis code errors
|
---|
| 96 | I $D(ACKPROB($J,ACKI,"ERROR1","DX/PL","DIAGNOSIS")) D
|
---|
| 97 | . S ACKNUM="" F S ACKNUM=$O(ACKPROB($J,ACKI,"ERROR1","DX/PL","DIAGNOSIS",ACKNUM)) Q:ACKNUM="" D
|
---|
| 98 | . . S ACKINT=@ACKAPI@("DX/PL",ACKNUM,"DIAGNOSIS")
|
---|
| 99 | . . S ACKEXT=$$ICDNAME(ACKINT)
|
---|
| 100 | . . S ACKMSG=ACKPROB($J,ACKI,"ERROR1","DX/PL","DIAGNOSIS",ACKNUM)
|
---|
| 101 | . . D ADDRSN("DIAGNOSIS",ACKINT,ACKEXT,ACKMSG,.ACKRSN)
|
---|
| 102 | . . K ACKPROB($J,ACKI,"ERROR1","DX/PL","DIAGNOSIS",ACKNUM)
|
---|
| 103 | ;
|
---|
| 104 | ; check for any remaining errors not coded for
|
---|
| 105 | S ACKTYP="" F S ACKTYP=$O(ACKPROB($J,ACKI,"ERROR1",ACKTYP)) Q:ACKTYP="" D
|
---|
| 106 | . S ACKFLD="" F S ACKFLD=$O(ACKPROB($J,ACKI,"ERROR1",ACKTYP,ACKFLD)) Q:ACKFLD="" D
|
---|
| 107 | . . S ACKNUM="" F S ACKNUM=$O(ACKPROB($J,ACKI,"ERROR1",ACKTYP,ACKFLD,ACKNUM)) Q:ACKNUM="" D
|
---|
| 108 | . . . I $D(@ACKAPI@(ACKTYP,ACKNUM,ACKFLD))#10=0 Q
|
---|
| 109 | . . . I $D(ACKPROB($J,ACKI,"ERROR1",ACKTYP,ACKFLD,ACKNUM))#10=0 Q
|
---|
| 110 | . . . S ACKINT=@ACKAPI@(ACKTYP,ACKNUM,ACKFLD)
|
---|
| 111 | . . . S ACKMSG=ACKPROB($J,ACKI,"ERROR1",ACKTYP,ACKFLD,ACKNUM)
|
---|
| 112 | . . . D ADDRSN(ACKTYP_":"_ACKFLD,ACKINT,"",ACKMSG,.ACKRSN)
|
---|
| 113 | . . . K ACKPROB($J,ACKI,"ERROR1",ACKTYP,ACKFLD,ACKNUM)
|
---|
| 114 | ;
|
---|
| 115 | ; end of processing errors
|
---|
| 116 | Q
|
---|
| 117 | ;
|
---|
| 118 | ;
|
---|
| 119 | ADDRSN(FLD,INT,EXT,MSG,ACKRSN) ; add erorr to the output array
|
---|
| 120 | I +$G(ACKRSN)=0 K ACKRSN S ACKRSN=0 ; if count=0 make sure array empty
|
---|
| 121 | S ACKRSN=ACKRSN+1
|
---|
| 122 | S $P(ACKRSN(ACKRSN,0),U,1)=ACKRSN ; error number
|
---|
| 123 | S $P(ACKRSN(ACKRSN,0),U,2)=FLD ; field name
|
---|
| 124 | S $P(ACKRSN(ACKRSN,0),U,3)=INT ; internal format
|
---|
| 125 | S $P(ACKRSN(ACKRSN,0),U,4)=EXT ; external format
|
---|
| 126 | S ACKRSN(ACKRSN,1)=MSG ; error message
|
---|
| 127 | Q
|
---|
| 128 | PATIENT(ACKPAT) ; get patient name
|
---|
| 129 | Q $$GET1^DIQ(509850.2,ACKPAT_",",.01,"E")
|
---|
| 130 | PRVNAME(ACKPRV) ; get provider name
|
---|
| 131 | Q $$GET1^DIQ(200,ACKPRV_",",.01,"E")
|
---|
| 132 | CLINIC(ACKCLN) ; get clinic name
|
---|
| 133 | Q $$GET1^DIQ(44,ACKCLN_",",.01,"E")
|
---|
| 134 | CPTNAME(ACKCPT) ; get CPT procedure name
|
---|
| 135 | Q $$GET1^DIQ(509850.4,ACKCPT_",",.01,"E")
|
---|
| 136 | ICDNAME(ACKICD) ; get ICD diagnosis name
|
---|
| 137 | Q $$GET1^DIQ(509850.1,ACKICD_",",.01,"E")
|
---|
| 138 | DATETIME(Y) ; convert date/time to external
|
---|
| 139 | D DD^%DT
|
---|
| 140 | Q Y
|
---|