source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORDV04A.m@ 1686

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

revised back to 6/30/08 version

File size: 3.4 KB
RevLine 
[623]1ORDV04A ;SLC/DAN - OE/RR ;7/30/01 14:33
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**109**;Dec 17,1997
3 ;
4 Q
5ENSR ; Entry point for component
6 ;External calls to ^GMTSROB, ^DIQ, ^GMTSORC, ^DIWP
7 ;External references to ^SRF, ^DD, ^ICPT
8 N GMIDT,GMN,SURG
9 I '$D(^SRF("B",DFN)) Q
10 S GMN=0 F S GMN=$O(^SRF("B",DFN,GMN)) Q:GMN'>0 D SORT
11 I '$D(SURG) Q
12 S GMIDT=0 F S GMIDT=$O(SURG(GMIDT)) Q:GMIDT'>0!(ORCNT'<ORMAX) S GMN=SURG(GMIDT) D EXTRCT
13 Q
14 ;
15SORT ; Sort surgeries by inverted date
16 N GMDT
17 S GMDT=$P(^SRF(GMN,0),U,9) I GMDT>ORDBEG&(GMDT<ORDEND) D
18 . F Q:'$D(SURG(9999999-GMDT)) S GMDT=GMDT+.0001
19 . S SURG(9999999-GMDT)=GMN
20 Q
21EXTRCT ; Extract surgical case record
22 N X,GMI,GMDT,OPPRC,POSDX,PREDX,SPEC,STATUS,SURGEON,VER
23 N DCTDTM,TRSDTM,Y,C,DIWL,DIWF,ORSITE,ORMORE,SITE
24 S ORCNT=ORCNT+1,ORMORE=0
25 S GMDT=$$DATE^ORDVU($P(^SRF(GMN,0),U,9))
26 D STATUS^GMTSROB S:'$D(STATUS) STATUS="UNKNOWN"
27 S X=$P(^SRF(GMN,0),U,4) I X>0 S Y=X,C=$P(^DD(130,.04,0),U,2) D Y^DIQ S SPEC=Y K Y
28 I $D(^SRF(GMN,.1)) S X=$P(^SRF(GMN,.1),U,4) I X>0 S Y=X,C=$P(^DD(130,.14,0),U,2) D Y^DIQ S SURGEON=Y K Y
29 S VER=$S($G(^SRF(GMN,"VER"))'="Y":"(Unverified)",1:"")
30 S PREDX(0)=$S($G(^SRF(GMN,33))]"":$P(^(33),U),1:"") S GMI=0 F S GMI=$O(^SRF(GMN,14,GMI)) Q:GMI'>0 S PREDX(GMI)=$P(^SRF(GMN,14,GMI,0),U)
31 S POSDX(0)=$S($G(^SRF(GMN,34))]"":$P(^(34),U),1:"") S GMI=0 F S GMI=$O(^SRF(GMN,15,GMI)) Q:GMI'>0 S POSDX(GMI)=$P(^SRF(GMN,15,GMI,0),U)
32 S OPPRC(0)=$P($G(^SRF(GMN,"OP")),U,1,2) S:$P(OPPRC(0),U,2)]"" $P(OPPRC(0),U,2)=$P($$CPT^ICPTCOD($P($G(^SRF(GMN,"OP")),U,2)),U,3) D
33 . S GMI=0 F S GMI=$O(^SRF(GMN,13,GMI)) Q:GMI'>0 S OPPRC(GMI)=$P($G(^SRF(GMN,13,GMI,0)),U)_U_$G(^SRF(GMN,13,GMI,2)) S:$P(OPPRC(GMI),U,2)]"" $P(OPPRC(GMI),U,2)=$P($$CPT^ICPTCOD($P($G(^SRF(GMN,13,GMI,2)),U)),U,3)
34 S X=$P($G(^SRF(GMN,31)),U,6) S:X>0 DCTDTM=$$DATE^ORDVU(X)
35 S X=$P($G(^SRF(GMN,31)),U,7) S:X>0 TRSDTM=$$DATE^ORDVU(X)
36 S DIWL=0,DIWF="N",ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
37 K ^UTILITY($J,"W")
38 I $D(^SRF(GMN,12)) F GMI=1:1:$P(^SRF(GMN,12,0),U,4) S X=^SRF(GMN,12,GMI,0) D ^DIWP
39 S SITE=ORSITE
40 S ^TMP("ORDATA",$J,GMIDT,"WP",1)="1^"_SITE ;Station ID
41 S ^TMP("ORDATA",$J,GMIDT,"WP",2)="2^"_GMDT ; date
42 ;
43 ; Operative Procedure(s)
44 S GMI="" F S GMI=$O(OPPRC(GMI)) Q:GMI="" D S:GMI ORMORE=1
45 . S ^TMP("ORDATA",$J,GMIDT,"WP",3,GMI)="3^"_$P(OPPRC(GMI),U)_$S($P(OPPRC(GMI),U,2)]"":" - "_$P(OPPRC(GMI),U,2),1:"")
46 ;
47 S ^TMP("ORDATA",$J,GMIDT,"WP",4)="4^"_$G(SPEC) ;surgical specialty
48 ;
49 S ^TMP("ORDATA",$J,GMIDT,"WP",5)="5^"_$G(SURGEON) ; surgeon
50 S ^TMP("ORDATA",$J,GMIDT,"WP",6)="6^"_$G(STATUS) ; op status
51 ;
52 ; Pre-operative diagnosis
53 S GMI="" F S GMI=$O(PREDX(GMI)) Q:GMI="" D S:GMI ORMORE=1
54 . S ^TMP("ORDATA",$J,GMIDT,"WP",7,GMI)="7^"_PREDX(GMI)
55 ;
56 ; Post-operative diagnosis
57 S GMI="" F S GMI=$O(POSDX(GMI)) Q:GMI="" D S:GMI ORMORE=1
58 . S ^TMP("ORDATA",$J,GMIDT,"WP",8,GMI)="8^"_POSDX(GMI)
59 ;
60 ; Lab work? Y/N
61 S ^TMP("ORDATA",$J,GMIDT,"WP",9)="9^"_$S($O(^SRF(GMN,9,0)):"Yes",1:"No")
62 S ^TMP("ORDATA",$J,GMIDT,"WP",10)="10^"_$G(DCTDTM) ; dictation time
63 S ^TMP("ORDATA",$J,GMIDT,"WP",11)="11^"_$G(TRSDTM) ; transcription time
64 ;
65 ; surgeon's dictation
66 I $D(^UTILITY($J,"W")) D S ORMORE=1
67 . K ^TMP("ORHSSRT",$J)
68 . F GMI=1:1:^UTILITY($J,"W",DIWL) D
69 .. S ^TMP("ORHSSRT",$J,GMIDT,"WP",GMI)=^UTILITY($J,"W",DIWL,GMI,0)
70 . D SPMRG^ORDVU($NA(^TMP("ORHSSRT",$J,GMIDT,"WP")),$NA(^TMP("ORDATA",$J,GMIDT,"WP",12)),12)
71 . K ^UTILITY($J,"W")
72 . K ^TMP("ORHSSRT",$J)
73 I ORMORE S ^TMP("ORDATA",$J,GMIDT,"WP",13)="13^[+]" ;flag for detail
74 Q
Note: See TracBrowser for help on using the repository browser.