MHVXCLN ;WAS/DLF/KUM - Clinic extract ; 9/25/08 4:10pm
;;1.0;My HealtheVet;**6,10**;Aug 23, 2005;Build 50
;;Per VHA Directive 2004-038, this routine should not be modified.
;
Q
;
; Integration Agreements:
;
; 10103 : $$DT^XLFDT
; $$NOW^XLFDT
; 10004 : $$GET1^DIQ
; 10040 : ^SC("B"
; 4482 : ^SC("ACST"
; 93 : Fields IEN and Stop Code Number in Hospital Location File (#44)
; 557 : ^DIC(40.7
;
CLIN(QRY,ERR,DATAROOT) ; return all Clinics
;
; return provider data in DATAROOT
; QRY, ERR passed by ref.
;
; Input:
; QRY - Query array
;
; DATAROOT - Root of array to hold extract data
;
; Output:
; DATAROOT - Populated data array
; includes number of hits and timestamp
; ERR - Errors during extraction, zero on success
;
N EXTIME,HIT,KEYNM,LOGND,CLINAR,CLIEN,CLNM,X
;
S LOGND=$T(+0)_"^CLINIC" ; node for logging
D LOG^MHVUL2(LOGND,"BEGIN","S","TRACE")
; needed vars.
S ERR=0,EXTIME=$$NOW^XLFDT,HIT=0
;
K @DATAROOT ; clean up residue
S HIT=0
S CLNM=$O(^SC("B",QRY("LNAME")),-1)
I QRY("LNAME")="" S CLNM=99
S DATAROOT=$E(DATAROOT,1,$L(DATAROOT)-1)_","_"""CLINICS"""_")"
F S CLNM=$O(^SC("B",CLNM)) Q:CLNM="" D
.S CLIEN=0
.S CLIEN=$O(^SC("B",CLNM,CLIEN))
.I $E(CLNM,1,$L(QRY("LNAME")))=QRY("LNAME") D
..S HIT=HIT+1
..S @DATAROOT@(HIT)=CLIEN_U_CLNM
;
S @DATAROOT=HIT_U_EXTIME ; hits ^ time
D XITLOG(LOGND,HIT)
;
Q
SPCLIN(QRY,ERR,DATAROOT) ; return all Clinics with Stop Code 719
;
; return provider data in DATAROOT
; QRY, ERR passed by ref.
;
; Input:
; QRY - Query array
;
; DATAROOT - Root of array to hold extract data
;
; Output:
; DATAROOT - Populated data array
; includes number of hits and timestamp
; ERR - Errors during extraction, zero on success
;
N EXTIME,HIT,KEYNM,LOGND,CLINAR,MHVCLIEN,MHVCLNM,MHVCSIEN,MHVCLPSC,MHVPSCIE,MHVPSCNU,X
;
S LOGND=$T(+0)_"^CLINIC" ; node for logging
D LOG^MHVUL2(LOGND,"BEGIN","S","TRACE")
; needed vars.
S ERR=0,EXTIME=$$NOW^XLFDT,HIT=0
;
K @DATAROOT ; clean up residue
S HIT=0
;I $G(QRY("FNAME"))=""!$G(QRY("FNAME"))=0 S ERR="1^Stop Code cannot be null." Q
S MHVCSIEN=$$SCIEN($G(QRY("FNAME")))
;I $G(MHVCSIEN)=""!$G(MHVCSIEN)=0 S ERR="2^Unknown Stop Code:"_$G(QRY("FNAME")) Q
S MHVCLIEN=0
F S MHVCLIEN=$O(^SC("ACST",MHVCSIEN,MHVCLIEN)) Q:'MHVCLIEN D
.S MHVCLNM=$$GET1^DIQ(44,+MHVCLIEN,.01,"I")
.I ($G(MHVCLNM)'="")&($$UP^XLFSTR($E(MHVCLNM,1,$L($G(QRY("LNAME")))))=$G(QRY("LNAME"))!($G(QRY("LNAME"))="")) D
..S HIT=HIT+1
..S MHVCLPSC=$$GET1^DIQ(44,+MHVCLIEN,8,"E")
..S MHVPSCIE=$$GET1^DIQ(44,+MHVCLIEN,8,"I")
..S MHVPSCNU=$$GET1^DIQ(40.7,+MHVPSCIE,1,"I")
..S @DATAROOT@(HIT)=MHVCLIEN_U_MHVCLNM_U_MHVPSCIE_U_MHVCLPSC_U_MHVPSCNU
;
S @DATAROOT=HIT_U_EXTIME ; hits ^ time
D XITLOG(LOGND,HIT)
;
Q
XITLOG(ND,HT) ; exit log
D LOG^MHVUL2(ND,HT_" HITS","S","TRACE")
D LOG^MHVUL2(ND,"END","S","TRACE") Q
Q
SCIEN(SCN) ;Get stop code IEN
N SCIEN
I SCN="" Q ""
S SCIEN=$O(^DIC(40.7,"C",SCN,0))
I $G(SCIEN)="" Q ""
Q SCIEN
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMHVXCLN 3275 printed Nov 22, 2024@17:26:16 Page 2
MHVXCLN ;WAS/DLF/KUM - Clinic extract ; 9/25/08 4:10pm
+1 ;;1.0;My HealtheVet;**6,10**;Aug 23, 2005;Build 50
+2 ;;Per VHA Directive 2004-038, this routine should not be modified.
+3 ;
+4 QUIT
+5 ;
+6 ; Integration Agreements:
+7 ;
+8 ; 10103 : $$DT^XLFDT
+9 ; $$NOW^XLFDT
+10 ; 10004 : $$GET1^DIQ
+11 ; 10040 : ^SC("B"
+12 ; 4482 : ^SC("ACST"
+13 ; 93 : Fields IEN and Stop Code Number in Hospital Location File (#44)
+14 ; 557 : ^DIC(40.7
+15 ;
CLIN(QRY,ERR,DATAROOT) ; return all Clinics
+1 ;
+2 ; return provider data in DATAROOT
+3 ; QRY, ERR passed by ref.
+4 ;
+5 ; Input:
+6 ; QRY - Query array
+7 ;
+8 ; DATAROOT - Root of array to hold extract data
+9 ;
+10 ; Output:
+11 ; DATAROOT - Populated data array
+12 ; includes number of hits and timestamp
+13 ; ERR - Errors during extraction, zero on success
+14 ;
+15 NEW EXTIME,HIT,KEYNM,LOGND,CLINAR,CLIEN,CLNM,X
+16 ;
+17 ; node for logging
SET LOGND=$TEXT(+0)_"^CLINIC"
+18 DO LOG^MHVUL2(LOGND,"BEGIN","S","TRACE")
+19 ; needed vars.
+20 SET ERR=0
SET EXTIME=$$NOW^XLFDT
SET HIT=0
+21 ;
+22 ; clean up residue
KILL @DATAROOT
+23 SET HIT=0
+24 SET CLNM=$ORDER(^SC("B",QRY("LNAME")),-1)
+25 IF QRY("LNAME")=""
SET CLNM=99
+26 SET DATAROOT=$EXTRACT(DATAROOT,1,$LENGTH(DATAROOT)-1)_","_"""CLINICS"""_")"
+27 FOR
SET CLNM=$ORDER(^SC("B",CLNM))
if CLNM=""
QUIT
Begin DoDot:1
+28 SET CLIEN=0
+29 SET CLIEN=$ORDER(^SC("B",CLNM,CLIEN))
+30 IF $EXTRACT(CLNM,1,$LENGTH(QRY("LNAME")))=QRY("LNAME")
Begin DoDot:2
+31 SET HIT=HIT+1
+32 SET @DATAROOT@(HIT)=CLIEN_U_CLNM
End DoDot:2
End DoDot:1
+33 ;
+34 ; hits ^ time
SET @DATAROOT=HIT_U_EXTIME
+35 DO XITLOG(LOGND,HIT)
+36 ;
+37 QUIT
SPCLIN(QRY,ERR,DATAROOT) ; return all Clinics with Stop Code 719
+1 ;
+2 ; return provider data in DATAROOT
+3 ; QRY, ERR passed by ref.
+4 ;
+5 ; Input:
+6 ; QRY - Query array
+7 ;
+8 ; DATAROOT - Root of array to hold extract data
+9 ;
+10 ; Output:
+11 ; DATAROOT - Populated data array
+12 ; includes number of hits and timestamp
+13 ; ERR - Errors during extraction, zero on success
+14 ;
+15 NEW EXTIME,HIT,KEYNM,LOGND,CLINAR,MHVCLIEN,MHVCLNM,MHVCSIEN,MHVCLPSC,MHVPSCIE,MHVPSCNU,X
+16 ;
+17 ; node for logging
SET LOGND=$TEXT(+0)_"^CLINIC"
+18 DO LOG^MHVUL2(LOGND,"BEGIN","S","TRACE")
+19 ; needed vars.
+20 SET ERR=0
SET EXTIME=$$NOW^XLFDT
SET HIT=0
+21 ;
+22 ; clean up residue
KILL @DATAROOT
+23 SET HIT=0
+24 ;I $G(QRY("FNAME"))=""!$G(QRY("FNAME"))=0 S ERR="1^Stop Code cannot be null." Q
+25 SET MHVCSIEN=$$SCIEN($GET(QRY("FNAME")))
+26 ;I $G(MHVCSIEN)=""!$G(MHVCSIEN)=0 S ERR="2^Unknown Stop Code:"_$G(QRY("FNAME")) Q
+27 SET MHVCLIEN=0
+28 FOR
SET MHVCLIEN=$ORDER(^SC("ACST",MHVCSIEN,MHVCLIEN))
if 'MHVCLIEN
QUIT
Begin DoDot:1
+29 SET MHVCLNM=$$GET1^DIQ(44,+MHVCLIEN,.01,"I")
+30 IF ($GET(MHVCLNM)'="")&($$UP^XLFSTR($EXTRACT(MHVCLNM,1,$LENGTH($GET(QRY("LNAME")))))=$GET(QRY("LNAME"))!($GET(QRY("LNAME"))=""))
Begin DoDot:2
+31 SET HIT=HIT+1
+32 SET MHVCLPSC=$$GET1^DIQ(44,+MHVCLIEN,8,"E")
+33 SET MHVPSCIE=$$GET1^DIQ(44,+MHVCLIEN,8,"I")
+34 SET MHVPSCNU=$$GET1^DIQ(40.7,+MHVPSCIE,1,"I")
+35 SET @DATAROOT@(HIT)=MHVCLIEN_U_MHVCLNM_U_MHVPSCIE_U_MHVCLPSC_U_MHVPSCNU
End DoDot:2
End DoDot:1
+36 ;
+37 ; hits ^ time
SET @DATAROOT=HIT_U_EXTIME
+38 DO XITLOG(LOGND,HIT)
+39 ;
+40 QUIT
XITLOG(ND,HT) ; exit log
+1 DO LOG^MHVUL2(ND,HT_" HITS","S","TRACE")
+2 DO LOG^MHVUL2(ND,"END","S","TRACE")
QUIT
+3 QUIT
SCIEN(SCN) ;Get stop code IEN
+1 NEW SCIEN
+2 IF SCN=""
QUIT ""
+3 SET SCIEN=$ORDER(^DIC(40.7,"C",SCN,0))
+4 IF $GET(SCIEN)=""
QUIT ""
+5 QUIT SCIEN
+6 ;