source: FOIAVistA/trunk/r/DSS_EXTRACTS-ECX/ECXPRO.m@ 666

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

initial load of FOIAVistA 6/30/08 version

File size: 7.0 KB
Line 
1ECXPRO ;ALB/GTS - Prosthetics Extract for DSS ; 10/17/07 3:47pm
2 ;;3.0;DSS EXTRACTS;**9,13,15,21,24,33,39,46,71,92,105**;Dec 22, 1997;Build 70
3BEG ;entry point from option
4 D SETUP I ECFILE="" Q
5 D:+ECINST>0 ^ECXTRAC D ^ECXKILL
6 Q
7 ;
8START ;start package specific extract
9 ;
10 ; Input
11 ; ECSD1 - FM formatted Beginning Date (Set by ECXTRAC)
12 ; ECED - FM formatted End Date (Set by ECXTRAC)
13 ; ECSDN - Externally formatted Start Date (Set by ECXTRAC)
14 ; ECEDN - Externally formatted End Date (Set by ECXTRAC)
15 ; EC - IEN from file #727 (Set by ECXTRAC)
16 ; ECXYM - Year and Month of extract (YYYYMM)
17 ; ECXINST - IEN for division in file #4
18 ; ECINST - Station number of selected division
19 ;
20 N ECXLNE,ECXCT,ECXDACT,ECX0,ECXLB,ECXED1,ECINSTSV,ECXLNSTR,ECXP
21 N DIC,DR,DA,DIQ,CPTCODE,ECXNPRFI
22 D ECXBUL^ECXPRO2(.ECXLNE,ECSDN,ECEDN,EC)
23 S QFLG=0,ECXLNSTR=ECXLNE,ECXED1=ECED+.9999,ECXCT=ECSD1
24 F S ECXCT=$O(^RMPR(660,"CT",ECXCT)) Q:(ECXCT>ECXED1)!('ECXCT)!(QFLG=1) D
25 .S ECXDACT=0
26 .F S ECXDACT=$O(^RMPR(660,"CT",ECXCT,ECXDACT)) Q:('ECXDACT)!(QFLG=1) D
27 ..;* initialize variables
28 ..S (ECXDFN,ECXPNM,ECXSSN,ECXSEX,ECXSTAT,ECXDATE,ECXTYPE,ECXSRCE)=""
29 ..S (ECXHCPCS,ECXPHCPC,ECXRQST,ECXRCST,ECXFORM,ECXCTAMT,ECXLLC)=""
30 ..S (ECXLMC,ECXGRPR,ECXBILST,ECXQTY,ECXFELOC,ECXFEKEY,ECXA)=""
31 ..S (ECPTTM,ECPTPR,ECXAST,ECXRST,ECXEST,ECXELIG,ECXVET,ECXZIP)=""
32 ..S (ECXDOB,ECXDSSD,ECXICD9,ECXAOL,ECXHNCI,ECXETH,ECXRC1,ECXMST)=""
33 ..F I=1:1:4 S @("ECXICD9"_I)=""
34 ..Q:'$D(^RMPR(660,ECXDACT,0))
35 ..S ECX0=^RMPR(660,ECXDACT,0),ECXLB=$G(^RMPR(660,ECXDACT,"LB"))
36 ..K ECXP S DIC="^RMPR(660,",DR=".02;11",DA=ECXDACT,DIQ(0)="EI"
37 ..S DIQ="ECXP" D EN^DIQ1
38 ..S ECXDIV=$$GET1^DIQ(660,ECXDACT,8,"I")
39 ..S ECXDFN=$G(ECXP(660,ECXDACT,.02,"I"))
40 ..S ECXFORM=$G(ECXP(660,ECXDACT,11,"E"))_U_$G(ECXP(660,ECXDACT,11,"I"))
41 ..Q:'$$PATDEM^ECXUTL2(ECXDFN,ECXCT)
42 ..S OK=$$PAT^ECXUTL3(ECXDFN,ECXDATE,"1;5",.ECXPAT)
43 ..I 'OK S ECXERR=1 K ECXPAT Q
44 ..;OEF/OIF data
45 ..S ECXOEF=ECXPAT("ECXOEF")
46 ..S ECXOEFDT=ECXPAT("ECXOEFDT")
47 ..Q:'$$NTEG^ECXPRO1(ECXDFN,.ECXLNE,ECXDACT,ECX0,ECXLB,ECINST,ECXFORM)
48 ..D PROSINFO^ECXPRO1(ECXDACT,ECXLB,ECX0,ECXFORM)
49 ..S CPTCODE=$E(ECXHCPCS,1,5)
50 ..;nppd entry date
51 ..S ECXNPPDT=$$ECXDATE^ECXUTL($P(ECX0,U,1),ECXYM)
52 ..;
53 ..;Get production division ;p-46
54 ..N ECXPDIV S ECXPDIV=$$RADDIV^ECXDEPT(ECXDIV) ;p-46
55 ..;- Observation patient indicator (YES/NO)
56 ..S ECXOBS=$$OBSPAT^ECXUTL4(ECXA,ECXTS)
57 ..;
58 ..;- CNH status (YES/NO)
59 ..S ECXCNH=$$CNHSTAT^ECXUTL4(ECXDFN)
60 ..;
61 ..;get encounter classifications
62 ..S (ECXAO,ECXECE,ECXHNC,ECXMIL,ECXIR)=""
63 ..S ECXVISIT=$$GET1^DIQ(660,ECXDACT,8.12,"I") I ECXVISIT'="" D
64 ...D VISIT^ECXSCX1(ECXDFN,ECXVISIT,.ECXVIST,.ECXERR) I ECXERR K ECXERR Q
65 ...S ECXAO=$G(ECXVIST("AO")),ECXECE=$G(ECXVIST("PGE"))
66 ...S ECXHNC=$G(ECXVIST("HNC")),ECXMIL=$G(ECXVIST("MST")),ECXIR=$G(ECXVIST("IR"))
67 ..; - Head and Neck Cancer Indicator
68 ..S ECXHNCI=$$HNCI^ECXUTL4(ECXDFN)
69 ..;
70 ..; - set national patient record flag if exist
71 ..D NPRF^ECXUTL5
72 ..;
73 ..;- If no encounter number don't file record
74 ..S ECXENC=$$ENCNUM^ECXUTL4(ECXA,ECXSSN,ECXADMDT,ECXDATE,ECXTS,ECXOBS,ECHEAD,,) Q:ECXENC=""
75 ..I ECXFORM["-3" F ECXLAB="LAB","ORD" D
76 ...D FEEDINFO^ECXPRO2(ECXSRCE,CPTCODE,ECXTYPE,ECXSTAT2,ECXRQST,ECXRCST,ECXLAB)
77 ...Q:ECXFELOC="" D FILE
78 ..I ECXFORM'["-3" S ECXLAB="NONL" D
79 ...D FEEDINFO^ECXPRO2(ECXSRCE,CPTCODE,ECXTYPE,ECXSTAT2,ECXRQST,ECXRCST,ECXLAB)
80 ...Q:ECXFELOC="" D FILE
81 ;* Send the Exception message
82 I ECXLNSTR<ECXLNE DO
83 .K XMY S XMY("G.DSS-"_ECGRP_"@"_^XMB("NETNAME"))=""
84 .S XMDUZ=.5
85 .S XMSUB=ECINST_" - Prosthetics DSS Exception Message",XMN=0
86 .S XMTEXT="^TMP(""ECX-PRO EXC"",$J,"
87 .D ^XMD
88 K ^TMP("ECX-PRO EXC",$J),XMDUZ,XMSUB,XMTEXT,XMY
89 Q
90 ;
91FILE ;file extract record
92 ;node0
93 ;facility^dfn (ECXDFN)^ssn (ECXSSN)^name (ECXPNM)^in/out (ECXA)^
94 ;day^feeder location^
95 ;feeder key^qty^pc team^pc provider^hcpcs^icd9 (ECXICD9)^
96 ;icd9-1 (ECXICD91)^icd9-2 (ECXICD92)^icd9-3 (ECXICD93)^
97 ;icd9-4 (ECXICD94)^agent orange^radiation^env contam^eligibility^
98 ;cost^lab labor cost^lab matl cost^billing status^
99 ;vet^transaction type^req station^rec station^file#661.1 ien
100 ;node1
101 ;zip^dob^sex^amis grouper^placeholder^mpi^dss dept ECXDSSD^
102 ;pc prov person class^race^pow status^pow loc^
103 ;sharing agree payor^sharing agree ins^mst status^
104 ;enroll loc^state^county^assoc pc provider^
105 ;assoc pc prov person class^placeholder
106 ;dom (ECXDOM)^purple heart indicator (ECXPHI)^
107 ;enrollment Category (ECXCAT)^enrollment status (ECXSTAT)^
108 ;enrollment priority (ECXPRIOR)^purple heart ind (ECXPHI)^
109 ;period of serv (ECXPOS)^observ pat ind (ECXOBS)^encounter num (ECXENC)^
110 ;ao loc (ECXAOL)^CNH status (ECXCNH)^production division ECXPDIV^
111 ;head & neck canc. ind. (ECXHNCI)^ethnicity (ECXETH)^race1 (ECXRC1)^
112 ;^enrollment priority (ECXPRIOR)_enrollment sub-
113 ;group (ECXSBGRP)^user enrollee (ECXUESTA)^patient type ECXPTYPE
114 ;^combat vet elig ECXCVE^combat vet elig end date ECXCVEDT^enc cv
115 ;eligible ECXCVENC^national patient record flag ECXNPRFI^
116 ;emergency response indicator(FEMA) ECXERI^agent orange indicator ECXAO
117 ;^environ contam ECXECE^head/neck cancer ECXHNC^encntr mst ECXMIL^
118 ;radiation ECXIR^OEF/OIF ECXOEF^OEF/OIF return date ECXOEFDT^
119 ;nppd code ECXNPPDC^nppd entry date ECXNPPDT
120 ;assoc pc provider npi ECASNPI^primary care provider npi ECPTNPI
121 N DA,DIK
122 S EC7=$O(^ECX(ECFILE,999999999),-1),EC7=EC7+1
123 S ECODE=EC7_U_EC23_U_ECINST_U_ECXDFN_U_ECXSSN_U_ECXPNM_U_ECXA_U
124 S ECODE=ECODE_$$ECXDATE^ECXUTL(ECXDATE,ECXYM)_U_ECXFELOC_U
125 S ECODE=ECODE_ECXFEKEY_U_ECXQTY_U_ECPTTM_U_ECPTPR_U_ECXHCPCS_U
126 S ECODE=ECODE_ECXICD9_U_ECXICD91_U_ECXICD92_U_ECXICD93_U_ECXICD94_U
127 S ECODE=ECODE_ECXAST_U_ECXRST_U_ECXEST_U_ECXELIG_U_ECXCTAMT_U_ECXLLC_U
128 S ECODE=ECODE_ECXLMC_U_ECXBILST_U_ECXVET_U_ECXTYPE_U_ECXRQST_U_ECXRCST_U
129 S ECODE=ECODE_ECXPHCPC_U
130 S ECODE1=ECXZIP_U_ECXDOB_U_ECXSEX_U_ECXGRPR_U_U_ECXMPI_U
131 S ECODE1=ECODE1_ECXDSSD_U_ECCLAS_U_ECXRACE_U_ECXPST_U_ECXPLOC_U
132 S ECODE1=ECODE1_U_U_ECXMST_U_ECXENRL_U_ECXSTATE_U
133 S ECODE1=ECODE1_ECXCNTY_U_ECASPR_U_ECCLAS2_U_U_ECXDOM_U
134 S ECODE1=ECODE1_ECXCAT_U_ECXSTAT_U_$S(ECXLOGIC<2005:ECXPRIOR,1:"")_U_ECXPHI_U_ECXPOS_U
135 S ECODE1=ECODE1_ECXOBS_U_ECXENC_U_ECXAOL_U_ECXCNH_U_ECXPDIV_U
136 S ECODE1=ECODE1_ECXHNCI_U_ECXETH_U_ECXRC1_U
137 I ECXLOGIC>2004 S ECODE1=ECODE1_U_ECXPRIOR_ECXSBGRP_U_ECXUESTA_U_ECXPTYPE_U_ECXCVE_U_ECXCVEDT_U_ECXCVENC_U_ECXNPRFI
138 I ECXLOGIC>2006 S ECODE1=ECODE1_U_ECXERI_U_ECXAO_U_ECXECE_U_ECXHNC_U_ECXMIL_U_ECXIR_U
139 I ECXLOGIC>2007 S ECODE2=ECXOEF_U_ECXOEFDT_U_ECXNPPDC_U_ECXNPPDT_U_ECASNPI_U_ECPTNPI
140 S ^ECX(ECFILE,EC7,0)=ECODE,^ECX(ECFILE,EC7,1)=ECODE1,^ECX(ECFILE,EC7,2)=$G(ECODE2),ECRN=ECRN+1
141 S DA=EC7,DIK="^ECX("_ECFILE_"," D IX1^DIK K DIK,DA
142 I $D(ZTQUEUED),$$S^%ZTLOAD S QFLG=1
143 Q
144SETUP ;Set required input for ECXTRAC
145 S ECHEAD="PRO"
146 D ECXDEF^ECXUTL2(ECHEAD,.ECPACK,.ECGRP,.ECFILE,.ECRTN,.ECPIECE,.ECVER)
147 S ECINST=$$PDIV^ECXPUTL
148 Q
149 ;
150 ;**Note: LOCAL and QUE are carry over from protocols set by other
151 ; routines.
152LOCAL ;to extract nightly for local use not to be transmitted to TSI
153 ;QUEUE with 1D frequency
154 D SETUP,^ECXTLOCL,^ECXKILL Q
155 ;
156QUE ; entry point for the background requeuing handled by ECXTAUTO
157 D SETUP,QUE^ECXTAUTO,^ECXKILL Q
Note: See TracBrowser for help on using the repository browser.