- FHMMNADM ;Hines OIFO/JT,RTK,AAC - Multidiv Adm/Disc Monitor Report ;10/10/03 10:34
- ;;5.5;DIETETICS;;Jan 28, 2005
- ;
- COM ;Get Communication Offices
- ;
- S (XX,ZCO,CO,COXX,CNAME,CONAME,CONAM,WARD,FHCOMM)="",(ALLMON,ALLMV)=0
- ;S ZZOUT=$G(^FH(119.73,0)),(CONUMX,ZOUT)=$P(ZZOUT,"^",4)
- S ZZCOUNT=0 F ZZCOUNT=0:0 S ZZCOUNT=$O(^FH(119.73,ZZCOUNT)) Q:ZZCOUNT'>0 S ZOUT=ZZCOUNT
- R !!,"Print report for all Communications Offices Y or N: ",ZCO:DTIME W ! S ZCO=$TR(ZCO,"y","Y")
- I ZCO'="Y" D N2 I (Y=-1)&(CO="") Q
- ;
- DATE ;sets date
- ;
- K %DT(0) S %DT="AEPT",%DT("A")="Enter beginning date: " D ^%DT Q:Y<0
- S FHSDT=Y,%DT(0)=FHSDT,%DT("A")="Enter ending date: " D ^%DT Q:Y<0
- S FHEDT=Y
- S DIR(0)="SA^A:Admissions;D:Discharges"
- S DIR("A")="Select type of movement for this report: " D ^DIR
- Q:Y["^"!(Y="") S TYP=Y
- D DEV Q
- ;
- EN ;get admission/monitor information
- Q:XX="*"
- I ZCO'="Y" S CONUMX=CONUMX-1 G:CONUMX=0 THEND S COXX=$P(CO,"^",CONUMX),CNAME=$P(CONAME,"^",CONUMX)
- I ZCO="Y" S COXX=COXX+1 G:COXX>ZOUT THEND S CNAME=$G(^FH(119.73,COXX,0)),CNAME=$P(CNAME,"^")
- I $D(^FH(119.73,COXX,"I"))!'$D(^FH(119.73,COXX,0)) G EN
- ;
- I TYP'="A" G EN1 Q
- S PG=0,EX="",Y=DT X ^DD("DD") S FHNDT=Y D HDR
- S MVTOT=0,MONTOT=0
- S I=FHSDT F S I=$O(^DGPM("ATT1",I)) Q:'I!(I>FHEDT)!(EX=U) D
- .S J=0 F S J=$O(^DGPM("ATT1",I,J)) Q:'J!(EX=U) S REC=$G(^DGPM(J,0)) S WARD=$P(REC,"^",6) Q:WARD="" D COFF2 Q:FHCOMM="" Q:$D(^FH(119.73,FHCOMM,"I")) Q:FHCOMM'=COXX D
- ..S ADM=J,ADMD=I D WRT
- .Q
- Q:XX="*"
- D END
- D EN
- Q
- ;
- COFF ;get communication offices
- Q:'$D(^DIC(42,"B",WARD))
- S WARDIEN=$O(^DIC(42,"B",WARD,""))
- Q:'$D(^FH(119.6,"AW",WARDIEN))
- S FHWARD=$O(^FH(119.6,"AW",WARDIEN,""))
- S FHCOMM=$P($G(^FH(119.6,FHWARD,0)),"^",8)
- Q
- ;
- COFF2 ;
- Q:'$D(^FH(119.6,"AW",WARD))
- S FHWARD=$O(^FH(119.6,"AW",WARD,""))
- S FHCOMM=$P($G(^FH(119.6,FHWARD,0)),"^",8)
- Q
- ;
- WRT ;write info
- ;
- S DFN=$P(^DGPM(J,0),U,3) I $Y>(IOSL-4) D PG I EX=U S XX="*" Q
- S FHZ115="P"_DFN D CHECK^FHOMDPA I FHDFN="" Q
- S Y=$P(ADMD,".") X ^DD("DD") W !,Y,?13,$E($P($G(^DPT(DFN,0)),U,1),U,23)
- W ?39,$E($P($G(^DPT(DFN,0)),U,9),6,9) S MVTOT=MVTOT+1
- I $D(^FHPT(FHDFN,"A",ADM,"MO","B")) W ?48,"Yes" S MONTOT=MONTOT+1
- S Y=$P($P($G(^FHPT(FHDFN,"A",ADM,0)),U,14),".",1) I Y X ^DD("DD") W ?56,Y
- I $Y>(IOSL-4) D PG I EX=U S XX="*" Q
- Q
- ;
- EN1 ;discharges
- S PG=0,EX="",Y=DT X ^DD("DD") S FHNDT=Y D HDR I EX=U S XX="*" Q
- S MVTOT=0,MONTOT=0
- S I=FHSDT F S I=$O(^DGPM("ATT3",I)) Q:'I!(I>FHEDT)!(EX=U) D
- .S J=0 F S J=$O(^DGPM("ATT3",I,J)) Q:'J!(EX=U) S D0=J D WARD^DGPMUTL S WARD=X Q:WARD="" D COFF Q:FHCOMM="" Q:$D(^FH(119.73,FHCOMM,"I")) Q:FHCOMM'=COXX D
- ..S ADM=$P(^DGPM(J,0),U,14)
- ..S ADMD=$P(^DGPM(ADM,0),U,1) D WRT
- .Q
- D END
- D EN Q
- ;
- END ;end/kill/quit
- ;
- I EX=U Q
- W !!,"TOTAL "_$S(TYP="A":"ADMISSIONS",TYP="D":"DISCHARGES")_": ",?22,MVTOT S ALLMV=ALLMV+MVTOT
- W !,"TOTAL WITH MONITORS:",?22,MONTOT S ALLMON=ALLMON+MONTOT
- S FHPER=0 I MONTOT>0,MVTOT>0 S FHPER=(MONTOT/MVTOT)*100
- I $L($P(FHPER,".",2))>2 S FHPER=$P(FHPER,".",1)_"."_$E($P(FHPER,".",2),1,2)
- W !,"Percentage of "
- W $S(TYP="A":"Admissions",TYP="D":"Discharges")
- W " with Monitors: ",FHPER,"%"
- I IOST?1"C".E W ! K DIR S DIR(0)="E" D ^DIR
- Q
- ;
- THEND ;end/kill/quit
- ;
- I EX=U Q
- S CNAME="ALL "
- D HDR
- W !!,"ALL TOTAL "_$S(TYP="A":"ADMISSIONS",TYP="D":"DISCHARGES")_": ",?22,ALLMV
- W !,"TOTAL WITH MONITORS:",?22,ALLMON
- S ALLFHPER=0 I ALLMON>0,ALLMV>0 S ALLFHPER=(ALLMON/ALLMV)*100
- I $L($P(ALLFHPER,".",2))>2 S ALLFHPER=$P(ALLFHPER,".",1)_"."_$E($P(ALLFHPER,".",2),1,2)
- W !,"Percentage of "
- W $S(TYP="A":"Admissions",TYP="D":"Discharges")
- W " with Monitors: ",ALLFHPER,"%"
- Q
- ;
- ;
- DEV ;get device and set up queue
- S TAG=$S(TYP="A":"EN",TYP="D":"EN")
- K %ZIS,IOP S %ZIS="Q" D ^%ZIS Q:POP
- I '$D(IO("Q")) U IO D @TAG,^%ZISC Q
- S ZTRTN=TAG_"^FHMMNADM",ZTSAVE("FHSDT")="",ZTSAVE("FHEDT")=""
- S ZTSAVE("ZCO")="",ZTSAVE("COXX")="",ZTSAVE("CONUMX")="",ZTSAVE("ZOUT")="",ZTSAVE("XX")=""
- S ZTSAVE("CNAME")="",ZTSAVE("FHCOMM")="",ZTSAVE("CO")="",ZTSAVE("CONAME")=""
- S ZTSAVE("ALLMV")="",ZTSAVE("ALLMON")="",ZTSAVE("ALLFHPER")=""
- S ZTSAVE("TYP")="",ZTDESC="Dietetics Monitor Report" D ^%ZTLOAD
- W !,"Task #",ZTSK
- D ^%ZISC K %ZIS,IOP Q
- Q
- ;
- KL ;
- K I,J,DFN,FHDFN,SSN,MVTOT,MONTOT,FHPER,X,Y,PG,FHNDT,ADM,CO,CONAME,CONAM,WARD,FHCOMM,ALLMON,ALLMV
- K TAG,DIR,%DT,ADDT Q
- Q
- ;
- N2 ;Find Communications Office
- S DIC=119.73,DIC(0)="AEQ",DIC("A")="Select Communication Offices: "
- D ^DIC I (Y=-1)&(CO="") Q
- I Y=-1 Q
- S CON=$P(Y,"^",1),CO=CON_"^"_CO,CONAM=$P(Y,"^",2),CONAME=CONAM_"^"_CONAME S CONUMX=$L(CO,"^") G N2
- I Y=-1 K DIC Q
- Q
- ;
- PG ;
- I IOST?1"C".E W ! K DIR S DIR(0)="E" D ^DIR I 'Y S EX=U Q
- D HDR Q
- HDR ;Header
- ;
- W:$Y @IOF
- W !,"DIETETIC MONITOR REPORT (Monitoring "
- W $S(TYP="A":"Admissions",TYP="D":"Discharges")_")"
- W !,FHNDT,?60,"Page: " S PG=PG+1 W PG,!
- W !,?5,"Communication Offices: ",CNAME,!!
- W "Admission",?13,"Patient",?39,"SSN",?45,"Monitor?",?56,"Discharge"
- W ! F Z=1:1:79 W "="
- Q
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HFHMMNADM 5081 printed Mar 13, 2025@20:52:34 Page 2
- FHMMNADM ;Hines OIFO/JT,RTK,AAC - Multidiv Adm/Disc Monitor Report ;10/10/03 10:34
- +1 ;;5.5;DIETETICS;;Jan 28, 2005
- +2 ;
- COM ;Get Communication Offices
- +1 ;
- +2 SET (XX,ZCO,CO,COXX,CNAME,CONAME,CONAM,WARD,FHCOMM)=""
- SET (ALLMON,ALLMV)=0
- +3 ;S ZZOUT=$G(^FH(119.73,0)),(CONUMX,ZOUT)=$P(ZZOUT,"^",4)
- +4 SET ZZCOUNT=0
- FOR ZZCOUNT=0:0
- SET ZZCOUNT=$ORDER(^FH(119.73,ZZCOUNT))
- if ZZCOUNT'>0
- QUIT
- SET ZOUT=ZZCOUNT
- +5 READ !!,"Print report for all Communications Offices Y or N: ",ZCO:DTIME
- WRITE !
- SET ZCO=$TRANSLATE(ZCO,"y","Y")
- +6 IF ZCO'="Y"
- DO N2
- IF (Y=-1)&(CO="")
- QUIT
- +7 ;
- DATE ;sets date
- +1 ;
- +2 KILL %DT(0)
- SET %DT="AEPT"
- SET %DT("A")="Enter beginning date: "
- DO ^%DT
- if Y<0
- QUIT
- +3 SET FHSDT=Y
- SET %DT(0)=FHSDT
- SET %DT("A")="Enter ending date: "
- DO ^%DT
- if Y<0
- QUIT
- +4 SET FHEDT=Y
- +5 SET DIR(0)="SA^A:Admissions;D:Discharges"
- +6 SET DIR("A")="Select type of movement for this report: "
- DO ^DIR
- +7 if Y["^"!(Y="")
- QUIT
- SET TYP=Y
- +8 DO DEV
- QUIT
- +9 ;
- EN ;get admission/monitor information
- +1 if XX="*"
- QUIT
- +2 IF ZCO'="Y"
- SET CONUMX=CONUMX-1
- if CONUMX=0
- GOTO THEND
- SET COXX=$PIECE(CO,"^",CONUMX)
- SET CNAME=$PIECE(CONAME,"^",CONUMX)
- +3 IF ZCO="Y"
- SET COXX=COXX+1
- if COXX>ZOUT
- GOTO THEND
- SET CNAME=$GET(^FH(119.73,COXX,0))
- SET CNAME=$PIECE(CNAME,"^")
- +4 IF $DATA(^FH(119.73,COXX,"I"))!'$DATA(^FH(119.73,COXX,0))
- GOTO EN
- +5 ;
- +6 IF TYP'="A"
- GOTO EN1
- QUIT
- +7 SET PG=0
- SET EX=""
- SET Y=DT
- XECUTE ^DD("DD")
- SET FHNDT=Y
- DO HDR
- +8 SET MVTOT=0
- SET MONTOT=0
- +9 SET I=FHSDT
- FOR
- SET I=$ORDER(^DGPM("ATT1",I))
- if 'I!(I>FHEDT)!(EX=U)
- QUIT
- Begin DoDot:1
- +10 SET J=0
- FOR
- SET J=$ORDER(^DGPM("ATT1",I,J))
- if 'J!(EX=U)
- QUIT
- SET REC=$GET(^DGPM(J,0))
- SET WARD=$PIECE(REC,"^",6)
- if WARD=""
- QUIT
- DO COFF2
- if FHCOMM=""
- QUIT
- if $DATA(^FH(119.73,FHCOMM,"I"))
- QUIT
- if FHCOMM'=COXX
- QUIT
- Begin DoDot:2
- +11 SET ADM=J
- SET ADMD=I
- DO WRT
- End DoDot:2
- +12 QUIT
- End DoDot:1
- +13 if XX="*"
- QUIT
- +14 DO END
- +15 DO EN
- +16 QUIT
- +17 ;
- COFF ;get communication offices
- +1 if '$DATA(^DIC(42,"B",WARD))
- QUIT
- +2 SET WARDIEN=$ORDER(^DIC(42,"B",WARD,""))
- +3 if '$DATA(^FH(119.6,"AW",WARDIEN))
- QUIT
- +4 SET FHWARD=$ORDER(^FH(119.6,"AW",WARDIEN,""))
- +5 SET FHCOMM=$PIECE($GET(^FH(119.6,FHWARD,0)),"^",8)
- +6 QUIT
- +7 ;
- COFF2 ;
- +1 if '$DATA(^FH(119.6,"AW",WARD))
- QUIT
- +2 SET FHWARD=$ORDER(^FH(119.6,"AW",WARD,""))
- +3 SET FHCOMM=$PIECE($GET(^FH(119.6,FHWARD,0)),"^",8)
- +4 QUIT
- +5 ;
- WRT ;write info
- +1 ;
- +2 SET DFN=$PIECE(^DGPM(J,0),U,3)
- IF $Y>(IOSL-4)
- DO PG
- IF EX=U
- SET XX="*"
- QUIT
- +3 SET FHZ115="P"_DFN
- DO CHECK^FHOMDPA
- IF FHDFN=""
- QUIT
- +4 SET Y=$PIECE(ADMD,".")
- XECUTE ^DD("DD")
- WRITE !,Y,?13,$EXTRACT($PIECE($GET(^DPT(DFN,0)),U,1),U,23)
- +5 WRITE ?39,$EXTRACT($PIECE($GET(^DPT(DFN,0)),U,9),6,9)
- SET MVTOT=MVTOT+1
- +6 IF $DATA(^FHPT(FHDFN,"A",ADM,"MO","B"))
- WRITE ?48,"Yes"
- SET MONTOT=MONTOT+1
- +7 SET Y=$PIECE($PIECE($GET(^FHPT(FHDFN,"A",ADM,0)),U,14),".",1)
- IF Y
- XECUTE ^DD("DD")
- WRITE ?56,Y
- +8 IF $Y>(IOSL-4)
- DO PG
- IF EX=U
- SET XX="*"
- QUIT
- +9 QUIT
- +10 ;
- EN1 ;discharges
- +1 SET PG=0
- SET EX=""
- SET Y=DT
- XECUTE ^DD("DD")
- SET FHNDT=Y
- DO HDR
- IF EX=U
- SET XX="*"
- QUIT
- +2 SET MVTOT=0
- SET MONTOT=0
- +3 SET I=FHSDT
- FOR
- SET I=$ORDER(^DGPM("ATT3",I))
- if 'I!(I>FHEDT)!(EX=U)
- QUIT
- Begin DoDot:1
- +4 SET J=0
- FOR
- SET J=$ORDER(^DGPM("ATT3",I,J))
- if 'J!(EX=U)
- QUIT
- SET D0=J
- DO WARD^DGPMUTL
- SET WARD=X
- if WARD=""
- QUIT
- DO COFF
- if FHCOMM=""
- QUIT
- if $DATA(^FH(119.73,FHCOMM,"I"))
- QUIT
- if FHCOMM'=COXX
- QUIT
- Begin DoDot:2
- +5 SET ADM=$PIECE(^DGPM(J,0),U,14)
- +6 SET ADMD=$PIECE(^DGPM(ADM,0),U,1)
- DO WRT
- End DoDot:2
- +7 QUIT
- End DoDot:1
- +8 DO END
- +9 DO EN
- QUIT
- +10 ;
- END ;end/kill/quit
- +1 ;
- +2 IF EX=U
- QUIT
- +3 WRITE !!,"TOTAL "_$SELECT(TYP="A":"ADMISSIONS",TYP="D":"DISCHARGES")_": ",?22,MVTOT
- SET ALLMV=ALLMV+MVTOT
- +4 WRITE !,"TOTAL WITH MONITORS:",?22,MONTOT
- SET ALLMON=ALLMON+MONTOT
- +5 SET FHPER=0
- IF MONTOT>0
- IF MVTOT>0
- SET FHPER=(MONTOT/MVTOT)*100
- +6 IF $LENGTH($PIECE(FHPER,".",2))>2
- SET FHPER=$PIECE(FHPER,".",1)_"."_$EXTRACT($PIECE(FHPER,".",2),1,2)
- +7 WRITE !,"Percentage of "
- +8 WRITE $SELECT(TYP="A":"Admissions",TYP="D":"Discharges")
- +9 WRITE " with Monitors: ",FHPER,"%"
- +10 IF IOST?1"C".E
- WRITE !
- KILL DIR
- SET DIR(0)="E"
- DO ^DIR
- +11 QUIT
- +12 ;
- THEND ;end/kill/quit
- +1 ;
- +2 IF EX=U
- QUIT
- +3 SET CNAME="ALL "
- +4 DO HDR
- +5 WRITE !!,"ALL TOTAL "_$SELECT(TYP="A":"ADMISSIONS",TYP="D":"DISCHARGES")_": ",?22,ALLMV
- +6 WRITE !,"TOTAL WITH MONITORS:",?22,ALLMON
- +7 SET ALLFHPER=0
- IF ALLMON>0
- IF ALLMV>0
- SET ALLFHPER=(ALLMON/ALLMV)*100
- +8 IF $LENGTH($PIECE(ALLFHPER,".",2))>2
- SET ALLFHPER=$PIECE(ALLFHPER,".",1)_"."_$EXTRACT($PIECE(ALLFHPER,".",2),1,2)
- +9 WRITE !,"Percentage of "
- +10 WRITE $SELECT(TYP="A":"Admissions",TYP="D":"Discharges")
- +11 WRITE " with Monitors: ",ALLFHPER,"%"
- +12 QUIT
- +13 ;
- +14 ;
- DEV ;get device and set up queue
- +1 SET TAG=$SELECT(TYP="A":"EN",TYP="D":"EN")
- +2 KILL %ZIS,IOP
- SET %ZIS="Q"
- DO ^%ZIS
- if POP
- QUIT
- +3 IF '$DATA(IO("Q"))
- USE IO
- DO @TAG
- DO ^%ZISC
- QUIT
- +4 SET ZTRTN=TAG_"^FHMMNADM"
- SET ZTSAVE("FHSDT")=""
- SET ZTSAVE("FHEDT")=""
- +5 SET ZTSAVE("ZCO")=""
- SET ZTSAVE("COXX")=""
- SET ZTSAVE("CONUMX")=""
- SET ZTSAVE("ZOUT")=""
- SET ZTSAVE("XX")=""
- +6 SET ZTSAVE("CNAME")=""
- SET ZTSAVE("FHCOMM")=""
- SET ZTSAVE("CO")=""
- SET ZTSAVE("CONAME")=""
- +7 SET ZTSAVE("ALLMV")=""
- SET ZTSAVE("ALLMON")=""
- SET ZTSAVE("ALLFHPER")=""
- +8 SET ZTSAVE("TYP")=""
- SET ZTDESC="Dietetics Monitor Report"
- DO ^%ZTLOAD
- +9 WRITE !,"Task #",ZTSK
- +10 DO ^%ZISC
- KILL %ZIS,IOP
- QUIT
- +11 QUIT
- +12 ;
- KL ;
- +1 KILL I,J,DFN,FHDFN,SSN,MVTOT,MONTOT,FHPER,X,Y,PG,FHNDT,ADM,CO,CONAME,CONAM,WARD,FHCOMM,ALLMON,ALLMV
- +2 KILL TAG,DIR,%DT,ADDT
- QUIT
- +3 QUIT
- +4 ;
- N2 ;Find Communications Office
- +1 SET DIC=119.73
- SET DIC(0)="AEQ"
- SET DIC("A")="Select Communication Offices: "
- +2 DO ^DIC
- IF (Y=-1)&(CO="")
- QUIT
- +3 IF Y=-1
- QUIT
- +4 SET CON=$PIECE(Y,"^",1)
- SET CO=CON_"^"_CO
- SET CONAM=$PIECE(Y,"^",2)
- SET CONAME=CONAM_"^"_CONAME
- SET CONUMX=$LENGTH(CO,"^")
- GOTO N2
- +5 IF Y=-1
- KILL DIC
- QUIT
- +6 QUIT
- +7 ;
- PG ;
- +1 IF IOST?1"C".E
- WRITE !
- KILL DIR
- SET DIR(0)="E"
- DO ^DIR
- IF 'Y
- SET EX=U
- QUIT
- +2 DO HDR
- QUIT
- HDR ;Header
- +1 ;
- +2 if $Y
- WRITE @IOF
- +3 WRITE !,"DIETETIC MONITOR REPORT (Monitoring "
- +4 WRITE $SELECT(TYP="A":"Admissions",TYP="D":"Discharges")_")"
- +5 WRITE !,FHNDT,?60,"Page: "
- SET PG=PG+1
- WRITE PG,!
- +6 WRITE !,?5,"Communication Offices: ",CNAME,!!
- +7 WRITE "Admission",?13,"Patient",?39,"SSN",?45,"Monitor?",?56,"Discharge"
- +8 WRITE !
- FOR Z=1:1:79
- WRITE "="
- +9 QUIT