ECXPIVD2 ;ALB/JAP,BIR/DMA,CML,PTD-Extract from IV EXTRACT DATA File (#728.113) ;2/14/20 09:07
;;3.0;DSS EXTRACTS;**105,120,127,144,149,161,166,170,174,178,181,184,187**;Dec 22, 1997;Build 163
;
; Reference to ^XMD in ICR #10113
; Reference to ^XMB("NETNAME") in ICR #1131
; Reference to ^TMP($J) in SACC 2.3.2.5.1
;
FILE ;file record
;node0
;fac^dfn^ssn^name^i/o^day^va class^qty^ward^cost^movement #^treat spec^ndc^investigational^iv dispensing fee^new feeder key^total doses^
;Placehold primary care team^Placehold primary care provider^ivp time^adm date^adm time^dss identifier
;node1
;mpi^placeholder^pc provider npi^Placehold pc prov person class^Placehold assoc pc provider^Placehold assoc pc prov person class^assoc pc prov npi^dom^obs pat ind^enc num^
;ord pr^ordering stop code^ord dt^req phys^nat prod division^means tst^elig^dob^sex^state^county^zip+4^vet^period of svc^pow stat^pow loc^ir stat^ao stat^
;ao loc^purple heart ind.^mst stat^enrollment loc^enrollment cat^enrollment stat^enrollment prior^cnh/sh stat^ord pr npi
;node2
;head & neck cancer ind.^Placehold ethnicity^Placehold race1^bcma drug dispensed^bcma dose given^bcma unit of administration^bcma ICU flag^
;ordering provider person class^^user enrollee ECXUESTA^patient type ECXPTYPE^combat vet elig ECXCVE^
;combat vet elig end date ECXCVEDT^enc cv eligible ECXCVENC^national patient record flag ECXNPRFI^emerg resp indic(FEMA) ECXERI^
;environ contamin ECXEST
;^oef/oif ECXOEF^ oef/oif return date ECXOEFDT^Placehold assoc pc prov npi ECASNPI
;^ordering provider npi ECXOPNPI^Placehold primary care provider npi ECPTNPI
;^country ECXCNTRY^PATCAT^Encounter SC ECXESC^Camp Lejeune Status ECXCLST^Encounter Camp Lejeune ECXECL ;144
;^Combat Service Indicator (ECXSVCI) ^ Combat Service Location (ECXSVCL)
;^ Patient Division (ECXSTANO) ^ Vista DEA special hdlg (ECXDEA) ;tjl 166
;node3 - patch 184
;Cerner Data (ECXCERN)
;node4
;New MPI (ECXNMPI)^Self Identified Gender (ECXSIGI) ;184
N DA,DIK
S ECPLACE=""
S EC7=$O(^ECX(ECFILE,999999999),-1),EC7=EC7+1
I ECXLOGIC>2018 S (ECXETH,ECXRC1,ECPTTM,ECPTPR,ECCLAS,ECASPR,ECCLAS2,ECASNPI,ECPTNPI)="" ;170 Fields will now be null
I ECXLOGIC>2020 S ECXMTST="" ;178 Means Test field will now be null
I ECXLOGIC>2022 S ECXMPI="" ;184 field retired
S ECODE=EC7_U_EC23_U_ECXDIV_U_DFN_U_ECXSSN_U_ECXPNM_U_ECXA_U
S ECODE=ECODE_$$ECXDATE^ECXUTL(ECD,ECXYM)_U_ECVACL_U_ECXCNT_U_ECXW_U
;convert specialty to PTF Code for transmission
N ECXDATA
S ECXDATA=$$TSDATA^DGACT(42.4,+ECXTS,.ECXDATA)
S ECXTS=$G(ECXDATA(7))
;done
S ECODE=ECODE_ECXCOST_U_ECXMN_U_ECXTS_U_ECNDC_U_ECINV_U_ECTYP_U_ECNFC_U
S ECODE=ECODE_ECST_U_ECPTTM_U_ECPTPR_U_ECDTTM_U_$$ECXDATE^ECXUTL(ECXADM,ECXYM)_U_$$ECXTIME^ECXUTL(ECXADM)_U_ECXDSSI_U
;if outpat and not observ patient, admit date="" and admit time="000000"
I ECXA="O",(ECXOBS="NO") S $P(ECODE,U,24)="",$P(ECODE,U,25)="000000"
S ECODE1=ECXMPI_U_ECXDSSD_U_ECPLACE_U_ECCLAS_U_ECASPR_U_ECCLAS2_U_ECPLACE_U_ECXDOM_U_ECXOBS_U_ECXENC_U_ECXORDPR_U
S ECODE1=ECODE1_ECXORDST_U_$$ECXDATE^ECXUTL(ECXORDDT,ECXYM)_U_ECXRPHY_U_ECXPDIV_U_ECXMTST_U_ECXELIG_U_ECXDOB_U
S ECODE1=ECODE1_ECXSEX_U_ECXSTATE_U_ECXCNTY_U_ECXZIP_U_ECXVET_U_ECXPOS_U_ECXPST_U_ECXPLOC_U_ECXRST_U_ECXAST_U
S ECODE1=ECODE1_ECXAOL_U_ECXPHI_U_ECXMST_U_ECXENRL_U_ECXCAT_U
S ECODE1=ECODE1_ECXSTAT_U_$S(ECXLOGIC<2005:ECXPRIOR,ECXLOGIC>2010:ECXSHADI,1:"")_U_ECXCNHU_U_U
S ECODE2=ECXHNCI_U_ECXETH_U_ECXRC1
I ECXLOGIC>2003 D
.S ECODE2=ECODE2_U_ECXBCDD_U_ECXBCDG_U_ECXBCUA_U_ECXBCIF_U_ECXOPPC
I ECXLOGIC>2004 S ECODE2=ECODE2_U_U_ECXPRIOR_ECXSBGRP_U_ECXUESTA_U_ECXPTYPE_U_ECXCVE_U_ECXCVEDT_U_ECXCVENC_U_ECXNPRFI
I ECXLOGIC>2006 S ECODE2=ECODE2_U_ECXERI_U_ECXEST
I ECXLOGIC>2007 S ECODE2=ECODE2_U_ECXOEF_U_ECXOEFDT_U_ECASNPI_U_ECXOPNPI_U_ECPTNPI
I ECXLOGIC>2009 S ECODE2=ECODE2_U_ECXCNTRY
I ECXLOGIC>2010 S ECODE2=ECODE2_U_ECXPATCAT
I ECXLOGIC>2013 S ECODE2=ECODE2_U_ECXESC_U_ECXCLST_U_ECXECL ;144
I ECXLOGIC>2014 S ECODE2=ECODE2_U_ECXSVCI_U_ECXSVCL ;149
I ECXLOGIC>2017 S ECODE2=ECODE2_U_ECXSTANO ;166
I ECXLOGIC>2019 S ECODE2=ECODE2_U_ECXDEA_U ;174 ,184 Added "^"
I ECXLOGIC>2022 S ECODE3=$G(ECXCERN)_U,ECODE4=ECXNMPI_U_ECXSIGI ;184
I ECXLOGIC>2023 S ECODE4=ECODE4_U_ECXPPDU_U_ECXDUNIT ;187 Adding Price Per Dispense Unit and Dispense Unit
S ^ECX(ECFILE,EC7,0)=ECODE,^ECX(ECFILE,EC7,1)=ECODE1
S ^ECX(ECFILE,EC7,2)=ECODE2 ;,ECRN=ECRN+1 ;184 - Move record count to below
S:ECXLOGIC>2022 ^ECX(ECFILE,EC7,3)=$G(ECODE3),^ECX(ECFILE,EC7,4)=$G(ECODE4) ;184
S ECRN=ECRN+1
S DA=EC7,DIK="^ECX("_ECFILE_"," D IX^DIK K DIK,DA
I $D(ZTQUEUED),$$S^%ZTLOAD S QFLG=1
Q
SENDMSG ;181 - Called from ECXPIVDN
N ECMSG,ECX,XMSUB,XMDUZ,XMY,XMTEXT
;Send missing stop code message
S ECX=$O(^TMP($J,"ECXIVPM","ECXNOSC",0))
I ECX D
.S XMSUB="CLINICS WITH MISSING STOP CODE in File #44",XMDUZ="DSS SYSTEM"
.K XMY S XMY("G.DSS-"_ECGRP_"@"_^XMB("NETNAME"))=""
.S ECMSG(1,0)="The DSS-"_ECPACK_" extract (#"_$P(EC23,U,2)_") for "_ECSDN_" through "_ECEDN
.S ECMSG(2,0)="contains the following clinics which have not been assigned a stop code in"
.S ECMSG(3,0)="the HOSPITAL LOCATION file (#44). The DSS-"_ECPACK_" extract records"
.S ECMSG(4,0)="associated with these clinics have been given a default Stop Code of ""PHA""."
.S ECMSG(5,0)=""
.S ECMSG(6,0)="CLIN IEN CLINIC NAME"
.S ECMSG(7,0)="-----------------------------------------"
.S ECMSG(8,0)=""
.S ECX=0
.F S ECX=$O(^TMP($J,"ECXIVPM","ECXNOSC",ECX)) Q:ECX="" S ECMSG(8+ECX,0)=^TMP($J,"ECXIVPM","ECXNOSC",ECX,0)
.S XMTEXT="ECMSG(" D ^XMD
;Send Inactive Stop Code message
S ECX=$O(^TMP($J,"ECXIVPM","ECXINVSC",0))
I ECX D
.S XMSUB="CLINICS WITH INACTIVE STOP CODE",XMDUZ="DSS SYSTEM"
.K XMY S XMY("G.DSS-"_ECGRP_"@"_^XMB("NETNAME"))=""
.S ECMSG(1,0)="The DSS-"_ECPACK_" extract (#"_$P(EC23,U,2)_") for "_ECSDN_" through "_ECEDN
.S ECMSG(2,0)="contains the following clinics which have been assigned an inactive stop"
.S ECMSG(3,0)="code in the HOSPITAL LOCATION file (#44). The DSS-"_ECPACK_" extract records"
.S ECMSG(4,0)="associated with these clinics have been given a default Stop Code of ""PHA""."
.S ECMSG(5,0)=""
.S ECMSG(6,0)="CLINIC IEN/NAME STOP CODE NUMBER/NAME"
.S ECMSG(7,0)="--------------------------------------------------------------------"
.S ECMSG(8,0)=""
.S ECX=0
.F S ECX=$O(^TMP($J,"ECXIVPM","ECXINVSC",ECX)) Q:ECX="" S ECMSG(8+ECX,0)=^TMP($J,"ECXIVPM","ECXINVSC",ECX,0)
.S XMTEXT="ECMSG(" D ^XMD
K ^TMP($J,"ECXIVPM")
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HECXPIVD2 6594 printed Sep 15, 2024@21:17:36 Page 2
ECXPIVD2 ;ALB/JAP,BIR/DMA,CML,PTD-Extract from IV EXTRACT DATA File (#728.113) ;2/14/20 09:07
+1 ;;3.0;DSS EXTRACTS;**105,120,127,144,149,161,166,170,174,178,181,184,187**;Dec 22, 1997;Build 163
+2 ;
+3 ; Reference to ^XMD in ICR #10113
+4 ; Reference to ^XMB("NETNAME") in ICR #1131
+5 ; Reference to ^TMP($J) in SACC 2.3.2.5.1
+6 ;
FILE ;file record
+1 ;node0
+2 ;fac^dfn^ssn^name^i/o^day^va class^qty^ward^cost^movement #^treat spec^ndc^investigational^iv dispensing fee^new feeder key^total doses^
+3 ;Placehold primary care team^Placehold primary care provider^ivp time^adm date^adm time^dss identifier
+4 ;node1
+5 ;mpi^placeholder^pc provider npi^Placehold pc prov person class^Placehold assoc pc provider^Placehold assoc pc prov person class^assoc pc prov npi^dom^obs pat ind^enc num^
+6 ;ord pr^ordering stop code^ord dt^req phys^nat prod division^means tst^elig^dob^sex^state^county^zip+4^vet^period of svc^pow stat^pow loc^ir stat^ao stat^
+7 ;ao loc^purple heart ind.^mst stat^enrollment loc^enrollment cat^enrollment stat^enrollment prior^cnh/sh stat^ord pr npi
+8 ;node2
+9 ;head & neck cancer ind.^Placehold ethnicity^Placehold race1^bcma drug dispensed^bcma dose given^bcma unit of administration^bcma ICU flag^
+10 ;ordering provider person class^^user enrollee ECXUESTA^patient type ECXPTYPE^combat vet elig ECXCVE^
+11 ;combat vet elig end date ECXCVEDT^enc cv eligible ECXCVENC^national patient record flag ECXNPRFI^emerg resp indic(FEMA) ECXERI^
+12 ;environ contamin ECXEST
+13 ;^oef/oif ECXOEF^ oef/oif return date ECXOEFDT^Placehold assoc pc prov npi ECASNPI
+14 ;^ordering provider npi ECXOPNPI^Placehold primary care provider npi ECPTNPI
+15 ;^country ECXCNTRY^PATCAT^Encounter SC ECXESC^Camp Lejeune Status ECXCLST^Encounter Camp Lejeune ECXECL ;144
+16 ;^Combat Service Indicator (ECXSVCI) ^ Combat Service Location (ECXSVCL)
+17 ;^ Patient Division (ECXSTANO) ^ Vista DEA special hdlg (ECXDEA) ;tjl 166
+18 ;node3 - patch 184
+19 ;Cerner Data (ECXCERN)
+20 ;node4
+21 ;New MPI (ECXNMPI)^Self Identified Gender (ECXSIGI) ;184
+22 NEW DA,DIK
+23 SET ECPLACE=""
+24 SET EC7=$ORDER(^ECX(ECFILE,999999999),-1)
SET EC7=EC7+1
+25 ;170 Fields will now be null
IF ECXLOGIC>2018
SET (ECXETH,ECXRC1,ECPTTM,ECPTPR,ECCLAS,ECASPR,ECCLAS2,ECASNPI,ECPTNPI)=""
+26 ;178 Means Test field will now be null
IF ECXLOGIC>2020
SET ECXMTST=""
+27 ;184 field retired
IF ECXLOGIC>2022
SET ECXMPI=""
+28 SET ECODE=EC7_U_EC23_U_ECXDIV_U_DFN_U_ECXSSN_U_ECXPNM_U_ECXA_U
+29 SET ECODE=ECODE_$$ECXDATE^ECXUTL(ECD,ECXYM)_U_ECVACL_U_ECXCNT_U_ECXW_U
+30 ;convert specialty to PTF Code for transmission
+31 NEW ECXDATA
+32 SET ECXDATA=$$TSDATA^DGACT(42.4,+ECXTS,.ECXDATA)
+33 SET ECXTS=$GET(ECXDATA(7))
+34 ;done
+35 SET ECODE=ECODE_ECXCOST_U_ECXMN_U_ECXTS_U_ECNDC_U_ECINV_U_ECTYP_U_ECNFC_U
+36 SET ECODE=ECODE_ECST_U_ECPTTM_U_ECPTPR_U_ECDTTM_U_$$ECXDATE^ECXUTL(ECXADM,ECXYM)_U_$$ECXTIME^ECXUTL(ECXADM)_U_ECXDSSI_U
+37 ;if outpat and not observ patient, admit date="" and admit time="000000"
+38 IF ECXA="O"
IF (ECXOBS="NO")
SET $PIECE(ECODE,U,24)=""
SET $PIECE(ECODE,U,25)="000000"
+39 SET ECODE1=ECXMPI_U_ECXDSSD_U_ECPLACE_U_ECCLAS_U_ECASPR_U_ECCLAS2_U_ECPLACE_U_ECXDOM_U_ECXOBS_U_ECXENC_U_ECXORDPR_U
+40 SET ECODE1=ECODE1_ECXORDST_U_$$ECXDATE^ECXUTL(ECXORDDT,ECXYM)_U_ECXRPHY_U_ECXPDIV_U_ECXMTST_U_ECXELIG_U_ECXDOB_U
+41 SET ECODE1=ECODE1_ECXSEX_U_ECXSTATE_U_ECXCNTY_U_ECXZIP_U_ECXVET_U_ECXPOS_U_ECXPST_U_ECXPLOC_U_ECXRST_U_ECXAST_U
+42 SET ECODE1=ECODE1_ECXAOL_U_ECXPHI_U_ECXMST_U_ECXENRL_U_ECXCAT_U
+43 SET ECODE1=ECODE1_ECXSTAT_U_$SELECT(ECXLOGIC<2005:ECXPRIOR,ECXLOGIC>2010:ECXSHADI,1:"")_U_ECXCNHU_U_U
+44 SET ECODE2=ECXHNCI_U_ECXETH_U_ECXRC1
+45 IF ECXLOGIC>2003
Begin DoDot:1
+46 SET ECODE2=ECODE2_U_ECXBCDD_U_ECXBCDG_U_ECXBCUA_U_ECXBCIF_U_ECXOPPC
End DoDot:1
+47 IF ECXLOGIC>2004
SET ECODE2=ECODE2_U_U_ECXPRIOR_ECXSBGRP_U_ECXUESTA_U_ECXPTYPE_U_ECXCVE_U_ECXCVEDT_U_ECXCVENC_U_ECXNPRFI
+48 IF ECXLOGIC>2006
SET ECODE2=ECODE2_U_ECXERI_U_ECXEST
+49 IF ECXLOGIC>2007
SET ECODE2=ECODE2_U_ECXOEF_U_ECXOEFDT_U_ECASNPI_U_ECXOPNPI_U_ECPTNPI
+50 IF ECXLOGIC>2009
SET ECODE2=ECODE2_U_ECXCNTRY
+51 IF ECXLOGIC>2010
SET ECODE2=ECODE2_U_ECXPATCAT
+52 ;144
IF ECXLOGIC>2013
SET ECODE2=ECODE2_U_ECXESC_U_ECXCLST_U_ECXECL
+53 ;149
IF ECXLOGIC>2014
SET ECODE2=ECODE2_U_ECXSVCI_U_ECXSVCL
+54 ;166
IF ECXLOGIC>2017
SET ECODE2=ECODE2_U_ECXSTANO
+55 ;174 ,184 Added "^"
IF ECXLOGIC>2019
SET ECODE2=ECODE2_U_ECXDEA_U
+56 ;184
IF ECXLOGIC>2022
SET ECODE3=$GET(ECXCERN)_U
SET ECODE4=ECXNMPI_U_ECXSIGI
+57 ;187 Adding Price Per Dispense Unit and Dispense Unit
IF ECXLOGIC>2023
SET ECODE4=ECODE4_U_ECXPPDU_U_ECXDUNIT
+58 SET ^ECX(ECFILE,EC7,0)=ECODE
SET ^ECX(ECFILE,EC7,1)=ECODE1
+59 ;,ECRN=ECRN+1 ;184 - Move record count to below
SET ^ECX(ECFILE,EC7,2)=ECODE2
+60 ;184
if ECXLOGIC>2022
SET ^ECX(ECFILE,EC7,3)=$GET(ECODE3)
SET ^ECX(ECFILE,EC7,4)=$GET(ECODE4)
+61 SET ECRN=ECRN+1
+62 SET DA=EC7
SET DIK="^ECX("_ECFILE_","
DO IX^DIK
KILL DIK,DA
+63 IF $DATA(ZTQUEUED)
IF $$S^%ZTLOAD
SET QFLG=1
+64 QUIT
SENDMSG ;181 - Called from ECXPIVDN
+1 NEW ECMSG,ECX,XMSUB,XMDUZ,XMY,XMTEXT
+2 ;Send missing stop code message
+3 SET ECX=$ORDER(^TMP($JOB,"ECXIVPM","ECXNOSC",0))
+4 IF ECX
Begin DoDot:1
+5 SET XMSUB="CLINICS WITH MISSING STOP CODE in File #44"
SET XMDUZ="DSS SYSTEM"
+6 KILL XMY
SET XMY("G.DSS-"_ECGRP_"@"_^XMB("NETNAME"))=""
+7 SET ECMSG(1,0)="The DSS-"_ECPACK_" extract (#"_$PIECE(EC23,U,2)_") for "_ECSDN_" through "_ECEDN
+8 SET ECMSG(2,0)="contains the following clinics which have not been assigned a stop code in"
+9 SET ECMSG(3,0)="the HOSPITAL LOCATION file (#44). The DSS-"_ECPACK_" extract records"
+10 SET ECMSG(4,0)="associated with these clinics have been given a default Stop Code of ""PHA""."
+11 SET ECMSG(5,0)=""
+12 SET ECMSG(6,0)="CLIN IEN CLINIC NAME"
+13 SET ECMSG(7,0)="-----------------------------------------"
+14 SET ECMSG(8,0)=""
+15 SET ECX=0
+16 FOR
SET ECX=$ORDER(^TMP($JOB,"ECXIVPM","ECXNOSC",ECX))
if ECX=""
QUIT
SET ECMSG(8+ECX,0)=^TMP($JOB,"ECXIVPM","ECXNOSC",ECX,0)
+17 SET XMTEXT="ECMSG("
DO ^XMD
End DoDot:1
+18 ;Send Inactive Stop Code message
+19 SET ECX=$ORDER(^TMP($JOB,"ECXIVPM","ECXINVSC",0))
+20 IF ECX
Begin DoDot:1
+21 SET XMSUB="CLINICS WITH INACTIVE STOP CODE"
SET XMDUZ="DSS SYSTEM"
+22 KILL XMY
SET XMY("G.DSS-"_ECGRP_"@"_^XMB("NETNAME"))=""
+23 SET ECMSG(1,0)="The DSS-"_ECPACK_" extract (#"_$PIECE(EC23,U,2)_") for "_ECSDN_" through "_ECEDN
+24 SET ECMSG(2,0)="contains the following clinics which have been assigned an inactive stop"
+25 SET ECMSG(3,0)="code in the HOSPITAL LOCATION file (#44). The DSS-"_ECPACK_" extract records"
+26 SET ECMSG(4,0)="associated with these clinics have been given a default Stop Code of ""PHA""."
+27 SET ECMSG(5,0)=""
+28 SET ECMSG(6,0)="CLINIC IEN/NAME STOP CODE NUMBER/NAME"
+29 SET ECMSG(7,0)="--------------------------------------------------------------------"
+30 SET ECMSG(8,0)=""
+31 SET ECX=0
+32 FOR
SET ECX=$ORDER(^TMP($JOB,"ECXIVPM","ECXINVSC",ECX))
if ECX=""
QUIT
SET ECMSG(8+ECX,0)=^TMP($JOB,"ECXIVPM","ECXINVSC",ECX,0)
+33 SET XMTEXT="ECMSG("
DO ^XMD
End DoDot:1
+34 KILL ^TMP($JOB,"ECXIVPM")
+35 QUIT