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

BDGSYS2.m

Go to the documentation of this file.
  1. BDGSYS2 ; IHS/ANMC/LJF - TREATING SPECIALTY SETUP ;
  1. ;;5.3;PIMS;;APR 26, 2002
  1. ;
  1. EN ; -- main entry point for BDG SYS TREAT SPEC SETUP
  1. NEW VALMCNT
  1. D TERM^VALM0,CLEAR^VALM1
  1. D EN^VALM("BDG SYS TREAT SPEC SETUP")
  1. D CLEAR^VALM1
  1. Q
  1. ;
  1. HDR ; -- header code
  1. NEW X
  1. S X=$$GET1^DIQ(40.8,BDGDIV,.01)
  1. S VALMHDR(1)=$$SP(79-$L(X)\2)_X
  1. Q
  1. ;
  1. INIT ; -- init variables and list array
  1. D MSG^BDGF("Please wait while I compile the list...",1,0)
  1. NEW CODE,IEN,COUNT,LINE,Y
  1. S VALMCNT=0
  1. K ^TMP("BDGSYS2",$J)
  1. S NAME=0
  1. F S NAME=$O(^DIC(45.7,"B",NAME)) Q:NAME="" D
  1. . S IEN=0
  1. . F S IEN=$O(^DIC(45.7,"B",NAME,IEN)) Q:'IEN D
  1. .. S CODE=$$GET1^DIQ(45.7,IEN,9999999.01) Q:CODE="00" ;bad entry
  1. .. ;
  1. .. S COUNT=$G(COUNT)+1
  1. .. S LINE=$J(COUNT,2)_". "_NAME ;service name
  1. .. S LINE=$$PAD(LINE,32)_$$GET1^DIQ(45.7,IEN,99) ;abbreviation
  1. .. S LINE=$$PAD(LINE,39)_CODE
  1. .. S LINE=$$PAD(LINE,45)_$$SRV(IEN) ;hos service
  1. .. S LINE=$$PAD(LINE,61)_$$LASTDATE(IEN) ;active date
  1. .. D SET(LINE,COUNT,IEN,.VALMCNT)
  1. ;
  1. I '$D(^TMP("BDGSYS2",$J)) D
  1. . D SET("*** NO ENTRIES FOUND WITH IHS CODES!! ***",0,0,.VALMCNT)
  1. Q
  1. ;
  1. LASTDATE(N) ; find latest effective date and active status
  1. NEW X,Y
  1. I $$GET1^DIQ(45.7,N,9999999.03)'="YES" Q "" ;admitting service?
  1. S X=$O(^DIC(45.7,N,"E","ADATE","")) I X="" Q "No effective date"
  1. S Y=$O(^DIC(45.7,N,"E","ADATE",X,0)) I 'Y Q "Bad entry"
  1. I $$GET1^DIQ(45.702,Y_","_N,.02)'="YES" Q "Inactive" ;active?
  1. Q "YES - "_$$PAD($$FMTE^XLFDT(-X),14)
  1. ;
  1. SRV(N) ; returns hospital service for entry
  1. Q $E($P($$GET1^DIQ(45.7,IEN,2)," SERVICE"),1,15)
  1. ;
  1. SET(DATA,NUM,N,LINE) ; put display line into array
  1. S LINE=LINE+1
  1. S ^TMP("BDGSYS2",$J,LINE,0)=DATA
  1. S ^TMP("BDGSYS2",$J,"IDX",LINE,NUM)=N
  1. Q
  1. ;
  1. HELP ; -- help code
  1. S X="?" D DISP^XQORM1 W !!
  1. Q
  1. ;
  1. EXIT ; -- exit code
  1. K ^TMP("BDGSYS2",$J)
  1. Q
  1. ;
  1. EXPND ; -- expand code
  1. Q
  1. ;
  1. RESET ; -- update partition for return to list manager
  1. I $D(VALMQUIT) S VALMBCK="Q" Q
  1. D TERM^VALM0 S VALMBCK="R"
  1. D INIT,HDR
  1. Q
  1. ;
  1. EDIT ;EP; called by Edit Entry protocol
  1. NEW X,Y,Z,BDGN,DDSFILE,DA,DR
  1. D FULL^VALM1
  1. D EN^VALM2(XQORNOD(0),"OS")
  1. I '$D(VALMY) Q
  1. S X=0 F S X=$O(VALMY(X)) Q:X="" D
  1. . S Y=0 F S Y=$O(^TMP("BDGSYS2",$J,"IDX",Y)) Q:Y="" D
  1. .. S Z=$O(^TMP("BDGSYS2",$J,"IDX",Y,0))
  1. .. Q:^TMP("BDGSYS2",$J,"IDX",Y,Z)=""
  1. .. I Z=X S BDGN=^TMP("BDGSYS2",$J,"IDX",Y,Z)
  1. ;
  1. I 'BDGN D RESET Q
  1. S DDSFILE=45.7,DA=BDGN,DR="[BDG 45.7 SETUP]" D ^DDS
  1. D RESET
  1. Q
  1. ;
  1. PAD(D,L) ;EP -- SUBRTN to pad length of data
  1. ; -- D=data L=length
  1. Q $E(D_$$REPEAT^XLFSTR(" ",L),1,L)
  1. ;
  1. SP(N) ; -- SUBRTN to pad N number of spaces
  1. Q $$PAD(" ",N)