source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORQOR1.m@ 794

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

initial load of FOIAVistA 6/30/08 version

File size: 2.6 KB
Line 
1ORQOR1 ; slc/CLA - Functions which return order information ;12/15/97 [ 04/02/97 3:01 PM ]
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**78,127,242**;Dec 17, 1997;Build 6
3LIST(ORY,PATIENT,GROUP,FLAG,ORSDT,OREDT,ORXREF,GETKID) ;return list of patient orders
4 ; return PATIENT's orders for a display GROUP of type FLAG
5 ; between start (ORSDT) and end dates (OREDT)
6 ; dates can be in Fileman or T, T-14 formats
7 N GIEN S GIEN=""
8 I $L($G(ORSDT)) D DT^DILF("T",ORSDT,.ORSDT,"","")
9 I $L($G(OREDT)) D DT^DILF("T",OREDT,.OREDT,"","")
10 I (ORSDT=-1)!(OREDT=-1) S ORY(1)="^Error in date range." Q
11 S PATIENT=PATIENT_";DPT("
12 S:$L($G(GROUP)) GIEN=$O(^ORD(100.98,"B",GROUP,GIEN))
13 K ^TMP("ORR",$J)
14 D EN^ORQ1(PATIENT,GIEN,FLAG,"",ORSDT,OREDT,1,0,$G(ORXREF),$G(GETKID))
15 N J,HOR,SEQ,X S J=1,HOR=0,SEQ=0
16 S HOR=$O(^TMP("ORR",$J,HOR)) Q:+HOR<1
17 F S SEQ=$O(^TMP("ORR",$J,HOR,SEQ)) Q:+SEQ<1 D
18 .S X=^TMP("ORR",$J,HOR,SEQ)
19 .S ORY(J)=$P(X,U)_U_$E(^TMP("ORR",$J,HOR,SEQ,"TX",1),1,60)_U_$P(X,U,4)_U_$P(X,U,6),J=J+1
20 K ^TMP("ORR",$J)
21 S:+$G(ORY(1))<1 ORY(1)="^No orders found."
22 Q
23STATI(ORY) ; return stati from ORDER STATUS file [#100.01]
24 N STATUS,IEN,I S STATUS="",IEN=0,I=1
25 F S STATUS=$O(^ORD(100.01,"B",STATUS)) Q:STATUS="" D
26 .S IEN=$O(^ORD(100.01,"B",STATUS,IEN))
27 .Q:$$SCREEN^XTID(100.01,,IEN_",") ;inactive VUID
28 .S ORY(I)=IEN_"^"_STATUS,IEN=0,I=I+1
29 Q
30DG(DGNAME) ; extrinsic function returns display group ien
31 Q:'$L($G(DGNAME)) ""
32 N DGIEN S DGIEN=0
33 S DGIEN=$O(^ORD(100.98,"B",DGNAME,DGIEN))
34 Q +$G(DGIEN)
35OI(OINAME) ; extrinsic function returns orderable item ien
36 Q:'$L($G(OINAME)) ""
37 N OI S OI=""
38 S OI=$O(^ORD(101.43,"B",OINAME,OI))
39 Q +$G(OI)
40TEXTSTAT(ORNUM) ;extrinsic function returns the first 200 chars of order text
41 ;and order status in format: <order text>^<order status>
42 ;ORNUM - order number (main order number - $P(ORNUM,";",1))
43 S ORNUM=+ORNUM
44 Q:'$L($G(ORNUM)) ""
45 Q:'$L($G(^OR(100,ORNUM,0))) ""
46 N ORSTATUS,ORY
47 D TEXT^ORQ12(.ORY,ORNUM,200)
48 Q:+$G(ORY)<1 "Order text not found.^"
49 S ORSTATUS=$P(^OR(100,ORNUM,3),U,3)
50 S ORSTATUS=$G(^ORD(100.01,+ORSTATUS,0))
51 S ORSTATUS=$P(ORSTATUS,U)
52 Q ORY(1)_U_ORSTATUS
53FULLTEXT(ORNUM) ;extrinsic function returns the full text of an order
54 ;and order status in format: <order text>^<order status>
55 ;ORNUM - order number (main order number - $P(ORNUM,";",1))
56 N ORX,ORTXT
57 S ORTXT=""
58 S ORNUM=+ORNUM
59 Q:'$L($G(ORNUM)) ""
60 Q:'$L($G(^OR(100,ORNUM,0))) ""
61 N ORSTATUS,ORY
62 D TEXT^ORQ12(.ORY,ORNUM,"")
63 Q:+$G(ORY)<1 "Order text not found.^"
64 S:ORY>2 ORY=2 ;only display first two lines of text
65 F ORX=1:1:ORY S ORTXT=ORTXT_ORY(ORX)_" "
66 S ORSTATUS=$P(^OR(100,ORNUM,3),U,3)
67 S ORSTATUS=$G(^ORD(100.01,+ORSTATUS,0))
68 S ORSTATUS=$P(ORSTATUS,U)
69 Q ORTXT_U_ORSTATUS
Note: See TracBrowser for help on using the repository browser.