1 | VWREGITU ;Portland, OR/jeb et al World Vista Registration Utilities
|
---|
2 | ;V.2;;**LOCAL**;; 2015;Build 2
|
---|
3 | ;;c2014, BellFelder Productions(BF Productions)
|
---|
4 | ;No Fall thru - jeb
|
---|
5 | Q
|
---|
6 | ;
|
---|
7 | DFNID() ;Set NAME(IEN),TAB,DOB(AGE),TAB,HRN,TAB,PHONE#
|
---|
8 | N DFNID,NAME,X,Y,DOB,HRN,PHONE
|
---|
9 | I 'DFN Q ""
|
---|
10 | S NAME=$P(^DPT(DFN,0),"^")
|
---|
11 | S Y=$$OUTPUT^VWTIME(DFN) X ^DD("DD") S DOB=Y
|
---|
12 | S HRN=$G(^DPT(DFN,540001.1))
|
---|
13 | S PHONE="Phone: "_$P(^DPT(DFN,.13),"^")
|
---|
14 | S DFNID=NAME_$C(9)_DOB_$C(9)_$S($L(HRN):"HRN: "_HRN_$C(9),1:"")_PHONE
|
---|
15 | Q DFNID
|
---|
16 | ;
|
---|
17 | HELP(XDIC,XFIELD) ;
|
---|
18 | N N
|
---|
19 | K FHELP
|
---|
20 | S FHELP=$G(^DD(XDIC,XFIELD,3))
|
---|
21 | G:'$L(FHELP) HELPX
|
---|
22 | S FHELP=FHELP_$S($E($L(FHELP))=".":" ",1:". ")
|
---|
23 | I XFIELD'=27.02,$D(^DD(XDIC,XFIELD,21)) S N=0 F S N=$O(^DD(XDIC,XFIELD,21,N)) Q:'+N S FHELP=FHELP_^(N,0)_" "
|
---|
24 | S FHELP=$TR(FHELP,"'","`")
|
---|
25 | HELPX Q FHELP
|
---|
26 | ;
|
---|
27 | M(RESULT,XMF) ;
|
---|
28 | ; **********************************************
|
---|
29 | ; * XMF_____PARENT FIELD^DFN^TEMPLATE NAME(IEN)*
|
---|
30 | ; **********************************************
|
---|
31 | ;
|
---|
32 | ;W " ;Intentional break
|
---|
33 | K RESULT,AR,TEMPLATE
|
---|
34 | N XMFD,SUBD,SUBD3,SUBD4,SUBD5,F2,F3,F4,F5,DFN,N,X,SUBF,XT,FHELP
|
---|
35 | S TNUM=+$P(XMF,"(",2) ;Template IEN, if any
|
---|
36 | S DFN=+$P(XMF,"^",2) ;Client IEN, if any
|
---|
37 | S XMF=+XMF ;Parent field
|
---|
38 | I '+$P(^DD(2,XMF,0),"^",2) S RESULT(0)=-1 ;Not a parent, eh?!
|
---|
39 | S XMFD=+$P(^(0),"^",2)
|
---|
40 | S F=0 F S F=$O(^DD(XMFD,F)) Q:'+F S RESULT($$INR)=$P(^(F,0),"^")_"^"_XMFD_";"_F_"^^"_$$HELP(XMFD,F)_"^"_$P(^(0),"^",3) D:+$P(^(0),"^",2)
|
---|
41 | . S SUBD=+$P(^(0),"^",2)
|
---|
42 | . S F2=0 F S F2=$O(^DD(SUBD,F2)) Q:'+F2 S RESULT($$INR)=$P(^(F2,0),"^")_"^"_SUBD_";"_F2_"^^"_$$HELP(SUBD,F2)_"^"_$P(^(0),"^",3) D:+$P(^DD(SUBD,F2,0),"^",2)
|
---|
43 | .. S SUBD3=+$P(^(0),"^",2)
|
---|
44 | .. S F3=0 F S F3=$O(^DD(SUBD3,F3)) Q:'+F3 S RESULT($$INR)=$P(^(F3,0),"^")_"^"_SUBD3_";"_F3_"^^"_$$HELP(SUBD3,F3)_"^"_$P(^(0),"^",3) D:+$P(^DD(SUBD3,F3,0),"^",2)
|
---|
45 | ... S SUBD4=+$P(^DD(SUBD3,F3,0),"^",2)
|
---|
46 | ... S F4=0 F S F4=$O(^DD(SUBD4,F4)) Q:'+F4 S RESULT($$INR)=$P(^(F4,0),"^")_"^"_SUBD4_";"_F4_"^^"_$$HELP(SUBD4,F4)_"^"_$P(^(0),"^",3) D:+$P(^DD(SUBD4,F2,0),"^",2)
|
---|
47 | .... S SUBD5=+$P(^(0),"^",2)
|
---|
48 | .... S F5=0 F S F5=$O(^DD(SUBD5,F5)) Q:'+F5 S RESULT($$INR)=$P(^(F5,0),"^")_"^"_SUBD5_";"_F5_"^^"_$$HELP(SUBD5,F5)_"^"_$P(^(0),"^",3)
|
---|
49 | ;Clean up of parents IN multiple fields
|
---|
50 | M AR=RESULT K RESULT N DD,F
|
---|
51 | S N=0 F S N=$O(AR(N)) Q:'+N D
|
---|
52 | . S DD=+$P($P(AR(N),"^",2),";") ;Is this a sub DD ?
|
---|
53 | . S F=+$P(AR(N),";",2)
|
---|
54 | . I +$P(^DD(DD,F,0),"^",2) K AR(N)
|
---|
55 | ;Clean up fields not in template
|
---|
56 | M TEMPLATE=^DIE(TNUM,"DR")
|
---|
57 | S X=$Q(@"TEMPLATE") K @X ;Remove top, non-multiple subscript
|
---|
58 | S X="AR" F S X=$Q(@X) Q:X="" D
|
---|
59 | . S SUBD=+$P($P(@X,"^",2),";")
|
---|
60 | . S SUBF=+$P(@X,";",2)
|
---|
61 | . F I=1:1:20 I $D(TEMPLATE(I,SUBD)) D
|
---|
62 | .. Q:TEMPLATE(I,SUBD)[SUBF
|
---|
63 | .. K @X
|
---|
64 | S N=0 F S N=$O(AR(N)) Q:'+N S RESULT($$INR)=AR(N)
|
---|
65 | K AR,TEMPLATE
|
---|
66 | Q
|
---|
67 | ;
|
---|
68 | DISV(RESULT,DFN) ;Set the Disv GLOBAL
|
---|
69 | K RESULT
|
---|
70 | I '$L(DFN) S RESULT=-1 Q
|
---|
71 | S ^DISV(DUZ,"^DPT(")=+$P(DFN,"(",2),RESULT=1
|
---|
72 | Q
|
---|
73 | ;
|
---|
74 | SR(FNAME,FNUM,FVALUE,FHELP,FSETPNTR,FMISC) ;Set values into RESULT()
|
---|
75 | ;********************************************************
|
---|
76 | ;* FNAME________Field Name *
|
---|
77 | ;* FNUM_________Field Number *
|
---|
78 | ;* FVALUE_______Data from existing client/patient *
|
---|
79 | ;* FHELP________Help text from field *
|
---|
80 | ;* FSETPNTR_____Set of codes or Pointer reference *
|
---|
81 | ;* FMISC________Locally described designator (not used) *
|
---|
82 | ;********************************************************
|
---|
83 | S RESULT($$INR)=FNAME_"^"_FNUM_"^"_FVALUE_"^"_FHELP_"^"_FSETPNTR_"^"_FMISC
|
---|
84 | Q
|
---|
85 | ;
|
---|
86 | INR() ;Specific incrementer for RESULT array
|
---|
87 | Q $O(RESULT(" "),-1)+1
|
---|
88 | ;
|
---|
89 | ZPC(RESULT,ZIP) ;Get zip,county/area/region,state/province,preferred city
|
---|
90 | K RESULT N STP,CNTP,COUNTY,XZIP
|
---|
91 | S XZIP=ZIP S RESULT(0)="No return" Q:'$L(XZIP)
|
---|
92 | D POSTAL^XIPUTIL(XZIP,.ZIPDATA)
|
---|
93 | I $D(ZIPDATA("ERROR")) Q ;Can't be found
|
---|
94 | S COUNTY=$G(ZIPDATA("COUNTY"))
|
---|
95 | S STP=$G(ZIPDATA("STATE POINTER"))
|
---|
96 | I STP,$L(COUNTY) S CNTP=$O(^DIC(5,STP,1,"B",COUNTY,0))
|
---|
97 | K RESULT(0)
|
---|
98 | S RESULT($$INR)=ZIPDATA("STATE")_"("_STP_")"
|
---|
99 | S RESULT($$INR)=ZIPDATA("COUNTY")_"("_CNTP_")"
|
---|
100 | S RESULT($$INR)=ZIPDATA("CITY")
|
---|
101 | S RESULT($$INR)=ZIPDATA("FIPS CODE")
|
---|
102 | K ZIPDATA
|
---|
103 | Q
|
---|
104 | ;
|
---|
105 | SPI(RESULT,DFN) ;Simple patient inquiry display
|
---|
106 | S LINE="----------"
|
---|
107 | S DIC="^DPT(",DA=DFN,DIQ(0)="E",DIQ="AR"
|
---|
108 | S DR=".01:.05;.111:.115;.1171:.1173;.117;.363"
|
---|
109 | D EN^DIQ1
|
---|
110 | S CITY=$G(AR(2,DFN,.114,"E"))
|
---|
111 | S STIEN="",STATE=$G(AR(2,DFN,.115,"E")) S:$L(STATE) STIEN=$O(^DIC(5,"B",STATE,0))
|
---|
112 | S XAGE=$G(AR(2,DFN,.033,"E"))
|
---|
113 | S XAGE=$S(+XAGE:XAGE_" y/o",1:"")
|
---|
114 | ;;GET HRN
|
---|
115 | HRN S HRN="",N=$O(^AUPNPAT(DFN,41,0))
|
---|
116 | S HRN=$S('N:HRN,1:$P($G(^AUPNPAT(DFN,41,N,0)),"^",2))
|
---|
117 | S RESULT($$INR)=AR(2,DFN,.01,"E")_" "_AR(2,DFN,.363,"E")_" HRN: "_HRN
|
---|
118 | S RESULT($$INR)="DOB: "_AR(2,DFN,.03,"E")_" ("_XAGE_" "_AR(2,DFN,.02,"E")_")"
|
---|
119 | S RESULT($$INR)="ADDRESS"_LINE_LINE
|
---|
120 | S RESULT($$INR)=$G(AR(2,DFN,.111,"E"))_" "_$G(AR(2,DFN,.112,"E"))
|
---|
121 | S RESULT($$INR)=$G(AR(2,DFN,.114,"E"))_", "_$G(AR(2,DFN,.115,"E"))_" "_$S($L($G(AR(2,DFN,.1172,"E"))):AR(2,DFN,.1172,"E"),1:$G(AR(2,DFN,.1112,"E")))
|
---|
122 | S RESULT($$INR)="Walk-ins"_LINE_LINE
|
---|
123 | S RESULT($$INR)="Appointments"_LINE_LINE
|
---|
124 | S RESULT($$INR)="Admissions"_LINE_LINE
|
---|
125 | Q
|
---|
126 | ;
|
---|
127 | CONTROL() ;Check for CONTROL status
|
---|
128 | N X S X=$O(^DIC(19,"B","VW REG IT CONTROL",0))
|
---|
129 | I 'X Q 0 ;Ain't no option there
|
---|
130 | Q $S($D(^VA(200,DUZ,203,"B",X)):1,1:0)
|
---|
131 | ;
|
---|
132 | MISC(RESULT,VWDD) ;Get simple value from VWDD ID
|
---|
133 | ;***************************************************
|
---|
134 | ;* VWDD___________________(sub)-Dictionary number *
|
---|
135 | ;* Multiple delimiter_____;(Semicolon) *
|
---|
136 | ;***************************************************
|
---|
137 | ;
|
---|
138 | I '$L(VWDD) S RESULT(0)="No value to evaluate" Q
|
---|
139 | K RESULT
|
---|
140 | N XDD,XDDLOC,N,X
|
---|
141 | G MISCSD:$G(^DD(VWDD,0,"UP"))
|
---|
142 | S CALLER=$S($P(VWDD,"^",2)="INS":1,1:0)
|
---|
143 | S VWDD=$P(VWDD,"^")
|
---|
144 | F I=1:1:$L(VWDD,";") S XDD=+$P(VWDD,";",I) S RESULT($$INR)="["_$P(^DIC(XDD,0),"^")_"]" D MISC1
|
---|
145 | I CALLER S RESULT($$INR)="[GUARANTOR]" D
|
---|
146 | . S X=$P(^DD(2.312,16,0),"^",3)
|
---|
147 | . F I=1:1:$L(X,";") S Y=$P(X,";",I),RESULT($$INR)=$P(Y,":",2)_"("_$P(Y,":")_")"
|
---|
148 | Q
|
---|
149 | ;
|
---|
150 | MISC1 S XDDLOC=$G(^DIC(XDD,0,"GL")) D:$L(XDDLOC)
|
---|
151 | . S N=0 F S N=$O(@(XDDLOC_N_")")) Q:'+N D
|
---|
152 | .. I XDDLOC["779.004" S XCNAME=$P(@(XDDLOC_N_",0)"),"^")_" "_$P(^(0),"^",2)_" "_+$G(^("SDS"))_"("_N_")",RESULT($$INR)=XCNAME Q
|
---|
153 | .. S X=$P(@(XDDLOC_N_",0)"),"^")_"("_N_")",RESULT($$INR)=X
|
---|
154 | MX Q
|
---|
155 | ;
|
---|
156 | MISCSD ;Sub-dictionary
|
---|
157 | W ^("UP")
|
---|
158 | Q
|
---|
159 | ;
|
---|
160 |
|
---|