source: WorldVistAEHR/trunk/r/HEALTH_SUMMARY-GMTS/GMTSPSZO.m@ 1046

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

revised back to 6/30/08 version

File size: 2.0 KB
Line 
1GMTSPSZO ;SLC/JER - OP Rx 5.6 Summary Component ;12/2/91 13:45 ;
2 ;;2.7;Health Summary;;Oct 20, 1995
3GMTSPSO ;SLC/JER - OP Rx Summary Component ;12/2/91 13:45 ;
4 ;;2.7;Health Summary;;Oct 20, 1995
5MAIN N ECD,GMR,GMW,IX,PSOBEGIN
6 S PSOBEGIN=$S(GMTS2'=9999999:(9999999-GMTS2),1:"")
7 I PSOBEGIN="" S PSOACT=1
8 K ^UTILITY("PSOO",$J) I '$D(^PS(55,DFN,"P")),'$D(^("ARC")) Q
9 I '$O(^PS(55,DFN,"P",0)),$D(^PS(55,DFN,"ARC")) D CKP^GMTSUP Q:$D(GMTSQIT) W "Patient Has Archived OP Prescriptions",!
10 D ^PSOHCSUM I '$D(^UTILITY("PSOO",$J)) Q
11 I $D(^DPT(DFN,.1)),^(.1)]"",$D(^DIC(59,+$O(^DIC(59,0)),1)),$P(^(1),"^",8) D CKP^GMTSUP Q:$D(GMTSQIT) W "Outpatient prescriptions are cancelled 72 hours after admission",!
12 S GMTSLO=GMTSLO+3
13 D HEAD
14 S IX=0 F S IX=$O(^UTILITY("PSOO",$J,IX)) Q:IX'>0 S GMR=$G(^(IX,0)) D WRT
15 S GMTSLO=GMTSLO-3
16 K ^UTILITY("PSOO",$J)
17 Q
18HEAD ; Prints Header
19 D CKP^GMTSUP Q:$D(GMTSQIT) W ?67,"Last",!
20 D CKP^GMTSUP Q:$D(GMTSQIT)
21 W "Drug",?27,"Rx #",?38,"St (Exp/Can)",?51,"Qty",?58,"Issued",?67,"Filled",?76,"Rem",! W:$Y'>(IOSL-GMTSLO) !
22 Q
23WRT ; Writes OP Pharmacy Segment Record
24 N ID,LFD,X,MI,NL,CF,GMD,GMV,GMI
25 S ID=$P(GMR,U),LFD=$P(GMR,U,2),ECD=$P(GMR,U,11),CF=$P(GMR,U,10)
26 F GMV="ID","LFD","ECD" S X=@GMV D REGDT^GMTSU S @GMV=X K X
27 S MI=$G(^UTILITY("PSOO",$J,IX,1)),NL=0 I $L(MI)>73 D PARSE
28 S GMD=$P($P(GMR,U,4),";",2)
29 D CKP^GMTSUP Q:$D(GMTSQIT) D:GMTSNPG HEAD W $E($P($P(GMR,U,3),";",2),1,25),?27,$P(GMR,U,6),?38,$P($P(GMR,U,5),";"),?40,$S("EC"[$P($P(GMR,U,5),";"):"("_ECD_")",1:""),?51,$P(GMR,U,7),?57,ID,?67,LFD,?76,"("_$P(GMR,U,8)_")",!
30 I 'NL D CKP^GMTSUP Q:$D(GMTSQIT) D:GMTSNPG HEAD W ?2,MI,!
31 F GMI=1:1:NL D CKP^GMTSUP Q:$D(GMTSQIT) D:GMTSNPG HEAD W ?2,MI(GMI),!
32 D CKP^GMTSUP Q:$D(GMTSQIT) D:GMTSNPG HEAD W ?4,"Provider: ",$E(GMD,1,26) W:CF ?41,"Cost/Fill: $",$J(CF,6,2) W !
33 Q
34PARSE ; Parses Medication Instructions
35 N GMI,NW,WPL
36 S NL=$S(($L(MI)/73)>($L(MI)\73):($L(MI)\73)+1,1:$L(MI)\73)
37 S NW=$L(MI," "),WPL=$S((NW/NL)>(NW\NL):(NW\NL)+1,1:NW\NL)
38 F GMI=1:1:NL S MI(GMI)=$P(MI," ",(GMI-1)*WPL+1,GMI*WPL)
39 Q
Note: See TracBrowser for help on using the repository browser.