source: WorldVistAEHR/trunk/r/AUTOMATED_INFO_COLLECTION_SYS-IBD/IBDFRPC4.m@ 1154

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

initial load of WorldVistAEHR

File size: 4.9 KB
Line 
1IBDFRPC4 ;ALB/AAS - AICS Pass data to PCE, Broker Call ; 24-FEB-96
2 ;;3.0;AUTOMATED INFO COLLECTION SYS;**38,36,37**;APR 24, 1997
3 ;
4 ; -- used by AICS Data Entry System, routine IBDFDE1
5 ;
6SEND(RESULT,IBDF) ; -- procedure
7 ; -- broker call to set data into pxca array and send to pce
8 ; rpc := IBD RECEIVE DATA
9 ;
10 ; -- input: Result := passed by reference, see output
11 ; ibdf(text) := contains data about visit, plus checkout defined as follows:
12 ; ibdf("appt") := appointment data/time
13 ; ibdf("clinic") := clinic, pointer to file 44
14 ; ibdf("dfn") := patient, pointer to file 2
15 ; ibdf("form") := encounter form ID, pointer to file 357.96
16 ; ibdf("frmdef") := form definition, pointer to 357.95
17 ; ibdf("foregnd") := pass data in foreground, show results
18 ; ibdf("backgnd") := pass data in background, don't show results
19 ;
20 ; ibdf("co") := check out date/time
21 ; ibdf("sc") := is visit for service connected condition
22 ; ibdf("ao") := is visit related to Agent orange
23 ; ibdf("ir") := is visit related to ionizing radiation
24 ; ibdf("ec") := is visit related to environmental contam.
25 ; ibdf("mst"):= is visit related to Military Sexual Trauma
26 ;
27 ; ibdf(n) := where n>0 are user selections as follows:
28 ; $p1 := package interface, pointer to file 357.6
29 ; $p2 := value to send
30 ; $p3 := display text
31 ; $p4 := header to send
32 ; $p5 := clin lexicon pointer
33 ; $p6 := qualifier
34 ; $p7 := ien of inteface
35 ; $p8 := vitals type (.01 field in 359.1)
36 ; $p9 := quantity
37 ;
38 N I,J,X,Y,D,D0,D1,D2,DA,DIC,DIE,DR,TNODE,FID,FORMID,NODE,VALUE,PI,TEXT,SUBHDR,HEADER,TYPE,QLFR,ITEM,PROVIDER,PXKDONE,STATUS,VSIT,QUANTITY,SDFN
39 S RESULT="-1^No data passed"
40 ;
41 K PXCA
42 S (PXCA,PXCASTAT)=""
43 ;
44 ; -- check form,frmdef and appt/clinic. Need one or the other
45 S TNODE=$G(^IBD(357.96,+$G(IBDF("FORM")),0))
46 S:'$G(IBDF("DFN")) IBDF("DFN")=$P(TNODE,"^",2)
47 S:'$G(IBDF("APPT")) IBDF("APPT")=$P(TNODE,"^",3)
48 S:'$G(IBDF("FRMDEF")) IBDF("FRMDEF")=$P(TNODE,"^",4)
49 S:'$G(IBDF("CLINIC")) IBDF("CLINIC")=$P(TNODE,"^",10)
50 ;
51 I '$G(IBDF("DFN"))!('$G(IBDF("APPT")))!('$G(IBDF("CLINIC"))) D G END
52 . I $G(IBDF("FORM")) S STATUS=$$FSCND^IBDF18C(+IBDF("FORM"),12)
53 . S RESULT="-1^Critical information for processing missing"
54 ;
55 ; -- log manual data entry attempt in form tracking
56 S STATUS=$$FSCND^IBDF18C(IBDF("FORM"),5)
57 ;
58 ; -- build the encounter node and source node from form tracking
59 S PXCA("ENCOUNTER")=$G(IBDF("APPT"))_"^"_$G(IBDF("DFN"))_"^"_$G(IBDF("CLINIC"))_"^^^"_$G(IBDF("SC"))_"^"_$G(IBDF("AO"))_"^"_$G(IBDF("IR"))_"^"_$G(IBDF("EC"))_"^"_$G(IBDF("MST"))_"^^^^"_$G(IBDF("CO"))
60 S PXCA("SOURCE")="1^"_DUZ_"^"_$G(IBDF("FRMDEF"))_"^^"_$G(IBDF("FORM"))
61 ;
62 ; -- process data in ibdf(n) nodes
63 S FORMID=IBDF("FORM")
64 S FID=0 F S FID=$O(IBDF(FID)) Q:'FID S NODE=$G(IBDF(FID)) D
65 .N VALUE,PI,TEXT,SUBHDR,HEADER,TYPE,QLFR,ITEM,DELEX,QUANTITY
66 .I NODE="" D LOGERR^IBDF18E2(3570002,.FORMID,FID) Q
67 .S PI=$P(NODE,"^")
68 .S VALUE=$$INPUT(PI,$P(NODE,"^",2))
69 .S TEXT=$P(NODE,"^",3)
70 .S (SUBHDR,HEADER)=$E($P(NODE,"^",4),1,80)
71 .I $L(SUBHDR),$L(SUBHDR)<2 S (SUBHDR,HEADER)=""
72 .;I $L(SUBHDR),($L(SUBHDR)+$L(TEXT)<80) S TEXT=SUBHDR_" "_TEXT
73 .S QLFR=$P(NODE,"^",6) S:QLFR'="" QLFR=$O(^IBD(357.98,"B",QLFR,0))
74 .S TYPE=+$$TYPE($P(NODE,"^",8))
75 .S ITEM=FID
76 .S DELEX=$P(NODE,"^",5)
77 .S QUANTITY=$P(NODE,"^",9)
78 .S SLCTN=$P(NODE,"^",12)
79 .D SETTEMP^IBDF18E1
80 .Q
81 ;
82 ; --added to copy visit modifiers
83 ;
84 D:$D(TEMP("ENCOUNTER")) VSTPXCA^IBDF18E0
85 ;
86 D SETPXCA^IBDF18E0,PRO^IBDF18E0
87 ;
88 ; send misc. data that does not go to PCE
89 D ^IBDF18E4
90 ;
91 S IBDF("PASSFLAG")=+$P($G(^IBD(357.09,1,0)),"^",7)
92 S IBD("AICS")=1 ;flag for IBDF PCE EVENT protocal
93 ;
94 ;I $G(IBDF("PASSFLAG"))<1 D BACKGND^PXCA(.PXCA,.PXCASTAT)
95 ;I $G(IBDF("PASSFLAG"))=1 D VALIDATE^PXCA(.PXCA) I '$D(PXCA("ERROR")) D BACKGND^PXCA(.PXCA,.PXCASTAT)
96 I $G(IBDF("PASSFLAG"))<2 D QUE^IBDF18E3
97 I $G(IBDF("PASSFLAG"))>1 D FOREGND^PXCA(.PXCA,.PXCASTAT)
98 K IBD("AICS")
99 ;
100 ; -- kill erroneous inpatient warnings
101 I $D(PXCA("WARNING","ENCOUNTER"))>0 D INPT^IBDF18E0($G(IBDF("DFN")),$G(IBDF("APPT")))
102 ;
103 ; -- set form tracking processing status, if okay=6, if error=7
104 I $G(IBDF("FORM")) S STATUS=$$FSCND^IBDF18C(IBDF("FORM"),$S(PXCASTAT=0:7,PXCASTAT=1:6,PXCASTAT=-1:7,PXCASTAT=-2:6,1:12),$S((PXCASTAT=0!(PXCASTAT=-1)):"PCE RETURNED AN ERROR",1:""))
105 ;
106 S RESULT(0)=PXCASTAT
107 I (PXCASTAT=1!(PXCASTAT=-2)),IBDF("PASSFLAG")<3 K PXCA,PXCASTAT
108END Q
109 ;
110INPUT(PI,X) ; -- convert external value to internal value
111 I $G(PI)=""!($G(X)="")
112 I $G(^IBE(357.6,+$G(PI),9))'="" X ^(9)
113VALQ Q $G(X)
114 ;
115TYPE(X) ; -- Change external to internal for hand print fields
116 N Y S Y=""
117 I X'="" S Y=$O(^IBE(359.1,"B",X,0))
118 Q Y
Note: See TracBrowser for help on using the repository browser.