BEDDGET ;GDIT/HS/BEE-BEDD Utility Routine ; 08 Nov 2011 12:00 PM
;;2.0;BEDD DASHBOARD;**1**;Jun 04, 2014;Build 22
;
Q
;
GETCHIEF(BEDDIEN,BEDDCOMP,TYPE,CCLIST,LATEST) ;EP - Get V NARRATIVE TEXT
;
; Input:
; BEDDIEN - V NARRATIVE TEXT Entry IEN
; BEDDCOMP - BEDD.EDVISIT - Complaint field value
; TYPE - Return type - P - Presenting, C - Chief, Null - All
;
; Output:
; V NARRATIVE TEXT (1st) or Complaint value (2nd)
; CCLIST - Array of chief complaint entries
;
;Error Trap
NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BEDDGET D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
;
S TYPE=$G(TYPE)
S BEDDCOMP=$G(BEDDCOMP)
S BEDDIEN=$G(BEDDIEN)
S LATEST=$G(LATEST)
;
;Return only presenting complaint
I BEDDCOMP="" D
. NEW DFN
. S DFN=$$GET1^DIQ(9000010,BEDDIEN_",",.05,"I") Q:DFN=""
. S BEDDCOMP=$$GET1^DIQ(9009081,DFN_",",23,"E")
I TYPE="P" Q BEDDCOMP
;
;Retrieve V NARRATIVE TEXT entries
NEW BEDDCTXT
S BEDDCTXT=""
;
I $G(BEDDIEN)]"",$D(^AUPNVNT("AD",BEDDIEN)) D
. NEW BEDDCC
. S BEDDCC="" F S BEDDCC=$O(^AUPNVNT("AD",BEDDIEN,BEDDCC),-1) Q:'BEDDCC D I $G(BEDDCTXT)]"",LATEST Q
.. ;
.. ;Pull the entry
.. I $D(^AUPNVNT(BEDDCC,11,0)) D
... N LN
... S CCLIST=$G(CCLIST)+1
... S LN=0 F S LN=$O(^AUPNVNT(BEDDCC,11,LN)) Q:'LN D
.... S BEDDCTXT=$G(BEDDCTXT)_$S(BEDDCTXT="":"",1:" ")_$G(^AUPNVNT(BEDDCC,11,LN,0))
.... S CCLIST(CCLIST)=$G(CCLIST(CCLIST))_$S($G(CCLIST(CCLIST))="":"",1:"; ")_$G(^AUPNVNT(BEDDCC,11,LN,0))
;
;If request for all, add the presenting complaint
I TYPE="" D
. I LATEST,BEDDCTXT]"" Q
. S BEDDCTXT=BEDDCTXT_$S(BEDDCTXT="":"",1:"; ")_BEDDCOMP
. S CCLIST=$G(CCLIST)+1
. S CCLIST(CCLIST)=BEDDCOMP
;
Q BEDDCTXT
;
;
ERR ;
D ^%ZTER
Q
BEDDGET ;GDIT/HS/BEE-BEDD Utility Routine ; 08 Nov 2011 12:00 PM
+1 ;;2.0;BEDD DASHBOARD;**1**;Jun 04, 2014;Build 22
+2 ;
+3 QUIT
+4 ;
GETCHIEF(BEDDIEN,BEDDCOMP,TYPE,CCLIST,LATEST) ;EP - Get V NARRATIVE TEXT
+1 ;
+2 ; Input:
+3 ; BEDDIEN - V NARRATIVE TEXT Entry IEN
+4 ; BEDDCOMP - BEDD.EDVISIT - Complaint field value
+5 ; TYPE - Return type - P - Presenting, C - Chief, Null - All
+6 ;
+7 ; Output:
+8 ; V NARRATIVE TEXT (1st) or Complaint value (2nd)
+9 ; CCLIST - Array of chief complaint entries
+10 ;
+11 ;Error Trap
+12 ; SAC 2006 2.2.3.3.2
NEW $ESTACK,$ETRAP
SET $ETRAP="D ERR^BEDDGET D UNWIND^%ZTER"
+13 ;
+14 SET TYPE=$GET(TYPE)
+15 SET BEDDCOMP=$GET(BEDDCOMP)
+16 SET BEDDIEN=$GET(BEDDIEN)
+17 SET LATEST=$GET(LATEST)
+18 ;
+19 ;Return only presenting complaint
+20 IF BEDDCOMP=""
Begin DoDot:1
+21 NEW DFN
+22 SET DFN=$$GET1^DIQ(9000010,BEDDIEN_",",.05,"I")
IF DFN=""
QUIT
+23 SET BEDDCOMP=$$GET1^DIQ(9009081,DFN_",",23,"E")
End DoDot:1
+24 IF TYPE="P"
QUIT BEDDCOMP
+25 ;
+26 ;Retrieve V NARRATIVE TEXT entries
+27 NEW BEDDCTXT
+28 SET BEDDCTXT=""
+29 ;
+30 IF $GET(BEDDIEN)]""
IF $DATA(^AUPNVNT("AD",BEDDIEN))
Begin DoDot:1
+31 NEW BEDDCC
+32 SET BEDDCC=""
FOR
SET BEDDCC=$ORDER(^AUPNVNT("AD",BEDDIEN,BEDDCC),-1)
IF 'BEDDCC
QUIT
Begin DoDot:2
+33 ;
+34 ;Pull the entry
+35 IF $DATA(^AUPNVNT(BEDDCC,11,0))
Begin DoDot:3
+36 NEW LN
+37 SET CCLIST=$GET(CCLIST)+1
+38 SET LN=0
FOR
SET LN=$ORDER(^AUPNVNT(BEDDCC,11,LN))
IF 'LN
QUIT
Begin DoDot:4
+39 SET BEDDCTXT=$GET(BEDDCTXT)_$SELECT(BEDDCTXT="":"",1:" ")_$GET(^AUPNVNT(BEDDCC,11,LN,0))
+40 SET CCLIST(CCLIST)=$GET(CCLIST(CCLIST))_$SELECT($GET(CCLIST(CCLIST))="":"",1:"; ")_$GET(^AUPNVNT(BEDDCC,11,LN,0))
End DoDot:4
End DoDot:3
End DoDot:2
IF $GET(BEDDCTXT)]""
IF LATEST
QUIT
End DoDot:1
+41 ;
+42 ;If request for all, add the presenting complaint
+43 IF TYPE=""
Begin DoDot:1
+44 IF LATEST
IF BEDDCTXT]""
QUIT
+45 SET BEDDCTXT=BEDDCTXT_$SELECT(BEDDCTXT="":"",1:"; ")_BEDDCOMP
+46 SET CCLIST=$GET(CCLIST)+1
+47 SET CCLIST(CCLIST)=BEDDCOMP
End DoDot:1
+48 ;
+49 QUIT BEDDCTXT
+50 ;
+51 ;
ERR ;
+1 DO ^%ZTER
+2 QUIT