Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: DGPT401

DGPT401.m

Go to the documentation of this file.
DGPT401 ;ALB/MTC,HIOFO/FT - 401/402/403 Edits ;2/19/15 2:51pm
 ;;5.3;Registration;**164,729,884,1057**;Aug 13, 1993;Build 17
 ;
 ;no external references
 ;
 ;Edits for 401/402/403 transmission
EN ;called by RTE^DGPTAE (using indirection) 
 N ERROR
 S (DGPTEDFL,DGPTERC)=0,DGPTSTR=^TMP("AEDIT",$J,NODE,SEQ)
 S:$E(DGPTSTR,37,40)="2400" DGPTSTR=$E(DGPTSTR,1,36)_"2359"_$E(DGPTSTR,41,246)
SET ;parse data string and set variables. different record layout for dg*5.3*884
 D:DGPTFMT=2 SET9
 D:DGPTFMT=3 SET10
DATE ;date of surgery
 ; DGPTDDS - discharge DT
 ; DGPTDTS - admission DT
 ; DGPTSDD - surgery DT 
 S DGPTSDT=$E(DGPTSTR,31,40),(X,DGPTSDD)=$$FMDT^DGPT101($E(DGPTSDT,1,6))_"."_$E(DGPTSDT,7,10) S %DT="XT" D ^%DT K %DT I Y<0 S DGPTERC=405 D ERR G:DGPTEDFL EXIT
 I $$FMDIFF^XLFDT(DGPTDDS,DGPTSDD,2)<0 S DGPTERC=440 D ERR G:DGPTEDFL EXIT  ; DG*5.3*1057
 I $$FMDIFF^XLFDT(DGPTSDD,$$FMADD^XLFDT(DGPTDTS,,-72),2)<0 S DGPTERC=437 D ERR G:DGPTEDFL EXIT  ; DG*5.3*1057
 D DD^%DT S DGPTSDT=$E(Y,5,6)_"-"_$E(Y,1,3)_"-"_$E(Y,9,12)_" "_$S($P(Y,"@",2)]"":$E($P(Y,"@",2),1,5),1:"00:00")
 I DGPTSDT'?1.2N1"-"3U1"-"4N1" "2N1":"2N S DGPTERC=450 D ERR G:DGPTEDFL EXIT
 I ($P(DGPTSDD,".",2)="0000")!($P(DGPTDTS,".",2)="0000")!($P(DGPTDDS,".",2)="0000") S DGPTERC=$S(+DGPTSDD<+DGPTDTS:437,+DGPTSDD>+DGPTDDS:440,1:0)
SPEC ;specialty
 I ((DGPTSSC>63)!(DGPTSSC<48))&((DGPTSSC'=65)&(DGPTSSC'=78)&(DGPTSSC'=97)) S DGPTERC=406 D ERR G:DGPTEDFL EXIT
CHFS ;chief surgeon
 S DGPTERC=0 D CHIEF^DGPTAE04 I DGPTERC D ERR G:DGPTEDFL EXIT
FAST ;first assistant
 S DGPTERC=0 D FAST^DGPTAE04 I DGPTERC D ERR G:DGPTEDFL EXIT
ANES ;anesthesia technique
 S DGPTERC=0 D ANES^DGPTAE04 I DGPTERC D ERR G:DGPTEDFL EXIT
SRP ;source of payment
 N I,FLAG
 I "12 "'[DGPTSSP S DGPTERC=410 D ERR G:DGPTEDFL EXIT
 S FLAG=0 F I=20:1:26 I DGPTSTTY[U_I_U S FLAG=1 Q
 G:FLAG OPCD
 I "12"[DGPTSSP S DGPTERC=410 F I=10,11,30,40,42 I DGPTSTTY[U_I_U S FLAG=1,DGPTERC=0 Q
 I FLAG D ERR G:DGPTEDFL EXIT
OPCD ;operation codes
 S DGPTERC=0 D FIRST^DGPTAE04 G:DGPTEDFL EXIT
TRANS ; Transplant status
 I DGPTFMT=2 D  ;check only if icd-9, otherwise this field will not be used with ICD-10 
 .I DGPTDDS'<2911001 G GOOD
 .S DGPTERC=0 D TRAN^DGPTAE04 I DGPTERC D ERR G:DGPTEDFL EXIT
GOOD ;
 W:'$D(ERROR) "."
EXIT ;
 K DGPTSDT,DGPTSSC,DGPTSCS,DGPTSFA,DGPTSAT,DGPTSSP,DGPTSTR,DGPTSDD,DGPT40PT,DGPTXX
 K DGPTSO1,DGPTSO2,DGPTSO3,DGPTSO4,DGPTSO5,DGPTSO6,DGPTSO7,DGPTSO8,DGPTSO9,DGPTSO10
 K DGPTSO11,DGPTSO12,DGPTSO13,DGPTSO14,DGPTSO15,DGPTSO16,DGPTSO17,DGPTSO18,DGPTSO19,DGPTSO20
 K DGPTSO21,DGPTSO22,DGPTSO23,DGPTSO24,DGPTSO25
 Q
ERR ;
 D WRTERR^DGPTAE(DGPTERC,NODE,SEQ)
 S ERROR=1
 Q
SET9 ;record layout before icd10 turned on
 S DGPTSDT=$E(DGPTSTR,31,40) ;31-36 is date of surgery, 37-40 is time of surgery
 S DGPTSSC=$E(DGPTSTR,41,42) ;specialty
 S DGPTSCS=$E(DGPTSTR,43) ;category of chief surgeon
 S DGPTSFA=$E(DGPTSTR,44) ;category of first assistant
 S DGPTSAT=$E(DGPTSTR,45) ;anesthesia technique (principal)
 S DGPTSSP=$E(DGPTSTR,46) ;source of payment
 S DGPTSO1=$E(DGPTSTR,47,53) ;operation codes 1-5
 S DGPTSO2=$E(DGPTSTR,54,60)
 S DGPTSO3=$E(DGPTSTR,61,67)
 S DGPTSO4=$E(DGPTSTR,68,74)
 S DGPTSO5=$E(DGPTSTR,75,81)
 S DGPTXX=$E(DGPTSTR,82,90) ;set & killed, otherwise not used.
 S DGPT40PT=$E(DGPTSTR,91) ;transplant status. Note: not used with ICD-10
 Q
SET10 ; record layout after icd10 turned on 
 S DGPTSDT=$E(DGPTSTR,31,40) ;31-36 is date of surgery, 37-40 is time of surgery
 S DGPTSSC=$E(DGPTSTR,41,42) ;specialty
 S DGPTSCS=$E(DGPTSTR,43) ;category of chief surgeon
 S DGPTSFA=$E(DGPTSTR,44) ;category of first assistant
 S DGPTSAT=$E(DGPTSTR,45) ;anesthesia technique (principal)
 S DGPTSSP=$E(DGPTSTR,46) ;source of payment
 S DGPTSO1=$E(DGPTSTR,47,53) ;the procedure code is 7 characters, The 8th character is a space when transmitting.
 S DGPTSO2=$E(DGPTSTR,55,61) ;grabbing 7 characters instead of 8.
 S DGPTSO3=$E(DGPTSTR,63,69)
 S DGPTSO4=$E(DGPTSTR,71,77)
 S DGPTSO5=$E(DGPTSTR,79,85)
 S DGPTSO6=$E(DGPTSTR,87,93)
 S DGPTSO7=$E(DGPTSTR,95,101)
 S DGPTSO8=$E(DGPTSTR,103,109)
 S DGPTSO9=$E(DGPTSTR,111,117)
 S DGPTSO10=$E(DGPTSTR,119,125)
 S DGPTSO11=$E(DGPTSTR,127,133)
 S DGPTSO12=$E(DGPTSTR,135,141)
 S DGPTSO13=$E(DGPTSTR,143,149)
 S DGPTSO14=$E(DGPTSTR,151,157)
 S DGPTSO15=$E(DGPTSTR,159,165)
 S DGPTSO16=$E(DGPTSTR,167,173)
 S DGPTSO17=$E(DGPTSTR,175,181)
 S DGPTSO18=$E(DGPTSTR,183,189)
 S DGPTSO19=$E(DGPTSTR,191,197)
 S DGPTSO20=$E(DGPTSTR,199,205)
 S DGPTSO21=$E(DGPTSTR,207,213)
 S DGPTSO22=$E(DGPTSTR,215,221)
 S DGPTSO23=$E(DGPTSTR,223,229)
 S DGPTSO24=$E(DGPTSTR,231,237)
 S DGPTSO25=$E(DGPTSTR,239,245)
 Q