SCRPTP3 ;ALB/CMM - List of Team's Patients ; 29 Jun 99 04:11PM ;;5.3;Scheduling;**41,48,98,177,231,433**;AUG 13, 1993 ; ;List of Team's Patients Report ; HITS(ARRY,TIEN) ; ;ARRY - list of patients for a given team ;TIEN - team ien ; N PTIEN,PIEN,PTNAME,PNAME,PTAI,NXT,NODE,CIEN,CNAME,INAME,INST,LAST,NEXT N PAIEN,PC,PHONE,PNODE,PTPA,PTPAN,ROL,PID,TINFO,TNAME,TPIEN,TPNODE N CNT,TPA,FLAG,DFN,VA,VAERR,PCAP,ROLN S INACTIVE=0 S NXT=0 F S NXT=$O(@ARRY@(NXT)) Q:NXT=""!(NXT'?.N) D .S NODE=$G(@ARRY@(NXT)) .Q:NODE="" .S PTIEN=+$P(NODE,"^") ;patient ien .S PTNAME=$P(NODE,"^",2) ;patient name .S PTAI=+$P(NODE,"^",3) ;patient team assignment ien (#404.42) .; .S PNODE=$G(^DPT(PTIEN,0)) .Q:PNODE="" .S DFN=PTIEN .D PID^VADPT6 .S PID=VA("BID") .; .S TPA=$$TPAR(PTAI,"") .I TPA'=-1 D ..S PIEN=$P(TPA,"^") ..S PNAME=$P(TPA,"^",2) ..S CNAME=$P(TPA,"^",3) ..S LAST=$P(TPA,"^",4) ..S NEXT=$P(TPA,"^",5) ..; ..S FLAG="Y" ..S TINFO=$$TINF^SCRPTP(TIEN) ;team information ..S INST=+$P(TINFO,"^") ;institution ien ..S INAME=$P($G(^DIC(4,INST,0)),"^") ;institution name ..S PHONE=$P(TINFO,"^",4) ;team phone ..S PC=$P(TINFO,"^",3) ;primary care? ..S TNAME=$P(TINFO,"^",2) ;team name ..; ..D TFORMAT^SCRPTP2(INST,INAME,TIEN,TNAME,PHONE,PC) ..D FORMAT^SCRPTP(INST,TIEN,PTIEN,PTNAME,PID,PIEN,PNAME,CNAME,LAST,NEXT) .; .;check for other assignments .N TPIN .S CNT="" .F S CNT=$O(^SCPT(404.43,"B",PTAI,CNT)) Q:CNT=""!(CNT'?.N) D ..S TPIN=$$TPAR(PTAI,CNT) ..Q:TPIN=-1 ..S PIEN=$P(TPIN,"^") ..S PNAME=$P(TPIN,"^",2) ..S CNAME=$P(TPIN,"^",3) ..S LAST=$P(TPIN,"^",4) ..S NEXT=$P(TPIN,"^",5) ..S ROLN=$P(TPIN,U,6) ..S PCAP=$P(TPIN,U,7) ..I '$D(FLAG) D ...S TINFO=$$TINF^SCRPTP(TIEN) ;team information ...S INST=+$P(TINFO,"^") ;institution ien ...S INAME=$P($G(^DIC(4,INST,0)),"^") ;institution name ...S PHONE=$P(TINFO,"^",4) ;team phone ...S PC=$P(TINFO,"^",3) ;primary care? ...S TNAME=$P(TINFO,"^",2) ;team name ...; ...D TFORMAT^SCRPTP2(INST,INAME,TIEN,TNAME,PHONE,PC) ..D FORMAT^SCRPTP(INST,TIEN,PTIEN,PTNAME,PID,PIEN,PNAME,CNAME,LAST,NEXT,ROLN,PCAP) I INACTIVE S @STORE@(INST,TIEN,"INACT")="" Q ; TPAR(PTAI,START) ; N PTPA,TPIEN,TPNODE,ROL,CNAME,CIEN,ENROLL,OKAY,PNAME,NEXT,LAST,PAIEN N ROLN,PCAP I '$D(^SCPT(404.43,"B",PTAI)) Q "0^[Not Assigned]" ; ^ no patient team position assignment IF START="" D .S PTPA=$O(^SCPT(404.43,"B",PTAI,START)) ELSE D .S PTPA=START I PTPA="" Q "0^[Not Assigned]" S PTPAN=$G(^SCPT(404.43,PTPA,0)) ;patient team position assignment node I PTPAN=""!(PTPAN=0) Q "0^[Not Assigned]" I $P(PTPAN,"^",4)'="",$P(PTPAN,"^",4)