source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORQQVI1.m@ 1607

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

initial load of FOIAVistA 6/30/08 version

File size: 6.6 KB
Line 
1ORQQVI1 ;SLC/STAFF- Vitals rpc grid ;2/4/99 21:11
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**10**;Dec 17, 1997
3 ;
4TEST ; test use only
5 N CNT,I K ^TMP("ORQQVX",$J)
6 S ^TMP("ORQQVX",$J,"INPUT",1)="16^2970902^2920202^3"
7 S CNT=1
8 F I="WEIGHT","RESPIRATION","PULSE","HEIGHT" S CNT=CNT+1,^TMP("ORQQVX",$J,"INPUT",CNT)=I
9 D GRIDDATA
10 S I=0 F S I=$O(^TMP("ORQQVX",$J,"OUTPUT",I)) Q:I<1 W !,^(I)
11 K ^TMP("ORQQVX",$J)
12 Q
13 ;
14DETAIL(ROOT,DFN,DATE1,DATE2,RTIMES,TESTS) ; from Remote Procedure file
15 N CNT,NUM,TEMPDATE
16 I DATE1<DATE2 S TEMPDATE=DATE1,DATE1=DATE2,DATE2=TEMPDATE
17 K ^TMP("ORQQVX",$J,"INPUT"),^("OUTPUT")
18 S ROOT=$NA(^TMP("ORQQVX",$J,"OUTPUT"))
19 S ^TMP("ORQQVX",$J,"INPUT",1)=DFN_U_DATE1_U_DATE2_U_RTIMES
20 S CNT=1,NUM=0 F S NUM=$O(TESTS(NUM)) Q:NUM<1 D
21 .S CNT=CNT+1
22 .S ^TMP("ORQQVX",$J,"INPUT",CNT)=TESTS(NUM)
23 D MEMODATA
24 Q
25 ;
26MEMODATA ;
27 ; input format
28 ; ^TMP("ORQQVX",$J,"INPUT",1)=dfn^start date^end date^restrict # time values
29 ; ^TMP("ORQQVX",$J,"INPUT",#)=test# (tests displayed in this order)
30 ;
31 S ^TMP("ORQQVX",$J,"OUTPUT",1)=""
32 N CHECKOK,DATANUM,DATESEQ,DATETIME,DFN,EDATE,EDT,ENTERBY,IDT,LINE,LINE1,LOC,MAIN,NUM,OUTCNT,RCNT,RQUIT,RESULT,RTIMES,SDATE,TESTNAME,TESTNUM,TESTSEQ,VCNT,ZERO
33 K ^TMP("ORQQV",$J)
34 S DFN=+^TMP("ORQQVX",$J,"INPUT",1),SDATE=+$P(^(1),U,2),EDATE=+$P(^(1),U,3),RTIMES=+$P(^(1),U,4)
35 Q:'DFN I 'SDATE,'EDATE,'RTIMES Q
36 I RTIMES,'SDATE,'EDATE S SDATE=DT,EDATE=2750101
37 I SDATE,'EDATE Q
38 I EDATE,'SDATE Q
39 S OUTCNT=1,TESTSEQ=0
40 S NUM=1 F S NUM=$O(^TMP("ORQQVX",$J,"INPUT",NUM)) Q:NUM<1 S TESTNAME=^(NUM) D
41 .S TESTNAME=$$UP^XLFSTR(TESTNAME)
42 .S TESTNUM=$$FIND1^DIC(120.51,"","BX",TESTNAME,"","","ERR")
43 .I 'TESTNUM Q
44 .S TESTSEQ=TESTSEQ+1
45 .S LINE=TESTSEQ_U_TESTNUM_U_$$MIXED^ORU(TESTNAME)
46 .S ^TMP("ORQQV",$J,"TEST",TESTSEQ)=LINE
47 .S OUTCNT=OUTCNT+1
48 S EDATE=EDATE\1
49 S EDT=9999999-EDATE
50 S TESTSEQ=0 F S TESTSEQ=$O(^TMP("ORQQV",$J,"TEST",TESTSEQ)) Q:TESTSEQ<1 S TESTNUM=$P(^(TESTSEQ),U,2) D
51 .S IDT=9999999-SDATE,(RCNT,RQUIT)=0
52 .F S IDT=$O(^GMR(120.5,"AA",DFN,TESTNUM,IDT)) Q:IDT<1 Q:IDT>EDT D Q:RQUIT
53 ..S DATANUM=0 F S DATANUM=$O(^GMR(120.5,"AA",DFN,TESTNUM,IDT,DATANUM)) Q:DATANUM<1 D Q:RQUIT
54 ...Q:$P($G(^GMR(120.5,DATANUM,2)),U) S ZERO=$G(^(0))
55 ...Q:$P(ZERO,U,2)'=DFN Q:$P(ZERO,U,3)'=TESTNUM
56 ...S RESULT=$$STRIP^ORCMEDIT($P(ZERO,U,8)),DATETIME=$P(ZERO,U),LOC=+$P(ZERO,U,5),ENTERBY=+$P(ZERO,U,6)
57 ...S ^TMP("ORQQV",$J,"RESULTS",IDT)=DATETIME_U_LOC_U_ENTERBY ;$$FMTE^XLFDT(DATETIME)_" Location: "_$P($G(^SC(+$P(ZERO,U,5),0)),U)_" Entered by: "_$P($G(^VA(200,+$P(ZERO,U,6),0)),U)
58 ...S LINE=" "_$P(^TMP("ORQQV",$J,"TEST",TESTSEQ),U,3)
59 ...S LINE=$$SETSTR^VALM1(RESULT,LINE,22,1+$L(RESULT))_U_LOC_U_ENTERBY
60 ...S ^TMP("ORQQV",$J,"RESULTS",IDT,TESTSEQ)=LINE
61 ...I RTIMES S RCNT=RCNT+1 I RCNT=RTIMES S RQUIT=1
62 S (DATESEQ,RCNT,RQUIT,VCNT)=0
63 S IDT=0 F S IDT=$O(^TMP("ORQQV",$J,"RESULTS",IDT)) Q:IDT<1 S LINE=^(IDT) D Q:RQUIT
64 .S CHECKOK=1 D
65 ..S MAIN=$P(LINE,U,2,3)
66 ..S TESTSEQ=0 F S TESTSEQ=$O(^TMP("ORQQV",$J,"RESULTS",IDT,TESTSEQ)) Q:TESTSEQ<1 S RESULT=$P(^(TESTSEQ),U,2,3) I RESULT'=MAIN S CHECKOK=0 Q
67 .I CHECKOK D
68 ..S DATETIME=$$FMTE^XLFDT($P(LINE,U)),DATETIME=$P(DATETIME,":",1,2)
69 ..S DATETIME=DATETIME_" Location: "_$P($G(^SC($P(LINE,U,2),0)),U)
70 ..S DATETIME=$$SETSTR^VALM1(" Entered by: "_$P($G(^VA(200,$P(LINE,U,3),0)),U),DATETIME,50,30)
71 .E S DATETIME=$$FMTE^XLFDT($P(LINE,U)),DATETIME=$P(DATETIME,":",1,2)
72 .S DATESEQ=DATESEQ+1
73 .S OUTCNT=OUTCNT+1
74 .S ^TMP("ORQQVX",$J,"OUTPUT",OUTCNT)=DATETIME
75 .S TESTSEQ=0 F S TESTSEQ=$O(^TMP("ORQQV",$J,"RESULTS",IDT,TESTSEQ)) Q:TESTSEQ<1 S LINE1=^(TESTSEQ) D
76 ..I CHECKOK S RESULT=$P(LINE1,U)
77 ..E D
78 ...S RESULT=$$SETSTR^VALM1(" Location: "_$P($G(^SC($P(LINE1,U,2),0)),U),$P(LINE1,U),30,25)
79 ...S RESULT=$$SETSTR^VALM1(" Entered by; "_$P($G(^VA(200,$P(LINE1,U,3),0)),U),RESULT,50,30)
80 ..S OUTCNT=OUTCNT+1
81 ..S ^TMP("ORQQVX",$J,"OUTPUT",OUTCNT)=RESULT
82 .I RTIMES S RCNT=RCNT+1 I RCNT=RTIMES S RQUIT=1
83 K ^TMP("ORQQV",$J)
84 Q
85 ;
86GRID(ROOT,DFN,DATE1,DATE2,RTIMES,TESTS) ; from Remote Procedure file
87 N CNT,NUM,TEMPDATE
88 I DATE1<DATE2 S TEMPDATE=DATE1,DATE1=DATE2,DATE2=TEMPDATE
89 K ^TMP("ORQQVX",$J,"INPUT"),^("OUTPUT")
90 S ROOT=$NA(^TMP("ORQQVX",$J,"OUTPUT"))
91 S ^TMP("ORQQVX",$J,"INPUT",1)=DFN_U_DATE1_U_DATE2_U_RTIMES
92 S CNT=1,NUM=0 F S NUM=$O(TESTS(NUM)) Q:NUM<1 D
93 .S CNT=CNT+1
94 .S ^TMP("ORQQVX",$J,"INPUT",CNT)=TESTS(NUM)
95 D GRIDDATA
96 Q
97 ;
98GRIDDATA ;
99 ; input format
100 ; ^TMP("ORQQVX",$J,"INPUT",1)=dfn^start date^end date^restrict # time values
101 ; ^TMP("ORQQVX",$J,"INPUT",#)=test# (tests displayed in this order)
102 ;
103 S ^TMP("ORQQVX",$J,"OUTPUT",1)="0^0^0"
104 N DATANUM,DATESEQ,DATETIME,DFN,EDATE,EDT,IDT,LINE,NUM,OUTCNT,RCNT,RQUIT,RESULT,RTIMES,SDATE,TESTNAME,TESTNUM,TESTSEQ,VALUES,VCNT,ZERO
105 K ^TMP("ORQQV",$J)
106 S DFN=+^TMP("ORQQVX",$J,"INPUT",1),SDATE=+$P(^(1),U,2),EDATE=+$P(^(1),U,3),RTIMES=+$P(^(1),U,4)
107 Q:'DFN I 'SDATE,'EDATE,'RTIMES Q
108 I RTIMES,'SDATE,'EDATE S SDATE=DT,EDATE=2750101
109 I SDATE,'EDATE Q
110 I EDATE,'SDATE Q
111 S OUTCNT=1,TESTSEQ=0
112 S NUM=1 F S NUM=$O(^TMP("ORQQVX",$J,"INPUT",NUM)) Q:NUM<1 S TESTNAME=^(NUM) D
113 .S TESTNAME=$$UP^XLFSTR(TESTNAME)
114 .S TESTNUM=$$FIND1^DIC(120.51,"","BX",TESTNAME,"","","ERR")
115 .I 'TESTNUM Q
116 .S TESTSEQ=TESTSEQ+1
117 .S LINE=TESTSEQ_U_TESTNUM_U_TESTNAME
118 .S ^TMP("ORQQV",$J,"TEST",TESTSEQ)=LINE
119 .S OUTCNT=OUTCNT+1
120 .S ^TMP("ORQQVX",$J,"OUTPUT",OUTCNT)=LINE
121 S ^TMP("ORQQVX",$J,"OUTPUT",1)=TESTSEQ
122 S EDATE=EDATE\1
123 S EDT=9999999-EDATE
124 S TESTSEQ=0 F S TESTSEQ=$O(^TMP("ORQQV",$J,"TEST",TESTSEQ)) Q:TESTSEQ<1 S TESTNUM=$P(^(TESTSEQ),U,2) D
125 .S IDT=9999999-SDATE,(RCNT,RQUIT)=0
126 .F S IDT=$O(^GMR(120.5,"AA",DFN,TESTNUM,IDT)) Q:IDT<1 Q:IDT>EDT D Q:RQUIT
127 ..S DATANUM=0 F S DATANUM=$O(^GMR(120.5,"AA",DFN,TESTNUM,IDT,DATANUM)) Q:DATANUM<1 D Q:RQUIT
128 ...Q:$P($G(^GMR(120.5,DATANUM,2)),U) S ZERO=$G(^(0))
129 ...Q:$P(ZERO,U,2)'=DFN Q:$P(ZERO,U,3)'=TESTNUM
130 ...S RESULT=$$STRIP^ORCMEDIT($P(ZERO,U,8)),DATETIME=$P(ZERO,U)
131 ...S ^TMP("ORQQV",$J,"RESULTS",IDT)=DATETIME
132 ...S ^TMP("ORQQV",$J,"RESULTS",IDT,TESTSEQ)=RESULT
133 ...I RTIMES S RCNT=RCNT+1 I RCNT=RTIMES S RQUIT=1
134 S (DATESEQ,RCNT,RQUIT,VCNT)=0
135 S IDT="A" F S IDT=$O(^TMP("ORQQV",$J,"RESULTS",IDT),-1) Q:IDT="" S DATETIME=^(IDT) D Q:RQUIT
136 .S DATESEQ=DATESEQ+1
137 .S OUTCNT=OUTCNT+1
138 .S ^TMP("ORQQVX",$J,"OUTPUT",OUTCNT)=DATESEQ_U_DATETIME
139 .S TESTSEQ=0 F S TESTSEQ=$O(^TMP("ORQQV",$J,"RESULTS",IDT,TESTSEQ)) Q:TESTSEQ<1 S RESULT=^(TESTSEQ) D
140 ..S VCNT=VCNT+1
141 ..S ^TMP("ORQQV",$J,"VALUES",VCNT)=DATESEQ_U_TESTSEQ_U_RESULT
142 .I RTIMES S RCNT=RCNT+1 I RCNT=RTIMES S RQUIT=1
143 S $P(^TMP("ORQQVX",$J,"OUTPUT",1),U,2,3)=DATESEQ_U_VCNT
144 S VCNT=0 F S VCNT=$O(^TMP("ORQQV",$J,"VALUES",VCNT)) Q:VCNT<1 S VALUES=^(VCNT) D
145 .S OUTCNT=OUTCNT+1
146 .S ^TMP("ORQQVX",$J,"OUTPUT",OUTCNT)=VALUES
147 K ^TMP("ORQQV",$J)
148 Q
Note: See TracBrowser for help on using the repository browser.