source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORSNAST1.m@ 1765

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

initial load of FOIAVistA 6/30/08 version

File size: 4.9 KB
Line 
1ORSNAST1 ;SLC/RAF - continuation of nature/status search ;10/20/00 14:30
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**50,190**;Dec 17, 1997
3 ;
4EN ;
5 S RPDT="""Report Date: "",$$FMTE^XLFDT($$NOW^XLFDT),!,""Sort Range From: "",$$FMTE^XLFDT(SDATE),"" TO: "",$$FMTE^XLFDT(EDATE)",STOP=0,PAGE=0
6 I SORT=1 D NATURE^ORSNAST2 Q
7STATUS ;goes thru the "AF" xref in 100 for order dates for a specific status
82 I SORT=2 D I ('$D(^TMP("ORNS",$J)))&(FORMAT=1) W !,"No orders found." Q
9 .D:('PAGE)&(FORMAT=1) HDR^ORS100
10 .S DATE=SDATE F S DATE=$O(^OR(100,"AF",DATE)) Q:'DATE!STOP Q:DATE>EDATE D
11 ..S IEN=0 F S IEN=$O(^OR(100,"AF",DATE,IEN)) Q:'IEN!STOP I $D(^OR(100,IEN)) D
12 ...S SUB=0 F S SUB=$O(^OR(100,"AF",DATE,IEN,SUB)) Q:'SUB!STOP D
13 ....I $P($G(^OR(100,IEN,3)),U,3)=SEARCH D
14 .....I $D(^VA(200,+$P(^OR(100,IEN,8,SUB,0),U,3),0)) S PROV=$$USER^ORS100(+$P(^OR(100,IEN,8,SUB,0),U,3))
15 .....I $D(^VA(200,+$P(^OR(100,IEN,0),U,4),5)),$L($P(^(5),U)) S SER=$$SER^ORS100(+$P(^VA(200,+$P(^OR(100,IEN,0),U,4),5),U))
16 .....E S SER="MISSING from file 200"
17 .....I $D(^VA(200,+$P(^OR(100,IEN,8,SUB,0),U,13))) S WHO=$$USER^ORS100(+$P(^OR(100,IEN,8,SUB,0),U,13))
18 .....S DFN=+$P(^OR(100,IEN,0),U,2) Q:$P(^DPT(DFN,0),U,21) D DEM^VADPT S SSN=VA("BID"),PNM=VADM(1)
19 .....S STATUS=$S(+$P(^OR(100,IEN,8,SUB,0),U,15)'=SEARCH&(+$P(^(0),U,15)'=0):$$STAT^ORS100(+$P(^(0),U,15)),1:$$STAT^ORS100($P(^OR(100,IEN,3),U,3)))
20 .....I $D(^OR(100,IEN,8,SUB,0)),$P(^(0),U) S WHEN=$$FMTE^XLFDT($P(^(0),U)) I $P(^(0),U,6) S SIGNED=$$FMTE^XLFDT($P(^(0),U,6))
21 .....E S SIGNED=""
22 .....S ^TMP("ORNS",$J,WHO,PROV,IEN)=WHO_U_PROV_U_PNM_U_SSN_U_STATUS_U_IEN_U_WHEN_U_SIGNED
23 .....S ^TMP("ORSERV",$J,SER,WHO,IEN)=SER_U_WHO_U_PROV_U_PNM_U_SSN_U_STATUS_U_IEN_U_WHEN_U_SIGNED
24DETAILS .....;detailed output which includes the order text
25 .....I FORMAT=1 D
26 ......W !,"Order STATUS: ",STATUS,?34,"Order Action: ",$P(^OR(100,IEN,8,SUB,0),U,2),?52,"ORIFN(Order #): ",IEN D:$Y>(IOSL-4) HDR^ORS100 Q:STOP
27 ......W !,"OBJECT OF ORDER(Patient name): ",$G(PNM),?63,"SSN: ",$G(SSN) D:$Y>(IOSL-4) HDR^ORS100 Q:STOP
28 ......I $P(^ORD(100.98,$P(^OR(100,+IEN,0),U,11),0),U)="NON-VA MEDICATIONS" D
29 .......W !,"DOCUMENTED BY: ",$P($G(^VA(200,+$P(^OR(100,IEN,8,SUB,0),U,3),0)),U),?53,"VEILED ORDER?: ",$S($P(^OR(100,IEN,3),U,8)=1:"YES",1:"NO") D:$Y>(IOSL-4) HDR^ORS100 Q:STOP
30 ......E W !,"ORDERED BY: ",$P($G(^VA(200,+$P(^OR(100,IEN,8,SUB,0),U,3),0)),U),?53,"VEILED ORDER?: ",$S($P(^OR(100,IEN,3),U,8)=1:"YES",1:"NO") D:$Y>(IOSL-4) HDR^ORS100 Q:STOP
31 ......W !,"ENTERED BY: ",$P($G(^VA(200,+$P(^OR(100,IEN,8,SUB,0),U,13),0)),U)," ON ",$$FMTE^XLFDT($P(^OR(100,IEN,0),U,7)) D:$Y>(IOSL-4) HDR^ORS100 Q:STOP
32 ......W !,"RELEASED BY: " I +$P(^OR(100,IEN,8,SUB,0),U,16) W $P($G(^VA(200,+$P(^OR(100,IEN,8,SUB,0),U,17),0)),U)," ON ",$$FMTE^XLFDT($P(^OR(100,IEN,8,SUB,0),U,16)) D:$Y>(IOSL-4) HDR^ORS100 Q:STOP
33 ......W !,"SIGNED BY: " I +$P(^OR(100,IEN,8,SUB,0),U,6) W $P($G(^VA(200,+$P(^OR(100,IEN,8,SUB,0),U,5),0)),U)," ON ",$$FMTE^XLFDT($P(^OR(100,IEN,8,SUB,0),U,6)) D:$Y>(IOSL-4) HDR^ORS100 Q:STOP
34 ......W !,"ORDER TEXT: " S ORIGVIEW=2 D TEXT^ORQ12(.TEXT,IEN_";"_SUB,(IOM-13)) S TEXTSUB="" F S TEXTSUB=$O(TEXT(TEXTSUB)) Q:'+TEXTSUB!(TEXTSUB=4)!STOP W:TEXTSUB'=1 ?12 W TEXT(TEXTSUB),! D:$Y>(IOSL-4) HDR^ORS100 Q:STOP
35 ......I 'STOP I TEXTSUB=4 W !,"***There is more order text. It is limited to 3 lines for this report***"
36 ......K TEXT,TEXTSUB
37 ......I 'STOP K DASH S $P(DASH,"-",IOM)="" W !,DASH
38COLUMNS ;this section uses the TMP global for the columnar format
39 I '$G(SERVICE)&(FORMAT=2) D
40 .S HDR1="!,""Provider"",?25,""Patient"",?50,""SSN"",?56,""Status"",?75,""Order #"",?87,""Order Date"",?110,""Signed"""
41 .S HDR="!,""Search for orders with a status of ""_SNAME"
42 .D HDR^ORS100
43 .I '$D(^TMP("ORNS",$J)) W !,"No orders found." Q
44 .S WHO="" F S WHO=$O(^TMP("ORNS",$J,WHO)) Q:WHO=""!STOP W "Entered by: ",WHO,! D W !
45 ..S PNM="" F S PNM=$O(^TMP("ORNS",$J,WHO,PNM)) Q:PNM=""!STOP D
46 ...S IEN=0 F S IEN=$O(^TMP("ORNS",$J,WHO,PNM,IEN)) Q:'IEN!STOP D
47 ....W $P(^(IEN),U,2),?25,$P(^(IEN),U,3),?50,$P(^(IEN),U,4),?56,$P(^(IEN),U,5),?75,$P(^(IEN),U,6),?87,$P(^(IEN),U,7),?110,$P(^(IEN),U,8),! D:$Y>(IOSL-4) HDR^ORS100
48SERV I $G(SERVICE)&(FORMAT=2) D
49 .S HDR1="!,""Provider"",?25,""Patient"",?50,""SSN"",?56,""Status"",?75,""Order #"",?87,""Order Date"",?110,""Signed"""
50 .S HDR="!,""Search for orders with a status of ""_SNAME"
51 .D HDR^ORS100
52 .I '$D(^TMP("ORSERV",$J)) W !,"No orders found." Q
53 .S REF=$S($D(LONER):"LONER(SER)",1:"^TMP(""ORSERV"",$J,SER)")
54 .S SER="" F S SER=$O(@REF) Q:SER=""!STOP W "Service/Section: ",SER,! D
55 ..I '$D(^TMP("ORSERV",$J,SER)) W "No orders found.",!! Q
56 ..S WHO="" F S WHO=$O(^TMP("ORSERV",$J,SER,WHO)) Q:WHO=""!STOP W ?5,"Entered by: ",WHO,! D W !
57 ...S IEN=0 F S IEN=$O(^TMP("ORSERV",$J,SER,WHO,IEN)) Q:'IEN!STOP D
58 ....W $P(^(IEN),U,3),?25,$P(^(IEN),U,4),?50,$P(^(IEN),U,5),?56,$P(^(IEN),U,6),?75,$P(^(IEN),U,7),?87,$P(^(IEN),U,8),?110,$P(^(IEN),U,9),! D:$Y>(IOSL-4) HDR^ORS100
59 ;
60 K ^TMP("ORNS",$J),^TMP("ORSERV",$J)
61 D ^%ZISC
62 Q
Note: See TracBrowser for help on using the repository browser.