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

GMTSRO.m

Go to the documentation of this file.
GMTSRO ; SLC/JER,KER - All Surgery Reports ; 06/24/2002 [8/3/04 2:10pm]
 ;;2.7;Health Summary;**9,11,28,37,57**;Oct 20, 1995
 ;
 ; External References
 ;   DBIA  3590  HS^SROGMTS
 ;                     
ENSRO ; Entry Point for Surgery Only Component
 S GMTSSO=1
 ;                               
ENSR ; Entry Point for SURGERY REPORT component
 ; (includes NON-OR procedures)
 N GMTSMX,GMCOUNT,GMIDT,GMN,SURG,GMTSGL S GMTSGL=$$GL^GMTSROE Q:'$L(GMTSGL)  Q:'$D(@(GMTSGL_"""B"","_DFN_")"))
 S GMTSMX=999 I $D(GMTSNDM),(GMTSNDM>0) S GMTSMX=GMTSNDM
 S GMN=0 F  S GMN=$O(@(GMTSGL_"""B"","_DFN_","_GMN_")")) Q:GMN'>0  D SORT
 Q:'$D(SURG)  S (GMCOUNT,GMIDT)=0 F  S GMIDT=$O(SURG(GMIDT)) Q:GMIDT'>0!(GMCOUNT'<GMTSMX)  S GMN=SURG(GMIDT) D WRT Q:$D(GMTSQIT)
 K GMTSSO Q
 ;                     
SORT ; Sort Surgeries by Inverse Date
 N GMDT S GMDT=$P($G(@(GMTSGL_GMN_",0)")),U,9) 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 REC,X,GMI,GMJ,GMDT,GMTSTR
 D:+($$PROK^GMTSU("SROGMTS",100))>0 HS^SROGMTS(GMN)
 D:+($$PROK^GMTSU("SROGMTS",100))'>0 ONE^GMTSROE(GMN)
NONOP ;   Non-Op Procedure
 ;     Quit if Surgery Only
 Q:$G(REC(130,GMN,118,"I"))="Y"&(+($G(GMTSSO))>0)
 ;     Print if SR*3*100
 ;G:+($$PROK^GMTSU("SROGMTS",100))>0 OPER
 I $G(REC(130,GMN,118,"I"))'="Y" G OPER
 ;     Print if NOT SR*3*100
 I $G(REC(130,GMN,118,"I"))="Y" Q:$G(GMTSSO)  D WRT^GMTSRON Q
 S GMCOUNT=GMCOUNT+1
OPER ;   Operative Procedure
SS ;     Date/Specialty/Surgeon
 D CKP^GMTSUP Q:$D(GMTSQIT)
 S GMDT=$G(REC(130,GMN,.09,"S")) S:'$L(GMDT) GMDT=$$ED^GMTSU($G(REC(130,GMN,.09,"I")))
 S GMTSTR=$G(REC(130,GMN,.04,"S")) S:$L($G(GMTSTR))>25 GMTSTR=$$WRAP^GMTSORC(GMTSTR,25)
 W $G(GMDT),?21,$P($G(GMTSTR),"|"),?47,"Surgeon:",?56,$G(REC(130,GMN,.14,"E")),!
 F GMI=2:1:$L($G(GMTSTR),"|") D CKP^GMTSUP Q:$D(GMTSQIT)  W ?23,$P($G(GMTSTR),"|",GMI),!
SPA ;     Status/Principal Anesthetist
 D CKP^GMTSUP Q:$D(GMTSQIT)
 W ?13,"Status:",?21,$G(REC(130,GMN,"STATUS"))
 W ?44,"Prin Anest:",?56,$G(REC(130,GMN,.31,"E")),!
PREDX ;     Principal Pre-Op Diagnosis
 D CKP^GMTSUP Q:$D(GMTSQIT)  W ?5,"Pre-op Diag(s):"
 S GMTSTR=$G(REC(130,GMN,32,"S")) S:GMTSTR="" GMTSTR=$G(REC(130,GMN,32,"E"))
 S:$L(GMTSTR)&($L($G(REC(130,GMN,"VERIFIED")))) GMTSTR=GMTSTR_" "_$G(REC(130,GMN,"VERIFIED")) S:$L(GMTSTR)>58 GMTSTR=$$WRAP^GMTSORC(GMTSTR,58)
 F GMJ=1:1:$L(GMTSTR,"|") D  Q:$D(GMTSQIT)
 . D CKP^GMTSUP Q:$D(GMTSQIT)  W ?$S(GMJ=1:21,1:22),$P(GMTSTR,"|",GMJ) W !
 Q:$D(GMTSQIT)
OPREDX ;       Other Pre-Op Diagnosis
 S GMI=0 F  S GMI=$O(REC(130,GMN,130.17,GMI)) Q:GMI'>0  D
 . S GMTSTR=$G(REC(130,GMN,130.17,GMI,.01,"S")) S:GMTSTR="" GMTSTR=$G(REC(130,GMN,130.17,GMI,.01,"E"))
 . S:$L(GMTSTR)&($L($G(REC(130,GMN,"VERIFIED")))) GMTSTR=GMTSTR_" "_$G(REC(130,GMN,"VERIFIED")) S:$L(GMTSTR)>58 GMTSTR=$$WRAP^GMTSORC(GMTSTR,58)
 . F GMJ=1:1:$L(GMTSTR,"|") D  Q:$D(GMTSQIT)
 . . D CKP^GMTSUP Q:$D(GMTSQIT)  W ?$S(GMJ=1:21,1:22),$P(GMTSTR,"|",GMJ) W !
 Q:$D(GMTSQIT)
PSTDX ;     Post-Op Diagnosis
 D CKP^GMTSUP Q:$D(GMTSQIT)  W ?4,"Post-op Diag(s):"
 S GMTSTR=$G(REC(130,GMN,34,"S")) S:GMTSTR="" GMTSTR=$G(REC(130,GMN,34,"E")) S:$L(GMTSTR)>58 GMTSTR=$$WRAP^GMTSORC(GMTSTR,58)
 F GMJ=1:1:$L(GMTSTR,"|") D CKP^GMTSUP Q:$D(GMTSQIT)  W ?$S(GMJ=1:21,1:22),$P(GMTSTR,"|",GMJ) W:GMJ=1&(GMTSTR?1.A.E) " ",$G(REC(130,GMN,"VERIFIED")) W !
OPSTDX ;       Other Post-Op Diagnosis
 S GMI=0 F  S GMI=$O(REC(130,GMN,130.18,GMI)) Q:GMI'>0  D
 . S GMTSTR=$G(REC(130,GMN,130.18,GMI,.01,"S")) S:GMTSTR="" GMTSTR=$G(REC(130,GMN,130.18,GMI,.01,"E")) S:$L(GMTSTR)>58 GMTSTR=$$WRAP^GMTSORC(GMTSTR,58)
 . F GMJ=1:1:$L(GMTSTR,"|") D CKP^GMTSUP Q:$D(GMTSQIT)  W ?$S(GMJ=1:21,1:22),$P(GMTSTR,"|",GMJ) W:GMJ=1&(GMTSTR?1.A.E) " ",$G(REC(130,GMN,"VERIFIED")) W !
OP ;     Operative Procedures
 D CKP^GMTSUP Q:$D(GMTSQIT)  W ?2,"Operative Proc(s):" S GMTSTR=$G(REC(130,GMN,26,"S")) S:GMTSTR="" GMTSTR=$G(REC(130,GMN,26,"E")) S:$L(GMTSTR)>58 GMTSTR=$$WRAP^GMTSORC(GMTSTR,58)
 F GMJ=1:1:$L(GMTSTR,"|") D  Q:$D(GMTSQIT)
 . D CKP^GMTSUP Q:$D(GMTSQIT)  W ?$S(GMJ=1:21,1:22),$P(GMTSTR,"|",GMJ),!
 Q:$D(GMTSQIT)
OPM ;       Operative Procedures (Modifiers)
 S GMI=0 F  S GMI=$O(REC(130,GMN,130.028,GMI)) Q:GMI'>0  D  Q:$D(GMTSQIT)
 . S GMTSTR=$G(REC(130,GMN,130.028,GMI,.01,"S")) S:GMTSTR="" GMTSTR=$G(REC(130,GMN,130.028,GMI,.01,"E")) S:$L(GMTSTR)>54 GMTSTR=$$WRAP^GMTSORC(GMTSTR,54)
 . F GMJ=1:1:$L(GMTSTR,"|") D  Q:$D(GMTSQIT)
 . . D CKP^GMTSUP Q:$D(GMTSQIT)  W ?$S(GMJ=1:25,1:26),$P(GMTSTR,"|",GMJ),!
 Q:$D(GMTSQIT)
OOP ;     Other Procedures
 S GMI=0 F  S GMI=$O(REC(130,GMN,130.16,GMI)) Q:GMI'>0  D
 . S GMTSTR=$G(REC(130,GMN,130.16,GMI,.01,"S")) S:GMTSTR="" GMTSTR=$G(REC(130,GMN,130.16,GMI,.01,"E")) S:$L(GMTSTR)>58 GMTSTR=$$WRAP^GMTSORC(GMTSTR,58)
 . F GMJ=1:1:$L(GMTSTR,"|") D  Q:$D(GMTSQIT)
 . . D CKP^GMTSUP Q:$D(GMTSQIT)
 . . W ?$S(GMJ=1:21,1:22),$P(GMTSTR,"|",GMJ),!
OOPM . ;       Other Operative Procedures (Modifiers)
 . N GMM S GMM=0 F  S GMM=$O(REC(130,GMN,130.16,GMI,130.164,GMM)) Q:+GMM=0  D
 . . S GMTSTR=$G(REC(130,GMN,130.16,GMI,130.164,GMM,.01,"S")) S:'$L(GMTSTR) GMTSTR=$G(REC(130,GMN,130.16,GMI,130.164,GMM,.01,"E")) S:$L(GMTSTR)>54 GMTSTR=$$WRAP^GMTSORC(GMTSTR,54)
 . . F GMJ=1:1:$L(GMTSTR,"|") D  Q:$D(GMTSQIT)
 . . . D CKP^GMTSUP Q:$D(GMTSQIT)  W ?$S(GMJ=1:25,1:26),$P(GMTSTR,"|",GMJ),!
 . Q:$D(GMTSQIT)
 Q:$D(GMTSQIT)
LAB ;     Lab Work
 I $L($G(REC(130,GMN,"LAB"))) D CKP^GMTSUP Q:$D(GMTSQIT)  W ?11,"Lab Work: ",$G(REC(130,GMN,"LAB")),!
RPTDT ;     Dates
DICDT ;       Dictation Date
 S GMTSTR=$G(REC(130,GMN,15,"S")) S:'$L(GMTSTR) GMTSTR=$G(REC(130,GMN,15,"E"))
 I $L(GMTSTR) D CKP^GMTSUP Q:$D(GMTSQIT)  W ?5,"Dictation Time:",?21,GMTSTR
TRCDT ;       Transcription Time
 S GMTSTR=$G(REC(130,GMN,39,"S")) S:'$L(GMTSTR) GMTSTR=$G(REC(130,GMN,39,"E"))
 I $L(GMTSTR) D CKP^GMTSUP Q:$D(GMTSQIT)  W ?41,"Transcription Time:",?61,GMTSTR
 D:$L($G(REC(130,GMN,15,"I")))!($L($G(REC(130,GMN,39,"I")))) CKP^GMTSUP Q:$D(GMTSQIT)  W:$L($G(REC(130,GMN,15,"I")))!($L($G(REC(130,GMN,39,"I")))) !
RPT ;     Dictation
 S GMCOUNT=+($G(GMCOUNT))+1
 I $O(REC(130,GMN,1.15,0))>0 D
 . I +($$PROK^GMTSU("SROGMTS",100))=0 N GMI D CKP^GMTSUP Q:$D(GMTSQIT)  W "Surgeon's Dictation:",!
 . S GMI=$S(+($$PROK^GMTSU("SROGMTS",100))=1:1,1:0) F  S GMI=$O(REC(130,GMN,1.15,GMI)) Q:+GMI=0  D  Q:$D(GMTSQIT)
 . . D CKP^GMTSUP Q:$D(GMTSQIT)  W ?2,$G(REC(130,GMN,1.15,GMI)),!
 Q:$D(GMTSQIT)
 Q