source: FOIAVistA/trunk/r/MENTAL_HEALTH-YS-RUCL-YI-YT/YSD40052.m@ 1801

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

initial load of FOIAVistA 6/30/08 version

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