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

AMHEYD2.m

Go to the documentation of this file.
AMHEYD2 ; IHS/CMI/LAB - PROCESS RECORD ;
 ;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
 ;
 ;
RECORD ;EP
 S (AMHE,AMHTX)="" K AMHRTYPE
 I '$D(^AMHREC(AMHR)) S AMHE="E026" Q
 I '$D(^AMHREC(AMHR,0)) S AMHTX="" Q
 S AMHREC=^AMHREC(AMHR,0)
 D RECORD^AMHEYC1
 I AMHE]"" Q
 S AMHTX=$$VREC(AMHR,"BH1")
 S AMH("ENC")=AMH("ENC")+1
 Q
VREC(AMHR,AMHRTYP) ;
 S AMHREC=^AMHREC(AMHR,0)
 S DFN=$P(^AMHREC(AMHR,0),U,8)
 S AMHSTG=$O(^AMHRCDST("B",AMHR,0))
 K AMHDRUG
 I AMHSTG D
 .S (X,C)=0 F  S X=$O(^AMHRCDST(AMHSTG,11,X)) Q:X'=+X  D
 ..S Y=$P(^AMHRCDST(AMHSTG,11,X,0),U)
 ..Q:'Y
 ..S Y=$P(^AMHTDRUG(Y,0),U,2)
 ..S C=C+1,AMHDRUG(C)=Y
 ..Q
 .Q
 NEW AMHRIEN S AMHRIEN=$O(^AMHRECD("B",AMHRTYP,0))
 I 'AMHRIEN Q ""
 NEW AMHY,AMHT S AMHY=0,AMHT="" F  S AMHY=$O(^AMHRECD(AMHRIEN,11,"B",AMHY)) Q:AMHY'=+AMHY  D
 .S X=""
 .NEW AMHZ S AMHZ=$O(^AMHRECD(AMHRIEN,11,"B",AMHY,0))
 .Q:'$D(^AMHRECD(AMHRIEN,11,AMHZ,1))
 .S X="" X ^AMHRECD(AMHRIEN,11,AMHZ,1)
 .S $P(AMHT,U,AMHY)=X
 .;S LORICNT=$G(LORICNT)+1,^LORITEST(LORICNT)=AMHR_"^"_$P(^AMHRECD(AMHRIEN,11,AMHZ,0),U,1)_"^"_$P(^AMHRECD(AMHRIEN,11,AMHZ,0),U,2)_"^"_X
 Q AMHT