Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: BPXRMPX

BPXRMPX.m

Go to the documentation of this file.
BPXRMPX ;IHS/MSC/MGH - APIs for Clinical Reminder indexes. ;03-Jun-2013 12:09;DU
 ;;2.0;CLINICAL REMINDERS;**1001**;Feb 04, 2005;Build 21
 Q
 ;===============================================================
 ;===============================================================
VPRC(DA,DATA) ;Return data for a specified V PROCEDURE entry.
 N TEMP
 S TEMP=^AUPNVPRC(DA,0)
 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("EVENT")=$P($G(^AUPNVPRC(DA,12,0)),U,1)
 Q
 ;
 ;===============================================================
VMEA(MEADATA,MEAIEN,MEAIB) ;Return data for a specified V Measurement entry.
 ; Input:
 ;   MEADATA = Array name passed by reference       (required)
 ;   MEAIEN = IEN for FILE 9000010.01    (required)
 ;   MEAIB = "I" for Internal value only
 ;           "B" for Internal and External values (default = B)
 ;
 ; If MEAIB = "I", then
 ;   Output = MEADATA(n)=internal value
 ;
 ; If MEAIB = "B", then
 ; Output: MEADATA(n)=internal value^external value
 ;
 ; where:
 ; MEADATA(1)=.01 (DATE/TIME VITALS TAKEN)
 ; MEADATA(2)=.02 (PATIENT)
 ; MEADATA(3)=.03 (VITAL TYPE)
 ; MEADATA(4)=.04 (DATE/TIME VITALS ENTERED)
 ; MEADATA(5)=.05 (HOSPITAL LOCATION)
 ; MEADATA(6)=.06 (ENTERED BY)
 ; MEADATA(7)=1.2 (RATE)
 ; MEADATA(8)=1.4 (SUPPLEMENTAL O2)
 ; MEADATA(9)=2   (ENTERED IN ERROR)
 ; MEADATA(10)=3  (ERROR ENTERED BY)
 ; MEADATA(11,n)=4 (REASON ENTERED IN ERROR)  <--multiple
 ; MEADATA(12,n)=5 (QUALIFIER)                <--multiple
 ;
 ; If the lookup failed then: MEADATA(1)=-1^error text
 ;
 N MEACNT,MEAIEN1,MEALIST,MEALEN,MEALOOP,MEATEMP,TEMP,TEMP2,TEMP12,VISIT,TEMP5,TP,EM
 K MEADATA
 I $G(MEAIB)'="I",$G(MEAIB)'="B" S MEAIB="B"
 I $G(MEAIEN)="" S MEADATA(1)="-1^Record Number is Null" Q
 I MEAIEN=+MEAIEN D
 .S TEMP=$G(^AUPNVMSR(MEAIEN,0))
 .S TEMP2=$G(^AUPNVMSR(MEAIEN,2))
 .S TEMP12=$G(^AUPNVMSR(MEAIEN,12))
 .S TEMP5=$G(^AUPNVMSR(MEAIEN,5))
 .S VISIT=$P(TEMP,U,3)
 I TEMP="" D  Q
 .S MEADATA(1)="-1^The entry does not exist"
 .Q
 ;
 S MEADATA(1)=$P(TEMP12,U,1)      ;Date/time taken
 ;Event date/time not entered
 I MEADATA(1)="" D
 .I +VISIT D
 ..S MEADATA(1)=$P($G(^AUPNVSIT(VISIT,0)),U,1)
 I MEAIB="B" S MEADATA(1)=$P(MEADATA(1),U,1)_U_$$FMTDATE^BGOUTL(MEADATA(1))
 S MEADATA(2)=$P(TEMP,U,2)       ;Patient
 I MEAIB="B"  S MEADATA(2)=$P(MEADATA(2),U,1)_U_$$EXTERNAL^DILFD(9000010.01,.02,"",$P(MEADATA(2),U,1),.EM)
 S MEADATA(3)=$P(TEMP,U,1)       ;Vital Type
 I MEAIB="B" S MEADATA(3)=$P(MEADATA(3),U,1)_U_$$EXTERNAL^DILFD(9000010.01,.01,"",$P(MEADATA(3),U,1),.EM)
 S MEADATA(4)=$P(TEMP,U,7)       ;Time entered
 I MEADATA(4)="" D
 .S MEADATA(4)=MEADATA(1)
 I MEAIB="B" S MEADATA(4)=MEADATA(4)_U_$$FMTDATE^BGOUTL(MEADATA(4))
 S MEADATA(5)=$P($G(^AUPNVSIT(VISIT,0)),U,22)
 I '$D(^SC(+MEADATA(5),0)) S MEADATA(5)=0
 I MEAIB="B" S MEADATA(5)=$P(MEADATA(5),U,1)_U_$$EXTERNAL^DILFD(9000010,.22,"",MEADATA(5),.EM)
 S MEADATA(6)=$P(TEMP,U,8)
 I MEADATA(6)="" S MEADATA(6)=$P(TEMP12,U,4)
 I MEAIB="B" S MEADATA(6)=$P(MEADATA(6),U,1)_U_$$EXTERNAL^DILFD(9000010.01,.08,"",$P(MEADATA(6),U,1),.EM)
 S MEADATA(7)=$P(TEMP,U,4)
 I MEAIB="B" S MEADATA(7)=$P(TEMP,U,4)_U_MEADATA(7)
 S MEADATA(8)=$P(TEMP,U,10)
 I MEAIB="B" S MEADATA(8)=$P(TEMP,U,10)_U_MEADATA(8)
 S MEADATA(9)=$P(TEMP2,U,1)
 I MEAIB="B" D
 .I MEADATA(9)="" S MEADATA(9)="^"
 .E  S MEADATA(9)=$P(MEADATA(9),U,1)_U_$$EXTERNAL^DILFD(9000010.01,2,"",$P(MEADATA(9),U,1),.EM)
 S MEADATA(10)=$P(TEMP2,U,2)
 I MEAIB="B"  S MEADATA(10)=$P(MEADATA(10),U,1)_U_$$EXTERNAL^DILFD(9000010.01,3,"",$P(MEADATA(10),U,1),.EM)
 S MEACNT=0
 S MEALIST=0 F  S MEALIST=$O(^AUPNVMSR(MEAIEN,2.1,MEALIST)) Q:'+MEALIST  D
 .S MEACNT=MEACNT+1
 .S MEADATA(11,MEACNT)=$G(^AUPNVMSR(MEAIEN,2.1,MEALIST,0))
 I MEACNT=0 S MEADATA(11,1)=""
 S MEALOOP=0,MEACNT=0
 F  S MEALOOP=$O(^AUPNVMSR(MEAIEN,5,MEALOOP)) Q:'+MEALOOP  D
 .S MEACNT=MEACNT+1
 .S MEADATA(12,MEACNT)=$G(^AUPNVMSR(MEAIEN,5,MEALOOP,0))
 I MEACNT=0 S MEADATA(12,1)=""
 ;
 ;loop through entered-in-error reason multiple
 I MEAIB="B" D
 .S (MEACNT,MEAIEN1)=0
 .F  S MEAIEN1=$O(MEADATA(11,MEAIEN1)) Q:'MEAIEN1  D
 ..S TP=$P(MEADATA(11,MEAIEN1),U,1)
 ..Q:'TP
 ..S MEADATA(11,MEAIEN1)=TP_U_$$EXTERNAL^DILFD(9000010.014,.01,"",TP,.EM)
 ..S MEACNT=1
 .I MEACNT=0 S MEADATA(11,1)="^"
 .;loop through qualifier multiple
 .S (MEACNT,MEAIEN1)=0
 .F  S MEAIEN1=$O(MEADATA(12,MEAIEN1)) Q:'MEAIEN1  D
 ..S TP=+$P(MEADATA(12,MEAIEN1),U,1)
 ..Q:'TP
 ..S MEADATA(12,MEAIEN1)=TP_U_$P($G(^GMRD(120.52,+TP,0)),U,1)
 ..S MEACNT=1
 .I MEACNT=0 S MEADATA(12,1)="^"
 Q
 ;