source: WorldVistAEHR/trunk/r/MEDICINE-MC/MCESCONV.m@ 1259

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

initial load of WorldVistAEHR

File size: 4.9 KB
Line 
1MCESCONV ;WISC/DCB-Convert PFTs to Electronic Signature ;7/31/96 15:32
2 ;;2.3;Medicine;**8**;09/13/1996
3CONV ;
4 N MCARGDA,MCREL,PDUZ,DRAFT,RELEASE,LOOP,LOCATION,CHECK,CODE2,INFO2
5 N SDRAFT,SRELEASE,MCOUNT,XMY,XMSUB,XMDUZ,XMTEXT,REC,PROC,MCARCK
6 N STATUS2,MCUTOFDT
7 D MCEPROC^MCARE
8 S:MCESKEY="MCGIKEY" MCROUT="GI"
9 S:$D(^XUSEC(MCESKEY,DUZ)) MCESSEC=1
10 S MCNODE=$S(MCFILE=700:2,MCFILE=694:0,1:"")
11 S MCPIECE=$S(MCFILE=700:1,MCFILE=694:9,1:"")
12 ; for PFT, check if version not 2.2
13 I MCFILE=700 D
14 .S REC=+$O(^DIC(9.4,"B","MEDICINE",""))
15 .S CHECK=+$O(^DIC(9.4,REC,22,"B","2.2",""))
16 .I CHECK="" S (MCNODE,MCPIECE)=""
17 S:MCFILE=699 MCARCODE=$S(MCESKEY="MCGIKEY":"G",1:"P")
18 I '$D(MCESSEC) W !,"You do not have '"_MCESKEY_"' KEY for "_MCROUT_"." D EXIT Q
19 I '$D(^XUSEC("MCMANAGER",DUZ)) W !,"You do not have the Manager key" D EXIT Q
20 ;W !,"This is a one time execution menu option."
21 N DIR S DIR(0)="DAO^:"_DT_":AEX"
22 S DIR("A")="Convert all records prior to: "
23 S DIR("?")="Enter an exact date less than or equal to today."
24 S DIR("?",1)="All records on or prior to this date will be converted."
25 S DIR("?",2)="Any records after this date will be left as is."
26 W ! D ^DIR S MCUTOFDT=+Y Q:$D(DIRUT)
27 W ! D NOW^%DTC
28 S LOC="Undefined",MCARGDA=.9,MCOUNT=8,SDRAFT=0,SRELEASE=0,NOW=$E(%,1,12),PDUZ=$$PERSON(MCESKEY),REC="",REC=$O(^DIC(4,"D",DUZ(2),REC))
29 S:REC'="" LOC=$P($G(^DIC(4,REC,0)),U,1)
30 Q:PDUZ=-1
31 S ^TMP("MCAR",$J,1)=Y(0,0)_" has been"
32 S ^TMP("MCAR",$J,2)="assigned the responsibility for releasing"
33 S ^TMP("MCAR",$J,3)="the procedure results that were released not verified"
34 S ^TMP("MCAR",$J,4)="for the "_MCROUT_" procedure file."
35 S ^TMP("MCAR",$J,5)="Only procedures on or prior to "_$$FMTE^XLFDT(MCUTOFDT)_" have been updated."
36 S ^TMP("MCAR",$J,6)=""
37 S ^TMP("MCAR",$J,7)="The following is a list of records that has been assigned a status:"
38 S ^TMP("MCAR",$J,8)=""
39 W !!,"Your records are being converted. Please wait!"
40 W !,"A mail message will be sent to you with records that are converted."
41 W !,"A dot is equal to 5 records."
42 F LOOP=1:1 D START Q:MCARGDA=""
43 S ^TMP("MCAR",$J,MCOUNT)="",MCOUNT=MCOUNT+1
44 I SDRAFT>0 S ^TMP("MCAR",$J,MCOUNT)="Records that have been assigned a draft status: "_SDRAFT,MCOUNT=MCOUNT+1
45 I SRELEASE>0 S ^TMP("MCAR",$J,MCOUNT)="Records that have been assigned a released not verified: "_SRELEASE
46 S XMSUB="Procedure File Change",XMDUZ="<Installer of Medicine>",XMTEXT="^TMP(""MCAR"","_$J_","
47 S:PDUZ'=DUZ XMY(PDUZ)=""
48 S XMY(DUZ)=""
49 D ^XMD
50 K ^TMP("MCAR",$J)
51 Q
52ESTOON ; Turn ES to ON.
53 S:'$D(MCPRO) MCPRO=$E($P(XQY0,U),8,$L($P(XQY0,U)))
54 D MCPPROC^MCARP
55 I MCESON W !,"Electronic Signature is already on!"
56 I '$D(^XUSEC(MCESKEY,DUZ)) W !,"You do not have '"_MCESKEY_"' KEY for "_MCROUT_"." D EXIT Q
57 I '$D(^XUSEC("MCMANAGER",DUZ)) W !,"You do not have the Manager key" D EXIT Q
58 S TYPE=$P(^MCAR(697.2,MCARP,0),U,4)
59 I TYPE="GEN" D SETESON("GEN",14)
60 I TYPE="I"!(TYPE="G") D SETESON("G",14),SETESON("I",14)
61 I TYPE="P" D SETESON("P",14)
62 I TYPE="HI"!(TYPE="H") D SETESON("H",14),SETESON("HI",14)
63 S $P(^MCAR(697.2,MCARP,0),U,14)=1
64 I 'MCESON W !,"Electronic Signature is now turned on!"
65 D EXIT
66 Q
67SETESON(PROC,PIECE) ; Set ES ON ALL PULM AND GI PROC
68 N ORDER S ORDER=""
69 F S ORDER=$O(^MCAR(697.2,"D",PROC,ORDER)) Q:ORDER="" D
70 .S $P(^MCAR(697.2,ORDER,0),U,PIECE)=1
71 Q
72START ;
73 S MCARGDA=$O(^MCAR(MCFILE,MCARGDA))
74 S:+MCARGDA=0 MCARGDA="" Q:MCARGDA=""
75 N Y S Y=$P($G(^MCAR(MCFILE,MCARGDA,0)),U)\1 I (Y'>0)!(Y>MCUTOFDT) Q
76 I MCFILE=691.5,'$D(^MCAR(MCFILE,MCARGDA,"ES")) Q
77 Q:$P($G(^MCAR(MCFILE,MCARGDA,"ES")),U,7)'=""
78 S DRAFT=PDUZ_"^^"_NOW_"^^^^D^"_NOW_"^^^^^^^"_$P(^MCAR(MCFILE,MCARGDA,0),U,1)
79 S RELEASE=PDUZ_"^^"_NOW_"^^^^RNV^"_NOW_"^^^^^^^"_$P(^MCAR(MCFILE,MCARGDA,0),U,1)
80 S:MCNODE'="" MCREL=$P($G(^MCAR(MCFILE,MCARGDA,MCNODE)),U,MCPIECE)
81 I MCFILE=699 S MCARCK=+$P(^MCAR(699,MCARGDA,0),U,12) I MCARCK=0,$D(^MCAR(697.2,"D",MCARCODE,MCARCK)) Q
82 I MCFILE=699.5,('$P(^MCAR(699.5,MCARGDA,0),U,3)),($P(^MCAR(699.5,MCARGDA,0),U,6)=MCARP) Q
83 D STATUS
84 S ^MCAR(MCFILE,MCARGDA,"ES")=STATUS
85 S ^MCAR(MCFILE,"ES",STATUS2,MCARGDA)=""
86 I (LOOP\5)=(LOOP/5) W "."
87 Q
88PERSON(MCESKEY) ; Get a person with the right key.
89 W !,"In order to do the conversion, you must select a provider that"
90 W !,"has the key to ",MCROUT,!!!!
91 S DIC=200,DIC(0)="AEQMZ",DIC("A")="Please select a Provider with a "_MCROUT_" key: ",DIC("S")="I $D(^XUSEC(MCESKEY,Y))"
92 S:$D(^XUSEC(MCESKEY,DUZ)) DIC("B")=DUZ
93 D ^DIC K DIC
94 Q +Y
95STATUS ; Current status of the record
96 S Y=$P($G(^MCAR(MCFILE,MCARGDA,0)),U,1) D DD^%DT
97 S:MCNODE="" MCREL="Y"
98 I MCREL="Y" D
99 .S SRELEASE=SRELEASE+1,STATUS=RELEASE,STATUS2="RNV"
100 .S ^TMP("MCAR",$J,MCOUNT)=$J(MCARGDA,10,0)_" "_$J(Y,20)_" -Released Not Verfied"
101 E D
102 .S SDRAFT=SDRAFT+1,STATUS=DRAFT,STATUS2="D"
103 .S ^TMP("MCAR",$J,MCOUNT)=$J(MCARGDA,10,0)_" "_$J(Y,20)_" -Draft"
104 S MCOUNT=MCOUNT+1
105 Q
106EXIT ;
107 K MCAR,MCARDOB,MCARDTM,MCARHDR,MCARRB,MCARWARD,MCRHR,VADM,VAIN
108 K MCARP,MCFILE,MCESON,MCESKEY,MCROUT,MCTYPE
109 K MCEBRIEF,MCEFULL,MCPBRIEF,MCPFULL,MCPRTRTN,MCBS
110 Q
Note: See TracBrowser for help on using the repository browser.