source: FOIAVistA/trunk/r/CLINICAL_CASE_REGISTRIES-ROR/ROREVT01.m@ 677

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

initial load of FOIAVistA 6/30/08 version

File size: 2.3 KB
Line 
1ROREVT01 ;HCIOFO/SG - EVENT PROTOCOLS ; 6/9/03 1:50pm
2 ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
3 ;
4 ; This routine uses the following IAs:
5 ;
6 ; #1181 Subscription to the DGPM MOVEMENT EVENT protocol
7 ; #1298 Subscription to the PXK VISIT DATA EVENT protocol
8 ; #3565 Subscription to the LR7O ALL EVSEND RESULTS protocol
9 ;
10 Q
11 ;
12 ;***** 'ROR EVENT LAB' PROTOCOL IMPLEMENTATION (DATA AREA #1)
13LAB ;
14 Q:$G(OREMSG)=""
15 N BUF,DATE,DONE,FS,I,PATIEN
16 S I="",DONE="00"
17 F S I=$O(@OREMSG@(I)) Q:I="" D Q:DONE="11"
18 . S BUF=$G(@OREMSG@(I))
19 . ;--- Get the HL7 field separator
20 . I $G(FS)="" S:$E(BUF,1,3)="MSH" FS=$E(BUF,4) Q:$G(FS)=""
21 . ;--- Get the patient IEN
22 . I $P(BUF,FS)="PID" D:'$E(DONE,1) Q
23 . . S PATIEN=+$P(BUF,FS,4) ; PID-3
24 . . S:PATIEN>0 $E(DONE,1)="1"
25 . ;--- Get the specimen date
26 . I $P(BUF,FS)="OBR" D:'$E(DONE,2) Q
27 . . S DATE=$$HL7TFM^XLFDT($P(BUF,FS,8)) ; OBR-7
28 . . S $E(DONE,2)="1"
29 ;--- Create the event reference
30 S:DONE="11" I=$$ADD^RORUPP02(PATIEN,1,DATE)
31 Q
32 ;
33 ;***** RETURNS THE LIST OF PACKAGE EVENT PROTOCOLS
34 ;
35 ; .EPLST Reference to a local variable. The list of
36 ; package event protocols will be returned via
37 ; this parameter: EPLST(ProtocolName)=""
38 ;
39LIST(EPLST) ;
40 K EPLST
41 S EPLST("ROR EVENT LAB")=""
42 S EPLST("ROR EVENT PTF")=""
43 S EPLST("ROR EVENT VISIT")=""
44 Q
45 ;
46 ;***** 'ROR EVENT PTF' PROTOCOL IMPLEMENTATION (DATA AREA #3)
47PTF ;
48 N ADATE,IEN405,PATIEN,PDATE,RC,TRC
49 S PATIEN=$P($G(DGPMA),"^",3) Q:PATIEN'>0
50 ;--- Admissions, transfers and discharges
51 F TRC=1,2,3 D
52 . S IEN405=0
53 . F S IEN405=$O(^UTILITY("DGPM",$J,TRC,IEN405)) Q:IEN405'>0 D
54 . . S PDATE=$P($G(^UTILITY("DGPM",$J,TRC,IEN405,"P")),"^")
55 . . S ADATE=$P($G(^UTILITY("DGPM",$J,TRC,IEN405,"A")),"^")
56 . . I PDATE>0 S RC=$$ADD^RORUPP02(PATIEN,3,PDATE)
57 . . I ADATE>0 S:ADATE'=PDATE RC=$$ADD^RORUPP02(PATIEN,3,ADATE)
58 Q
59 ;
60 ;***** 'ROR EVENT VISIT' PROTOCOL IMPLEMENTATION (DATA AREA #2)
61VISIT ;
62 N BUF,IEN,PATIEN,RC,VSIEN
63 S VSIEN=""
64 F S VSIEN=$O(^TMP("PXKCO",$J,VSIEN)) Q:VSIEN="" D
65 . S IEN=""
66 . F S IEN=$O(^TMP("PXKCO",$J,VSIEN,"VST",IEN)) Q:IEN="" D
67 . . S BUF=$G(^TMP("PXKCO",$J,VSIEN,"VST",IEN,0,"AFTER"))
68 . . S PATIEN=$P(BUF,"^",5) Q:(PATIEN'>0)!$P(BUF,"^",11)
69 . . ;--- Create the event reference
70 . . S RC=$$ADD^RORUPP02(PATIEN,2,$P(BUF,"^",2))
71 Q
Note: See TracBrowser for help on using the repository browser.