| 1 | IBDFBK3 ;ALB/AAS - AICS broker Utilities ;23-May-95 | 
|---|
| 2 | ;;3.0;AUTOMATED INFO COLLECTION SYS;**12,38,36**;APR 24, 1997 | 
|---|
| 3 | ; | 
|---|
| 4 | LSTDATA(RESULT,PXCA,LCNT) ; | 
|---|
| 5 | ; -- expand the PXCA array data into human readable terms for | 
|---|
| 6 | ;    display on the workstation | 
|---|
| 7 | ; | 
|---|
| 8 | ;    Input : Result - (called by reference, see output) | 
|---|
| 9 | ;            PXCA   - (by referencethe array of data formated to | 
|---|
| 10 | ;                      the PCE device interface specification | 
|---|
| 11 | ;            lcnt   - (by reference) a counter for the result array | 
|---|
| 12 | ;    Output: RESULT - a new array element result(lcnt) will be | 
|---|
| 13 | ;                     created for each piece of data received | 
|---|
| 14 | ; | 
|---|
| 15 | N I,J,M,X,IBX | 
|---|
| 16 | ; | 
|---|
| 17 | ; -- noshow, cancel or reschedule checked | 
|---|
| 18 | I $D(PXCA("IBD-ABORT")) D | 
|---|
| 19 | .S I="" F  S I=$O(PXCA("IBD-ABORT",I)) Q:I=""  S J="" F  S J=$O(PXCA("IBD-ABORT",I,J)) Q:J=""  D | 
|---|
| 20 | ..S IBX=PXCA("IBD-ABORT",I,J) | 
|---|
| 21 | ..S X="The following Data was NOT Sent to PCE because "_$P(IBX,"^",2)_" was marked!" | 
|---|
| 22 | ..D NEWLINE(.RESULT,X,.LCNT) | 
|---|
| 23 | .Q | 
|---|
| 24 | ; | 
|---|
| 25 | ; -- expand the encounter node | 
|---|
| 26 | I $D(PXCA("ENCOUNTER")) S IBX=PXCA("ENCOUNTER") D | 
|---|
| 27 | .I $P(IBX,"^",14) S X="Checkout Date/Time: "_$$FMTE^XLFDT($P(IBX,"^",14)) D NEWLINE(.RESULT,X,.LCNT) | 
|---|
| 28 | .I $P(IBX,"^",4) S X=$S($P(IBX,"^",15)="P":"Primary ",$P(IBX,"^",15)="S":"Secondary ",1:"")_"Provider: "_$P($G(^VA(200,+$P(IBX,"^",4),0)),"^") D NEWLINE(.RESULT,X,.LCNT) | 
|---|
| 29 | .;; --change to api cpt ; dhh | 
|---|
| 30 | .I $P(IBX,"^",5) S X=$P(IBX,"^",5) D | 
|---|
| 31 | .. I X'="" D | 
|---|
| 32 | ... N IBVST | 
|---|
| 33 | ... S X=$$CPT^ICPTCOD(X) | 
|---|
| 34 | ... S (X,IBVST)=$S(+X=-1:"",1:$P(X,"^",2)) | 
|---|
| 35 | ... S X="Visit Type CPT: "_X D NEWLINE(.RESULT,X,.LCNT) | 
|---|
| 36 | ... I $D(PXCA("ENCOUNTER","MODIFIER")) D | 
|---|
| 37 | .... S X="    Modifier(s): " D NEWLINE(.RESULT,X,.LCNT) | 
|---|
| 38 | .... N IBM S IBM=0 | 
|---|
| 39 | .... F  S IBM=$O(PXCA("ENCOUNTER","MODIFIER",IBM)) Q:IBM']""  D | 
|---|
| 40 | ..... N IBMDESC S IBMDESC=$$MODP^ICPTMOD(IBVST,IBM,"E") Q:+IBMDESC<0 | 
|---|
| 41 | ..... S X="         "_IBM_"-"_$P(IBMDESC,"^",2) | 
|---|
| 42 | ..... D NEWLINE(.RESULT,X,.LCNT) | 
|---|
| 43 | .; add sc,ao,ir,ec,mst,eligibility,credit stop (pieces 6-10,13,17) | 
|---|
| 44 | .I $P(IBX,"^",6) D NEWLINE(.RESULT,"Visit for SC Condition",.LCNT) | 
|---|
| 45 | .I $P(IBX,"^",7) D NEWLINE(.RESULT,"Visit for Agent Orange Condition",.LCNT) | 
|---|
| 46 | .I $P(IBX,"^",8) D NEWLINE(.RESULT,"Visit for Ionizing Radiation Condition",.LCNT) | 
|---|
| 47 | .I $P(IBX,"^",9) D NEWLINE(.RESULT,"Visit for Environmental Contaminates Condition",.LCNT) | 
|---|
| 48 | .I $P(IBX,"^",10) D NEWLINE(.RESULT,"Visit for MST",.LCNT) | 
|---|
| 49 | .I $P(IBX,"^",13) D NEWLINE(.RESULT,"Eligibility for Visit: "_$P($G(^DIC(8,+$P(IBX,"^",13),0)),"^"),.LCNT) | 
|---|
| 50 | .I $P(IBX,"^",17) D NEWLINE(.RESULT,"Additional Credit Stop: "_$P($G(^DIC(40.7,+$P(IBX,"^",17),0)),"^"),.LCNT) | 
|---|
| 51 | ; | 
|---|
| 52 | ; -- expand the other nodes | 
|---|
| 53 | F M="DIAGNOSIS/PROBLEM","PROVIDER","DIAGNOSIS","PROCEDURE","VITALS","PROBLEM","EXAM","IMMUNIZATION","HEALTH FACTORS","SKIN TEST","PATIENT ED","LOCAL" I $D(PXCA(M)) D | 
|---|
| 54 | .S I="" F  S I=$O(PXCA(M,I)) Q:I=""  D:M="PROVIDER" PROV S J="" F  S J=$O(PXCA(M,I,J)) Q:J=""  D | 
|---|
| 55 | ..K X S IBX=PXCA(M,I,J) D  D:$D(X) NEWLINE(.RESULT,X,.LCNT) | 
|---|
| 56 | ...; | 
|---|
| 57 | ...I M="DIAGNOSIS" S X=$S($P(IBX,"^",2)="P":"Primary",$P(IBX,"^",2)="S":"Secondary",1:"")_" Diagnosis: "_$P($G(^ICD9(+$P($G(IBX),"^"),0)),"^")_" - "_$P(IBX,"^",9)_" - "_$P(IBX,"^",8) Q | 
|---|
| 58 | ...; | 
|---|
| 59 | ...I M="PROCEDURE" D | 
|---|
| 60 | ....I +IBX D | 
|---|
| 61 | ..... S X=$$CPT^ICPTCOD(+IBX) | 
|---|
| 62 | ..... S X=$S(X=-1:"",1:$P(X,"^",2)) | 
|---|
| 63 | ..... S X="Procedure: "_X_" - "_$P(IBX,"^",7)_" - "_$P(IBX,"^",6)_" - "_$S($P(IBX,"^",2)="P":"Primary ",$P(IBX,"^",2)="S":"Secondary ",1:"Quantity: "_+$P(IBX,"^",2)) | 
|---|
| 64 | ..... Q | 
|---|
| 65 | ....I 'IBX S X="Treatment: "_$P(IBX,"^",6) | 
|---|
| 66 | ...; | 
|---|
| 67 | ...I M="VITALS" S X="Vital Sign: "_$$VTYPE($P(IBX,"^"))_": "_$P(IBX,"^",2) Q | 
|---|
| 68 | ...; | 
|---|
| 69 | ...I M="IMMUNIZATION" S X="Immunization: "_$$DSPLYIM^PXAPIIB(+IBX) I $P(IBX,"^",5) S X=X_" - Contraindicated" Q | 
|---|
| 70 | ...; | 
|---|
| 71 | ...I M="EXAM" S X="Exam: "_$$DSPLYEX^PXAPIIB(+IBX)_$S($P(IBX,"^",2)="A":" Abnormal",$P(IBX,"^",2)="N":" Normal",1:"") Q | 
|---|
| 72 | ...; | 
|---|
| 73 | ...I M="PROBLEM" S X="Problem List: "_$P(IBX,"^") Q | 
|---|
| 74 | ...; | 
|---|
| 75 | ...I M="HEALTH FACTORS" S X="Health Factor: "_$$DSPLYHF^PXAPIIB(+IBX) N Y S Y=$P(IBX,"^",2) I Y'="" S X=X_" Level/Severity: "_$S(Y="M":"Minimal",Y="MO":"Moderate",Y="H":"Heavy/Severe",1:"") Q | 
|---|
| 76 | ...; | 
|---|
| 77 | ...I M="SKIN TEST" S X="Skin Tests: "_$$DSPLYSK^PXAPIIB(+IBX) Q | 
|---|
| 78 | ...; | 
|---|
| 79 | ...I M="PATIENT ED" S X="Patient Eduction: "_$$DSPLYED^PXAPIIB(+IBX) I $P(IBX,"^",2) S X=X_" , Level of Understanding: "_$S(IBX=1:"Poor",IBX=2:"Fair",IBX=3:"Good",IBX=4:"N/A",IBX=5:"Refused",1:"") Q | 
|---|
| 80 | ...; | 
|---|
| 81 | ...I M="DIAGNOSIS/PROBLEM" D  S:X="" X="Diagnosis/Problem: unspecified" | 
|---|
| 82 | ....N Y S X="" | 
|---|
| 83 | ....S Y=$P(IBX,"^",2) S X=$S(Y="P":"Primary ",Y="S":"Secondary ",1:"")_"Diagnosis/Problem" | 
|---|
| 84 | ....;I $P(IBX,"^",4) S X=X_$S($P(IBX,"^",6)="I":", Inactive",1:", Active") | 
|---|
| 85 | ....I $P(IBX,"^",13)'="" S X=X_" '"_$P(IBX,"^",14)_$S($P(IBX,"^",14)'="":" ",1:"")_$P(IBX,"^",13)_"'" | 
|---|
| 86 | ....;I +$P(IBX,"^",3) S X=X_", Clinical Lexicon term: "_$P($G(^GMP(757.01,+$P(IBX,"^",3),0)),"^") ;clinical lexicon term passed | 
|---|
| 87 | ....I +$P(IBX,"^",3) S X=X_", Clinical Lexicon term: " D | 
|---|
| 88 | .....I $D(^LEX) S X=X_$P($G(^LEX(757.01,+$P(IBX,"^",3),0)),"^") Q | 
|---|
| 89 | .....S X=X_$P($G(^GMP(757.01,+$P(IBX,"^",3),0)),"^") | 
|---|
| 90 | ....I $P(IBX,"^",5) S X=X_", Added to Problem List " | 
|---|
| 91 | ....I +$P(IBX,"^",4) S X=X_", Patient Active Problem: "_$$PROBNAR($P(IBX,"^",4)) ;problem entry passed | 
|---|
| 92 | ....I +IBX S IBY=$P($G(^ICD9(+IBX,0)),"^") I IBX'[IBY S X=X_", ICD9: "_IBY | 
|---|
| 93 | ....I $P(IBX,"^",9) S X=X_" SC Condition " | 
|---|
| 94 | ....I $P(IBX,"^",10) S X=X_" AO Condition " | 
|---|
| 95 | ....I $P(IBX,"^",11) S X=X_" IR Condition " | 
|---|
| 96 | ....I $P(IBX,"^",12) S X=X_" EC Condition " | 
|---|
| 97 | ...I M="LOCAL" S X="Local Data Received: "_IBX Q | 
|---|
| 98 | ..I M="PROCEDURE",$D(PXCA(M,I,J)) D MODLIST | 
|---|
| 99 | LSTQ Q | 
|---|
| 100 | ; | 
|---|
| 101 | MODLIST ; -- expand the modifiers filed | 
|---|
| 102 | N IBM,X S IBM=0 | 
|---|
| 103 | S X="    Modifier(s): " D NEWLINE(.RESULT,X,.LCNT) | 
|---|
| 104 | F  S IBM=$O(PXCA(M,I,J,IBM)) Q:IBM']""  D | 
|---|
| 105 | . S X="         "_IBM_"-"_$P(PXCA(M,I,J,IBM),"^",3) | 
|---|
| 106 | . D NEWLINE(.RESULT,X,.LCNT) | 
|---|
| 107 | Q | 
|---|
| 108 | PROV ; -- expand the additional provider node | 
|---|
| 109 | S IBX=$G(PXCA(M,I)) | 
|---|
| 110 | S X=$S($E(IBX,1)="P":"Primary ",$E(IBX,1)="S":"Secondary ",1:"")_"Provider: "_$P($G(^VA(200,I,0)),"^")_$S($P(IBX,"^",2)=1:" Attending",1:"") | 
|---|
| 111 | D NEWLINE(.RESULT,X,.LCNT) | 
|---|
| 112 | Q | 
|---|
| 113 | ; | 
|---|
| 114 | NEWLINE(RESULT,X,LCNT) ; | 
|---|
| 115 | ; -- increment count and add new line to results array. | 
|---|
| 116 | S LCNT=LCNT+1 | 
|---|
| 117 | S RESULT(LCNT)=X | 
|---|
| 118 | Q | 
|---|
| 119 | ; | 
|---|
| 120 | VTYPE(X) ; | 
|---|
| 121 | ; -- Vital sign type from codes | 
|---|
| 122 | S X=$G(X) | 
|---|
| 123 | Q $S(X="BP":"Blood Pressure",X="HT":"Height",X="WT":"Weight",X="TMP":"Temperature",X="PU":"Pulse",1:"Other Vital") | 
|---|
| 124 | ; | 
|---|
| 125 | PROBNAR(IEN) ; -- display problem narrative | 
|---|
| 126 | ; | 
|---|
| 127 | Q $P($G(^AUTNPOV(+$P($G(^AUPNPROB(+$G(IEN),0)),"^",5),0)),"^") | 
|---|
| 128 | ; | 
|---|
| 129 | PROBDIA(IEN) ; -- return problem diagnosis code pointer | 
|---|
| 130 | Q +$P($G(^AUPNPROB(+$G(IEN),0)),"^") | 
|---|