source: FOIAVistA/trunk/r/MENTAL_HEALTH-YS-RUCL-YI-YT/YSD40042.m@ 1516

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

initial load of FOIAVistA 6/30/08 version

File size: 3.2 KB
Line 
1YSD40042 ;DALISC/LJA - YSD40040 - continuation ; [ 04/08/94 11:53 AM ]
2 ;;5.01;MENTAL HEALTH;;Dec 30, 1994
3 ;;
4 ;
5CONVNTRY ; Make Conversion file entry
6 ;
7 ; Default to 0; not made...
8 S (YSD4CIEN,YSD4EREP)=0
9 ;
10 ; Exit if no "actual" data...
11 D HASDATA QUIT:'YSD4OK ;->
12 ;
13 ; Set roots, B xref, etc
14 S YSD4CIEN=0,YSD40="",YSD4REF=+YSD4IEN_";YSD(627.8,"
15 S YSD4CIEN=$O(^YSD(627.99,"B",YSD4REF,0)),YSD4OK=0
16 ; ----------------------------------------------------------------
17 ; Following check: Was the IEN returned in YSD4CIEN???
18 ; If so, some portion of the conversion has "hit" this record.
19 ; Therefore, the Status is either...
20 ; Null, <S>tarted, <R>ecorded, <C>onverted, or <E>rrored...
21 I YSD4CIEN D QUIT:'YSD4OK
22 . S YSD4OK=1 ; Assume all is OK...
23 . S YSD40=$G(^YSD(627.99,+YSD4CIEN,0))
24 .
25 . ; -------- No 0 node error...
26 . I YSD40']"" D QUIT ;->
27 . . S YSD4OK=0
28 . . D NOW^%DTC
29 . . D PED^YSD4E010(%,"Null 0 node",627.8,"",+YSD4IEN,"",+$P($G(^YSD(627.8,+YSD4IEN,0)),U,2))
30 . . S $P(^YSD(627.99,+YSD4CIEN,0),U,2)="E",YSD4EREP=1
31 .
32 . ; -------- Null status error...
33 . I $P(YSD40,U,2)']"" D QUIT ;->
34 . . S YSD4OK=0
35 . . D NOW^%DTC
36 . . D PED^YSD4E010(%,"Can't convert 'null status' entries",627.8,"",+YSD4IEN,"",+$P($G(^YSD(627.8,+YSD4IEN,0)),U,2))
37 . . S $P(^YSD(627.99,+YSD4CIEN,0),U,2)="E",YSD4EREP=1
38 .
39 . ; -------- If status=<E>rror, error has already been recorded...
40 . ; Don't try to convert again...
41 . I $P(YSD40,U,2)["E" S YSD4OK=0 QUIT ;->
42 .
43 . ; -------- If status=<C>onverted, do not reconvert!!!
44 . I $P(YSD40,U,2)["C" S YSD4OK=0 QUIT ;->
45 .
46 . ; -------- If status=<R>ecorded, report an error...
47 . ; (... conversion has started, and progressed to
48 . ; an unknown state.)
49 . I $P(YSD40,U,2)["R" D QUIT ;->
50 . . S YSD4OK=0
51 . . D NOW^%DTC
52 . . D PED^YSD4E010(%,"Can't convert 'Recorded' entries",627.8,"",+YSD4IEN,"",+$P($G(^YSD(627.8,+YSD4IEN,0)),U,2))
53 . . S $P(^YSD(627.99,+YSD4CIEN,0),U,2)="E",YSD4EREP=1
54 .
55 . ; -------- So, by elimination, the Status is <S>tarted...
56 . ; Therefore, it can be restarted from the beginning...
57 . K ^YSD(627.99,+YSD4CIEN)
58 . K ^YSD(627.99,"AS","DR LAST STARTED")
59 . S ^YSD(627.99,+YSD4CIEN,0)=YSD4REF_U_"S"
60 . S ^YSD(627.99,"AS","DR LAST STARTED")=+YSD4IEN_U_$H
61 .
62 . ; Record as OK in YSD4OK...
63 . S YSD4OK=1
64 ; ----------------------------------------------------------------
65 ; If entry does not already exist, make new entry
66 I 'YSD4CIEN D QUIT:'YSD4CIEN ;->
67 . S X=^YSD(627.99,0),YSD4CIEN=+$P(X,U,3)+1,$P(X,U,3)=YSD4CIEN,$P(X,U,4)=$P(X,U,4)+1 S ^YSD(627.99,0)=X
68 . S ^YSD(627.99,"B",YSD4REF,+YSD4CIEN)=""
69 . S ^YSD(627.99,+YSD4CIEN,0)=YSD4REF_U_"S"
70 . S ^YSD(627.99,"AS","DR LAST STARTED")=+YSD4IEN_U_$H
71 . S YSD4OK=1
72 QUIT
73 ;
74HASDATA ; Check performed in REPOINT^YSD40040
75 S YSD4OK=1
76 QUIT
77 ;
78STARTNO ;
79 I $G(^YSD(627.99,"AS","DR CONVERSION COMPLETED"))]"" D QUIT ;->
80 . S YSD4IEN="Done"
81 . W:$X>1 ! W "Conversion of Diagnostic Results - Mental Health data already completed ...",!
82 S YSD4IEN=+$G(^YSD(627.99,"AS","DR LAST STARTED"))
83 I YSD4IEN>0 S YSD4IEN=YSD4IEN-1 ; Reevaluate last entry
84 QUIT
85 ;
86EOR ;YSD40042 - YSD40040 - continuation ; 4/6/94 15:24
Note: See TracBrowser for help on using the repository browser.