source: WorldVistAEHR/trunk/r/HEALTH_SUMMARY-GMTS/GMTSROB.m@ 724

Last change on this file since 724 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.3 KB
Line 
1GMTSROB ; SLC/JER,KER - Surgery Reports Brief ; 06/24/2002
2 ;;2.7;Health Summary;**9,11,28,57**;Oct 20, 1995
3 ;
4 ; External References
5 ; DBIA 2491 ^SRF("B")
6 ; DBIA 2491 ^SRF( file #130
7 ; DBIA 10011 ^DIWP
8 ; DBIA 2056 $$GET1^DIQ (file #130)
9 ;
10ENSR ; Entry point for component
11 N MAX,GMCOUNT,GMIDT,GMN,SURG Q:'$D(^SRF("B",DFN))
12 S MAX=$S(+($G(GMTSNDM))>0:+($G(GMTSNDM)),1:999)
13 S GMN=0 F S GMN=$O(^SRF("B",DFN,GMN)) Q:GMN'>0 D SORT
14 I '$D(SURG) Q
15 S (GMCOUNT,GMIDT)=0 F S GMIDT=$O(SURG(GMIDT)) Q:GMIDT'>0!(GMCOUNT'<MAX) S GMN=SURG(GMIDT) D WRT
16 Q
17SORT ; Sort surgeries by inverted date
18 N GMDT S GMDT=$$GET1^DIQ(130,(+(GMN)_","),.09,"I")
19 I GMDT>GMTSBEG&(GMDT<GMTSEND) D
20 . F Q:'$D(SURG(9999999-GMDT)) S GMDT=GMDT+.0001
21 . S SURG(9999999-GMDT)=GMN
22 Q
23WRT ; Write surgical case record
24 N X,GMI,GMDT,STATUS K ^UTILITY($J,"W")
25 S GMCOUNT=GMCOUNT+1
26 ; Date of Operation
27 S X=$$GET1^DIQ(130,(+(GMN)_","),.09,"I") D REGDT4^GMTSU S GMDT=X
28 D CKP^GMTSUP Q:$D(GMTSQIT) W GMDT
29 D STATUS S:'$D(STATUS) STATUS="UNKNOWN"
30 ; Principle Procedure
31 S X=$$GET1^DIQ(130,(+(GMN)_","),26,"I") D FORMAT
32 D CKP^GMTSUP Q:$D(GMTSQIT) W:$D(^UTILITY($J,"W",1,1,0)) ?21,^(0) W ?61,STATUS,!
33 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),!
34 K ^UTILITY($J,"W")
35 ; Other Procedures
36 S GMI=0 F S GMI=$O(^SRF(GMN,13,GMI)) Q:GMI'>0 D CKP^GMTSUP Q:$D(GMTSQIT) D
37 . S X(GMI)=$$GET1^DIQ(130.16,(+GMI_","_+(GMN)_","),.01,"I")
38 . W ?21,X(GMI),!
39 Q
40STATUS ; case status
41 I $$GET1^DIQ(130,(+(GMN)_","),118,"I")="Y" D NONORST Q
42 I $D(^SRF(GMN,30)) S STATUS=$S(+($$GET1^DIQ(130,(+(GMN)_","),.205,"I")):"(ABORTED)",1:"CANCELLED") Q
43 I +($$GET1^DIQ(130,(+(GMN)_","),.23,"I")) S STATUS="(COMPLETED)" Q
44 I +($$GET1^DIQ(130,(+(GMN)_","),.22,"I")),'+($$GET1^DIQ(130,(+(GMN)_","),.23,"I")) S STATUS="INCOMPLETE" Q
45 I +($$GET1^DIQ(130,(+(GMN)_","),10,"I")) S STATUS="SCHEDULED" Q
46 I +($$GET1^DIQ(130,(+(GMN)_","),36,"I")),'+($$GET1^DIQ(130,(+(GMN)_","),.22,"I")) S STATUS="REQUESTED"
47 Q
48FORMAT ; format surgery name
49 N DIWF,DIWL,DIWR
50 S DIWF="C35R",DIWL=1,DIWR=36 D ^DIWP
51 Q
52NONORST ;Obtains status for NON-OR procedures.
53 S STATUS="UNKNOWN"
54 I +($$GET1^DIQ(130,(+(GMN)_","),122,"I")) S STATUS="(COMPLETED)" Q
55 I +($$GET1^DIQ(130,(+(GMN)_","),121,"I")),'+($$GET1^DIQ(130,(+(GMN)_","),122,"I")) S STATUS="INCOMPLETE" Q
56 Q
Note: See TracBrowser for help on using the repository browser.