VistA-FOIAVistA/r/NURSING_SERVICE-NUR/NURCES5.m

37 lines
2.3 KiB
Mathematica

NURCES5 ;HIRMFO/YH-END OF SHIFT -VITAL/MEASUREMENT DATA ;12/5/96
;;4.0;NURSING SERVICE;**24**;Apr 25, 1997
VITAL ;
N NUR,NURVIT,NURIEF,NURDT,NDTFLG,NURDT,NURTYP,NURQUAL,NURDATA,NURWT,NURHT,NURBMI
S GMRVSTR="T;P;R;BP;WT;HT;PN;",GMRVSTR(0)="^^1^1" D EN1^GMRVUT0
I $D(^UTILITY($J,"GMRVD")) S %X="^UTILITY($J,""GMRVD"",",%Y="NURVIT(" D %XY^%RCR K ^UTILITY($J,"GMRVD")
S GMRVSTR="T;P;R;BP;PN;",GMRVSTR(0)=NURNOW(1)_"^"_NURNOW D EN1^GMRVUT0
F NUR="T","P","R","BP" S NURDT=0 F S NURDT=$O(^UTILITY($J,"GMRVD",NUR,NURDT)) Q:NURDT'>0 S NURDA=0 F S NURDA=$O(^UTILITY($J,"GMRVD",NUR,NURDT,NURDA)) Q:NURDA'>0 D
. I $P(^UTILITY($J,"GMRVD",NUR,NURDT,NURDA),"^",12)="*",'$D(NURVIT(NURDT,NUR,NURDA)) S NURVIT(NURDT,NUR,NURDA)=^UTILITY($J,"GMRVD",NUR,NURDT,NURDA)
K NVM S NVM=0 S NURDT=0,NDTFLG=0 F S NURDT=$O(NURVIT(NURDT)) Q:NURDT'>0 D
. I NURDT'=NDTFLG S NDTFLG=NURDT,NVM=NVM+1,NVM(NVM)=$$FMTE^XLFDT(9999999-NURDT,"2P"),NDTFLG=NURDT
. S NURTYP="" F S NURTYP=$O(NURVIT(NURDT,NURTYP)) Q:NURTYP="" D
. . S NURIEF=0 F S NURIEF=$O(NURVIT(NURDT,NURTYP,NURIEF)) Q:NURIEF'>0 D
. . . S NURDATA=NURVIT(NURDT,NURTYP,NURIEF)
. . . S NURQUAL=$P(NURDATA,"^",10)_$S($P(NURDATA,"^",10)'="":" ",1:"")_$P(NURDATA,"^",11)
. . . S:NURQUAL'="" NURQUAL="-"_NURQUAL
. . . S NURDATA(1)=$P(NURDATA,"^",8)_$P(NURDATA,"^",12)_$S(NURTYP="WT":" lb",NURTYP="HT":" in",1:"")_NURQUAL
. . . I '$D(NURTYP(NURDT,NURTYP)) S NVM=NVM+1,NVM(NVM)=$E(" "_NURTYP_":"_NURDATA(1),1,21),NURTYP(NURDT,NURTYP)=""
. . .E S NVM=NVM+1,NVM(NVM)=" "_$E(NURDATA(1),1,20)
. . . I NURTYP="WT" S NURWT=$S($P(NURDATA,"^",13)>0:+$P(NURDATA,"^",13),1:0)
. . . I NURTYP="HT" S NURHT=$S($P(NURDATA,"^",13)>0:$P(NURDATA,"^",13)/100,1:0)
. . . Q
. . Q
. Q
I $G(NURWT)>0,$G(NURHT)>0 S NURBMI=$J(NURWT/(NURHT*NURHT),0,0),NURBMI=NURBMI_$S(NURBMI>27:"*",1:""),NVM=NVM+1,NVM(NVM)="BMI: "_NURBMI
Q
SORT(NORDER) ;SORT BY ROOM-BED/ALPHABETICAL/BED
SORT1 W !,?5,"1. by room-bed",!,?5,"2. by alphabetical",!,?5,"3. by bed",!!,?5,"Enter a number: 1// " R NORDER:DTIME I '$T!(NORDER["^") S NURQUIT=1 Q NORDER
I NORDER="" S NORDER="SORT1" Q NORDER
I NORDER=1!(NORDER=2)!(NORDER=3) S NORDER="SORT"_NORDER Q NORDER
G SORT1
FITLINE(NLINE,NLEN,NGLOB) ;
N X,NL S X=NLINE,DIWR=NLEN,DIWF="",DIWL=0 K ^UTILITY($J) D ^DIWP
S NL=0 F S NL=$O(^UTILITY($J,"W",0,NL)) Q:NL'>0 S NGLOB=NGLOB+1,NGLOB(NGLOB)=$S(NL>1:" ",1:"")_^UTILITY($J,"W",0,NL,0)
K ^UTILITY($J)
Q