GMTSROB ; SLC/JER,KER - Surgery Reports Brief ; AUG 06,2002
;;2.7;Health Summary;**9,11,28,57,142**;Oct 20, 1995;Build 1
;
; External References
; DBIA 2491 ^SRF("B")
; DBIA 2491 ^SRF( file #130
; DBIA 10011 ^DIWP
; DBIA 2056 $$GET1^DIQ (file #130)
;
ENSR ; Entry point for component
N MAX,GMCOUNT,GMIDT,GMN,SURG Q:'$D(^SRF("B",DFN))
S MAX=$S(+($G(GMTSNDM))>0:+($G(GMTSNDM)),1:999)
S GMN=0 F S GMN=$O(^SRF("B",DFN,GMN)) Q:GMN'>0 D SORT
I '$D(SURG) Q
S (GMCOUNT,GMIDT)=0 F S GMIDT=$O(SURG(GMIDT)) Q:GMIDT'>0!(GMCOUNT'<MAX) S GMN=SURG(GMIDT) D WRT
Q
SORT ; Sort surgeries by inverted date
N GMDT S GMDT=$$GET1^DIQ(130,(+(GMN)_","),.09,"I")
I GMDT>GMTSBEG&(GMDT<GMTSEND) D
. F Q:'$D(SURG(9999999-GMDT)) S GMDT=GMDT+.0001
. S SURG(9999999-GMDT)=GMN
Q
WRT ; Write surgical case record
N X,GMI,GMDT,STATUS K ^UTILITY($J,"W")
S GMCOUNT=GMCOUNT+1
; Date of Operation
S X=$$GET1^DIQ(130,(+(GMN)_","),.09,"I") D REGDT4^GMTSU S GMDT=X
D CKP^GMTSUP Q:$D(GMTSQIT) W GMDT
D STATUS S:'$D(STATUS) STATUS="UNKNOWN"
; Principle Procedure
S X=$$GET1^DIQ(130,(+(GMN)_","),26,"I") D FORMAT
D CKP^GMTSUP Q:$D(GMTSQIT) W:$D(^UTILITY($J,"W",1,1,0)) ?21,^(0) W ?61,STATUS,!
S GMI=1 F S GMI=$O(^UTILITY($J,"W",1,GMI)) Q:GMI'>0 D CKP^GMTSUP Q:$D(GMTSQIT) W ?21,^UTILITY($J,"W",1,GMI,0),!
K ^UTILITY($J,"W")
; Other Procedures
S GMI=0 F S GMI=$O(^SRF(GMN,13,GMI)) Q:GMI'>0 D CKP^GMTSUP Q:$D(GMTSQIT) D
. S X(GMI)=$$GET1^DIQ(130.16,(+GMI_","_+(GMN)_","),.01,"I")
. W ?21,X(GMI),!
Q
STATUS ; case status
I $$GET1^DIQ(130,(+(GMN)_","),118,"I")="Y" D NONORST Q
I $D(^SRF(GMN,30)),$P(^(30),U,1)>0 S STATUS=$S(+($$GET1^DIQ(130,(+(GMN)_","),.205,"I")):"(ABORTED)",1:"CANCELLED") Q
I +($$GET1^DIQ(130,(+(GMN)_","),.23,"I")) S STATUS="(COMPLETED)" Q
I +($$GET1^DIQ(130,(+(GMN)_","),.22,"I")),'+($$GET1^DIQ(130,(+(GMN)_","),.23,"I")) S STATUS="INCOMPLETE" Q
I +($$GET1^DIQ(130,(+(GMN)_","),10,"I")) S STATUS="SCHEDULED" Q
I +($$GET1^DIQ(130,(+(GMN)_","),36,"I")),'+($$GET1^DIQ(130,(+(GMN)_","),.22,"I")) S STATUS="REQUESTED"
Q
FORMAT ; format surgery name
N DIWF,DIWL,DIWR
S DIWF="C35R",DIWL=1,DIWR=36 D ^DIWP
Q
NONORST ;Obtains status for NON-OR procedures.
S STATUS="UNKNOWN"
I +($$GET1^DIQ(130,(+(GMN)_","),122,"I")) S STATUS="(COMPLETED)" Q
I +($$GET1^DIQ(130,(+(GMN)_","),121,"I")),'+($$GET1^DIQ(130,(+(GMN)_","),122,"I")) S STATUS="INCOMPLETE" Q
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMTSROB 2463 printed Nov 22, 2024@17:10:21 Page 2
GMTSROB ; SLC/JER,KER - Surgery Reports Brief ; AUG 06,2002
+1 ;;2.7;Health Summary;**9,11,28,57,142**;Oct 20, 1995;Build 1
+2 ;
+3 ; External References
+4 ; DBIA 2491 ^SRF("B")
+5 ; DBIA 2491 ^SRF( file #130
+6 ; DBIA 10011 ^DIWP
+7 ; DBIA 2056 $$GET1^DIQ (file #130)
+8 ;
ENSR ; Entry point for component
+1 NEW MAX,GMCOUNT,GMIDT,GMN,SURG
if '$DATA(^SRF("B",DFN))
QUIT
+2 SET MAX=$SELECT(+($GET(GMTSNDM))>0:+($GET(GMTSNDM)),1:999)
+3 SET GMN=0
FOR
SET GMN=$ORDER(^SRF("B",DFN,GMN))
if GMN'>0
QUIT
DO SORT
+4 IF '$DATA(SURG)
QUIT
+5 SET (GMCOUNT,GMIDT)=0
FOR
SET GMIDT=$ORDER(SURG(GMIDT))
if GMIDT'>0!(GMCOUNT'<MAX)
QUIT
SET GMN=SURG(GMIDT)
DO WRT
+6 QUIT
SORT ; Sort surgeries by inverted date
+1 NEW GMDT
SET GMDT=$$GET1^DIQ(130,(+(GMN)_","),.09,"I")
+2 IF GMDT>GMTSBEG&(GMDT<GMTSEND)
Begin DoDot:1
+3 FOR
if '$DATA(SURG(9999999-GMDT))
QUIT
SET GMDT=GMDT+.0001
+4 SET SURG(9999999-GMDT)=GMN
End DoDot:1
+5 QUIT
WRT ; Write surgical case record
+1 NEW X,GMI,GMDT,STATUS
KILL ^UTILITY($JOB,"W")
+2 SET GMCOUNT=GMCOUNT+1
+3 ; Date of Operation
+4 SET X=$$GET1^DIQ(130,(+(GMN)_","),.09,"I")
DO REGDT4^GMTSU
SET GMDT=X
+5 DO CKP^GMTSUP
if $DATA(GMTSQIT)
QUIT
WRITE GMDT
+6 DO STATUS
if '$DATA(STATUS)
SET STATUS="UNKNOWN"
+7 ; Principle Procedure
+8 SET X=$$GET1^DIQ(130,(+(GMN)_","),26,"I")
DO FORMAT
+9 DO CKP^GMTSUP
if $DATA(GMTSQIT)
QUIT
if $DATA(^UTILITY($JOB,"W",1,1,0))
WRITE ?21,^(0)
WRITE ?61,STATUS,!
+10 SET GMI=1
FOR
SET GMI=$ORDER(^UTILITY($JOB,"W",1,GMI))
if GMI'>0
QUIT
DO CKP^GMTSUP
if $DATA(GMTSQIT)
QUIT
WRITE ?21,^UTILITY($JOB,"W",1,GMI,0),!
+11 KILL ^UTILITY($JOB,"W")
+12 ; Other Procedures
+13 SET GMI=0
FOR
SET GMI=$ORDER(^SRF(GMN,13,GMI))
if GMI'>0
QUIT
DO CKP^GMTSUP
if $DATA(GMTSQIT)
QUIT
Begin DoDot:1
+14 SET X(GMI)=$$GET1^DIQ(130.16,(+GMI_","_+(GMN)_","),.01,"I")
+15 WRITE ?21,X(GMI),!
End DoDot:1
+16 QUIT
STATUS ; case status
+1 IF $$GET1^DIQ(130,(+(GMN)_","),118,"I")="Y"
DO NONORST
QUIT
+2 IF $DATA(^SRF(GMN,30))
IF $PIECE(^(30),U,1)>0
SET STATUS=$SELECT(+($$GET1^DIQ(130,(+(GMN)_","),.205,"I")):"(ABORTED)",1:"CANCELLED")
QUIT
+3 IF +($$GET1^DIQ(130,(+(GMN)_","),.23,"I"))
SET STATUS="(COMPLETED)"
QUIT
+4 IF +($$GET1^DIQ(130,(+(GMN)_","),.22,"I"))
IF '+($$GET1^DIQ(130,(+(GMN)_","),.23,"I"))
SET STATUS="INCOMPLETE"
QUIT
+5 IF +($$GET1^DIQ(130,(+(GMN)_","),10,"I"))
SET STATUS="SCHEDULED"
QUIT
+6 IF +($$GET1^DIQ(130,(+(GMN)_","),36,"I"))
IF '+($$GET1^DIQ(130,(+(GMN)_","),.22,"I"))
SET STATUS="REQUESTED"
+7 QUIT
FORMAT ; format surgery name
+1 NEW DIWF,DIWL,DIWR
+2 SET DIWF="C35R"
SET DIWL=1
SET DIWR=36
DO ^DIWP
+3 QUIT
NONORST ;Obtains status for NON-OR procedures.
+1 SET STATUS="UNKNOWN"
+2 IF +($$GET1^DIQ(130,(+(GMN)_","),122,"I"))
SET STATUS="(COMPLETED)"
QUIT
+3 IF +($$GET1^DIQ(130,(+(GMN)_","),121,"I"))
IF '+($$GET1^DIQ(130,(+(GMN)_","),122,"I"))
SET STATUS="INCOMPLETE"
QUIT
+4 QUIT