source: WorldVistAEHR/trunk/r/TEXT_INTEGRATION_UTILITIES-GMRP-TIU/TIUADCL1.m@ 1432

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

initial load of WorldVistAEHR

File size: 5.5 KB
Line 
1TIUADCL1 ; SLC/AJB - UNK Addenda Cleanup ; 10/01/04
2 ;;1.0;TEXT INTEGRATION UTILITIES;**173**;Jun 20, 1997
3 ;
4 ; Cleanup Utility for OPERATION REPORT addenda.
5 ; Finds parentless/unknown addenda and attaches to user
6 ; selected parent.
7 ;
8 Q
9EN ; main entry point for TIU UNK ADDENDA CLEANUP
10 N DTR2,TIUADD,TIULVL,TIUQUIT
11 D SAVEADD
12 D DTRANGE^TIUADCL(.DTR2) Q:$D(TIUQUIT)
13 D EN^VALM("TIU UNK ADDENDA ATTACH")
14 K ^TMP("VALMAR",$J,TIULVL)
15 Q
16EXIT ;
17 D XQORM
18 Q
19HDR ; sets header
20 N HDR
21 S HDR="OPERATION REPORTS from "_$$FMTE^XLFDT(DTR2("BEGDT"),"D")_" to "_$$FMTE^XLFDT(DTR2("ENDDT"),"D")
22 S VALMHDR(1)=$$SETSTR^VALM1(HDR,"",(IOM-$L(HDR))/2,$L(HDR))
23 D XQORM
24 Q
25HELP ; help code
26 N DIR
27 I X="?" S DIR("A")="Enter RETURN to continue or '^' to exit",DIR(0)="E"
28 D FULL^VALM1
29 W !!,"The following actions are available:"
30 W !,"Browse a Document - View a selected document (if authorized)"
31 W !,"Change View - Modify search criteria"
32 W !,"Detailed Display - View detailed display of a document (if authorized)"
33 W !,"Attach to Parent - Attach the currently selected "
34 W $S($$MULTI^TIUADCL("TIUADD")>1:"addenda",1:"addendum")," to one OPERATION"
35 W !," REPORT",!
36 I $D(DIR("A")) D ^DIR
37 S VALMBCK="R"
38 Q
39INIT ; finds unknown addenda & creates list
40 N OPREPORT,STRTDT,TIUDA,TIU
41 S TIULVL=VALMEVL,TIU("IOCUOFF")=$C(27)_"[?25l",TIU("IOCUON")=$C(27)_"[?25h"
42 W TIU("IOCUOFF")
43 W !!,"Searching for the documents."
44 S OPREPORT=$$CHKFILE^TIUADCL(8925.1,"OPERATION REPORT","I $P(^(0),U,4)=""DOC"""),TIUDA="",STRTDT=DTR2("BEGDT"),VALMCNT=0
45 F S STRTDT=$O(^TIU(8925,"F",STRTDT)) Q:STRTDT=""!(STRTDT>DTR2("ENDDT")) F S TIUDA=$O(^TIU(8925,"F",STRTDT,TIUDA)) Q:TIUDA="" I +$G(^TIU(8925,TIUDA,0))=OPREPORT D
46 . N DATA,DISPLAY,MSG
47 . I '$D(TIUADD($$GET1^DIQ(8925,TIUDA,.02))) Q
48 . ; D CANDO^TIUSRVA(.MSG,TIUDA,"MAKE ADDENDUM") I '+MSG Q
49 . S VALMCNT=VALMCNT+1 W:VALMCNT#3=0 "."
50 . S DISPLAY=$$SETSTR^VALM1(VALMCNT,"",1,4)
51 . S DISPLAY=$$SETSTR^VALM1($$PATIENT^TIU144($P($G(^TIU(8925,TIUDA,0)),U,2)),DISPLAY,6,38)
52 . S DISPLAY=$$SETSTR^VALM1(TIUDA,DISPLAY,40,50)
53 . S DISPLAY=$$SETSTR^VALM1($$FDATE^VALM1($$GET1^DIQ(8925,TIUDA,1201,"I")),DISPLAY,52,62)
54 . S DISPLAY=$$SETSTR^VALM1($$GET1^DIQ(8925,TIUDA,.05),DISPLAY,62,71)
55 . S DISPLAY=$$SETSTR^VALM1("#"_+$P($G(^TIU(8925,TIUDA,14)),U,5),DISPLAY,75,80)
56 . D SET^VALM10(VALMCNT,DISPLAY,TIUDA)
57 I VALMCNT=0 D
58 . D SET^VALM10(2,$$SETSTR^VALM1("No records found to satisfy search criteria.","",(IOM-$L("No records found to satisfy search criteria."))/2,$L("No records found to satisfy search criteria.")),0)
59 Q
60XQORM ; default action for list manager
61 S XQORM("#")=$O(^ORD(101,"B","TIU UNK ADDENDA SELECT",0))_U_"1:"_VALMCNT
62 Q
63ATTACH ;
64 N DISPLAY,LINE,PARENT
65 D FULL^VALM1 W @IOF
66 W "Attach the following UNKNOWN "_$S($$MULTI^TIUADCL("TIUADD")>1:"Addenda",1:"Addendum")_":",!!
67 W "TIU",!,"Doc No.",?9,"Patient",?40,"Entry DT/Time",?59,"Status",?71,"Parent",!
68 S LINE="",PARENT=$$ONEDOC^TIUADCL()
69 S $P(LINE,"-",80)="-" W LINE
70 S TIUADD="" F S TIUADD=$O(TIUADD(TIUADD)) Q:TIUADD=""!(+TIUADD'>0) D
71 . N TIUDA
72 . S TIUDA=TIUADD(TIUADD)
73 . S DISPLAY=$$SETSTR^VALM1(TIUDA,"",1,8)
74 . S DISPLAY=$$SETSTR^VALM1($$PATIENT^TIU144($P($G(^TIU(8925,TIUDA,0)),U,2)),DISPLAY,10,40)
75 . S DISPLAY=$$SETSTR^VALM1($$FDTTM^VALM1($$GET1^DIQ(8925,TIUDA,1201,"I")),DISPLAY,41,51)
76 . S DISPLAY=$$SETSTR^VALM1($$GET1^DIQ(8925,TIUDA,.05),DISPLAY,60,67)
77 . S DISPLAY=$$SETSTR^VALM1($S($$GET1^DIQ(8925,TIUDA,.06)="":"None",1:$$GET1^DIQ(8925,TIUDA,.06)),DISPLAY,72,80)
78 . W $E(DISPLAY,1,80)
79 W !!,"to the following "_$$GET1^DIQ(8925,PARENT,.01)_"?",!
80 S DISPLAY=$$SETSTR^VALM1(PARENT,"",1,8)
81 S DISPLAY=$$SETSTR^VALM1($$PATIENT^TIU144($P($G(^TIU(8925,PARENT,0)),U,2)),DISPLAY,10,40)
82 S DISPLAY=$$SETSTR^VALM1($$FDTTM^VALM1($$GET1^DIQ(8925,PARENT,1201,"I")),DISPLAY,41,51)
83 S DISPLAY=$$SETSTR^VALM1($$GET1^DIQ(8925,PARENT,.05),DISPLAY,60,67)
84 S DISPLAY=$$SETSTR^VALM1("#"_+$P($G(^TIU(8925,PARENT,14)),U,5),DISPLAY,72,80)
85 W !,"TIU",?71,"Surgical",!,"Doc No.",?9,"Patient",?40,"Entry DT/Time",?59,"Status",?71,"Case No.",!
86 W LINE,$E(DISPLAY,1,80),!
87 S VALMBCK="R"
88 I '$$READ^TIUU("Y","Do you wish to begin attaching","NO","Enter 'Y' or 'N'") W ! I $$READ^TIUU("EA","Press <RETURN> to continue") Q
89 S VALMBCK="Q"
90 S TIUADD="" F S TIUADD=$O(TIUADD(TIUADD)) Q:TIUADD=""!(+TIUADD'>0) D
91 . N TIUDA
92 . S TIUDA=TIUADD(TIUADD)
93 . W !!,"Attaching #",TIUDA," to #",PARENT," ... "
94 . D ATNOW(PARENT,TIUDA)
95 W ! I $$READ^TIUU("EA","Press <RETURN> to continue")
96 Q
97ATNOW(PARENT,ADDENDUM) ;
98 N FDA,FDARR,IENS,FLAGS,TIUMSG,TIUA0,TIUA12,TIUP0,TIUP12,TIUWARN
99 S TIUP0=$G(^TIU(8925,PARENT,0)),TIUA0=$G(^TIU(8925,ADDENDUM,0))
100 S TIUP12=$G(^TIU(8925,PARENT,12)),TIUA12=$G(^TIU(8925,ADDENDUM,12))
101 I $P(TIUP0,U,2)'=$P(TIUA0,U,2) W !,"ERROR: Parent and Addendum have different patients!" S TIUWARN=1
102 I $P(TIUA12,U)'>$P(TIUP12,U) W !,"ERROR: The addendum's ENTRY DATE/TIME precedes the parent's ENTRY DATE/TIME!" S TIUWARN=1
103 I +$G(TIUWARN) Q
104 S IENS=""""_ADDENDUM_",""",FDARR="FDA(8925,"_IENS_")",FLAGS="K"
105 S @FDARR@(.06)=PARENT
106 S @FDARR@(1405)=$$GET1^DIQ(8925,PARENT,1405,"I")
107 D FILE^DIE(FLAGS,"FDA","TIUMSG")
108 I $D(TIUMSG) D Q
109 . N LINE S LINE=""
110 . F S LINE=$O(TIUMSG("DIERR",1,"TEXT",LINE)) Q:LINE="" W !,TIUMSG("DIERR",1,"TEXT",LINE)
111 W ?29," success!"
112 Q
113SAVEADD ;
114 S TIUADD=0
115 F S TIUADD=$O(TIUDOCS(TIUADD)) Q:TIUADD="" S TIUADD(TIUADD)=TIUDOCS(TIUADD),TIUADD($$GET1^DIQ(8925,TIUADD(TIUADD),.02))=""
116 Q
117PREP ;
118 N DA,DIC,DIK,X,Y
119 S DIC="^SD(409.61,",DIC(0)="X"
120 F X="TIU UNK ADDENDA ATTACH","TIU UNK ADDENDA CLEANUP" D
121 . D ^DIC I +Y D
122 .. S DA=+Y,DIK=DIC D ^DIK
123 Q
Note: See TracBrowser for help on using the repository browser.