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

91 lines
4.2 KiB
Mathematica
Raw Normal View History

2009-11-29 13:37:14 -05:00
FSCRPCOC ;SLC/STAFF-NOIS RPC Other Contacts ;6/3/98 11:00
;;1.1;NOIS;;Sep 06, 1998
;
CONTACTS(IN,OUT) ; from FSCRPX (RPCCallContacts)
N CALL,CONTACT,CONTPH,CNT,DEVSP,MOD,NUM,PACK,PACKNAME,PIECE,SITE,SPEC,STINFO,STSITE,UNUM,USER,USERS K USERS
S CALL=+$G(^TMP("FSCRPC",$J,"INPUT",1))
I 'CALL S ^TMP("FSCRPC",$J,"OUTPUT",1)="no information" Q
S NUM=0
S SITE=$P(^FSCD("CALL",CALL,0),U,5),CONTACT=$P(^(0),U,6),CONTPH=$P(^(0),U,7),MOD=$P(^(0),U,8),SPEC=$P(^(0),U,9),DEVSP=$P(^(0),U,21)
I SPEC S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)="Specialist: "_$$VALUE^FSCGET(SPEC,7100,5)_" "_$$PH(SPEC)
I DEVSP S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)="Referred Specialist: "_$$VALUE^FSCGET(DEVSP,7100,5.1)_" "_$$PH(DEVSP)
S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)=""
S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)="Contact: "_$$VALUE^FSCGET(CONTACT,7100,2.1)_" "_CONTPH
S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)="NOIS contact information for this location: "_$$NOISINFO(SITE)
I 'MOD Q
S PACK=+$P(^FSC("MOD",MOD,0),U,8),PACKNAME=$P($G(^FSC("PACK",PACK,0)),U)
I '$L(PACKNAME) Q
S STSITE=$$STSITE(SITE) I STSITE D
.S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)=""
.S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)="IRM Chief and phone: "_$$IRMINFO(STSITE)
.S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)=PACKNAME_" ADPAC and phone: "_$$APINFO(STSITE,PACK)
.S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)="Information on "_$P(^FSC("SITE",SITE,0),U)_":"
.S STINFO=$G(^NTS(2050,STSITE,1))
.F PIECE=1:1:3 S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)=" "_$P(STINFO,U,PIECE)
.S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)=", "_$$VALUE^FSCGET($P(STINFO,U,4),2050,7)_" "_$P(STINFO,U,5)
.S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)=" FTS #: "_$P(STINFO,U,6)
.S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)=" COMM #: "_$P(STINFO,U,7)
S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)=""
S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)="Those affiliated with "_PACKNAME_":"
D AFFIL(PACK,.USERS)
S CNT=16,USER="" F S USER=$O(USERS(USER)) Q:USER="" D
.S UNUM=0 F S UNUM=$O(USERS(USER,UNUM)) Q:UNUM<1 D
..S NUM=NUM+1,^TMP("FSCRPC",$J,"OUTPUT",NUM)=USER_" "_USERS(USER,UNUM)
..S CNT=CNT+1
Q
;
AFFIL(PACK,USERS) ;
N DUTIES,FUNC,PACKGP,USER,USERNAME K USERS
S PACKGP=+$P(^FSC("PACK",PACK,0),U,2)
S USER=0 F S USER=$O(^FSC("SPEC","AG",PACKGP,USER)) Q:USER<.1 D
.I '$$ACCESS^FSCU(USER,"SPEC") Q
.S USERNAME=$P(^VA(200,USER,0),U)
.I $P($G(^FSC("SPEC",USER,20,+$O(^FSC("SPEC","AG",PACKGP,USER,0)),0)),U,3) D
..S DUTIES=$P($G(^FSC("SPEC",USER,20,+$O(^FSC("SPEC","AG",PACKGP,USER,0)),0)),U,2)
..S FUNC=$$VALUE^FSCGET($P(^FSC("SPEC",USER,0),U,4),7105.2,4) I $L(FUNC) S FUNC="("_FUNC_")"
..S USERS(USERNAME,USER)=FUNC_" "_DUTIES_" "_$$PH(USER)
S USER=0 F S USER=$O(^FSC("SPEC","AP",PACK,USER)) Q:USER<.1 D
.I '$$ACCESS^FSCU(USER,"SPEC") Q
.S USERNAME=$P(^VA(200,USER,0),U)
.S DUTIES=$P($G(^FSC("SPEC",USER,30,+$O(^FSC("SPEC","AP",PACK,USER,0)),0)),U,2)
.S FUNC=$$VALUE^FSCGET($P(^FSC("SPEC",USER,0),U,4),7105.2,4) I $L(FUNC) S FUNC="("_FUNC_")"
.S USERS(USERNAME,USER)=FUNC_" "_DUTIES_" "_$$PH(USER)
Q
;
NOISINFO(SITE) ; $$(site) -> contact & phone #
N INFO
S INFO=$P($G(^FSC("SITE",SITE,0)),U,6) I 'INFO Q ""
S INFO=$$VALUE^FSCGET(INFO,7100,2.1)
S INFO=INFO_" "_$S($L($P(^FSC("SITE",SITE,0),U,7)):$P(^(0),U,7),1:$P(^(0),U,8))
Q INFO
;
PH(PERSON) ; $$(person) -> phone # from file 200
Q $P($G(^VA(200,PERSON,.13)),U,2)
;
IRMINFO(STSITE) ; $$(site) -> irm chief & phone #
N INFO,IRM
S IRM=$G(^NTS(2050,STSITE,21))
S INFO=$P(IRM,U)_" "_$P(IRM,U,2) I $L(INFO)=2 Q ""
Q INFO
;
APINFO(STSITE,PACK) ; $$(site, pack) -> adpac & phone #
N ADPAC,INFO,STPACK
S STPACK=$$STPACK(PACK) I 'STPACK Q ""
S ADPAC=$G(^NTS(2050,STSITE,8,STPACK,0))
S INFO=$P(ADPAC,U,2)_" "_$P(ADPAC,U,3) I $L(INFO)=2 Q ""
Q INFO
;
STSITE(SITE) ; $$(site) -> site tracking site
N DOMAIN,STSITE
S DOMAIN=+$P(^FSC("SITE",SITE,0),U,14) I 'DOMAIN Q ""
S DOMAIN=$$VALUE^FSCGET(DOMAIN,7105.1,9)
S STSITE=+$O(^NTS(2050,"AE",DOMAIN,0)) I 'STSITE Q ""
Q STSITE
;
STPACK(PACK) ; $$(package) -> site tracking package
N OPACK,STPACK
I '$L(PACK) Q ""
S OPACK=+$P($G(^FSC("PACK",PACK,0)),U,3) I 'OPACK Q ""
S STPACK=+$O(^DIC(120102,"AP",OPACK,0)) I 'STPACK Q ""
Q STPACK