source: WorldVistAEHR/trunk/r/HEALTH_DATA_AND_INFORMATICS-HDI/HDISVU02.m@ 1270

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

initial load of WorldVistAEHR

File size: 2.9 KB
Line 
1HDISVU02 ;BPFO/JRP - STORE VUIDS FOR SET OF CODES;5/12/2005
2 ;;1.0;HEALTH DATA & INFORMATICS;**1,2**;Feb 22, 2005
3 ;
4VUIDL(TAG,ROUTINE) ;Instantiate VUIDs for set of code fields
5 ; Input: TAG - Line tag under which VUID data has been placed
6 ; ROUTINE - Routine line tag is in
7 ; Leave blank if in this routine
8 ;Output: 0 = Stop post-install (error)
9 ; 1 = Continue with post-install
10 ; Notes: Data lines must be in the format
11 ; File~Field~Code~VUID~Status~EffectiveDateTime
12 ; (Status and EffectiveDateTime must be in internal format)
13 ; (Default value for Status is 0 - Inactive)
14 ; (Default value for EffectiveDateTime is NOW)
15 ; : Call assumes that all input (TAG & ROUTINE) is valid
16 ; : Call assumes that data lines are valid
17 ; (i.e. no missing/bad data)
18 ; : The incoming status/date will not be stored in an existing
19 ; entry for the VUID if the currently stored status is the
20 ; same as the input status.
21 ;
22 N OFFSET,DATA,FILE,FIELD,IREF,VUID,STAT,STDT,DONE,RESULT,HDIMSG
23 S ROUTINE=$G(ROUTINE)
24 S RESULT=1
25 S DONE=0
26 F OFFSET=1:1 D Q:DONE
27 .S DATA=$S(ROUTINE="":$T(@TAG+OFFSET),1:$T(@TAG+OFFSET^@ROUTINE))
28 .S DATA=$P(DATA,";;",2)
29 .I DATA="" S DONE=1 Q
30 .S FILE=$P(DATA,"~",1)
31 .S FIELD=$P(DATA,"~",2)
32 .S IREF=$P(DATA,"~",3)
33 .S VUID=$P(DATA,"~",4)
34 .S STAT=$P(DATA,"~",5)
35 .I STAT="" S STAT=0
36 .S STDT=$P(DATA,"~",6)
37 .I STDT="" S STDT=$$NOW^XLFDT()
38 .I '$$STOREIT(FILE,FIELD,IREF,VUID,STAT,STDT) D
39 ..S HDIMSG(1)="**"
40 ..S HDIMSG(2)="** Unable to store VUID and/or status information for file"
41 ..S HDIMSG(3)="** "_FILE_", field "_FIELD_", and internal value "_IREF
42 ..S HDIMSG(4)="**"
43 ..D MES^XPDUTL(.HDIMSG) K HDIMSG
44 ..S RESULT=0
45 Q RESULT
46 ;
47STOREIT(FILE,FIELD,IREF,VUID,STAT,STDT) ;Store VUID info
48 ; Input: FILE - File number
49 ; FIELD - Field number
50 ; IREF - Internal reference
51 ; VUID - VUID
52 ; STAT - Status
53 ; 0 = Inacive (default) 1 = Active
54 ; STDT - Status Date/Time (FileMan)
55 ; (Defaults to NOW)
56 ;Output: 1 = Success
57 ; 0 = Failure
58 ; Notes: Existance/validity of input assumed (internal call)
59 ; : Call will automatically inactivate terms when appropriate
60 ; : The input status/date will not be stored in an existing
61 ; entry for the VUID if the currently stored status is the
62 ; same as the input status. Success (1) will be returned.
63 ;
64 N MASTER,CURSTAT
65 S STAT=+$G(STAT)
66 S STDT=+$G(STDT)
67 I 'STDT S STDT=$$NOW^XLFDT()
68 ;Is VUID already on file
69 S CURSTAT=$$GETSTAT^XTID(FILE,FIELD,IREF)
70 ;Don't store new date for same status (return SUCCESS)
71 I $P(CURSTAT,"^",1)=STAT Q 1
72 ;Store VUID (also sets master entry flag, if appropriate)
73 I '$$SETVUID^XTID(FILE,FIELD,IREF,VUID) Q 0
74 ;Inactivate non-master entries
75 I '$$GETMASTR^XTID(FILE,FIELD,IREF) D
76 .S STAT=0
77 .S STDT=$$NOW^XLFDT()
78 ;Store status
79 Q $$SETSTAT^XTID(FILE,FIELD,IREF,STAT,STDT)
Note: See TracBrowser for help on using the repository browser.