source: WorldVistAEHR/trunk/r/INPATIENT_MEDICATIONS-PSJ-PSIV-PSG--PSGW/PSGAL5.m@ 901

Last change on this file since 901 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 4.2 KB
Line 
1PSGAL5 ;BIR/CML3-ACTIVITY LOGGER ;22 Jan 99 / 8:00 AM
2 ;;5.0; INPATIENT MEDICATIONS ;**3,22,50**;16 DEC 97
3 ;
4 ;Reference to ^PS(55 is supported by DBIA 2191
5 ;Reference to ^DD is supported by DBIA 903
6 ;
7EN ;
8 N PSJ9,PSJ99 F Q=1:1 Q:'$D(DA(Q+1))
9 S PSGAL("D0")=DA(Q),PSGAL("D1")=$S(Q=1:DA,1:DA(Q-1))
10 I PSGAL("C")'=6000,$D(PSGALO),PSGALO S PSGAL("C")=PSGALO
11 I PSGAL("C")=6000,$D(PSGALR),PSGALR]"" S PSGAL("C")=PSGAL("C")+PSGALR
12 I $E(PSGAL("C"),1,2)=60 S OLD=X,FLD=$S($D(PSGALFF):PSGALFF,1:0),FN=$S($D(PSGALFN):PSGALFN,1:55.06) D FIELD^DID(FN,FLD,,"SPECIFIER","PSJ9") I OLD]"",$G(PSJ9("SPECIFIER"))["P" S XX=FN,YY=FLD D PNTR
13 I $E(PSGAL("C"),1,2)=60,OLD]"" D FIELD^DID(FN,FLD,,"SPECIFIER","PSJ9") I $G(PSJ9("SPECIFIER"))["S" S OLDS=$P($P(";"_$P(^DD(FN,FLD,0),"^",3),";"_OLD_":",2),";") I OLDS]"" S OLD=OLDS
14 ;L +^PS(55,PSGAL("D0"),5,PSGAL("D1"),9,0) S QQ=$G(^PS(55,PSGAL("D0"),5,PSGAL("D1"),9,0)) S:QQ="" QQ="^55.09D" F Q=$P(QQ,"^",3)+1:1 I '$D(^(Q)) S $P(QQ,"^",3,4)=Q_"^"_Q,^(0)=QQ,PSGAL("N")=Q Q
15 S QQ=$G(^PS(55,PSGAL("D0"),5,PSGAL("D1"),9,0)) S:QQ="" QQ="^55.09D" F Q=$P(QQ,"^",3)+1:1 I '$D(^(Q)) S $P(QQ,"^",3,4)=Q_"^"_Q,^(0)=QQ,PSGAL("N")=Q Q
16 ;L -^PS(55,PSGAL("D0"),5,PSGAL("D1"),9,0) D NOW^%DTC S PSGDT=+$E(%,1,12)
17 D NOW^%DTC S PSGDT=+$E(%,1,12)
18 S Q=%_"^"_$S(PSGAL("C")=6010:"AUTO CANCEL",$D(DUZ)[0:"UNKNOWN",DUZ]"":DUZ,1:"UNKNOWN")_"^"_PSGAL("C")_$S($E(PSGAL("C"),1,2)=60:"^"_$S('$D(^DD(FN,FLD,0)):FLD,$P(^(0),"^")]"":$P(^(0),"^"),1:FLD)_"^"_OLD,1:"")
19 S ^PS(55,PSGAL("D0"),5,PSGAL("D1"),9,PSGAL("N"),0)=Q I PSGAL("C")=6000,$D(PSGALEF) S PSGALEF=PSGALEF+1
20 ;
21DONE ;
22 S PSGAL("D")=% K OLDS,FLD,FN,OLD,PSGALFF,PSGALFN,SS,XX,YY Q
23 ;
24PNTR ; find pointer value
25 F D FIELD^DID(XX,YY,,"POINTER","PSJ99") S SS=PSJ99("POINTER"),XX=+$P(@("^"_SS_"0)"),"^",2),OLD=$P(@("^"_SS_OLD_",0)"),"^") D FIELD^DID(XX,.01,,"SPECIFIER","PSJ99") Q:$G(PSJ99("SPECIFIER"))'["P" S YY=.01
26 Q
27 ;
28KILL ; if user merely reenters same data (tsk, tsk), kill record just written
29 K ^PS(55,PSGAL("D0"),5,PSGAL("D1"),9,PSGAL("N"),0) I PSGAL("C")=6000,$D(PSGALEF),PSGALEF S PSGALEF=PSGALEF-1
30 Q
31 ;
32 ; Create new activity log entry in file #55.
33NEWUDAL(PSGALGP,PSGALORD,PSGALC,PSGFLD,PSGOLD) ;
34 ;
35 ;Where PSGALGP = PSGP (Required)
36 ; PSGALORD = PSGORD (Required)
37 ; PSGALC = ACTIVITY CODE FROM #53.3 (Required)
38 ; PSGFLD = FIELD THAT CHANGED (Free text, optional)
39 ; PSGOLD = THE FIELDS OLD DATA VALUE (Free text, optional)
40 ;
41 ;N PSGALGP,PSGALORD,PSGALC,PSGFLD,PSGOLD
42 ;
43 ; Create 0 node activity log for order if not exists, and get next entry number
44 S QQ=$G(^PS(55,PSGALGP,5,+PSGALORD,9,0)) S:QQ="" QQ="^55.09D" F Q=$P(QQ,"^",3)+1:1 I '$D(^(Q)) S $P(QQ,"^",3,4)=Q_"^"_Q,^(0)=QQ,PSGAL("N")=Q Q
45 ;Set up data to be held in activity log record
46 D NOW^%DTC S PSGDT=+$E(%,1,12)
47 I $L($G(PSGOLD))>170 S PSGOLD=$E(PSGOLD,1,167)_"..." ; Use of ... indicates old data field was greater than 170 characters
48 S Q=%_"^"_$S(PSGALC=6010:"AUTO CANCEL",$D(DUZ)[0:"UNKNOWN",DUZ]"":DUZ,1:"UNKNOWN")_"^"_PSGALC_"^"_$S($D(PSGFLD):PSGFLD,1:"")_"^"_$S($D(PSGOLD):PSGOLD,1:"")
49 ; Create activity log entry
50 S ^PS(55,PSGALGP,5,+PSGALORD,9,PSGAL("N"),0)=Q
51 Q
52 ; Create new activity log entry
53NEWNVAL(PSGALORD,PSGALC,PSGFLD,PSGOLD) ;
54 ;
55 ;Where PSGALORD = PSGORD (Required)
56 ; PSGALC = ACTIVITY CODE FROM #53.3 (Required)
57 ; PSGFLD = FIELD THAT CHANGED (Free text, optional)
58 ; PSGOLD = THE FIELDS OLD DATA VALUE (Free text, optional)
59 ;
60 ;N PSGALORD,PSGALC,PSGFLD,PSGOLD
61 ;
62 ; Create 0 node activity log for order if not exists, and get next entry number
63 S QQ=$G(^PS(53.1,+PSGALORD,"A",0)) S:QQ="" QQ="^53.1119D" F Q=$P(QQ,"^",3)+1:1 I '$D(^(Q)) S $P(QQ,"^",3,4)=Q_"^"_Q,^(0)=QQ,PSGAL("N")=Q Q
64 ;Set up data to be held in activity log record
65 D NOW^%DTC S PSGDT=+$E(%,1,12)
66 I $L($G(PSGOLD))>170 S PSGOLD=$E(PSGOLD,1,167)_"..." ; Use of ... indicates old data field was greater than 170 characters
67 S Q=%_"^"_$S(PSGALC=6010:"AUTO CANCEL",$D(DUZ)[0:"UNKNOWN",DUZ]"":DUZ,1:"UNKNOWN")_"^"_PSGALC_"^"_$S($D(PSGFLD):PSGFLD,1:"")_"^"_$S($D(PSGOLD):PSGOLD,1:"")
68 ; Create activity log entry
69 S ^PS(53.1,+PSGALORD,"A",PSGAL("N"),0)=Q
70 Q
71 ;
72KILLNV ; if user merely reenters same data (tsk, tsk), kill record just written
73 K ^PS(53.1,PSGAL("D0"),"A",PSGAL("N"),0) I PSGAL("C")=6000,$D(PSGALEF),PSGALEF S PSGALEF=PSGALEF-1
74 Q
Note: See TracBrowser for help on using the repository browser.