source: WorldVistAEHR/trunk/r/TEXT_INTEGRATION_UTILITIES-GMRP-TIU/TIUPNCV8.m@ 1005

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

initial load of WorldVistAEHR

File size: 5.0 KB
Line 
1TIUPNCV8 ;SLC/DJP - PNs ==> TIU cnv rtns ;10/5/98 15:25
2 ;;1.0;TEXT INTEGRATION UTILITIES;**9,37**;Jun 20, 1997
3 ;
4 ; used to handset TIUIFN and update ^TIU(8925 appropriately
5 ; call with REDO (TIU IFN) and GMRPIFN.
6 ; if adding new records, set NEWNODE
7 ;
8DRIVER ;Entry point
9 S TIUFPRIV=1
10 S:'$D(U) U="^"
11 S (GMRPCTR,TIUCTR)=0
12 S:'$D(GMRPST) GMRPST=0 ;If not a Restart, initialize counter
13 I '$D(NEWNODE) S TIUIFN=REDO S ^TMP("TIUIFN",GMRPIFN)=TIUIFN
14 D MAIN
15CLEANUP ;Kills variables and scratch files
16 K GMRPCTR,TIUCTR,GMRPST,GMRPIFN,GMRPFLD,NEWNODE,REDO
17 K ^TMP("TIUIFN")
18 Q
19 ;
20MAIN ;Main loop for each record
21 K DIC S DIC="^GMR(121,",DA=GMRPIFN,DIQ="PN"
22 S DIQ(0)="I",DR=".01:.03;.05;.06;1:7.1;9;100"
23 D EN^DIQ1
24 I (PN(121,GMRPIFN,.02,"I")="")!(PN(121,GMRPIFN,.03,"I")="")!(PN(121,GMRPIFN,.05,"I")="")!(PN(121,GMRPIFN,1,"I")="")!(PN(121,GMRPIFN,2,"I")="") D Q
25 . S PROBLEM="Progress Note - IFN #"_GMRPIFN_" is incomplete."
26 . D ERRORLOG^TIUPNCV3 K BADREC,PN,PROBLEM Q
27 I PN(121,GMRPIFN,100,"I"),'$D(^GMR(121,"CNV",PN(121,GMRPIFN,100,"I"))) D Q
28 . S PROBLEM="Progress note - IFN # "_GMRPIFN_", addendum to unconverted parent note IFN # "_PN(121,GMRPIFN,100,"I")
29 . D ERRORLOG^TIUPNCV3 K BADREC,PN,PROBLEM Q
30 D TIUFLDS
31 ; do not convert test patient notes
32 S TIU("SSN")=$P(^DPT(TIU(.02),0),U,9),TIU("SSN4")=$E(TIU("SSN"),1,4)
33 I TIU("SSN4")["0000" D CLEANREC Q
34 ;
35 D TITLE^TIUPNCV3 I $D(BADREC) D CLEANREC Q
36 I $D(NEWNODE) D RTNODE I $D(BADREC) D CLEANREC Q
37 D SETFIELD^TIUPNCV1 I $D(BADREC) D WIPEOUT Q
38 ;Builds the TIU record
39 ;Sets single-component record
40 S DIE="^TIU(8925,",DA=TIUIFN D COPY I $D(BADREC) D WIPEOUT Q
41 D TEXT
42 D:TIU(1505)'="" SIGSET D:TIU(1511)'="" COSET
43 ;Records number of successfully processed notes
44 D SEND^TIUALRT(+TIUIFN)
45 I '$D(TIU("INDY")) S TIUCTR=TIUCTR+1
46 S ^GMR(121,"CNV",GMRPIFN)=TIUIFN
47 D CLEANREC Q
48 ;
49CLEANREC ;Cleans partition after entry of record
50 K TIU,ESIG,PN,ATH,P1,P2,P3,P4,P5,C1,C2,C3,PNT,BADREC,TIUD,TIUNM
51 K TIUT,TMSG,TYP,^TMP("TIUBRK",GMRPIFN)
52 Q
53 ;
54WIPEOUT ;Clears ^TIU(8925 if record is found to be incomplete
55 S DIK="^TIU(8925,",DA=TIUIFN D ^DIK K DIK
56 K ^TMP("TIUIFN",GMRPIFN)
57 ;Next line removed **37** (Call to SUB^AUPNVSIT already in the DD)
58 ;I $G(TIU(.03)) S X=TIU(.03) D SUB^AUPNVSIT
59 D CLEANREC
60 Q
61 ;
62TIUFLDS ;Sets TIU variables with PN data
63 ; .01 FILE ENTRY DATE
64 ; .02 PATIENT
65 ; 1201 ENTRY DATE/TIME
66 ; 1202 AUTHOR/DICTATOR - 2 AUTHOR
67 ; 1204 EXPECTED SIGNER - 2 AUTHOR
68 ; 1205 HOSPITAL LOCATION - 9 LOCATION
69 ; 1301 REFERENCE DATE - .03 DATE/TIME OF PROGRESS NOTE
70 ; 1302 ENTERED BY - .05 TRANSCRIBER
71 ; 1501 SIGNATURE DATE/TIME - 4 DATE/TIME SIGNED
72 ; 1502 SIGNED BY - 3 ELECTRONIC SIGNATURE (AUTHOR)
73 ; 1506 COSIGNATURE NEEDED - 5 COSIGNATURE REQUIRED
74 ; 1507 COSIGNATURE DATE/TIME - 7 DATE/TIME COSIGNED
75 ; 1508 COSIGNED BY - 6 COSIGNER
76 ; 1512 MARKED SIGNED ON CHART BY - 4.1 SIGNATURE IN CHART
77 ; 1513 MARKED COSIGNED ON CHART BY - 7.1 COSIGNATURE IN CHART
78 S TIU(1201)=PN(121,GMRPIFN,.01,"I")
79 S TIU(.02)=PN(121,GMRPIFN,.02,"I")
80 S (TIU(.07),TIU(1301))=PN(121,GMRPIFN,.03,"I")
81 S TIU(1302)=PN(121,GMRPIFN,.05,"I")
82 S TIU("MHCONV")=PN(121,GMRPIFN,.06,"I")
83 S TIU("TITLE")=PN(121,GMRPIFN,1,"I")
84 S (TIU(1202),TIU(1204))=PN(121,GMRPIFN,2,"I")
85 S TIU(1303)="C"
86 S TIU(1502)=PN(121,GMRPIFN,3,"I")
87 S TIU(1501)=PN(121,GMRPIFN,4,"I")
88 S (TIU("SIGCHART"),TIU(1512))=PN(121,GMRPIFN,4.1,"I")
89 S TIU(1506)=PN(121,GMRPIFN,5,"I")
90 S TIU(1508)=PN(121,GMRPIFN,6,"I")
91 S TIU(1507)=PN(121,GMRPIFN,7,"I")
92 S (TIU("COSCHART"),TIU(1513))=PN(121,GMRPIFN,7.1,"I")
93 S (TIU(1205),TIU(1211))=$G(PN(121,GMRPIFN,9,"I"))
94 S TIU("PARENT")=$S(+PN(121,GMRPIFN,100,"I"):$G(^GMR(121,"CNV",+PN(121,GMRPIFN,100,"I"))),1:"")
95 S TIU("SPECDT")=$P(TIU(1201),".",1)
96 Q
97 ;
98RTNODE ;Sets 0 Node for TIU record
99 S (DIC,DLAYGO)=8925,DIC(0)="LN",X=""""_"`"_TIU(.01)_""""
100 D ^DIC I +Y<1 S TIU("BAD")=1 Q
101 S TIUIFN=+Y,^TMP("TIUIFN",GMRPIFN)=TIUIFN
102 Q
103 ;
104COPY ;Writes data from ^GMR(121,GMRPIFN --> ^TIU(8925,TIUIFN
105 S DR=".02////"_TIU(.02)_";.03////"_TIU(.03)_";.04////"_TIU(.04)_";.05////"_TIU(.05)_";.07////"_TIU(.07)_";.13////E"_";1208////"_$G(TIU(1208))_";1506////"_$G(TIU(1506)) D ^DIE
106 I TIU("PARENT")'="" S DR=".06////"_TIU("PARENT") D ^DIE
107 S DR="1201////"_TIU(1201)_";1202////"_TIU(1202)_";1204////"_$G(TIU(1204))_";1205////"_TIU(1205)_";1211////"_TIU(1211)_";1301////"_TIU(1301)_";1302////"_TIU(1302)_";1303////"_TIU(1303)
108 D ^DIE
109 I $D(TIUNEWTY) S DR=".01///"_TIUNEWTY D ^DIE K TIUNEWTY
110 Q
111 ;
112TEXT ;Copies text
113 I $D(^TMP("TIUHOLD",GMRPIFN))
114 I M ^TIU(8925,TIUIFN,"TEXT")=^TMP("TIUHOLD",GMRPIFN,10)
115 K ^TMP("TIUHOLD",GMRPIFN),^TMP("TIUMERGE",GMRPIFN) Q
116 M ^TIU(8925,TIUIFN,"TEXT")=^GMR(121,GMRPIFN,GMRPFLD)
117 Q
118 ;
119SIGSET ;Sets ^TIU(8925 signature fields
120 S DR="1501////"_TIU(1501)_";1502////"_TIU(1502)_";1503///^S X=TIU(1503);1504///^S X=TIU(1504);1505///"_TIU(1505)_";1512////"_TIU(1512)
121 D ^DIE Q
122 ;
123COSET ;Sets ^TIU(8925 co-signature fields if required
124 S DR="1506////"_TIU(1506)_";1507////"_TIU(1507)_";1508////"_TIU(1508)_";1509///^S X=TIU(1509);1510///^S X=TIU(1510);1511////"_TIU(1511)_";1513////"_TIU(1513)
125 D ^DIE Q
126 ;
Note: See TracBrowser for help on using the repository browser.