Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: MCARAM5

MCARAM5.m

Go to the documentation of this file.
  1. MCARAM5 ;WASH ISC/JKL-MUSE TRANSFER LOCAL DATA INTO DHCP ;4/24/96 09:24
  1. ;;2.3;Medicine;**31**;09/13/1996
  1. ;
  1. ;
  1. EKG(MCA,MCE) ;Transfer local array data into new EKG record in DHCP
  1. ; USAGE: S X=$$EKG^MCARAM5(.A,.B)
  1. ; WHERE: A=array of local data
  1. ; B=array of DHCP data
  1. ; including internal record number of EKG file
  1. ; if successful, returns function value of 0
  1. ; if unsuccessful, returns error message
  1. ; check for valid SSN
  1. N MCI,%,MCERR,Y,DIC,X,MCP
  1. S MCERR=$$LSSN^MCARAM6(MCA("DT"),MCA(.02),.MCP)
  1. I +MCERR'=55 S MCERR=$$NMCHK^MCARAM5(.MCA,.MCP) I +MCERR>50 Q MCERR
  1. I +MCERR=55 S MCERR=$$LNAME^MCARAM6(MCA("DT"),MCA("NAME"),.MCP) Q:+MCERR>50 "55-Social Security Number not in Patient file" S MCERR=$$SSNCHK^MCARAM5(.MCA,.MCP) I +MCERR>50 Q MCERR
  1. ; if PID not a medical patient, add PID to medical patient file
  1. I '$D(^MCAR(690,MCP(1))) S ^MCAR(690,MCP(1),0)=MCP(1),^MCAR(690,"B",MCP(1),MCP(1))="",$P(^MCAR(690,0),U,4)=$P(^MCAR(690,0),U,4)+1 S:$P(^MCAR(690,0),U,3)<MCP(1) $P(^MCAR(690,0),U,3)=MCP(1)
  1. ; set confirmation status, field 11,of record
  1. S MCA(11)="C"
  1. S MCI=.02,MCA(1)=MCP(1),DIC("DR")=".02///"_MCA(.02) F S MCI=$O(MCA(MCI)) Q:MCI=""!(MCI?1A.A) S DIC("DR")=DIC("DR")_";"_MCI_"///"_MCA(MCI)
  1. ; EKG Data dictionary identified by PID of 690, PID of 690 .01 is file 2
  1. S DIC("DR")=$P(DIC("DR"),"1///")_"1////"_$P(DIC("DR"),"1///",2,99)
  1. K DD,DO N DLAYGO S DLAYGO=691.5,DIC="^MCAR(691.5,",DIC(0)="LXZ",X=MCA("DT")
  1. D FILE^DICN
  1. I +Y'>0 Q $$LOG^MCARAM7("58-ECG record not filed")
  1. ; set automated instrument data, field 21,of record
  1. S MCE("EKG")=+Y
  1. D NOW^%DTC S ^MCAR(691.5,MCE("EKG"),"A")=%
  1. Q 0
  1. ;
  1. EKGDG(MCA,MCE) ; Transfer local array diagnosis data into EKG record
  1. ; USAGE: S X=$$EKGDG^MCARAM5(.A,.B)
  1. ; WHERE: A=array of diagnosis data
  1. ; B=array of DHCP data
  1. ; including internal record number of EKG file
  1. ; if successful, returns function value of 0
  1. ; if unsuccessful, returns error message
  1. N MCI,MCJ
  1. I '$D(^MCAR(691.5,MCE("EKG"))) Q $$LOG^MCARAM7("59-ECG record undefined-Diagnosis not filed")
  1. S MCERR=$$DGCK^MCARAM4(.MCA) I +MCERR>50 Q $$LOG^MCARAM7(MCERR)
  1. S MCI="DX,0"
  1. F MCJ=1:1:MCA(MCI) S MCI=$O(MCA(MCI)),^MCAR(691.5,MCE("EKG"),9,MCJ,0)=MCA(MCI)
  1. S ^MCAR(691.5,MCE("EKG"),9,0)=U_U_MCJ_U_MCJ
  1. Q 0
  1. ;
  1. EKGRX(MCA,MCE) ; Transfer local array medication data into EKG record
  1. ; USAGE: S X=$$EKGDG^MCARAM5(.A,.B)
  1. ; WHERE: A=array of medication data
  1. ; B=array of DHCP data
  1. ; including internal record number of EKG file
  1. ; if successful, returns function value of 0
  1. ; if unsuccessful, returns error message
  1. N MCI
  1. I '$D(^MCAR(691.5,MCE("EKG"))) Q $$LOG^MCARAM7("60-ECG record undefined-Medication not filed")
  1. S ^MCAR(691.5,MCE("EKG"),2,0)="^691.53PA"
  1. S MCERR=$$RXCK^MCARAM4(.MCA) I +MCERR>0 Q $$LOG^MCARAM7(MCERR)
  1. S DIE="^MCAR(691.5,"_MCE("EKG")_",2,",DA(1)=MCE("EKG")
  1. F MCI=1:1:MCA("RX,0") S DA=MCI,DR=".01///^S X=$P(MCA(""RX,""_MCI),U);1///^S X=$P(MCA(""RX,""_MCI),U,2);2///^S X=$P(MCA(""RX,""_MCI),U,3)" D ^DIE
  1. S ^MCAR(691.5,MCE("EKG"),2,0)="^691.53PA^"_MCI_U_MCI
  1. Q 0
  1. ;
  1. EKGOR(MCA,MCE) ;Transfer order entry data into EKG record
  1. ; USAGE: S X=$$EKGOR^MCARAM5(.A,.B)
  1. ; WHERE: A=array of local data
  1. ; including print name for ECG procedure/subspecialty
  1. ; B=array of DHCP data
  1. ; including internal record number of EKG file
  1. ; if successful, returns function value of 0
  1. ; if unsuccessful, returns error message
  1. Q 0
  1. NMCHK(MCA,MCP) ;Check name input against patient data
  1. ; Marquette allows 16 chars for last name and 10 chars for first etc.
  1. ; USAGE: S X=$$NMCHK^MCARAM5(.MCA,.MCP)
  1. ; WHERE: MCA=array of local data
  1. ; MCP=array of DHCP patient data
  1. ; if successful, returns function value of 0
  1. ; if unsuccessful, returns error message
  1. N MCI,MCERR S MCERR=0
  1. S MCP("LNAME")=$P(MCP("NAME"),","),MCA("LNAME")=$P(MCA("NAME"),",")
  1. F MCI=1:1:$L(MCP("LNAME")) Q:$L(MCP("LNAME"))>16 I $E(MCA("LNAME"),MCI,MCI)'=$E(MCP("LNAME"),MCI,MCI) S MCERR="56-Name does not match Patient file" Q
  1. Q MCERR
  1. ;
  1. SSNCHK(MCA,MCP) ;Check SSN input
  1. ; USAGE: S X=$$SSNCHK^MCARAM5(.MCA,.MCP)
  1. ; WHERE: MCA=array of local data
  1. ; MCP=array of DHCP patient data
  1. ; if successful, returns function value of 0
  1. ; if unsuccessful, returns error message
  1. N MCI,MCERR S MCERR=0
  1. S MCP("SSN")=$P(^DPT(MCP(1),0),"^",9)
  1. I $E(MCA(.02),1,8)'=$E(MCP("SSN"),1,8) S MCERR="55-Social Security Number not in Patient file"
  1. Q MCERR