ECXSURG1 ;ALB/JA,BIR/DMA,PTD-Surgery Extract for DSS ;4/24/18 15:36
;;3.0;DSS EXTRACTS;**105,112,120,127,132,144,149,161,166,170,184**;Dec 22, 1997;Build 124
;
FILE ;file record
;node0
;division^dfn^ssn^name^in/out (ECXA)^day^case #^
;surg specialty^or room #^
;surgeon^attending^anesthesia supervisor^anesthesia technique^
;primary/secondary/prostheses^placeholder^^pt time^op time^anes time^
;prostheses^qty^^
;movement number^treating specialty^cancel/abort (ECCAN)^time^or type^
;attending's service^non-or dss id^recovery room time^^
;Placehold primary care team^Placehold primary care provider^admission date
;node1
;mpi^placeholder ECXDSSD^surgeon npi^attending npi^anes supervisor npi^
;pc provider npi^Placehold pc prov person class^
;Placehold assoc pc provider^Placehold assoc pc prov person class^assoc pc prov npi^
;cpt&modifiers ECXCPT^dom ECXDOM^enrollment category ECXCAT^
;enrollment status ECXSTAT^enrollment priority ECXPRIOR^
;period of service ECXPOS^purple heart indicator ECXPHI^
;observ pat ind ECXOBS^encounter num ECXENC^ao loc ECXAOL^
;production division ECXPDIV^head & neck canc ind ECXHNCI^
;Placehold ethnicity ECXETH^Placehold race1 ECXRC1^new quantity ECXQ^
;^user enrollee ECXUESTA^patient type ECXPTYPE^combat vet elig
;ECXCVE^combat vet elig end date ECXCVEDT^enc cv eligible ECXCVENC
;or clean time ECXORCT^time pt in hold area ECXPTHA^national patient
;record flag ECXNPRFI^princ anesthetist ECXPA^surgeon per class ECSRPC
;node2
;atten surgeon per class ECATPC^anesthesia super person class ECSAPC^
;princ anesthetist PC ECXPAPC^emergency response indicator(FEMA) ECXERI^
;agent orange indic ECXAO^head/neck cancer ECXHNC
;OEF/OIF ECXOEF^OEF/OIF return date ECXOEFDT^clinic pointer ECXCLIN
;credit stop ECXCRST^stop code ECXSTCD^Placeholder ECXPODX^
;Placeholder ECXPODX1^Placeholder ECXPODX2^Placeholder ECXPODX3^
;Placeholder ECXPODX4^Placeholder ECXPODX5^
;anesthesia sup npi ECSANPI^Placehold assoc pc prov npi ECASNPI^
;attending surgeon npi ECATNPI^Placehold primary care provider npi ECPTNPI^
;principle anesthetist npi ECPANPI^surgeon npi ECSRNPI
;encounter ec ECENEC^radiation encounter indicator ECENRI^
;mst encounter indicator ECENMST^encounter sc ECENSC^
;agent orange status ECXAST^
;environmental contaminants ECXEST^radiation status ECXRST^
;mst status ECXMST^shad indicator ECXSHADI^encounter shad ECXSHAD^
;NODE3
;1st assist EC1A^1st assist pc EC1APC^1st assist npi EC1ANPI^
;2nd assist EC2A^2nd assist pc EC2APC^2nd assist npi EC2ANPI^
;perfusionist ECPQ^perfusionist pc ECPQPC^perfusionist npi ECQANPI^
;anesthesia severity ECASA^patcat PATCAT^date of birth ECXDOB
;Vietnam Status ECXVNS^Camp Lejeune Status ECXCLST^Encounter Camp Lejeune ECXECL^
;Concurrent Case ECXCONC^Principle post op icd-10 ECICD10^post op icd-10 code #1 ECICD101^post op icd-10 code #2 ECICD102^
;post op icd-10 code #3 ECICD103^post op icd-10 code #4 ECICD104^post op icd-10 code #5 ECICD105^
;Combat Service Indicator (ECXSVCI)^Combat Service Location (ECXSVCL)^
;NODE 4
;medical specialty of non-OR provider (ECXNONMS)^transplant organ 1 (ECXORG1)^trans org 2 (ECXORG2)^trans org 3 (ECXORG3)^
;Patient Division (ECXSTANO) ;166
;convert specialty to PTF Code for transmission
;NODE 5 ;184
;Placehold CERNER (ECXCERN)^
;NODE 6 ;184
;New MPI (ECXNMPI)^Self Identified Gender (ECXSIG)
;
N ECXDATA,ECXTSC
S ECXDATA=$$TSDATA^DGACT(42.4,+ECXTS,.ECXDATA)
S ECXTSC=$G(ECXDATA(7))
;done
N DA,DIK,STR
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>2022 S ECXMPI="" ;184 field retired
S ECODE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OGIC>2008 S ECODE2=ECODE2_U_$G(ECENEC)_U_$G(ECENRI)_U_$G(ECENMST)_U_$G(ECENSC)_U_$G(ECXAST)_U_$G(ECXEST)_U_$G(ECXRST)_U_$G(ECXMST)
I ECXLOGIC>2010 S ECODE2=ECODE2_U_$G(ECXSHADI)_U_$G(ECXSHAD)_U,ECODE3=$G(EC1A)_U_$G(EC1APC)_U_$G(EC1ANPI)
I ECXLOGIC>2010 S ECODE3=ECODE3_U_$G(EC2A)_U_$G(EC2APC)_U_(EC2ANPI)_U_$G(ECPQ)_U_$G(ECPQPC)_U_$G(ECPQNPI)_U_$G(ECQA)_U_$G(ECQAPC)_U_$G(ECQANPI)_U_$G(ECASA)_U_ECXPATCAT
I ECXLOGIC>2011 S ECODE3=ECODE3_U_$G(ECXDOB)
I ECXLOGIC>2013 S ECODE3=ECODE3_U_ECXVNS_U_ECXCLST_U_ECXECL ;144
I ECXLOGIC>2013 S ECODE3=ECODE3_U_ECXCONC_U_ECICD10_U_ECICD101_U_ECICD102_U_ECICD103_U_ECICD104_U_ECICD105 ;144 Concurrent case ICD-10
I ECXLOGIC>2014 S ECODE3=ECODE3_U_ECXSVCI_U_ECXSVCL ;149
I ECXLOGIC>2017 S ECODE3=ECODE3_U,ECODE4=ECXNONMS_U_$G(ECXORG1)_U_$G(ECXORG2)_U_$G(ECXORG3)_U_$G(ECXSTANO)_U ;166,184 - Added "^"
I ECXLOGIC>2022 S ECODE5=$G(ECXCERN)_U,ECODE6=ECXNMPI_U_ECXSIGI ;184
S ^ECX(ECFILE,EC7,0)=ECODE,^ECX(ECFILE,EC7,1)=ECODE1,^ECX(ECFILE,EC7,2)=$G(ECODE2),^ECX(ECFILE,EC7,3)=$G(ECODE3),^ECX(ECFILE,EC7,4)=$G(ECODE4) ;166, 184 move Record count to below
S ^ECX(ECFILE,EC7,5)=$G(ECODE5),^ECX(ECFILE,EC7,6)=$G(ECODE6) ;184
S ECRN=ECRN+1 ;184 Moved from above
S DA=EC7,DIK="^ECX("_ECFILE_"," D IX1^DIK K DIK,DA
I $D(ZTQUEUED),$$S^%ZTLOAD S QFLG=1
;
TIME ; given date/time get increment
;A1=later, A2=earlier, TIME=difference
N CON,TIMEDIF
S CON=$P($G(^SRF(ECD0,"CON")),U)
;
;-Get time diff (in secs) & set to .5 if < 7.5 minutes (rounds to 1)
S TIMEDIF=$$FMDIFF^XLFDT(A1,A2,2)/900
S TIMEDIF=$S(TIMEDIF>0&(TIMEDIF<.5):.5,1:TIMEDIF)
I 'CON D
.S TIME=$J($TR($J(TIMEDIF,4,0)," "),2,1)
.S:TIME>"99.0" TIME="99.0"
I CON D
.S TIME=$J(($TR($J(TIMEDIF,4,0)," ")/2),2,1)
.S:TIME>"99.5" TIME="99.5"
S:TIME<0 TIME="###"
Q
;
SETUP ;Set required input for ECXTRAC
S ECHEAD="SUR"
D ECXDEF^ECXUTL2(ECHEAD,.ECPACK,.ECGRP,.ECFILE,.ECRTN,.ECPIECE,.ECVER)
Q
;
QUE ; entry point for the background requeuing handled by ECXTAUTO
D SETUP,QUE^ECXTAUTO,^ECXKILL Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HECXSURG1 6967 printed Dec 13, 2024@01:54:01 Page 2
ECXSURG1 ;ALB/JA,BIR/DMA,PTD-Surgery Extract for DSS ;4/24/18 15:36
+1 ;;3.0;DSS EXTRACTS;**105,112,120,127,132,144,149,161,166,170,184**;Dec 22, 1997;Build 124
+2 ;
FILE ;file record
+1 ;node0
+2 ;division^dfn^ssn^name^in/out (ECXA)^day^case #^
+3 ;surg specialty^or room #^
+4 ;surgeon^attending^anesthesia supervisor^anesthesia technique^
+5 ;primary/secondary/prostheses^placeholder^^pt time^op time^anes time^
+6 ;prostheses^qty^^
+7 ;movement number^treating specialty^cancel/abort (ECCAN)^time^or type^
+8 ;attending's service^non-or dss id^recovery room time^^
+9 ;Placehold primary care team^Placehold primary care provider^admission date
+10 ;node1
+11 ;mpi^placeholder ECXDSSD^surgeon npi^attending npi^anes supervisor npi^
+12 ;pc provider npi^Placehold pc prov person class^
+13 ;Placehold assoc pc provider^Placehold assoc pc prov person class^assoc pc prov npi^
+14 ;cpt&modifiers ECXCPT^dom ECXDOM^enrollment category ECXCAT^
+15 ;enrollment status ECXSTAT^enrollment priority ECXPRIOR^
+16 ;period of service ECXPOS^purple heart indicator ECXPHI^
+17 ;observ pat ind ECXOBS^encounter num ECXENC^ao loc ECXAOL^
+18 ;production division ECXPDIV^head & neck canc ind ECXHNCI^
+19 ;Placehold ethnicity ECXETH^Placehold race1 ECXRC1^new quantity ECXQ^
+20 ;^user enrollee ECXUESTA^patient type ECXPTYPE^combat vet elig
+21 ;ECXCVE^combat vet elig end date ECXCVEDT^enc cv eligible ECXCVENC
+22 ;or clean time ECXORCT^time pt in hold area ECXPTHA^national patient
+23 ;record flag ECXNPRFI^princ anesthetist ECXPA^surgeon per class ECSRPC
+24 ;node2
+25 ;atten surgeon per class ECATPC^anesthesia super person class ECSAPC^
+26 ;princ anesthetist PC ECXPAPC^emergency response indicator(FEMA) ECXERI^
+27 ;agent orange indic ECXAO^head/neck cancer ECXHNC
+28 ;OEF/OIF ECXOEF^OEF/OIF return date ECXOEFDT^clinic pointer ECXCLIN
+29 ;credit stop ECXCRST^stop code ECXSTCD^Placeholder ECXPODX^
+30 ;Placeholder ECXPODX1^Placeholder ECXPODX2^Placeholder ECXPODX3^
+31 ;Placeholder ECXPODX4^Placeholder ECXPODX5^
+32 ;anesthesia sup npi ECSANPI^Placehold assoc pc prov npi ECASNPI^
+33 ;attending surgeon npi ECATNPI^Placehold primary care provider npi ECPTNPI^
+34 ;principle anesthetist npi ECPANPI^surgeon npi ECSRNPI
+35 ;encounter ec ECENEC^radiation encounter indicator ECENRI^
+36 ;mst encounter indicator ECENMST^encounter sc ECENSC^
+37 ;agent orange status ECXAST^
+38 ;environmental contaminants ECXEST^radiation status ECXRST^
+39 ;mst status ECXMST^shad indicator ECXSHADI^encounter shad ECXSHAD^
+40 ;NODE3
+41 ;1st assist EC1A^1st assist pc EC1APC^1st assist npi EC1ANPI^
+42 ;2nd assist EC2A^2nd assist pc EC2APC^2nd assist npi EC2ANPI^
+43 ;perfusionist ECPQ^perfusionist pc ECPQPC^perfusionist npi ECQANPI^
+44 ;anesthesia severity ECASA^patcat PATCAT^date of birth ECXDOB
+45 ;Vietnam Status ECXVNS^Camp Lejeune Status ECXCLST^Encounter Camp Lejeune ECXECL^
+46 ;Concurrent Case ECXCONC^Principle post op icd-10 ECICD10^post op icd-10 code #1 ECICD101^post op icd-10 code #2 ECICD102^
+47 ;post op icd-10 code #3 ECICD103^post op icd-10 code #4 ECICD104^post op icd-10 code #5 ECICD105^
+48 ;Combat Service Indicator (ECXSVCI)^Combat Service Location (ECXSVCL)^
+49 ;NODE 4
+50 ;medical specialty of non-OR provider (ECXNONMS)^transplant organ 1 (ECXORG1)^trans org 2 (ECXORG2)^trans org 3 (ECXORG3)^
+51 ;Patient Division (ECXSTANO) ;166
+52 ;convert specialty to PTF Code for transmission
+53 ;NODE 5 ;184
+54 ;Placehold CERNER (ECXCERN)^
+55 ;NODE 6 ;184
+56 ;New MPI (ECXNMPI)^Self Identified Gender (ECXSIG)
+57 ;
+58 NEW ECXDATA,ECXTSC
+59 SET ECXDATA=$$TSDATA^DGACT(42.4,+ECXTS,.ECXDATA)
+60 SET ECXTSC=$GET(ECXDATA(7))
+61 ;done
+62 NEW DA,DIK,STR
+63 SET EC7=$ORDER(^ECX(ECFILE,999999999),-1)
SET EC7=EC7+1
+64 ;170 Fields will now be null
IF ECXLOGIC>2018
SET (ECXETH,ECXRC1,ECPTTM,ECPTPR,ECCLAS,ECASPR,ECCLAS2,ECASNPI,ECPTNPI)=""
+65 ;184 field retired
IF ECXLOGIC>2022
SET ECXMPI=""
+66 SET ECODE=EC7_U_EC23_U_ECXDIV_U_ECXDFN_U_ECXSSN_U_ECXPNM_U_ECXA_U
+67 SET ECODE=ECODE_$$ECXDATE^ECXUTL(ECXDATE,ECXYM)_U_ECD0_U_ECSS_U_ECO_U
+68 SET ECODE=ECODE_ECSR_U_ECAT_U_ECSA_U_ECANE_U_ECODE0_U
+69 SET STR=ECXMN_U_ECXTSC_U_$SELECT(ECCAN'="":ECCAN,1:"")_U_ECXTM_U_ECORTY_U
+70 SET STR=STR_ECATSV_U_ECNL_U_ECRR_U_U_ECPTTM_U_ECPTPR_U_ECXADD_U
+71 SET $PIECE(ECODE,U,26,38)=STR
+72 SET ECODE1=ECXMPI_U_ECXDSSD_U_U_U_U_U
+73 SET ECODE1=ECODE1_ECCLAS_U_ECASPR_U_ECCLAS2_U_U_ECXCPT_U_ECXDOM_U
+74 SET ECODE1=ECODE1_ECXCAT_U_ECXSTAT_U_$SELECT(ECXLOGIC<2005:ECXPRIOR,1:"")_U_ECXPOS_U_ECXPHI_U
+75 SET ECODE1=ECODE1_ECXOBS_U_ECXENC_U_ECXAOL_U_ECXPDIV_U_ECXHNCI_U
+76 SET ECODE1=ECODE1_ECXETH_U_ECXRC1_U_ECXQ_U
+77 IF ECXLOGIC>2004
SET ECODE1=ECODE1_U_ECXPRIOR_ECXSBGRP_U_ECXUESTA_U_ECXPTYPE_U_ECXCVE_U_ECXCVEDT_U_ECXCVENC_U_ECXORCT_U_ECXPTHA_U_ECXNPRFI
+78 IF ECXLOGIC>2005
SET ECODE1=ECODE1_U_ECXPA_U_ECSRPC_U
SET ECODE2=ECATPC_U_ECSAPC_U_ECXPAPC
+79 IF ECXLOGIC>2006
SET ECODE2=ECODE2_U_ECXERI_U_ECXAO_U_ECXHNC
+80 IF ECXLOGIC>2007
SET ECODE2=ECODE2_U_ECXOEF_U_ECXOEFDT_U_ECXCLIN_U_ECXCRST_U_ECXSTCD_U_ECXPODX_U_ECXPODX1_U_ECXPODX2_U_ECXPODX3_U_ECXPODX4_U_ECXPODX5_U_ECSANPI_U_ECASNPI_U_ECATNPI_U_ECPTNPI_U_ECPANPI_U_ECSRNPI
+81 IF ECXLOGIC>2008
SET ECODE2=ECODE2_U_$GET(ECENEC)_U_$GET(ECENRI)_U_$GET(ECENMST)_U_$GET(ECENSC)_U_$GET(ECXAST)_U_$GET(ECXEST)_U_$GET(ECXRST)_U_$GET(ECXMST)
+82 IF ECXLOGIC>2010
SET ECODE2=ECODE2_U_$GET(ECXSHADI)_U_$GET(ECXSHAD)_U
SET ECODE3=$GET(EC1A)_U_$GET(EC1APC)_U_$GET(EC1ANPI)
+83 IF ECXLOGIC>2010
SET ECODE3=ECODE3_U_$GET(EC2A)_U_$GET(EC2APC)_U_(EC2ANPI)_U_$GET(ECPQ)_U_$GET(ECPQPC)_U_$GET(ECPQNPI)_U_$GET(ECQA)_U_$GET(ECQAPC)_U_$GET(ECQANPI)_U_$GET(ECASA)_U_ECXPATCAT
+84 IF ECXLOGIC>2011
SET ECODE3=ECODE3_U_$GET(ECXDOB)
+85 ;144
IF ECXLOGIC>2013
SET ECODE3=ECODE3_U_ECXVNS_U_ECXCLST_U_ECXECL
+86 ;144 Concurrent case ICD-10
IF ECXLOGIC>2013
SET ECODE3=ECODE3_U_ECXCONC_U_ECICD10_U_ECICD101_U_ECICD102_U_ECICD103_U_ECICD104_U_ECICD105
+87 ;149
IF ECXLOGIC>2014
SET ECODE3=ECODE3_U_ECXSVCI_U_ECXSVCL
+88 ;166,184 - Added "^"
IF ECXLOGIC>2017
SET ECODE3=ECODE3_U
SET ECODE4=ECXNONMS_U_$GET(ECXORG1)_U_$GET(ECXORG2)_U_$GET(ECXORG3)_U_$GET(ECXSTANO)_U
+89 ;184
IF ECXLOGIC>2022
SET ECODE5=$GET(ECXCERN)_U
SET ECODE6=ECXNMPI_U_ECXSIGI
+90 ;166, 184 move Record count to below
SET ^ECX(ECFILE,EC7,0)=ECODE
SET ^ECX(ECFILE,EC7,1)=ECODE1
SET ^ECX(ECFILE,EC7,2)=$GET(ECODE2)
SET ^ECX(ECFILE,EC7,3)=$GET(ECODE3)
SET ^ECX(ECFILE,EC7,4)=$GET(ECODE4)
+91 ;184
SET ^ECX(ECFILE,EC7,5)=$GET(ECODE5)
SET ^ECX(ECFILE,EC7,6)=$GET(ECODE6)
+92 ;184 Moved from above
SET ECRN=ECRN+1
+93 SET DA=EC7
SET DIK="^ECX("_ECFILE_","
DO IX1^DIK
KILL DIK,DA
+94 IF $DATA(ZTQUEUED)
IF $$S^%ZTLOAD
SET QFLG=1
+95 ;
TIME ; given date/time get increment
+1 ;A1=later, A2=earlier, TIME=difference
+2 NEW CON,TIMEDIF
+3 SET CON=$PIECE($GET(^SRF(ECD0,"CON")),U)
+4 ;
+5 ;-Get time diff (in secs) & set to .5 if < 7.5 minutes (rounds to 1)
+6 SET TIMEDIF=$$FMDIFF^XLFDT(A1,A2,2)/900
+7 SET TIMEDIF=$SELECT(TIMEDIF>0&(TIMEDIF<.5):.5,1:TIMEDIF)
+8 IF 'CON
Begin DoDot:1
+9 SET TIME=$JUSTIFY($TRANSLATE($JUSTIFY(TIMEDIF,4,0)," "),2,1)
+10 if TIME>"99.0"
SET TIME="99.0"
End DoDot:1
+11 IF CON
Begin DoDot:1
+12 SET TIME=$JUSTIFY(($TRANSLATE($JUSTIFY(TIMEDIF,4,0)," ")/2),2,1)
+13 if TIME>"99.5"
SET TIME="99.5"
End DoDot:1
+14 if TIME<0
SET TIME="###"
+15 QUIT
+16 ;
SETUP ;Set required input for ECXTRAC
+1 SET ECHEAD="SUR"
+2 DO ECXDEF^ECXUTL2(ECHEAD,.ECPACK,.ECGRP,.ECFILE,.ECRTN,.ECPIECE,.ECVER)
+3 QUIT
+4 ;
QUE ; entry point for the background requeuing handled by ECXTAUTO
+1 DO SETUP
DO QUE^ECXTAUTO
DO ^ECXKILL
QUIT