source: WorldVistAEHR/trunk/r/MENTAL_HEALTH-YS-RUCL-YI-YT/YSD40032.m@ 1608

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

initial load of WorldVistAEHR

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