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

SDES2CLINUT.m

Go to the documentation of this file.
SDES2CLINUT ;ALB/BWF - SDES2 Clinic Save utilities ;JAN 5, 2023
 ;;5.3;Scheduling;**853,857,866,885**;Aug 13, 1993;Build 5
 ;;Per VHA Directive 6402, this routine should not be modified
 ;
 Q
SAVEPROVIDERS(ERRORS,SDCLINIC,SDIEN) ;
 N PROVIEN,ACTION,DELIEN,CURDEFPROV,DEFPROVIEN,FDA,NEWDEFIEN,FDA,SFIEN
 S PROVIEN=0 F  S PROVIEN=$O(SDCLINIC("PROVIDER",PROVIEN)) Q:'PROVIEN  D
 .S ACTION=$G(SDCLINIC("PROVIDER",PROVIEN))
 .; delete provider
 .I ACTION="@" D  Q
 ..I '$D(^SC(SDIEN,"PR","B",PROVIEN)) Q
 ..S DELIEN=$O(^SC(SDIEN,"PR","B",PROVIEN,0)) Q:'DELIEN
 ..S FDA(44.1,DELIEN_","_SDIEN_",",.01)="@" D FILE^DIE(,"FDA") K FDA
 .; default provider
 .I $D(SDCLINIC("PROVIDER",PROVIEN,"DEFAULT")) D  Q
 ..S CURDEFPROV=$$DEFPROV(SDIEN)
 ..; clear out current default provider
 ..I CURDEFPROV D
 ...S DEFPROVIEN=$O(^SC(SDIEN,"PR","B",CURDEFPROV,0))
 ...S FDA(44.1,DEFPROVIEN_","_SDIEN_",",.02)="" D FILE^DIE(,"FDA") K FDA
 ..; if the current provider exists, file it as default
 ..I $D(^SC(SDIEN,"PR","B",PROVIEN)) D  Q
 ...S NEWDEFIEN=$O(^SC(SDIEN,"PR","B",PROVIEN,0))
 ...S FDA(44.1,NEWDEFIEN_","_SDIEN_",",.02)=1 D FILE^DIE(,"FDA") K FDA
 ..; if current provider is new, file it and set to default
 ..I '$D(^SC(SDIEN,"PR","B",PROVIEN)) D  Q
 ...S FDA(44.1,"+1,"_SDIEN_",",.01)=PROVIEN
 ...S FDA(44.1,"+1,"_SDIEN_",",.02)=1
 ...D UPDATE^DIE(,"FDA") K FDA
 .; remove default provider flag if the provider is passed in without the default designation
 .I $D(^SC(SDIEN,"PR","B",PROVIEN)),'$D(SDCLINIC("PROVIDER",PROVIEN,"DEFAULT")) D  Q
 ..S SFIEN=$O(^SC(SDIEN,"PR","B",PROVIEN,0))
 ..S FDA(44.1,SFIEN_","_SDIEN_",",.02)="" D FILE^DIE(,"FDA") Q
 .; all other providers
 .I $D(^SC(SDIEN,"PR","B",PROVIEN)) Q
 .S FDA(44.1,"+1,"_SDIEN_",",.01)=PROVIEN D UPDATE^DIE(,"FDA") K FDA
 Q
SAVEDIAG(ERRORS,SDCLINIC,SDIEN) ;
 N DIAGCODE,ACTION,DIAGIEN,CURDEFDIAG,REMDIAGIEN,DEFDIAGIEN,FDA,DIAGSFIEN,SFIEN
 S CURDEFDIAG=$$DEFDIAG(SDIEN)
 S DIAGCODE="" F  S DIAGCODE=$O(SDCLINIC("DIAGNOSIS",DIAGCODE)) Q:DIAGCODE=""  D
 .S DIAGIEN=$$CODEN^ICDEX(DIAGCODE,80),DIAGIEN=+$P(DIAGIEN,U)
 .I DIAGIEN=-1 D ERRLOG^SDES2JSON(.ERRORS,85,DIAGCODE)
 .S ACTION=$G(SDCLINIC("DIAGNOSIS",DIAGCODE))
 .; delete diagnosis
 .I ACTION="@" D  Q
 ..I '$D(^SC(SDIEN,"DX","B",DIAGIEN)) Q
 ..S REMDIAGIEN=$O(^SC(SDIEN,"DX","B",DIAGIEN,0)) Q:'REMDIAGIEN
 ..S FDA(44.11,REMDIAGIEN_","_SDIEN_",",.01)="@" D FILE^DIE(,"FDA") K FDA Q
 .; Default diagnosis
 .I $D(SDCLINIC("DIAGNOSIS",DIAGCODE,"DEFAULT")) D  Q
 ..; remove the current default
 ..I CURDEFDIAG D
 ...S DEFDIAGIEN=$O(^SC(SDIEN,"DX","B",CURDEFDIAG,0)) Q:'DEFDIAGIEN
 ...S FDA(44.11,DEFDIAGIEN_","_SDIEN_",",.02)="" D FILE^DIE(,"FDA") K FDA
 ..; if the current diagnosis exists, set it to default
 ..I $D(^SC(SDIEN,"DX","B",DIAGIEN)) D  Q
 ...S DIAGSFIEN=$O(^SC(SDIEN,"DX","B",DIAGIEN,0)) Q:'DIAGSFIEN
 ...S FDA(44.11,DIAGSFIEN_","_SDIEN_",",.02)=1 D FILE^DIE(,"FDA") K FDA
 ..; if this is a new diagnosis, add it as default
 ..I '$D(^SC(SDIEN,"DX","B",DIAGIEN)) D
 ...S FDA(44.11,"+1,"_SDIEN_",",.01)=DIAGIEN
 ...S FDA(44.11,"+1,"_SDIEN_",",.02)=1
 ...D UPDATE^DIE(,"FDA") K FDA
 .; remove default diagnosis flag if the diagnosis is passed in without the default designation
 .I $D(^SC(SDIEN,"DX","B",DIAGIEN)),'$D(SDCLINIC("DIAGNOSIS",DIAGCODE,"DEFAULT")) D  Q
 ..S SFIEN=$O(^SC(SDIEN,"DX","B",DIAGIEN,0))
 ..S FDA(44.11,SFIEN_","_SDIEN_",",.02)="" D FILE^DIE(,"FDA") K FDA
 .; All other diagnosis codes
 .I $D(^SC(SDIEN,"DX","B",DIAGIEN)) Q
 .S FDA(44.11,"+1,"_SDIEN_",",.01)=DIAGIEN D UPDATE^DIE(,"FDA") K FDA
 Q
 ; CLINDATA("SPECIAL INSTRUCTION",COUNTER)=IEN|TEXT - to edit existing entry
 ; CLINDATA("SPECIAL INSTRUCTION",COUNTER)=IEN|@ for deletion
 ; CLINDATA("SPECIAL INSTRUCTION",COUNTER)=""|TEXT to add new entry
 ;
SAVEINSTRUCT(ERRORS,CLINDATA,SDIEN) ;
 N INSTRUCT,INSTDATA,INSLOOP,FDA,INSTTEXT,INSTIEN,FILERR
 S INSTRUCT=0 F  S INSTRUCT=$O(CLINDATA("SPECIAL INSTRUCTIONS",INSTRUCT)) Q:'INSTRUCT  D
 .S INSTDATA=$G(CLINDATA("SPECIAL INSTRUCTIONS",INSTRUCT))
 .S INSTIEN=$P(INSTDATA,"|")
 .S INSTTEXT=$P(INSTDATA,"|",2,99)
 .I INSTTEXT="@" D  Q
 ..; cannot delete an entry that does not exist
 ..I '$D(^SC(SDIEN,"SI",INSTIEN)) Q
 ..S FDA(44.03,INSTIEN_","_SDIEN_",",.01)="@" D FILE^DIE(,"FDA") K FDA
 .I INSTIEN,INSTTEXT'="@" D  Q
 ..I '$D(^SC(SDIEN,"SI",INSTIEN)) S FDA(44.03,"+1,"_SDIEN_",",.01)=INSTTEXT D UPDATE^DIE(,"FDA") K FDA Q
 ..S FDA(44.03,INSTIEN_","_SDIEN_",",.01)=INSTTEXT D FILE^DIE(,"FDA","FILERR") K FDA
 .I 'INSTIEN S FDA(44.03,"+1,"_SDIEN_",",.01)=INSTTEXT D UPDATE^DIE(,"FDA") K FDA
 Q
SAVEPRIVUSERS(ERRORS,CLINDATA,SDIEN)    ;
 N PUSER,USERACT,NEWIEN
 S PUSER=0 F  S PUSER=$O(CLINDATA("PRIVILEGED USER",PUSER)) Q:'PUSER  D
 .S USERACT=$G(CLINDATA("PRIVILEGED USER",PUSER))
 .I USERACT="@" S FDA(44.04,PUSER_","_SDIEN_",",.01)="@" D FILE^DIE(,"FDA") K FDA Q
 .S FDA(44.04,"+1,"_SDIEN_",",.01)=PUSER
 .S NEWIEN(1)=PUSER
 .D UPDATE^DIE(,"FDA","NEWIEN") K FDA
 Q
 ;
ADDHASH2CLIN(SDCLINICIEN) ; add HASH to clinic after creation of clinic
 N SDHASH,SDHASHDATE,SDCLNJSON,SDCLNSREC
 D BLDCLNREC(.SDCLNSREC,SDCLINICIEN)
 D BUILDJSON^SDES2JSON(.SDCLNJSON,.SDCLNSREC)
 D UPDATECLINICHASH(SDCLINICIEN,.SDHASH,.SDHASHDATE,.SDCLNJSON)
 Q
 ;
BLDCLNREC(SDCLNSREC,SDCLNIEN) ;Get Clinic data
 ;
 N SDFIELDS,SDDATA,SDMSG,SDX,SDC,SDTIMEZONE,SDTIMEZONEEXC,SDUSRCNT,SDUSRIEN,SDSTATUSINACTIVE,SDSTATUS,SDECI
 S SDECI=$G(SDECI,0)
 S SDFIELDS=".01;1;3.5;8;9;10;24;60;61;62;63;1914;2502;2504;2505;2506;2507;2802;99;99.1;2000;2000.5;2508;2509;2510;2511;2801;30;2001;2002;1918.5;2503;2500;1916;1918;20;21;1912;1913;1917"
 D GETS^DIQ(44,SDCLNIEN_",",SDFIELDS,"IE","SDDATA","SDMSG")
 S SDECI=SDECI+1
 S SDCLNSREC("Clinic","ClinicIEN")=$G(SDCLNIEN) ;Clinic IEN
 S SDCLNSREC("Clinic","ClinicName")=$G(SDDATA(44,SDCLNIEN_",",.01,"E")) ;Clinic Name
 S SDCLNSREC("Clinic","Abbreviation")=$G(SDDATA(44,SDCLNIEN_",",1,"E")) ;Clinic Abbreviation
 S SDCLNSREC("Clinic","PatientFriendlyName")=$G(SDDATA(44,SDCLNIEN_",",60,"E")) ;Patient Friendly Name
 S SDCLNSREC("Clinic","StationNumber")=$$STATIONNUMBER^SDESUTIL(SDCLNIEN) ;Clinic station number
 S SDCLNSREC("Clinic","MeetsAtThisFacility")=$G(SDDATA(44,SDCLNIEN_",",2504,"E")) ;Clinic meets at this facility?
 S SDCLNSREC("Clinic","AllowPatScheduling")=$G(SDDATA(44,SDCLNIEN_",",61,"E")) ;Allow Direct Patient Scheduling?
 S SDCLNSREC("Clinic","DisplayClinicAppt")=$G(SDDATA(44,SDCLNIEN_",",62,"E")) ;DISPLAY CLIN APPT TO PATIENTS?
 S SDCLNSREC("Clinic","VeteranSelfCancel")=$G(SDDATA(44,SDCLNIEN_",",63,"E")) ;VETERAN SELF-CANCEL
 S SDCLNSREC("Clinic","Service")=$G(SDDATA(44,SDCLNIEN_",",9,"E")) ;Service
 S SDCLNSREC("Clinic","NonCountClinic")=$G(SDDATA(44,SDCLNIEN_",",2502,"E")) ;NON-COUNT CLINIC? (Y OR N)
 S SDCLNSREC("Clinic","DivisionIEN")=$G(SDDATA(44,SDCLNIEN_",",3.5,"I")) ;Division
 S SDCLNSREC("Clinic","DivisionName")=$G(SDDATA(44,SDCLNIEN_",",3.5,"E")) ;Division
 S SDSTATUS=$$INACTIVE^SDESUTIL(SDCLNIEN,DT),SDSTATUS=$S(SDSTATUS=0:"ACTIVE",1:"INACTIVE") ;Get status of clinic
 S SDCLNSREC("Clinic","ClinicStatus")=SDSTATUS
 S SDCLNSREC("Clinic","StopCodeName")=$G(SDDATA(44,SDCLNIEN_",",8,"E")) ;Stop Code Name
 S SDCLNSREC("Clinic","StopCodeNum")=$G(SDDATA(44,SDCLNIEN_",",8,"I")) ;Stop Code IEN
 S SDCLNSREC("Clinic","StopCodeAMISNum")=$$GET1^DIQ(40.7,$G(SDDATA(44,SDCLNIEN_",",8,"I")),1) ;Stop Code AMIS Number
 S SDCLNSREC("Clinic","DefaultApptType")=$G(SDDATA(44,SDCLNIEN_",",2507,"E")) ;Default Appointment type
 S SDCLNSREC("Clinic","AdminInpatientMeds")=$G(SDDATA(44,SDCLNIEN_",",2802,"E")) ;ADMINISTER INPATIENT MEDS?
 S SDCLNSREC("Clinic","Telephone")=$G(SDDATA(44,SDCLNIEN_",",99,"E")) ;TELEPHONE
 S SDCLNSREC("Clinic","TelephoneExtension")=$G(SDDATA(44,SDCLNIEN_",",99.1,"E")) ;TELEPHONE Extension
 S SDCLNSREC("Clinic","ReqXrayFilms")=$G(SDDATA(44,SDCLNIEN_",",2000,"E")) ;REQUIRE X-RAY FILMS?
 S SDCLNSREC("Clinic","ReqActionProfiles")=$G(SDDATA(44,SDCLNIEN_",",2000.5,"E")) ;REQUIRE ACTION PROFILES?
 S SDCLNSREC("Clinic","NoShowLetter")=$G(SDDATA(44,SDCLNIEN_",",2508,"E")) ;NO SHOW LETTER
 S SDCLNSREC("Clinic","NoShowLetterIEN")=$G(SDDATA(44,SDCLNIEN_",",2508,"I")) ;NO SHOW IEN
 S SDCLNSREC("Clinic","PreApptLetter")=$G(SDDATA(44,SDCLNIEN_",",2509,"E")) ;PRE-APPOINTMENT LETTER
 S SDCLNSREC("Clinic","CancelLetter")=$G(SDDATA(44,SDCLNIEN_",",2510,"E")) ;CLINIC CANCELLATION LETTER
 S SDCLNSREC("Clinic","ApptCancelLetter")=$G(SDDATA(44,SDCLNIEN_",",2511,"E")) ;APPT. CANCELLATION LETTER
 S SDCLNSREC("Clinic","CheckinCheckoutTime")=$G(SDDATA(44,SDCLNIEN_",",24,"E")) ;ASK FOR CHECK IN/OUT TIME
 S SDCLNSREC("Clinic","DefaultToPCPractitioner")=$G(SDDATA(44,SDCLNIEN_",",2801,"E")) ;DEFAULT TO PC PRACTITIONER?
 S SDCLNSREC("Clinic","WorkloadValidationCheckout")=$G(SDDATA(44,SDCLNIEN_",",30,"E")) ;WORKLOAD VALIDATION AT CHK OUT
 S SDCLNSREC("Clinic","AllowableConsecutiveNoShows")=$G(SDDATA(44,SDCLNIEN_",",2001,"E")) ;ALLOWABLE CONSECUTIVE NO-SHOWS
 S SDCLNSREC("Clinic","MaxDaysForFutureBooking")=$G(SDDATA(44,SDCLNIEN_",",2002,"E")) ;MAX # DAYS FOR FUTURE BOOKING
 S SDCLNSREC("Clinic","HolidaySchedule")=$G(SDDATA(44,SDCLNIEN_",",1918.5,"E")) ;SCHEDULE ON HOLIDAYS?
 S SDCLNSREC("Clinic","CreditStopCodeNum")=$G(SDDATA(44,SDCLNIEN_",",2503,"I")) ;CREDIT STOP IEN
 S SDCLNSREC("Clinic","CreditStopCodeName")=$G(SDDATA(44,SDCLNIEN_",",2503,"E")) ;CREDIT STOP NAME
 S SDCLNSREC("Clinic","CreditStopCodeAMISNum")=$$GET1^DIQ(40.7,$G(SDDATA(44,SDCLNIEN_",",2503,"I")),1) ;Credit Stop Code AMIS Number
 S SDCLNSREC("Clinic","ProhibitAccessToClinic")=$G(SDDATA(44,SDCLNIEN_",",2500,"E")) ;PROHIBIT ACCESS TO CLINIC?
 S SDCLNSREC("Clinic","PhysicalLocation")=$G(SDDATA(44,SDCLNIEN_",",10,"E")) ;PHYSICAL LOCATION
 S SDCLNSREC("Clinic","Principal")=$G(SDDATA(44,SDCLNIEN_",",1916,"E")) ;PRINCIPAL Clinic
 S SDCLNSREC("Clinic","OverbooksPerDayMax")=$G(SDDATA(44,SDCLNIEN_",",1918,"E")) ;OVERBOOKS/DAY MAXIMUM
 S SDCLNSREC("Clinic","ECheckinAllowed")=$G(SDDATA(44,SDCLNIEN_",",20,"E")) ;E-CHECKIN ALLOWED
 S SDCLNSREC("Clinic","PreCheckinAllowed")=$G(SDDATA(44,SDCLNIEN_",",21,"E")) ;PRE-CHECKIN ALLOWED NO
 S SDCLNSREC("Clinic","LengthOfAppt")=$G(SDDATA(44,SDCLNIEN_",",1912,"E")) ;LENGTH OF APP'T
 S SDCLNSREC("Clinic","VariableApptLength")=$G(SDDATA(44,SDCLNIEN_",",1913,"E")) ;VARIABLE APP'NTMENT LENGTH
 S SDCLNSREC("Clinic","IncrementsPerHr")=$G(SDDATA(44,SDCLNIEN_",",1917,"E")) ;DISPLAY INCREMENTS PER HOUR
 S SDCLNSREC("Clinic","HourClinicDisplayBegins")=$S($G(SDDATA(44,SDCLNIEN_",",1914,"E"))'="":$G(SDDATA(44,SDCLNIEN_",",1914,"E")),1:8) ; HOUR CLINIC DISPLAY BEGINS
 S SDTIMEZONE=$$TIMEZONEDATA^SDESUTIL($G(SDCLNIEN)),SDTIMEZONEEXC=$P($G(SDTIMEZONE),U,3),SDTIMEZONE=$P($G(SDTIMEZONE),U)
 S SDCLNSREC("Clinic","Timezone")=SDTIMEZONE
 S SDCLNSREC("Clinic","TimezoneException")=SDTIMEZONEEXC
 S SDCLNSREC("Clinic","Inactivate Date")=$$FMTISO^SDAMUTDT($G(SDDATA(44,SDCLNIEN_",",2505,"I"))) ;Inactivate Date
 S SDCLNSREC("Clinic","Reactivate Date")=$$FMTISO^SDAMUTDT($G(SDDATA(44,SDCLNIEN_",",2506,"I"))) ;Reactivate Date
 ; Get CHAR4 Data
 N CHAR4
 S CHAR4=$$CHAR4^SDESUTIL($G(SDDATA(44,SDCLNIEN_",",.01,"E")))
 S SDCLNSREC("Clinic","CHAR4")=CHAR4
 ; Special Instructions Multiple
 S SDX="",SDC=0
 S SDFIELDS="1910*"
 K SDDATA,SDMSG
 D GETS^DIQ(44,SDCLNIEN_",",SDFIELDS,"E","SDDATA","SDMSG")
 F  S SDX=$O(SDDATA(44.03,SDX)) Q:SDX=""  D
 .S SDC=SDC+1
 .S SDCLNSREC("Clinic","Special Instructions",SDC)=$G(SDDATA(44.03,SDX,.01,"E"))
 ; Providers Multiple
 S SDX="",SDC=0
 S SDFIELDS="2600*"
 K SDDATA,SDMSG
 D GETS^DIQ(44,SDCLNIEN_",",SDFIELDS,"E","SDDATA","SDMSG")
 F  S SDX=$O(SDDATA(44.1,SDX)) Q:SDX=""  D
 .S SDC=SDC+1
 .S SDCLNSREC("Clinic","Provider",SDC,"Name")=$G(SDDATA(44.1,SDX,.01,"E"))
 .S SDCLNSREC("Clinic","Provider",SDC,"DefaultForClinic")=$G(SDDATA(44.1,SDX,.02,"E"))
 ; Diagnosis Multiple
 S SDX="",SDC=0
 S SDFIELDS="2700*"
 K SDDATA,SDMSG
 D GETS^DIQ(44,SDCLNIEN_",",SDFIELDS,"E","SDDATA","SDMSG")
 F  S SDX=$O(SDDATA(44.11,SDX)) Q:SDX=""  D
 .S SDC=SDC+1
 .S SDCLNSREC("Clinic","Diagnosis",SDC,"Code")=$G(SDDATA(44.11,SDX,.01,"E"))
 .S SDCLNSREC("Clinic","Diagnosis",SDC,"DefaultForClinic")=$G(SDDATA(44.11,SDX,.02,"E"))
 ; Return all Privileged Users
 S (SDUSRCNT,SDUSRIEN)=0
 F  S SDUSRIEN=$O(^SC(SDCLNIEN,"SDPRIV",SDUSRIEN)) Q:'SDUSRIEN  D
 .S SDUSRCNT=SDUSRCNT+1
 .S SDCLNSREC("Clinic","PrivilegedUser",SDUSRCNT,"IEN")=SDUSRIEN
 .S SDCLNSREC("Clinic","PrivilegedUser",SDUSRCNT,"Name")=$$GET1^DIQ(44.04,SDUSRIEN_","_SDCLNIEN,.01)
 ;I USRCNT=0 S SDCLNSREC("Clinic","PrivilegedUser","Error",1)="No privileged users are found."
 ;
 I $D(SDCLNSREC("Clinic")) Q 1
 S SDCLNSREC("Clinic")=""
 Q 0
 ;
UPDATECLINICHASH(SDCLIN,SDHASH,SDHASHDATE,SDCLNJSON) ;update clinic with new hash
 N SDFDA,SDFDAERR
 S SDHASH=$$SHAN^XLFSHAN(160,SDCLNJSON(1))
 S SDHASHDATE=$$NOW^XLFDT
 S SDFDA(44,SDCLIN_",",2900)=SDHASH
 S SDFDA(44,SDCLIN_",",2901)=SDHASHDATE
 D FILE^DIE(,"SDFDA","FDAERR") K FDA
 Q
 ;
ADDRESOURCE(SDCLINICIEN) ;   NEED IEN TO FILE RESOURCE ?
 N SDABBR,SDDATA,SDDI,SDFDA,SDFOUND,SDI,SDNOD,SDRT,SDFIELDS
 S SDFOUND=0
 S SDI="" F  S SDI=$O(^SDEC(409.831,"ALOC",SDCLINICIEN,SDI)) Q:SDI=""  D  Q:SDFOUND=1
 . S SDNOD=$G(^SDEC(409.831,SDI,0))
 . S SDRT=$P(SDNOD,U,11)
 . I $P(SDRT,";",2)="SC(",$P(SDRT,";",1)=SDCLINICIEN S SDFOUND=1
 S SDI=$S(SDFOUND=1:SDI,1:"+1")
 S SDFIELDS=".01;1;1917"   ;alb/sat 658 - add field 1
 D GETS^DIQ(44,SDCLINICIEN_",",SDFIELDS,"IE","SDDATA")
 S SDFDA(409.831,SDI_",",.01)=SDDATA(44,SDCLINICIEN_",",.01,"E")
 S SDDI=SDDATA(44,SDCLINICIEN_",",1917,"E") S SDFDA(409.831,SDI_",",.03)=$E(SDDI,1,2)
 S SDABBR=SDDATA(44,SDCLINICIEN_",",1,"E") S:SDABBR'="" SDFDA(409.831,SDI_",",.011)=SDABBR   ;alb/sat 658 - add abbreviation
 S SDFDA(409.831,SDI_",",.04)=SDCLINICIEN
 S SDFDA(409.831,SDI_",",.012)=SDCLINICIEN_";SC("
 S SDFDA(409.831,SDI_",",.015)=$E($$NOW^XLFDT,1,12)
 S SDFDA(409.831,SDI_",",.016)=DUZ
 D UPDATE^DIE("","SDFDA")
 Q
 ;
DEFPROV(CLINIEN) ;
 N DPROV
 S DPROV=$O(^SC("ADPR",CLINIEN,0)) Q:'DPROV 0
 Q $$GET1^DIQ(44.1,DPROV_","_CLINIEN_",",.01,"I")
 ;
DEFDIAG(CLINIEN) ;
 N DDIAG
 S DDIAG=$O(^SC("ADDX",CLINIEN,0)) Q:'DDIAG 0
 Q $$GET1^DIQ(44.11,DDIAG_","_CLINIEN_",",.01,"I")