VistA-WorldVistAEHR/r/NOIS-FSC/FSCRPCEC.m

122 lines
4.1 KiB
Mathematica

FSCRPCEC ;SLC/STAFF-NOIS RPC Edit Call ;9/6/98 21:56
;;1.1;NOIS;;Sep 06, 1998
;
EDIT(IN,OUT) ; from FSCRPX (RPCEditCall)
N CALL,EDITED,FIELDS K FIELDS
K ^TMP("FSC WP",$J)
D PROCESS^FSCRPCNC(.FIELDS)
S CALL=+$G(FIELDS("CALL"))
I 'CALL Q
I $O(^TMP("FSCRPC",$J,"INPUT",1)) D
.D FIELDS(CALL,.FIELDS,.EDITED)
.I EDITED D MRE^FSCMR(DUZ,CALL),UPDATE^FSCAUDIT(CALL)
S ^TMP("FSCRPC",$J,"OUTPUT",1)=CALL_U_$$SHORT^FSCRPXUS(CALL,DUZ)
K ^TMP("FSC WP",$J)
Q
;
FIELDS(CALL,FIELDS,EDITED) ; from FSCRPCEN
N DR,OK,STATUS,WOLDV,WNEWV K WOLDV,WNEWV
S EDITED=0
I $O(^TMP("FSC WP",$J,"DESC",0)) D
.D DESC^FSCRPCNC(CALL)
.S WOLDV("DESC")=1,WNEWV("DESC")=2
.D DESC^FSCAUDIT(CALL,.WOLDV,.WNEWV) ; forces audit update
D NOTE^FSCRPCNC(CALL)
S DR=""
I $L($G(FIELDS("SUBJECT"))) S DR=DR_";1///"_$$FIX(FIELDS("SUBJECT"))
I $D(FIELDS("SUBJECT")),FIELDS("SUBJECT")="" S DR=DR_";1///@"
I $L($G(FIELDS("PHONE"))) S DR=DR_";2.2///"_$$FIX(FIELDS("PHONE"))
I $D(FIELDS("PHONE")),FIELDS("PHONE")="" S DR=DR_";2.2///@"
I $L($G(FIELDS("PATCH"))) S DR=DR_";7///"_$$FIX(FIELDS("PATCH"))
I $D(FIELDS("PATCH")),FIELDS("PATCH")="" S DR=DR_";7///@"
I $L($G(FIELDS("KEYWORDS"))) S DR=DR_";1.5///"_$$FIX(FIELDS("KEYWORDS"))
I $D(FIELDS("KEYWORDS")),FIELDS("KEYWORDS")="" S DR=DR_";1.5///@"
I $L(DR)>100 D SETUP(CALL,"^FSCD(""CALL"",",.DR,.EDITED)
I $G(FIELDS("MOD")) S DR=DR_";3///`"_+FIELDS("MOD")
I $D(FIELDS("MOD")),FIELDS("MOD")="" S DR=DR_";3///@"
I $G(FIELDS("IRM")) S DR=DR_";2.1///`"_+FIELDS("IRM")
I $D(FIELDS("IRM")),FIELDS("IRM")="" S DR=DR_";2.1///@"
I $G(FIELDS("PRI")) S DR=DR_";6///`"_+FIELDS("PRI")
I $D(FIELDS("PRI")),FIELDS("PRI")="" S DR=DR_";6///@"
I $G(FIELDS("SPEC")) S DR=DR_";5///`"_+FIELDS("SPEC")
I $D(FIELDS("SPEC")),FIELDS("SPEC")="" S DR=DR_";5///@"
I $G(FIELDS("SPECD")) S DR=DR_";5.1///`"_+FIELDS("SPECD")
I $D(FIELDS("SPECD")),FIELDS("SPECD")="" S DR=DR_";5.1///@"
I $G(FIELDS("DEVSUB")) S DR=DR_";3.2///`"_+FIELDS("DEVSUB")
I $D(FIELDS("DEVSUB")),FIELDS("DEVSUB")="" S DR=DR_";3.2///@"
D SETUP(CALL,"^FSCD(""CALL"",",.DR,.EDITED)
S STATUS=+$G(FIELDS("STATUS"))
I STATUS=2 D I 'OK Q
.S OK=1
.S DR="81///`"_DUZ
.I $G(FIELDS("FUNC")) S DR=DR_";8///`"_+FIELDS("FUNC")
.I $G(FIELDS("TASK")) S DR=DR_";9///`"_+FIELDS("TASK")
.I $L($G(FIELDS("DATEC"))) S DR=DR_";82///"_FIELDS("DATEC")
.I $L(DR) D I 'OK Q
..N DA,DIE,X,Y
..I $E(DR)=";" S DR=$E(DR,2,245)
..S DA=CALL,DIE="^FSCD(""CALL"","
..L +^FSCD("CALL",DA):30 I '$T S OK=0 Q ; *** needs ok
..D ^DIE
..L -^FSCD("CALL",DA)
..D PICKUP^FSCES(DA)
..S DR=""
.D RES^FSCRPCNC(CALL)
D STATUS(CALL,STATUS,.EDITED)
Q
;
FIX(VALUE) ; $$(input) -> correct for invalid characters
N NEWVALUE
S NEWVALUE=$TR(VALUE,";""^","~~~")
I $E(NEWVALUE)="-" S NEWVALUE="~"_$E(NEWVALUE,2,245)
I VALUE="?" S NEWVALUE="@"
Q NEWVALUE
;
SETUP(DA,DIE,DR,EDITED) ; from FSCRPCEF
N ABBREV,CALLNUM,NEWV,OLDV,X,Y K NEWV,OLDV
S CALLNUM=DA
I '$L(DR),$O(^TMP("FSC WP",$J,"NOTE",0)) D Q
.D UPDATE^FSCTASK(CALLNUM) S EDITED=1
I '$L(DR) Q
I $E(DR)=";" S DR=$E(DR,2,245)
F ABBREV="SUBJECT","IRM","PHONE","MOD","SPEC","SPECD","PRI","PATCH","DEVSUB","KEYWORDS" S OLDV(ABBREV)=""
D GET^FSCGET("CUSTOM",CALLNUM,.OLDV)
L +^FSCD("CALL",DA):30 I '$T Q ; *** needs ok
D ^DIE
L -^FSCD("CALL",DA)
D PICKUP^FSCES(DA)
M NEWV=OLDV D GET^FSCGET("CUSTOM",CALLNUM,.NEWV)
D AUDIT^FSCAUDIT(CALLNUM,.OLDV,.NEWV)
D UPDATE^FSCTASK(CALLNUM) S EDITED=1
S DR=""
Q
;
STATUS(CALL,STATUS,EDITED) ; from FSCRPCEF
I 'STATUS Q
N PREVSTAT
S PREVSTAT=+$P(^FSCD("CALL",+CALL,0),U,17)
I PREVSTAT<2 S PREVSTAT=+$P(^FSCD("CALL",+CALL,0),U,2)
I PREVSTAT=0 D Q
.D STATUS^FSCES(CALL,"",1)
.D UPDATE^FSCTASK(CALL) S EDITED=1
.I STATUS'=1 D
..D STATUS^FSCES(CALL,1,STATUS)
..D UPDATE^FSCTASK(CALL) S EDITED=1
I STATUS,PREVSTAT=STATUS Q
D STATUS^FSCES(CALL,PREVSTAT,STATUS)
D UPDATE^FSCTASK(CALL) S EDITED=1
Q
;
REOPEN(IN,OUT) ; from FSCRPX (RPCReopenCall)
N CALL,OLDSTAT
S CALL=+$G(^TMP("FSCRPC",$J,"INPUT",1))
I 'CALL Q
S OLDSTAT=+$P($G(^FSCD("CALL",CALL,0)),U,2)
I '(OLDSTAT=2!(OLDSTAT=99)) Q
D STATUS^FSCES(CALL,OLDSTAT,1,1)
D UPDATE^FSCTASK(CALL)
D MRE^FSCMR(DUZ,CALL)
D UPDATE^FSCAUDIT(CALL)
S ^TMP("FSCRPC",$J,"OUTPUT",1)=CALL_U_$$SHORT^FSCRPXUS(CALL,DUZ)
Q