source: FOIAVistA/trunk/r/INPATIENT_MEDICATIONS-PSJ-PSIV-PSG--PSGW/PSJBCMA2.m@ 1397

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

initial load of FOIAVistA 6/30/08 version

File size: 1.9 KB
Line 
1PSJBCMA2 ;BIR/MV-RETURN INPATIENT ACTIVITY LOG ;16 Mar 99 / 11:43 AM
2 ;;5.0; INPATIENT MEDICATIONS ;**32,41,54,56,81**;16 DEC 97
3 ;
4 ;Reference to ^PS(55 is supported by DBIA 2191
5 ;
6EN(DFN,ON,PSJTMP) ;
7 NEW X,Y
8 S PSJINX=0
9 S PSJTMP=$S($G(PSJTMP)=1:"PSJ2",1:"PSJ")
10 I $G(ON)["U",$D(^PS(55,+$G(DFN),5,+ON)) D UD
11 I $G(ON)["V",$D(^PS(55,+$G(DFN),"IV",+ON)) D IV
12 I '$D(^TMP(PSJTMP,$J,0)) S ^(0)=-1
13 K PSJINX
14 Q
15UD ;Get Activity Log for Unit Dose order.
16 F PSJAL=0:0 S PSJAL=$O(^PS(55,DFN,5,+ON,9,PSJAL)) Q:'PSJAL D
17 . S X=$G(^PS(55,DFN,5,+ON,9,PSJAL,0))
18 . S PSJ("DATE")=$P(X,U)
19 . S (PSJ("USER"),PSJ("UIEN"))=$P(X,U,2),PSJ("FIELD")=$P(X,U,4)
20 . S PSJ("OLD DATA")=$P(X,U,5)
21 . S PSJ("ACTION")=$P($G(^PS(53.3,+$P(X,U,3),0)),U)
22 . D TMP K PSJ
23 K PSJAL
24 Q
25IV ;Get Activity Log for IV order.
26 F PSJAL=0:0 S PSJAL=$O(^PS(55,DFN,"IV",+ON,"A",PSJAL)) Q:'PSJAL D
27 . K PSJ,PSJDD
28 . S X=$G(^PS(55,DFN,"IV",+ON,"A",PSJAL,0))
29 . S PSJ("DATE")=$P(X,U,5)
30 . S PSJ("ACTION")=$P(X,U,2) Q:PSJ("ACTION")="F"
31 . S PSJ("USER")=$P(X,U,3)
32 . S PSJ("REASON")=$P(X,U,4)
33 . S PSJ("ACTION")=$$CODES^PSIVUTL(PSJ("ACTION"),55.04,.02)
34 . S PSJ("UIEN")=$P(X,U,6)
35 . I $O(^PS(55,DFN,"IV",+ON,"A",PSJAL,1,0))="" D TMP
36 . F PSJFC=0:0 S PSJFC=$O(^PS(55,DFN,"IV",+ON,"A",PSJAL,1,PSJFC)) Q:'PSJFC D
37 .. S X=$G(^PS(55,DFN,"IV",+ON,"A",PSJAL,1,PSJFC,0))
38 .. K PSJ("FIELD"),PSJ("OLD DATA")
39 .. S PSJ("FIELD")=$P(X,U)
40 .. S PSJ("OLD DATA")=$P(X,U,2)
41 .. D TMP
42 K PSJ,PSJAL,PSJFC
43 Q
44TMP ;Setup ^TMP
45 S PSJINX=PSJINX+1
46 I +PSJ("USER") D NAME^PSJBCMA1(+PSJ("USER"),.X,"") S PSJ("USER")=X
47 S ^TMP(PSJTMP,$J,0)=DFN_U_+ON_U_ON_U_PSJINX
48 S ^TMP(PSJTMP,$J,PSJINX,1)=PSJ("DATE")_U_PSJ("USER")_U_$G(PSJ("FIELD"))_U_PSJ("ACTION")_U_$G(PSJ("UIEN"))
49 S:$G(PSJ("OLD DATA"))]"" ^TMP(PSJTMP,$J,PSJINX,2)=PSJ("OLD DATA")
50 S:$G(PSJ("REASON"))]"" ^TMP(PSJTMP,$J,PSJINX,3)=PSJ("REASON")
51 Q
52GETFLD ;
53 N X D FIELD^DID(55.04,.02,"","POINTER","PSJDD") Q
Note: See TracBrowser for help on using the repository browser.