BHSCOAG ;IHS/MSC/MGH - Health Summary for Anticoag data ;22-Aug-2014 14:54;DU
;;1.0;HEALTH SUMMARY COMPONENTS;**8,9**;Mar 17,2006;Build 16
;===================================================================
ANTICOAG ;DISPLAY PROBLEMS USED BY VISITS IN HEALTH SUMMARY
N TARGET,X,LINE,IEN,QUIT,NUM,CNT
;For Visit instructions and treatments, the default is the latest visit
S GMTSNDM=$G(GMTSNDM)
I (GMTSNDM="")!(GMTSNDM=-1) S GMTSNDM=999
D CKP^GMTSUP Q:$D(GMTSQIT)
;Find the visits
S CNT=0
S IEN=$C(0)
F S IEN=$O(^AUPNVACG("AC",DFN,IEN),-1) Q:IEN=""!(CNT>GMTSNDM) D
.Q:$$GET1^DIQ(9000010.51,IEN,1.01)'=""
.D CKP^GMTSUP Q:$D(GMTSQIT) I GMTSNPG W !,"Anticoag Data",!
.S CNT=CNT+1
.D DATA(IEN)
Q
DATA(IEN) ;Get the data for the anticoag entry
N EVDT,WAR,GOAL,MAX,MIN,DUR,START,STOP,COMM,STRING,STRING,COMMENT,END,STRING2
S STRING2=""
S EVDT=$$GET1^DIQ(9000010.51,IEN,1201)
I EVDT="" S EVDT=$$GET1^DIQ(9000010.51,IEN,.03)
S WAR=$$GET1^DIQ(9000010.51,IEN,.01)
S GOAL=$$GET1^DIQ(9000010.51,IEN,.04)
S MIN=$$GET1^DIQ(9000010.51,IEN,.05)
S MAX=$$GET1^DIQ(9000010.51,IEN,.06)
S DUR=$$GET1^DIQ(9000010.51,IEN,.07)
S START=$$GET1^DIQ(9000010.51,IEN,.08)
S END=$$GET1^DIQ(9000010.51,IEN,.09)
S COMMENT=$$GET1^DIQ(9000010.51,IEN,1101)
D CKP^GMTSUP Q:$D(GMTSQIT)
W !!,"Date: "_EVDT_" Warfarin: "_WAR
S STRING="Goal: "_GOAL
I MIN'="" S STRING=STRING_" Min: "_MIN
I MAX'="" S STRING=STRING_" Max: "_MAX
D CKP^GMTSUP Q:$D(GMTSQIT)
W !,STRING
D CKP^GMTSUP Q:$D(GMTSQIT)
W !,"Duration: "_DUR
I START'="" S STRING2="Start "_START
I END'="" S STRING2=STRING2_" End: "_END
I STRING2'="" D
.D CKP^GMTSUP Q:$D(GMTSQIT)
.W !,STRING2
I COMMENT'="" D
.D CKP^GMTSUP Q:$D(GMTSQIT)
.W !,"Comment: "_COMMENT
Q
TMPGBL() ;EP
K ^TMP("BHSCOAG",$J) Q $NA(^($J))
BHSCOAG ;IHS/MSC/MGH - Health Summary for Anticoag data ;22-Aug-2014 14:54;DU
+1 ;;1.0;HEALTH SUMMARY COMPONENTS;**8,9**;Mar 17,2006;Build 16
+2 ;===================================================================
ANTICOAG ;DISPLAY PROBLEMS USED BY VISITS IN HEALTH SUMMARY
+1 NEW TARGET,X,LINE,IEN,QUIT,NUM,CNT
+2 ;For Visit instructions and treatments, the default is the latest visit
+3 SET GMTSNDM=$GET(GMTSNDM)
+4 IF (GMTSNDM="")!(GMTSNDM=-1)
SET GMTSNDM=999
+5 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
+6 ;Find the visits
+7 SET CNT=0
+8 SET IEN=$CHAR(0)
+9 FOR
SET IEN=$ORDER(^AUPNVACG("AC",DFN,IEN),-1)
IF IEN=""!(CNT>GMTSNDM)
QUIT
Begin DoDot:1
+10 IF $$GET1^DIQ(9000010.51,IEN,1.01)'=""
QUIT
+11 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
IF GMTSNPG
WRITE !,"Anticoag Data",!
+12 SET CNT=CNT+1
+13 DO DATA(IEN)
End DoDot:1
+14 QUIT
DATA(IEN) ;Get the data for the anticoag entry
+1 NEW EVDT,WAR,GOAL,MAX,MIN,DUR,START,STOP,COMM,STRING,STRING,COMMENT,END,STRING2
+2 SET STRING2=""
+3 SET EVDT=$$GET1^DIQ(9000010.51,IEN,1201)
+4 IF EVDT=""
SET EVDT=$$GET1^DIQ(9000010.51,IEN,.03)
+5 SET WAR=$$GET1^DIQ(9000010.51,IEN,.01)
+6 SET GOAL=$$GET1^DIQ(9000010.51,IEN,.04)
+7 SET MIN=$$GET1^DIQ(9000010.51,IEN,.05)
+8 SET MAX=$$GET1^DIQ(9000010.51,IEN,.06)
+9 SET DUR=$$GET1^DIQ(9000010.51,IEN,.07)
+10 SET START=$$GET1^DIQ(9000010.51,IEN,.08)
+11 SET END=$$GET1^DIQ(9000010.51,IEN,.09)
+12 SET COMMENT=$$GET1^DIQ(9000010.51,IEN,1101)
+13 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
+14 WRITE !!,"Date: "_EVDT_" Warfarin: "_WAR
+15 SET STRING="Goal: "_GOAL
+16 IF MIN'=""
SET STRING=STRING_" Min: "_MIN
+17 IF MAX'=""
SET STRING=STRING_" Max: "_MAX
+18 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
+19 WRITE !,STRING
+20 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
+21 WRITE !,"Duration: "_DUR
+22 IF START'=""
SET STRING2="Start "_START
+23 IF END'=""
SET STRING2=STRING2_" End: "_END
+24 IF STRING2'=""
Begin DoDot:1
+25 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
+26 WRITE !,STRING2
End DoDot:1
+27 IF COMMENT'=""
Begin DoDot:1
+28 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
+29 WRITE !,"Comment: "_COMMENT
End DoDot:1
+30 QUIT
TMPGBL() ;EP
+1 KILL ^TMP("BHSCOAG",$JOB)
QUIT $NAME(^($JOB))