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

AMHGECM.m

Go to the documentation of this file.
  1. AMHGECM ; IHS/CMI/MAW - AMHG Case Management Adds/Edits 3/3/2009 5:00:28 PM ;
  1. ;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
  1. ;
  1. ;
  1. ;
  1. DEBUG(RETVAL,AMHSTR) ;-- debug entry point
  1. D DEBUG^%Serenji("EP^AMHGD(RETVAL,.AMHSTR)")
  1. Q
  1. ;
  1. CM(AMHIEN,DM,REC,PRO,CO,PP,PV,CA,NR,DC,DSP,PAT,CMT) ;EP -- file the case status
  1. N AMHFDA,AMHIENS,AMHERRR,FL
  1. S FL=9002011.58
  1. S AMHIENS=$S(DM="A":"+1,",1:REC_",")
  1. S AMHFDA(FL,AMHIENS,.02)=PAT
  1. S AMHFDA(FL,AMHIENS,.03)=PRO
  1. S AMHFDA(FL,AMHIENS,.04)=CA
  1. S AMHFDA(FL,AMHIENS,.05)=DC
  1. S AMHFDA(FL,AMHIENS,.06)=DSP
  1. S AMHFDA(FL,AMHIENS,.08)=PP
  1. S AMHFDA(FL,AMHIENS,.09)=PV
  1. S AMHFDA(FL,AMHIENS,.12)=NR
  1. S AMHFDA(FL,AMHIENS,1101)=CMT
  1. I DM="A" D Q
  1. . S AMHFDA(FL,AMHIENS,.01)=CO
  1. . S AMHFDA(FL,AMHIENS,.11)=DT
  1. . D UPDATE^DIE("","AMHFDA","AMHIENS","AMHERRR(0")
  1. . I '$D(AMHERRR) S AMHIEN=$G(AMHIENS(1)) Q
  1. . S AMHER="0~Add Case"
  1. I DM="E" D Q
  1. . S AMHFDA(FL,AMHIENS,.01)=CO
  1. . D FILE^DIE("K","AMHFDA","AMHERRR(0)")
  1. . I '$D(AMHERRR) S AMHIEN=REC Q
  1. . S AMHER="0~Edit Case"
  1. Q
  1. ;
  1. PI(AMHIEN,DM,REC,DMP,DSP,DCP,DPO,DONA,DONB,FLG,FLGN) ;EP -- file the patient information
  1. N AMHFDA,AMHIENS,AMHERRR,FL
  1. S FL=9002011.55
  1. S AMHIENS=$S(DM="A":"+1,",1:REC_",")
  1. I '$D(^AMHPATR(REC)) S AMHIENS="+1,",DM="A"
  1. I $D(^AMHPATR(REC)) S AMHIENS=REC_",",DM="E"
  1. S AMHIENS(1)=REC
  1. S AMHFDA(FL,AMHIENS,.02)=DMP
  1. S AMHFDA(FL,AMHIENS,.03)=DSP
  1. S AMHFDA(FL,AMHIENS,.04)=DCP
  1. S AMHFDA(FL,AMHIENS,.09)=FLG
  1. S AMHFDA(FL,AMHIENS,.11)=FLGN
  1. S AMHFDA(FL,AMHIENS,.12)=DPO
  1. S AMHFDA(FL,AMHIENS,.13)=DONA
  1. S AMHFDA(FL,AMHIENS,.14)=DONB
  1. I DM="A" D Q
  1. . S AMHFDA(FL,AMHIENS,.01)=REC
  1. . D UPDATE^DIE("","AMHFDA","AMHIENS","AMHERRR(0")
  1. . I '$D(AMHERRR) S AMHIEN=$G(AMHIENS(1)) Q
  1. . S AMHER="0~Add Patient Information"
  1. I DM="E" D Q
  1. . D FILE^DIE("K","AMHFDA","AMHERRR(0)")
  1. . I '$D(AMHERRR) S AMHIEN=REC Q
  1. . S AMHER="0~Edit Patient Information"
  1. Q
  1. ;
  1. PH(AMHIEN,D,RC,PHSTR) ;EP -- add/edit/delete Personal History
  1. N PHS
  1. D ARRAY^AMHGU(.PHS,PHSTR)
  1. N AMHDA
  1. S AMHDA=0 F S AMHDA=$O(PHS(AMHDA)) Q:'AMHDA D
  1. . N PH
  1. . S PH=+$G(PHS(AMHDA))
  1. . D MODPH(PH,RC)
  1. D DELPH(RC,.PHS)
  1. Q
  1. ;
  1. MODPH(PI,R) ;-- add a personal history
  1. Q:$$FNDPH^AMHGU(R,PI)
  1. N AMHFDA,AMHIENS,AMHERRR,AMHPIEN
  1. S AMHIENS="+1,"
  1. S AMHFDA(9002011.52,AMHIENS,.01)=PI
  1. S AMHFDA(9002011.52,AMHIENS,.02)=R
  1. S AMHFDA(9002011.52,AMHIENS,.03)=DT
  1. D UPDATE^DIE("","AMHFDA","AMHIENS","AMHERRR(1)")
  1. I $D(AMHERRR) S AMHER="0~Add Personal History"
  1. S AMHPIEN=$G(AMHIENS(1))
  1. Q
  1. ;
  1. DELPH(REC,PHI) ;-- check to see if any personal history records were deleted during edit
  1. N ADA,R,C,PH
  1. S R="~"
  1. S ADA=0 F S ADA=$O(PHI(ADA)) Q:'ADA D
  1. . N PHIEN
  1. . S PHIEN=$P(PHI(ADA),R)
  1. . S PH(PHIEN)=PHIEN
  1. N IEN
  1. S IEN=0 F S IEN=$O(^AMHPPHX("AA",REC,IEN)) Q:'IEN D
  1. . I '$G(PH(IEN)) D
  1. .. S DIK="^AMHPPHX(",DA=$O(^AMHPPHX("AA",REC,IEN,0)) D ^DIK
  1. Q
  1. ;