source: WorldVistAEHR/trunk/r/DSS_EXTRACTS-ECX/ECXPRO.m@ 1474

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

revised back to 6/30/08 version

File size: 6.5 KB
RevLine 
[623]1ECXPRO ;ALB/GTS - Prosthetics Extract for DSS ; 11/2/06 8:56am
2 ;;3.0;DSS EXTRACTS;**9,13,15,21,24,33,39,46,71,92**;Dec 22, 1997;Build 30
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 ..Q:'$$NTEG^ECXPRO1(ECXDFN,.ECXLNE,ECXDACT,ECX0,ECXLB,ECINST,ECXFORM)
43 ..D PROSINFO^ECXPRO1(ECXDACT,ECXLB,ECX0,ECXFORM)
44 ..S CPTCODE=$E(ECXHCPCS,1,5)
45 ..;
46 ..;Get production division ;p-46
47 ..N ECXPDIV S ECXPDIV=$$RADDIV^ECXDEPT(ECXDIV) ;p-46
48 ..;- Observation patient indicator (YES/NO)
49 ..S ECXOBS=$$OBSPAT^ECXUTL4(ECXA,ECXTS)
50 ..;
51 ..;- CNH status (YES/NO)
52 ..S ECXCNH=$$CNHSTAT^ECXUTL4(ECXDFN)
53 ..;
54 ..;get encounter classifications
55 ..S (ECXAO,ECXECE,ECXHNC,ECXMIL,ECXIR)=""
56 ..S ECXVISIT=$$GET1^DIQ(660,ECXDACT,8.12,"I") I ECXVISIT'="" D
57 ...D VISIT^ECXSCX1(ECXDFN,ECXVISIT,.ECXVIST,.ECXERR) I ECXERR K ECXERR Q
58 ...S ECXAO=$G(ECXVIST("AO")),ECXECE=$G(ECXVIST("PGE"))
59 ...S ECXHNC=$G(ECXVIST("HNC")),ECXMIL=$G(ECXVIST("MST")),ECXIR=$G(ECXVIST("IR"))
60 ..; - Head and Neck Cancer Indicator
61 ..S ECXHNCI=$$HNCI^ECXUTL4(ECXDFN)
62 ..;
63 ..; - set national patient record flag if exist
64 ..D NPRF^ECXUTL5
65 ..;
66 ..;- If no encounter number don't file record
67 ..S ECXENC=$$ENCNUM^ECXUTL4(ECXA,ECXSSN,ECXADMDT,ECXDATE,ECXTS,ECXOBS,ECHEAD,,) Q:ECXENC=""
68 ..I ECXFORM["-3" F ECXLAB="LAB","ORD" D
69 ...D FEEDINFO^ECXPRO2(ECXSRCE,CPTCODE,ECXTYPE,ECXSTAT2,ECXRQST,ECXRCST,ECXLAB)
70 ...Q:ECXFELOC="" D FILE
71 ..I ECXFORM'["-3" S ECXLAB="NONL" D
72 ...D FEEDINFO^ECXPRO2(ECXSRCE,CPTCODE,ECXTYPE,ECXSTAT2,ECXRQST,ECXRCST,ECXLAB)
73 ...Q:ECXFELOC="" D FILE
74 ;* Send the Exception message
75 I ECXLNSTR<ECXLNE DO
76 .K XMY S XMY("G.DSS-"_ECGRP_"@"_^XMB("NETNAME"))=""
77 .S XMDUZ=.5
78 .S XMSUB=ECINST_" - Prosthetics DSS Exception Message",XMN=0
79 .S XMTEXT="^TMP(""ECX-PRO EXC"",$J,"
80 .D ^XMD
81 K ^TMP("ECX-PRO EXC",$J),XMDUZ,XMSUB,XMTEXT,XMY
82 Q
83 ;
84FILE ;file extract record
85 ;node0
86 ;facility^dfn (ECXDFN)^ssn (ECXSSN)^name (ECXPNM)^in/out (ECXA)^
87 ;day^feeder location^
88 ;feeder key^qty^pc team^pc provider^hcpcs^icd9 (ECXICD9)^
89 ;icd9-1 (ECXICD91)^icd9-2 (ECXICD92)^icd9-3 (ECXICD93)^
90 ;icd9-4 (ECXICD94)^agent orange^radiation^env contam^eligibility^
91 ;cost^lab labor cost^lab matl cost^billing status^
92 ;vet^transacton type^req station^rec station^file#661.1 ien
93 ;node1
94 ;zip^dob^sex^amis grouper^pc prov npi^mpi^dss dept ECXDSSD^
95 ;pc prov person class^race^pow status^pow loc^
96 ;sharing agree payor^sharing agree ins^mst status^
97 ;enroll loc^state^county^assoc pc provider^
98 ;assoc pc prov person class^assoc pc prov npi
99 ;dom (ECXDOM)^purple heart indicator (ECXPHI)^
100 ;enrollment Category (ECXCAT)^enrollment status (ECXSTAT)^
101 ;enrollment priority (ECXPRIOR)^purple heart ind (ECXPHI)^
102 ;period of serv (ECXPOS)^observ pat ind (ECXOBS)^encounter num (ECXENC)^
103 ;ao loc (ECXAOL)^CNH status (ECXCNH)^production division ECXPDIV^
104 ;head & neck canc. ind. (ECXHNCI)^ethnicity (ECXETH)^race1 (ECXRC1)^
105 ;^enrollment priority (ECXPRIOR)_enrollment sub-
106 ;group (ECXSBGRP)^user enrollee (ECXUESTA)^patient type ECXPTYPE
107 ;^combat vet elig ECXCVE^combat vet elig end date ECXCVEDT^enc cv
108 ;eligible ECXCVENC^national patient record flag ECXNPRFI^
109 ;emergency response indicator(FEMA) ECXERI^agent orange indicator ECXAO
110 ;^environ contam ECXECE^head/neck cancer ECXHNC^encntr mst ECXMIL^
111 ;radiation ECXIR
112 N DA,DIK
113 S EC7=$O(^ECX(ECFILE,999999999),-1),EC7=EC7+1
114 S ECODE=EC7_U_EC23_U_ECINST_U_ECXDFN_U_ECXSSN_U_ECXPNM_U_ECXA_U
115 S ECODE=ECODE_$$ECXDATE^ECXUTL(ECXDATE,ECXYM)_U_ECXFELOC_U
116 S ECODE=ECODE_ECXFEKEY_U_ECXQTY_U_ECPTTM_U_ECPTPR_U_ECXHCPCS_U
117 S ECODE=ECODE_ECXICD9_U_ECXICD91_U_ECXICD92_U_ECXICD93_U_ECXICD94_U
118 S ECODE=ECODE_ECXAST_U_ECXRST_U_ECXEST_U_ECXELIG_U_ECXCTAMT_U_ECXLLC_U
119 S ECODE=ECODE_ECXLMC_U_ECXBILST_U_ECXVET_U_ECXTYPE_U_ECXRQST_U_ECXRCST_U
120 S ECODE=ECODE_ECXPHCPC_U
121 S ECODE1=ECXZIP_U_ECXDOB_U_ECXSEX_U_ECXGRPR_U_ECPTNPI_U_ECXMPI_U
122 S ECODE1=ECODE1_ECXDSSD_U_ECCLAS_U_ECXRACE_U_ECXPST_U_ECXPLOC_U
123 S ECODE1=ECODE1_U_U_ECXMST_U_ECXENRL_U_ECXSTATE_U
124 S ECODE1=ECODE1_ECXCNTY_U_ECASPR_U_ECCLAS2_U_ECASNPI_U_ECXDOM_U
125 S ECODE1=ECODE1_ECXCAT_U_ECXSTAT_U_$S(ECXLOGIC<2005:ECXPRIOR,1:"")_U_ECXPHI_U_ECXPOS_U
126 S ECODE1=ECODE1_ECXOBS_U_ECXENC_U_ECXAOL_U_ECXCNH_U_ECXPDIV_U
127 S ECODE1=ECODE1_ECXHNCI_U_ECXETH_U_ECXRC1_U
128 I ECXLOGIC>2004 S ECODE1=ECODE1_U_ECXPRIOR_ECXSBGRP_U_ECXUESTA_U_ECXPTYPE_U_ECXCVE_U_ECXCVEDT_U_ECXCVENC_U_ECXNPRFI
129 I ECXLOGIC>2006 S ECODE1=ECODE1_U_ECXERI_U_ECXAO_U_ECXECE_U_ECXHNC_U_ECXMIL_U_ECXIR
130 S ^ECX(ECFILE,EC7,0)=ECODE,^ECX(ECFILE,EC7,1)=ECODE1,ECRN=ECRN+1
131 S DA=EC7,DIK="^ECX("_ECFILE_"," D IX1^DIK K DIK,DA
132 I $D(ZTQUEUED),$$S^%ZTLOAD S QFLG=1
133 Q
134SETUP ;Set required input for ECXTRAC
135 S ECHEAD="PRO"
136 D ECXDEF^ECXUTL2(ECHEAD,.ECPACK,.ECGRP,.ECFILE,.ECRTN,.ECPIECE,.ECVER)
137 S ECINST=$$PDIV^ECXPUTL
138 Q
139 ;
140 ;**Note: LOCAL and QUE are carry over from protocols set by other
141 ; routines.
142LOCAL ;to extract nightly for local use not to be transmitted to TSI
143 ;QUEUE with 1D frequency
144 D SETUP,^ECXTLOCL,^ECXKILL Q
145 ;
146QUE ; entry point for the background requeuing handled by ECXTAUTO
147 D SETUP,QUE^ECXTAUTO,^ECXKILL Q
Note: See TracBrowser for help on using the repository browser.