PXPXRM ;SLC/PKR - APIs for Clinical Reminder indexes. ;01-Jun-2015 12:25;DU
;;1.0;PCE PATIENT CARE ENCOUNTER;**119,1002,1003**;Aug 12, 1996;Build 3
;Patch 1002 added $G around the calls
;Patch 1003 allow return of nulls for graphing calls
Q
;===============================================================
KVFILE(FILENUM,X,DA) ;Delete indexes for a regular V File.
N VDATE,VISIT
S VISIT=$G(^AUPNVSIT(X(3),0))
I VISIT="" Q
S VDATE=$P(VISIT,U,1)
K ^PXRMINDX(FILENUM,"IP",X(1),X(2),VDATE,DA)
K ^PXRMINDX(FILENUM,"PI",X(2),X(1),VDATE,DA)
Q
;
;===============================================================
KVFILEC(FILENUM,X,DA) ;Delete indexes for V Files with coded entries.
N CTYPE,VDATE,VISIT
S VISIT=$G(^AUPNVSIT(X(3),0))
I VISIT="" Q
S CTYPE=$S(X(4)="":"U",1:X(4))
S VDATE=$P(VISIT,U,1)
K ^PXRMINDX(FILENUM,"IPP",X(1),CTYPE,X(2),VDATE,DA)
K ^PXRMINDX(FILENUM,"PPI",X(2),CTYPE,X(1),VDATE,DA)
Q
;
;===============================================================
;IHS/MSC/MGH ADDED FOR V MEASURMENTS
KEFILE(FILENUM,X,DA) ;Delete indexes for a regular V File.
N VDATE,VISIT,V
S VDATE=$P($G(^AUPNVMSR(DA,12)),"^",1)
I VDATE="" D
.S V=$P($G(^AUPNVMSR(DA,0)),U,3)
.I V="" Q
.S VISIT=$G(^AUPNVSIT(V,0))
.I VISIT="" Q
.S VDATE=$P(VISIT,U,1)
K ^PXRMINDX(FILENUM,"IP",X(1),X(2),VDATE,DA)
K ^PXRMINDX(FILENUM,"PI",X(2),X(1),VDATE,DA)
Q
SVFILE(FILENUM,X,DA) ;Set indexes for a regular V File.
;X(1)=ITEM, X(2)=DFN, X(3)=VISIT.
N VDATE,VISIT
S VISIT=$G(^AUPNVSIT(X(3),0))
I VISIT="" Q
S VDATE=$P(VISIT,U,1)
S ^PXRMINDX(FILENUM,"IP",X(1),X(2),VDATE,DA)=""
S ^PXRMINDX(FILENUM,"PI",X(2),X(1),VDATE,DA)=""
Q
;
;===============================================================
;IHS/MSC/MGH added call to set index on 1201 field, not visit
EVFILE(FILENUM,X,DA) ;Set indexes for V measurement
;X(1)=ITEM, X(2)=DFN, X(3)=VISIT.
N VDATE,VISIT
S VDATE=$P($G(^AUPNVMSR(DA,12)),"^",1)
I VDATE="" D
.S V=$P($G(^AUPNVMSR(DA,0)),U,3)
.I V="" Q
.S VISIT=$G(^AUPNVSIT(V,0))
.I VISIT="" Q
.S VDATE=$P(VISIT,U,1)
S ^PXRMINDX(FILENUM,"IP",X(1),X(2),VDATE,DA)=""
S ^PXRMINDX(FILENUM,"PI",X(2),X(1),VDATE,DA)=""
Q
;==============================================================
SVFILEC(FILENUM,X,DA) ;Set indexes for V Files with coded entries. These
;are V CPT and VPOV
;X(1)=ITEM, X(2)=DFN, X(3)=VISIT,
;X(4)=PRINCIPAL PROCEDURE for V CPT
;X(4)=PRIMARY/SECONDARY for V POV
N CTYPE,VDATE,VISIT
S VISIT=$G(^AUPNVSIT(X(3),0))
I VISIT="" Q
S CTYPE=$S(X(4)="":"U",1:X(4))
S VDATE=$P(VISIT,U,1)
S ^PXRMINDX(FILENUM,"IPP",X(1),CTYPE,X(2),VDATE,DA)=""
S ^PXRMINDX(FILENUM,"PPI",X(2),CTYPE,X(1),VDATE,DA)=""
Q
;
;===============================================================
VCPT(DA,DATA) ;Return data for a specified V CPT entry.
N TEMP
;S TEMP=^AUPNVCPT(DA,0)
S TEMP=$G(^AUPNVCPT(DA,0)) ;IHS/MSC/MGH added $G
;Q:$P(TEMP,U,3)=""
S DATA("VISIT")=$P(TEMP,U,3)
S DATA("PROVIDER NARRATIVE")=$P(TEMP,U,4)
S DATA("DIAGNOSIS")=$P(TEMP,U,5)
S DATA("PRINCIPAL PROCEDURE")=$P(TEMP,U,7)
S DATA("QUANTITY")=$P(TEMP,U,16)
S DATA("COMMENTS")=$G(^AUPNVCPT(DA,811))
Q
;
;===============================================================
VHF(DA,DATA) ;Return data for a specified V Health Factor entry.
N TEMP
;S TEMP=^AUPNVHF(DA,0)
S TEMP=$G(^AUPNVHF(DA,0)) ;IHS/MSC/MGH Added $G
;Q:$P(TEMP,U,3)=""
S DATA("VISIT")=$P(TEMP,U,3)
S (DATA("LEVEL/SEVERITY"),DATA("VALUE"))=$P(TEMP,U,4)
S DATA("COMMENTS")=$G(^AUPNVHF(DA,811))
Q
;
;===============================================================
VIMM(DA,DATA) ;Return data, for a specified V Immunization entry.
N TEMP
;S TEMP=^AUPNVIMM(DA,0)
S TEMP=$G(^AUPNVIMM(DA,0)) ;IHS/MSC/MGH Added $G
;Q:$P(TEMP,U,3)=""
S DATA("VISIT")=$P(TEMP,U,3)
S (DATA("SERIES"),DATA("VALUE"))=$P(TEMP,U,4)
S DATA("REACTION")=$P(TEMP,U,6)
S DATA("CONTRAINDICATED")=$P(TEMP,U,7)
S DATA("COMMENTS")=$G(^AUPNVIMM(DA,811))
Q
;
;===============================================================
VPEDU(DA,DATA) ;Return data, for a specified V Patient ED entry.
N TEMP
;S TEMP=^AUPNVPED(DA,0)
S TEMP=$G(^AUPNVPED(DA,0)) ;IHS/MSC/MGH Added $G
;Q:$P(TEMP,U,3)=""
S DATA("VISIT")=$P(TEMP,U,3)
S (DATA("LEVEL OF UNDERSTANDING"),DATA("VALUE"))=$P(TEMP,U,6)
S DATA("COMMENTS")=$G(^AUPNVPED(DA,811))
Q
;
;===============================================================
VPOV(DA,DATA) ;Return data for a specified V POV entry.
N TEMP,IEN,ICD,CDT
;S TEMP=^AUPNVPOV(DA,0)
S TEMP=$G(^AUPNVPOV(DA,0)) ;IHS/MSC/MGH Added $G
;Q:$P(TEMP,U,3)=""
S DATA("VISIT")=$P(TEMP,U,3)
S DATA("PROVIDER NARRATIVE")=$P(TEMP,U,4)
S DATA("MODIFIER")=$P(TEMP,U,6)
S DATA("PRIMARY/SECONDARY")=$P(TEMP,U,12)
S DATA("DATE OF INJURY")=$P(TEMP,U,13)
S DATA("CLINICAL TERM")=$P(TEMP,U,15)
;S ICD=$P(TEMP,U),CDT=$$NOW^XLFDT
;S IEN=$P($$ICDDX^ICDEX(ICD,CDT,"","I"),U,2)
;S DATA("CLINICAL TERM")=IEN
S DATA("PROBLEM LIST ENTRY")=$P(TEMP,U,16)
S DATA("COMMENTS")=$G(^AUPNVPOV(DA,811))
Q
;
;===============================================================
VSKIN(DA,DATA) ;Return data for a specified V Skin Test entry.
N TEMP
;S TEMP=^AUPNVSK(DA,0)
S TEMP=$G(^AUPNVSK(DA,0)) ;IHS/MSC/MGH Added $G
;Q:$P(TEMP,U,3)=""
S DATA("VISIT")=$P(TEMP,U,3)
S (DATA("RESULTS"),DATA("VALUE"))=$P(TEMP,U,4)
S DATA("READING")=$P(TEMP,U,5)
S DATA("DATE READ")=$P(TEMP,U,6)
S DATA("COMMENTS")=$G(^AUPNVSK(DA,811))
Q
;
;===============================================================
VXAM(DA,DATA) ;Return data, for a specified V Exam entry.
N TEMP
;S TEMP=^AUPNVXAM(DA,0)
S TEMP=$G(^AUPNVXAM(DA,0)) ;IHS/MSC/MGH Added $G
;Q:$P(TEMP,U,3)=""
S DATA("VISIT")=$P(TEMP,U,3)
S (DATA("RESULT"),DATA("VALUE"))=$P(TEMP,U,4)
S DATA("COMMENTS")=$G(^AUPNVXAM(DA,811))
Q
;
PXPXRM ;SLC/PKR - APIs for Clinical Reminder indexes. ;01-Jun-2015 12:25;DU
+1 ;;1.0;PCE PATIENT CARE ENCOUNTER;**119,1002,1003**;Aug 12, 1996;Build 3
+2 ;Patch 1002 added $G around the calls
+3 ;Patch 1003 allow return of nulls for graphing calls
+4 QUIT
+5 ;===============================================================
KVFILE(FILENUM,X,DA) ;Delete indexes for a regular V File.
+1 NEW VDATE,VISIT
+2 SET VISIT=$GET(^AUPNVSIT(X(3),0))
+3 IF VISIT=""
QUIT
+4 SET VDATE=$PIECE(VISIT,U,1)
+5 KILL ^PXRMINDX(FILENUM,"IP",X(1),X(2),VDATE,DA)
+6 KILL ^PXRMINDX(FILENUM,"PI",X(2),X(1),VDATE,DA)
+7 QUIT
+8 ;
+9 ;===============================================================
KVFILEC(FILENUM,X,DA) ;Delete indexes for V Files with coded entries.
+1 NEW CTYPE,VDATE,VISIT
+2 SET VISIT=$GET(^AUPNVSIT(X(3),0))
+3 IF VISIT=""
QUIT
+4 SET CTYPE=$SELECT(X(4)="":"U",1:X(4))
+5 SET VDATE=$PIECE(VISIT,U,1)
+6 KILL ^PXRMINDX(FILENUM,"IPP",X(1),CTYPE,X(2),VDATE,DA)
+7 KILL ^PXRMINDX(FILENUM,"PPI",X(2),CTYPE,X(1),VDATE,DA)
+8 QUIT
+9 ;
+10 ;===============================================================
+11 ;IHS/MSC/MGH ADDED FOR V MEASURMENTS
KEFILE(FILENUM,X,DA) ;Delete indexes for a regular V File.
+1 NEW VDATE,VISIT,V
+2 SET VDATE=$PIECE($GET(^AUPNVMSR(DA,12)),"^",1)
+3 IF VDATE=""
Begin DoDot:1
+4 SET V=$PIECE($GET(^AUPNVMSR(DA,0)),U,3)
+5 IF V=""
QUIT
+6 SET VISIT=$GET(^AUPNVSIT(V,0))
+7 IF VISIT=""
QUIT
+8 SET VDATE=$PIECE(VISIT,U,1)
End DoDot:1
+9 KILL ^PXRMINDX(FILENUM,"IP",X(1),X(2),VDATE,DA)
+10 KILL ^PXRMINDX(FILENUM,"PI",X(2),X(1),VDATE,DA)
+11 QUIT
SVFILE(FILENUM,X,DA) ;Set indexes for a regular V File.
+1 ;X(1)=ITEM, X(2)=DFN, X(3)=VISIT.
+2 NEW VDATE,VISIT
+3 SET VISIT=$GET(^AUPNVSIT(X(3),0))
+4 IF VISIT=""
QUIT
+5 SET VDATE=$PIECE(VISIT,U,1)
+6 SET ^PXRMINDX(FILENUM,"IP",X(1),X(2),VDATE,DA)=""
+7 SET ^PXRMINDX(FILENUM,"PI",X(2),X(1),VDATE,DA)=""
+8 QUIT
+9 ;
+10 ;===============================================================
+11 ;IHS/MSC/MGH added call to set index on 1201 field, not visit
EVFILE(FILENUM,X,DA) ;Set indexes for V measurement
+1 ;X(1)=ITEM, X(2)=DFN, X(3)=VISIT.
+2 NEW VDATE,VISIT
+3 SET VDATE=$PIECE($GET(^AUPNVMSR(DA,12)),"^",1)
+4 IF VDATE=""
Begin DoDot:1
+5 SET V=$PIECE($GET(^AUPNVMSR(DA,0)),U,3)
+6 IF V=""
QUIT
+7 SET VISIT=$GET(^AUPNVSIT(V,0))
+8 IF VISIT=""
QUIT
+9 SET VDATE=$PIECE(VISIT,U,1)
End DoDot:1
+10 SET ^PXRMINDX(FILENUM,"IP",X(1),X(2),VDATE,DA)=""
+11 SET ^PXRMINDX(FILENUM,"PI",X(2),X(1),VDATE,DA)=""
+12 QUIT
+13 ;==============================================================
SVFILEC(FILENUM,X,DA) ;Set indexes for V Files with coded entries. These
+1 ;are V CPT and VPOV
+2 ;X(1)=ITEM, X(2)=DFN, X(3)=VISIT,
+3 ;X(4)=PRINCIPAL PROCEDURE for V CPT
+4 ;X(4)=PRIMARY/SECONDARY for V POV
+5 NEW CTYPE,VDATE,VISIT
+6 SET VISIT=$GET(^AUPNVSIT(X(3),0))
+7 IF VISIT=""
QUIT
+8 SET CTYPE=$SELECT(X(4)="":"U",1:X(4))
+9 SET VDATE=$PIECE(VISIT,U,1)
+10 SET ^PXRMINDX(FILENUM,"IPP",X(1),CTYPE,X(2),VDATE,DA)=""
+11 SET ^PXRMINDX(FILENUM,"PPI",X(2),CTYPE,X(1),VDATE,DA)=""
+12 QUIT
+13 ;
+14 ;===============================================================
VCPT(DA,DATA) ;Return data for a specified V CPT entry.
+1 NEW TEMP
+2 ;S TEMP=^AUPNVCPT(DA,0)
+3 ;IHS/MSC/MGH added $G
SET TEMP=$GET(^AUPNVCPT(DA,0))
+4 ;Q:$P(TEMP,U,3)=""
+5 SET DATA("VISIT")=$PIECE(TEMP,U,3)
+6 SET DATA("PROVIDER NARRATIVE")=$PIECE(TEMP,U,4)
+7 SET DATA("DIAGNOSIS")=$PIECE(TEMP,U,5)
+8 SET DATA("PRINCIPAL PROCEDURE")=$PIECE(TEMP,U,7)
+9 SET DATA("QUANTITY")=$PIECE(TEMP,U,16)
+10 SET DATA("COMMENTS")=$GET(^AUPNVCPT(DA,811))
+11 QUIT
+12 ;
+13 ;===============================================================
VHF(DA,DATA) ;Return data for a specified V Health Factor entry.
+1 NEW TEMP
+2 ;S TEMP=^AUPNVHF(DA,0)
+3 ;IHS/MSC/MGH Added $G
SET TEMP=$GET(^AUPNVHF(DA,0))
+4 ;Q:$P(TEMP,U,3)=""
+5 SET DATA("VISIT")=$PIECE(TEMP,U,3)
+6 SET (DATA("LEVEL/SEVERITY"),DATA("VALUE"))=$PIECE(TEMP,U,4)
+7 SET DATA("COMMENTS")=$GET(^AUPNVHF(DA,811))
+8 QUIT
+9 ;
+10 ;===============================================================
VIMM(DA,DATA) ;Return data, for a specified V Immunization entry.
+1 NEW TEMP
+2 ;S TEMP=^AUPNVIMM(DA,0)
+3 ;IHS/MSC/MGH Added $G
SET TEMP=$GET(^AUPNVIMM(DA,0))
+4 ;Q:$P(TEMP,U,3)=""
+5 SET DATA("VISIT")=$PIECE(TEMP,U,3)
+6 SET (DATA("SERIES"),DATA("VALUE"))=$PIECE(TEMP,U,4)
+7 SET DATA("REACTION")=$PIECE(TEMP,U,6)
+8 SET DATA("CONTRAINDICATED")=$PIECE(TEMP,U,7)
+9 SET DATA("COMMENTS")=$GET(^AUPNVIMM(DA,811))
+10 QUIT
+11 ;
+12 ;===============================================================
VPEDU(DA,DATA) ;Return data, for a specified V Patient ED entry.
+1 NEW TEMP
+2 ;S TEMP=^AUPNVPED(DA,0)
+3 ;IHS/MSC/MGH Added $G
SET TEMP=$GET(^AUPNVPED(DA,0))
+4 ;Q:$P(TEMP,U,3)=""
+5 SET DATA("VISIT")=$PIECE(TEMP,U,3)
+6 SET (DATA("LEVEL OF UNDERSTANDING"),DATA("VALUE"))=$PIECE(TEMP,U,6)
+7 SET DATA("COMMENTS")=$GET(^AUPNVPED(DA,811))
+8 QUIT
+9 ;
+10 ;===============================================================
VPOV(DA,DATA) ;Return data for a specified V POV entry.
+1 NEW TEMP,IEN,ICD,CDT
+2 ;S TEMP=^AUPNVPOV(DA,0)
+3 ;IHS/MSC/MGH Added $G
SET TEMP=$GET(^AUPNVPOV(DA,0))
+4 ;Q:$P(TEMP,U,3)=""
+5 SET DATA("VISIT")=$PIECE(TEMP,U,3)
+6 SET DATA("PROVIDER NARRATIVE")=$PIECE(TEMP,U,4)
+7 SET DATA("MODIFIER")=$PIECE(TEMP,U,6)
+8 SET DATA("PRIMARY/SECONDARY")=$PIECE(TEMP,U,12)
+9 SET DATA("DATE OF INJURY")=$PIECE(TEMP,U,13)
+10 SET DATA("CLINICAL TERM")=$PIECE(TEMP,U,15)
+11 ;S ICD=$P(TEMP,U),CDT=$$NOW^XLFDT
+12 ;S IEN=$P($$ICDDX^ICDEX(ICD,CDT,"","I"),U,2)
+13 ;S DATA("CLINICAL TERM")=IEN
+14 SET DATA("PROBLEM LIST ENTRY")=$PIECE(TEMP,U,16)
+15 SET DATA("COMMENTS")=$GET(^AUPNVPOV(DA,811))
+16 QUIT
+17 ;
+18 ;===============================================================
VSKIN(DA,DATA) ;Return data for a specified V Skin Test entry.
+1 NEW TEMP
+2 ;S TEMP=^AUPNVSK(DA,0)
+3 ;IHS/MSC/MGH Added $G
SET TEMP=$GET(^AUPNVSK(DA,0))
+4 ;Q:$P(TEMP,U,3)=""
+5 SET DATA("VISIT")=$PIECE(TEMP,U,3)
+6 SET (DATA("RESULTS"),DATA("VALUE"))=$PIECE(TEMP,U,4)
+7 SET DATA("READING")=$PIECE(TEMP,U,5)
+8 SET DATA("DATE READ")=$PIECE(TEMP,U,6)
+9 SET DATA("COMMENTS")=$GET(^AUPNVSK(DA,811))
+10 QUIT
+11 ;
+12 ;===============================================================
VXAM(DA,DATA) ;Return data, for a specified V Exam entry.
+1 NEW TEMP
+2 ;S TEMP=^AUPNVXAM(DA,0)
+3 ;IHS/MSC/MGH Added $G
SET TEMP=$GET(^AUPNVXAM(DA,0))
+4 ;Q:$P(TEMP,U,3)=""
+5 SET DATA("VISIT")=$PIECE(TEMP,U,3)
+6 SET (DATA("RESULT"),DATA("VALUE"))=$PIECE(TEMP,U,4)
+7 SET DATA("COMMENTS")=$GET(^AUPNVXAM(DA,811))
+8 QUIT
+9 ;