ORWIB ; SLC/KCM - wrap calls to AISC
;;3.0;ORDER ENTRY/RESULTS REPORTING;;Dec 17, 1997
VISIT(LST,CLINIC) ; get list of visit types for clinic
D GETLST^IBDF18A(CLINIC,"DG SELECT VISIT TYPE CPT PROCEDURES","LST")
Q
PROC(LST,CLINIC) ; get list of procedures for clinic
D GETLST^IBDF18A(CLINIC,"DG SELECT CPT PROCEDURE CODES","LST")
Q
DIAG(LST,CLINIC) ; get list of diagnoses for clinic
D GETLST^IBDF18A(CLINIC,"DG SELECT ICD-9 DIAGNOSIS CODES","LST")
Q
EFVPD(LST,CLINIC) ; get list of encounter form elements
N PFN
S PFN(1)="DG SELECT VISIT TYPE CPT PROCEDURES"
S PFN(2)="DG SELECT CPT PROCEDURE CODES"
S PFN(3)="DG SELECT ICD-9 DIAGNOSIS CODES"
D GLL^IBDF18A(CLINIC,.PFN,"LST")
Q
SAVEPCE(OK,ORPXAPI) ; save encounter information
N PKG,SRC,CODE,IEN,I
S PKG=$O(^DIC(9.4,"B","ORDER ENTRY/RESULTS REPORTING",0))
S SRC="TEXT INTEGRATION UTILITIES"
S I=0 F S I=$O(ORPXAPI("DX/PL",I)) Q:'I D ; ICD codes to ptrs
. S CODE=ORPXAPI("DX/PL",I,"DIAGNOSIS"),IEN=+$O(^ICD9("AB",CODE_" ",0))
. I IEN'>0 S IEN=$O(^ICD9("AB",CODE_"0 ",0)) ; do I need this??
. S ORPXAPI("DX/PL",I,"DIAGNOSIS")=IEN
S I=0 F S I=$O(ORPXAPI("PROCEDURE",I)) Q:'I D ; CPT codes to ptrs
. S CODE=ORPXAPI("PROCEDURE",I,"PROCEDURE"),IEN=+$O(^ICPT("B",CODE,0))
. S ORPXAPI("PROCEDURE",I,"PROCEDURE")=IEN
S OK=$$DATA2PCE^PXAPI("ORPXAPI",PKG,SRC)
Q
SCSEL(VAL,DFN,ATM,LOC,VST) ; return SC conditions that may be selected
; VAL=SCallow^SCdflt;AOallow^AOdflt;IRallow^IRdflt;ECallow^ECdflt
N X,S S S=";"
D SCCOND^PXUTLSCC(DFN,ATM,LOC,$G(VST),.X)
S VAL=$G(X("SC"))_S_$G(X("AO"))_S_$G(X("IR"))_S_$G(X("EC"))
Q
SCDIS(LST,DFN) ; Return service connected % and rated disabilities
N VAEL,VAERR,I,ILST,DIS,SC,X
D ELIG^VADPT
S LST(1)="Service Connected: "_$S(+VAEL(3):$P(VAEL(3),U,2)_"%",1:"NO")
I 'VAEL(4),'$P($G(^DG(391,+VAEL(6),0)),U,2) S LST(2)="NOT A VETERAN." Q
S I=0,ILST=1 F S I=$O(^DPT(DFN,.372,I)) Q:'I S X=^(I,0) D
. S DIS=$P($G(^DIC(31,+X,0)),U) Q:DIS=""
. S SC=$S($P(X,U,3):"SC",$P(X,U,3)']"":"not specified",1:"NSC")
. S ILST=ILST+1,LST(ILST)=DIS_" ("_$P(X,U,2)_"% "_SC_")"
I ILST=1 S LST(2)="Rated Disabilities: NONE STATED"
Q
ORWIB ; SLC/KCM - wrap calls to AISC
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;;Dec 17, 1997
VISIT(LST,CLINIC) ; get list of visit types for clinic
+1 DO GETLST^IBDF18A(CLINIC,"DG SELECT VISIT TYPE CPT PROCEDURES","LST")
+2 QUIT
PROC(LST,CLINIC) ; get list of procedures for clinic
+1 DO GETLST^IBDF18A(CLINIC,"DG SELECT CPT PROCEDURE CODES","LST")
+2 QUIT
DIAG(LST,CLINIC) ; get list of diagnoses for clinic
+1 DO GETLST^IBDF18A(CLINIC,"DG SELECT ICD-9 DIAGNOSIS CODES","LST")
+2 QUIT
EFVPD(LST,CLINIC) ; get list of encounter form elements
+1 NEW PFN
+2 SET PFN(1)="DG SELECT VISIT TYPE CPT PROCEDURES"
+3 SET PFN(2)="DG SELECT CPT PROCEDURE CODES"
+4 SET PFN(3)="DG SELECT ICD-9 DIAGNOSIS CODES"
+5 DO GLL^IBDF18A(CLINIC,.PFN,"LST")
+6 QUIT
SAVEPCE(OK,ORPXAPI) ; save encounter information
+1 NEW PKG,SRC,CODE,IEN,I
+2 SET PKG=$ORDER(^DIC(9.4,"B","ORDER ENTRY/RESULTS REPORTING",0))
+3 SET SRC="TEXT INTEGRATION UTILITIES"
+4 ; ICD codes to ptrs
SET I=0
FOR
SET I=$ORDER(ORPXAPI("DX/PL",I))
IF 'I
QUIT
Begin DoDot:1
+5 SET CODE=ORPXAPI("DX/PL",I,"DIAGNOSIS")
SET IEN=+$ORDER(^ICD9("AB",CODE_" ",0))
+6 ; do I need this??
IF IEN'>0
SET IEN=$ORDER(^ICD9("AB",CODE_"0 ",0))
+7 SET ORPXAPI("DX/PL",I,"DIAGNOSIS")=IEN
End DoDot:1
+8 ; CPT codes to ptrs
SET I=0
FOR
SET I=$ORDER(ORPXAPI("PROCEDURE",I))
IF 'I
QUIT
Begin DoDot:1
+9 SET CODE=ORPXAPI("PROCEDURE",I,"PROCEDURE")
SET IEN=+$ORDER(^ICPT("B",CODE,0))
+10 SET ORPXAPI("PROCEDURE",I,"PROCEDURE")=IEN
End DoDot:1
+11 SET OK=$$DATA2PCE^PXAPI("ORPXAPI",PKG,SRC)
+12 QUIT
SCSEL(VAL,DFN,ATM,LOC,VST) ; return SC conditions that may be selected
+1 ; VAL=SCallow^SCdflt;AOallow^AOdflt;IRallow^IRdflt;ECallow^ECdflt
+2 NEW X,S
SET S=";"
+3 DO SCCOND^PXUTLSCC(DFN,ATM,LOC,$GET(VST),.X)
+4 SET VAL=$GET(X("SC"))_S_$GET(X("AO"))_S_$GET(X("IR"))_S_$GET(X("EC"))
+5 QUIT
SCDIS(LST,DFN) ; Return service connected % and rated disabilities
+1 NEW VAEL,VAERR,I,ILST,DIS,SC,X
+2 DO ELIG^VADPT
+3 SET LST(1)="Service Connected: "_$SELECT(+VAEL(3):$PIECE(VAEL(3),U,2)_"%",1:"NO")
+4 IF 'VAEL(4)
IF '$PIECE($GET(^DG(391,+VAEL(6),0)),U,2)
SET LST(2)="NOT A VETERAN."
QUIT
+5 SET I=0
SET ILST=1
FOR
SET I=$ORDER(^DPT(DFN,.372,I))
IF 'I
QUIT
SET X=^(I,0)
Begin DoDot:1
+6 SET DIS=$PIECE($GET(^DIC(31,+X,0)),U)
IF DIS=""
QUIT
+7 SET SC=$SELECT($PIECE(X,U,3):"SC",$PIECE(X,U,3)']"":"not specified",1:"NSC")
+8 SET ILST=ILST+1
SET LST(ILST)=DIS_" ("_$PIECE(X,U,2)_"% "_SC_")"
End DoDot:1
+9 IF ILST=1
SET LST(2)="Rated Disabilities: NONE STATED"
+10 QUIT