SDES2CREATECLIN ;ALB/MGD/BLB,BWF - SDES2 CREATE CLINIC MAIN DRIVER ;SEPT 20,2023
;;5.3;Scheduling;**853,860,871,885**;Aug 13, 1993;Build 5
;;Per VHA Directive 6402, this routine should not be modified
;
; The SDCONTEXT array is controlled by the Acheron application and its fields are
; needed for the storage of the required auditing information.
;
; SDCONTEXT("ACHERON AUDIT ID") = Up to 40 Character unique ID number. Ex: 11d9dcc6-c6a2-4785-8031-8261576fca37
; SDCONTEXT("PATIENT DFN") = The DFN/IEN of the target patient from the calling application.
; SDCONTEXT("PATIENT ICN") = The ICN of the target patient from the calling application.
; SDCONTEXT("USER DUZ") = The DUZ of the user taking action in the calling application.
; SDCONTEXT("USER SECID") = The SECID of the user taking action in the calling application.
;
; The SDCLINIC array contains all of the Clinic specific input variables needed
; to add and configure a clinic.
;
; Required Input Variables
; ========================
; Field # Array Element
; 2001 SDCLINIC("ALLOWABLE CONSECUTIVE NO-SHOWS")
; 61 SDCLINIC("DIRECT PATIENT SCHEDULING")
; 8 SDCLINIC("PRIMARY AMIS")
; .01 SDCLINIC("NAME")
; 62 SDCLINIC("DISPLAY APPOINTMENTS")
; 1917 SDCLINIC("DISPLAY INCREMENTS PER HOUR")
; 3.5 SDCLINIC("DIVISION")
; 20 SDCLINIC("E-CHECKIN ALLOWED")
; 1912 SDCLINIC("LENGTH OF APPOINTMENT")
; 2002 SDCLINIC("MAX DAYS FUTURE BOOKING")
; 2504 SDCLINIC("MEETS AT FACILITY")
; 2502 SDCLINIC("NON-COUNT")
; 1918 SDCLINIC("OVERBOOKS/DAY MAX")
; 21 SDCLINIC("PRE-CHECKIN ALLOWED")
; 2000.5 SDCLINIC("REQUIRE ACTION PROFILES")
; 9 SDCLINIC("SERVICE")
;
; Optional Input Variables
; Field # Array Element
; ========================
; 1 SDCLINIC("ABBREVIATION")
; 2802 SDCLINIC("ADMIN INPATIENT MEDS")
; 2511 SDCLINIC("APPOINTMENT CANCELLATION LETTER")
; 24 SDCLINIC("ASK CHECK IN/OUT")
; 2510 SDCLINIC("CLINIC CANCELLATION LETTER")
; 2503 SDCLINIC("CREDIT AMIS")
; 2507 SDCLINIC("DEFAULT APPOINTMENT TYPE")
; 2801 SDCLINIC("DEFAULT TO PC PRACTITIONER")
; 2700/.01 SDCLINIC("DIAGNOSIS",DIAGNOSISCODE)
; 2700/.02 SDCLINIC("DIAGNOSIS",DIAGNOSISCODE,"DEFAULT")
; 1914 SDCLINIC("HOUR CLINIC DISPLAY BEGINS")
; 2508 SDCLINIC("NO-SHOW LETTER")
; 60 SDCLINIC("PATIENT FRIENDLY NAME")
; 63 SDCLINIC("VETERAN SELF-CANCEL")
; 10 SDCLINIC("PHYSICAL LOCATION")
; 2509 SDCLINIC("PRE-APPOINTMENT LETTER")
; 1916 SDCLINIC("PRINCIPAL CLINIC")
; 2501/.01 SDCLINIC("PRIVILEGED USER",IEN)
; 2500 SDCLINIC("PROHIBIT ACCESS TO CLINIC")
; 2600/.01 SDCLINIC("PROVIDER",VPROVIEN)
; 2600/.02 SDCLINIC("PROVIDER",VPROVIEN,"DEFAULT")
; 2000 SDCLINIC("REQUIRE X-RAY")
; 1918.5 SDCLINIC("SCHEDULE ON HOLIDAYS")
; 1910/.01 SDCLINIC("SPECIAL INSTRUCTIONS",NUMBER)= "(null value) |SPECIAL INSTRUCTION TEXT UP TO 80 CHARACTERS" FOR ADDITION
; SDCLINIC("SPECIAL INSTRUCTIONS",NUMBER)= "INSTRUCTION ID|SPECIAL INSTRUCTION TEXT UP TO 80 CHARACTERS" FOR EDIT
; 99 SDCLINIC("TELEPHONE")
; 99.1 SDCLINIC("TELEPHONE EXTENSION")
; 1913 SDCLINIC("VARIABLE APPOINTMENT LENGTH")
; 30 SDCLINIC("WORKLOAD VALIDATION")
;
Q
;
; RPC: SDES2 CREATE CLINIC
;
CREATECLINIC(SDRETURN,SDCONTEXT,SDCLINIC) ; Add a new clinic to the HOSPITAL LOCATION file (#44)
;
N SDERRORS,SDJSONERRORS,SDFDA,SDCLINRETURN,SDFILEDATA,SDCLINICIEN,SDRESULTS
;
; Can't send in @ for Create Clinic
D CHECKFORDEL^SDES2UTIL(.SDERRORS,.SDCONTEXT)
I $D(SDERRORS) S SDJSONERRORS("CreateClinic",1)="" M SDJSONERRORS=SDERRORS D BUILDJSON^SDES2JSON(.SDRETURN,.SDJSONERRORS) Q
;
D CHECKFORDEL^SDES2UTIL(.SDERRORS,.SDCLINIC)
I $D(SDERRORS) S SDJSONERRORS("CreateClinic",1)="" M SDJSONERRORS=SDERRORS D BUILDJSON^SDES2JSON(.SDRETURN,.SDJSONERRORS) Q
;
D CHECKFORDELMULT^SDES2UTIL(.SDERRORS,.SDCLINIC)
I $D(SDERRORS) S SDJSONERRORS("CreateClinic",1)="" M SDJSONERRORS=SDERRORS D BUILDJSON^SDES2JSON(.SDRETURN,.SDJSONERRORS) Q
;
D VALCONTEXT^SDES2VALCONTEXT(.SDERRORS,.SDCONTEXT)
I $D(SDERRORS) S SDJSONERRORS("CreateClinic",1)="" M SDJSONERRORS=SDERRORS D BUILDJSON^SDES2JSON(.SDRETURN,.SDJSONERRORS) Q
;
D VALCLINIC^SDES2VALCRTCLIN1(.SDERRORS,.SDCLINIC,.SDFILEDATA)
I $D(SDERRORS) S SDJSONERRORS("CreateClinic",1)="" M SDJSONERRORS=SDERRORS D BUILDJSON^SDES2JSON(.SDRETURN,.SDJSONERRORS) Q
;
D CREATEFDAARRAY(.SDFILEDATA,.SDFDA)
;
D FILECLINIC(.SDERRORS,.SDFDA,.SDCLINICIEN)
I $D(SDERRORS) M SDJSONERRORS=SDERRORS D BUILDJSON^SDES2JSON(.SDRETURN,.SDJSONERRORS)
;
Q:'$G(SDCLINICIEN)
; Add multiple fields after creation of clinic
D ADDMULTIPLES(.SDERRORS,.SDFILEDATA,.SDCLINICIEN)
;
D ADDHASH2CLIN^SDES2CLINUT(SDCLINICIEN)
;
D ADDRESOURCE^SDES2CLINUT(SDCLINICIEN)
;
I +$G(SDCLINICIEN) S SDCLINRETURN("CreateClinic","IEN")=SDCLINICIEN
D BUILDJSON^SDES2JSON(.SDRETURN,.SDCLINRETURN)
Q
;
CREATEFDAARRAY(FILEDATA,SDFDA) ;
; Clinic Data - Required Fields
I $G(FILEDATA("ALLOWABLE CONSECUTIVE NO-SHOWS"))'="" S SDFDA(44,"+1,",2001)=FILEDATA("ALLOWABLE CONSECUTIVE NO-SHOWS")
I $G(FILEDATA("DIRECT PATIENT SCHEDULING"))'="" S SDFDA(44,"+1,",61)=FILEDATA("DIRECT PATIENT SCHEDULING")
I $G(FILEDATA("DISPLAY APPOINTMENTS"))'="" S SDFDA(44,"+1,",62)=FILEDATA("DISPLAY APPOINTMENTS")
I $G(FILEDATA("DISPLAY INCREMENTS PER HOUR"))'="" S SDFDA(44,"+1,",1917)=FILEDATA("DISPLAY INCREMENTS PER HOUR")
I $G(FILEDATA("DIVISION"))'="" S SDFDA(44,"+1,",3.5)=FILEDATA("DIVISION")
I $G(FILEDATA("E-CHECKIN ALLOWED"))'="" S SDFDA(44,"+1,",20)=FILEDATA("E-CHECKIN ALLOWED")
I $G(FILEDATA("LENGTH OF APPOINTMENT"))'="" S SDFDA(44,"+1,",1912)=FILEDATA("LENGTH OF APPOINTMENT")
I $G(FILEDATA("MAX DAYS FUTURE BOOKING"))'="" S SDFDA(44,"+1,",2002)=FILEDATA("MAX DAYS FUTURE BOOKING")
I $G(FILEDATA("NAME"))'="" S SDFDA(44,"+1,",.01)=FILEDATA("NAME")
I $G(FILEDATA("NON-COUNT"))'="" S SDFDA(44,"+1,",2502)=FILEDATA("NON-COUNT")
I $G(FILEDATA("OVERBOOKS/DAY MAX"))'="" S SDFDA(44,"+1,",1918)=FILEDATA("OVERBOOKS/DAY MAX")
I $G(FILEDATA("PRE-CHECKIN ALLOWED"))'="" S SDFDA(44,"+1,",21)=FILEDATA("PRE-CHECKIN ALLOWED")
I $G(FILEDATA("PRIMARY AMIS"))'="" S SDFDA(44,"+1,",8)=FILEDATA("PRIMARY AMIS")
I $G(FILEDATA("REQUIRE ACTION PROFILES"))'="" S SDFDA(44,"+1,",2000.5)=FILEDATA("REQUIRE ACTION PROFILES")
I $G(FILEDATA("SERVICE"))'="" S SDFDA(44,"+1,",9)=FILEDATA("SERVICE")
S SDFDA(44,"+1,",2.1)=$$FIND1^DIC(40.9,,,"CLINIC") ;Type Extension pointer to 40.9
; Optional Fields
I $G(FILEDATA("ABBREVIATION"))'="" S SDFDA(44,"+1,",1)=FILEDATA("ABBREVIATION")
I $G(FILEDATA("ADMIN INPATIENT MEDS"))'="" S SDFDA(44,"+1,",2802)=FILEDATA("ADMIN INPATIENT MEDS")
I $G(FILEDATA("APPOINTMENT CANCELLATION LETTER"))'="" S SDFDA(44,"+1,",2511)=FILEDATA("APPOINTMENT CANCELLATION LETTER")
I $G(FILEDATA("ASK CHECK IN/OUT"))'="" S SDFDA(44,"+1,",24)=FILEDATA("ASK CHECK IN/OUT")
I $G(FILEDATA("CLINIC CANCELLATION LETTER"))'="" S SDFDA(44,"+1,",2510)=FILEDATA("CLINIC CANCELLATION LETTER")
I $G(FILEDATA("CREDIT AMIS"))'="" S SDFDA(44,"+1,",2503)=FILEDATA("CREDIT AMIS")
I $G(FILEDATA("DEFAULT APPOINTMENT TYPE"))'="" S SDFDA(44,"+1,",2507)=FILEDATA("DEFAULT APPOINTMENT TYPE")
I $G(FILEDATA("DEFAULT TO PC PRACTITIONER"))'="" S SDFDA(44,"+1,",2801)=FILEDATA("DEFAULT TO PC PRACTITIONER")
I $G(FILEDATA("HOUR CLINIC DISPLAY BEGINS"))'="" S SDFDA(44,"+1,",1914)=FILEDATA("HOUR CLINIC DISPLAY BEGINS")
I $G(FILEDATA("MEETS AT FACILITY"))'="" S SDFDA(44,"+1,",2504)=FILEDATA("MEETS AT FACILITY")
I $G(FILEDATA("NO-SHOW LETTER"))'="" S SDFDA(44,"+1,",2508)=FILEDATA("NO-SHOW LETTER")
I $G(FILEDATA("PATIENT FRIENDLY NAME"))'="" S SDFDA(44,"+1,",60)=FILEDATA("PATIENT FRIENDLY NAME")
I $G(FILEDATA("PBSPID"))'="" S SDFDA(44,"+1,",200)=FILEDATA("PBSPID")
I $G(FILEDATA("PHYSICAL LOCATION"))'="" S SDFDA(44,"+1,",10)=FILEDATA("PHYSICAL LOCATION")
I $G(FILEDATA("PRE-APPOINTMENT LETTER"))'="" S SDFDA(44,"+1,",2509)=FILEDATA("PRE-APPOINTMENT LETTER")
I $G(FILEDATA("PRINCIPAL CLINIC"))'="" S SDFDA(44,"+1,",1916)=FILEDATA("PRINCIPAL CLINIC")
I $G(FILEDATA("PROHIBIT ACCESS TO CLINIC"))'="" S SDFDA(44,"+1,",2500)=FILEDATA("PROHIBIT ACCESS TO CLINIC")
I $G(FILEDATA("REQUIRE X-RAY"))'="" S SDFDA(44,"+1,",2000)=FILEDATA("REQUIRE X-RAY")
I $G(FILEDATA("SCHEDULE ON HOLIDAYS"))'="" S SDFDA(44,"+1,",1918.5)=FILEDATA("SCHEDULE ON HOLIDAYS")
I $G(FILEDATA("TELEPHONE"))'="" S SDFDA(44,"+1,",99)=FILEDATA("TELEPHONE")
I $G(FILEDATA("TELEPHONE EXTENSION"))'="" S SDFDA(44,"+1,",99.1)=FILEDATA("TELEPHONE EXTENSION")
I $G(FILEDATA("VARIABLE APPOINTMENT LENGTH"))'="" S SDFDA(44,"+1,",1913)=FILEDATA("VARIABLE APPOINTMENT LENGTH")
I $G(FILEDATA("WORKLOAD VALIDATION"))'="" S SDFDA(44,"+1,",30)=FILEDATA("WORKLOAD VALIDATION")
I $G(FILEDATA("VETERAN SELF-CANCEL"))'="" S SDFDA(44,"+1,",63)=FILEDATA("VETERAN SELF-CANCEL")
S SDFDA(44,"+1,",2)="C" ; C:CLINIC
Q
;
FILECLINIC(SDERRORS,SDFILEDATA,SDCLINICIEN) ;
N SDCLINRET,SDCLINMSG,SDCNT,SDERRNUM
D UPDATE^DIE("","SDFILEDATA","SDCLINRET","SDCLINMSG")
I $D(SDCLINMSG) D Q
. F SDERRNUM=1:1:$G(SDCLINMSG("DIERR")) D ERRLOG^SDES2JSON(.SDERRORS,464,$G(CLINMSG("DIERR",SDERRNUM,"TEXT",1)))
K CLINMSG("DIERR")
S SDCLINICIEN=SDCLINRET(1)
Q
;
ADDMULTIPLES(SDERRORS,SDFILEDATA,SDCLINICIEN) ; Add multiple fields after Clinic creation
I $D(SDCLINIC("PROVIDER")) D SAVEPROVIDERS^SDES2CLINUT(.SDERRORS,.SDFILEDATA,SDCLINICIEN)
I $D(SDCLINIC("DIAGNOSIS")) D SAVEDIAG^SDES2CLINUT(.SDERRORS,.SDFILEDATA,SDCLINICIEN)
I $D(SDCLINIC("PRIVILEGED USER")) D SAVEPRIVUSERS^SDES2CLINUT(.SDERRORS,.SDFILEDATA,SDCLINICIEN)
I $D(SDCLINIC("SPECIAL INSTRUCTIONS")) D SAVEINSTRUCT^SDES2CLINUT(.SDERRORS,.SDFILEDATA,SDCLINICIEN)
Q
;
ERRLOG(ERNUM,OPTIONALTXT) ;
D ERRLOG^SDES2JSON(.SDCLINIC,$G(ERNUM),$G(OPTIONALTXT))
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDES2CREATECLIN 10018 printed Sep 15, 2024@22:17:33 Page 2
SDES2CREATECLIN ;ALB/MGD/BLB,BWF - SDES2 CREATE CLINIC MAIN DRIVER ;SEPT 20,2023
+1 ;;5.3;Scheduling;**853,860,871,885**;Aug 13, 1993;Build 5
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 ;
+4 ; The SDCONTEXT array is controlled by the Acheron application and its fields are
+5 ; needed for the storage of the required auditing information.
+6 ;
+7 ; SDCONTEXT("ACHERON AUDIT ID") = Up to 40 Character unique ID number. Ex: 11d9dcc6-c6a2-4785-8031-8261576fca37
+8 ; SDCONTEXT("PATIENT DFN") = The DFN/IEN of the target patient from the calling application.
+9 ; SDCONTEXT("PATIENT ICN") = The ICN of the target patient from the calling application.
+10 ; SDCONTEXT("USER DUZ") = The DUZ of the user taking action in the calling application.
+11 ; SDCONTEXT("USER SECID") = The SECID of the user taking action in the calling application.
+12 ;
+13 ; The SDCLINIC array contains all of the Clinic specific input variables needed
+14 ; to add and configure a clinic.
+15 ;
+16 ; Required Input Variables
+17 ; ========================
+18 ; Field # Array Element
+19 ; 2001 SDCLINIC("ALLOWABLE CONSECUTIVE NO-SHOWS")
+20 ; 61 SDCLINIC("DIRECT PATIENT SCHEDULING")
+21 ; 8 SDCLINIC("PRIMARY AMIS")
+22 ; .01 SDCLINIC("NAME")
+23 ; 62 SDCLINIC("DISPLAY APPOINTMENTS")
+24 ; 1917 SDCLINIC("DISPLAY INCREMENTS PER HOUR")
+25 ; 3.5 SDCLINIC("DIVISION")
+26 ; 20 SDCLINIC("E-CHECKIN ALLOWED")
+27 ; 1912 SDCLINIC("LENGTH OF APPOINTMENT")
+28 ; 2002 SDCLINIC("MAX DAYS FUTURE BOOKING")
+29 ; 2504 SDCLINIC("MEETS AT FACILITY")
+30 ; 2502 SDCLINIC("NON-COUNT")
+31 ; 1918 SDCLINIC("OVERBOOKS/DAY MAX")
+32 ; 21 SDCLINIC("PRE-CHECKIN ALLOWED")
+33 ; 2000.5 SDCLINIC("REQUIRE ACTION PROFILES")
+34 ; 9 SDCLINIC("SERVICE")
+35 ;
+36 ; Optional Input Variables
+37 ; Field # Array Element
+38 ; ========================
+39 ; 1 SDCLINIC("ABBREVIATION")
+40 ; 2802 SDCLINIC("ADMIN INPATIENT MEDS")
+41 ; 2511 SDCLINIC("APPOINTMENT CANCELLATION LETTER")
+42 ; 24 SDCLINIC("ASK CHECK IN/OUT")
+43 ; 2510 SDCLINIC("CLINIC CANCELLATION LETTER")
+44 ; 2503 SDCLINIC("CREDIT AMIS")
+45 ; 2507 SDCLINIC("DEFAULT APPOINTMENT TYPE")
+46 ; 2801 SDCLINIC("DEFAULT TO PC PRACTITIONER")
+47 ; 2700/.01 SDCLINIC("DIAGNOSIS",DIAGNOSISCODE)
+48 ; 2700/.02 SDCLINIC("DIAGNOSIS",DIAGNOSISCODE,"DEFAULT")
+49 ; 1914 SDCLINIC("HOUR CLINIC DISPLAY BEGINS")
+50 ; 2508 SDCLINIC("NO-SHOW LETTER")
+51 ; 60 SDCLINIC("PATIENT FRIENDLY NAME")
+52 ; 63 SDCLINIC("VETERAN SELF-CANCEL")
+53 ; 10 SDCLINIC("PHYSICAL LOCATION")
+54 ; 2509 SDCLINIC("PRE-APPOINTMENT LETTER")
+55 ; 1916 SDCLINIC("PRINCIPAL CLINIC")
+56 ; 2501/.01 SDCLINIC("PRIVILEGED USER",IEN)
+57 ; 2500 SDCLINIC("PROHIBIT ACCESS TO CLINIC")
+58 ; 2600/.01 SDCLINIC("PROVIDER",VPROVIEN)
+59 ; 2600/.02 SDCLINIC("PROVIDER",VPROVIEN,"DEFAULT")
+60 ; 2000 SDCLINIC("REQUIRE X-RAY")
+61 ; 1918.5 SDCLINIC("SCHEDULE ON HOLIDAYS")
+62 ; 1910/.01 SDCLINIC("SPECIAL INSTRUCTIONS",NUMBER)= "(null value) |SPECIAL INSTRUCTION TEXT UP TO 80 CHARACTERS" FOR ADDITION
+63 ; SDCLINIC("SPECIAL INSTRUCTIONS",NUMBER)= "INSTRUCTION ID|SPECIAL INSTRUCTION TEXT UP TO 80 CHARACTERS" FOR EDIT
+64 ; 99 SDCLINIC("TELEPHONE")
+65 ; 99.1 SDCLINIC("TELEPHONE EXTENSION")
+66 ; 1913 SDCLINIC("VARIABLE APPOINTMENT LENGTH")
+67 ; 30 SDCLINIC("WORKLOAD VALIDATION")
+68 ;
+69 QUIT
+70 ;
+71 ; RPC: SDES2 CREATE CLINIC
+72 ;
CREATECLINIC(SDRETURN,SDCONTEXT,SDCLINIC) ; Add a new clinic to the HOSPITAL LOCATION file (#44)
+1 ;
+2 NEW SDERRORS,SDJSONERRORS,SDFDA,SDCLINRETURN,SDFILEDATA,SDCLINICIEN,SDRESULTS
+3 ;
+4 ; Can't send in @ for Create Clinic
+5 DO CHECKFORDEL^SDES2UTIL(.SDERRORS,.SDCONTEXT)
+6 IF $DATA(SDERRORS)
SET SDJSONERRORS("CreateClinic",1)=""
MERGE SDJSONERRORS=SDERRORS
DO BUILDJSON^SDES2JSON(.SDRETURN,.SDJSONERRORS)
QUIT
+7 ;
+8 DO CHECKFORDEL^SDES2UTIL(.SDERRORS,.SDCLINIC)
+9 IF $DATA(SDERRORS)
SET SDJSONERRORS("CreateClinic",1)=""
MERGE SDJSONERRORS=SDERRORS
DO BUILDJSON^SDES2JSON(.SDRETURN,.SDJSONERRORS)
QUIT
+10 ;
+11 DO CHECKFORDELMULT^SDES2UTIL(.SDERRORS,.SDCLINIC)
+12 IF $DATA(SDERRORS)
SET SDJSONERRORS("CreateClinic",1)=""
MERGE SDJSONERRORS=SDERRORS
DO BUILDJSON^SDES2JSON(.SDRETURN,.SDJSONERRORS)
QUIT
+13 ;
+14 DO VALCONTEXT^SDES2VALCONTEXT(.SDERRORS,.SDCONTEXT)
+15 IF $DATA(SDERRORS)
SET SDJSONERRORS("CreateClinic",1)=""
MERGE SDJSONERRORS=SDERRORS
DO BUILDJSON^SDES2JSON(.SDRETURN,.SDJSONERRORS)
QUIT
+16 ;
+17 DO VALCLINIC^SDES2VALCRTCLIN1(.SDERRORS,.SDCLINIC,.SDFILEDATA)
+18 IF $DATA(SDERRORS)
SET SDJSONERRORS("CreateClinic",1)=""
MERGE SDJSONERRORS=SDERRORS
DO BUILDJSON^SDES2JSON(.SDRETURN,.SDJSONERRORS)
QUIT
+19 ;
+20 DO CREATEFDAARRAY(.SDFILEDATA,.SDFDA)
+21 ;
+22 DO FILECLINIC(.SDERRORS,.SDFDA,.SDCLINICIEN)
+23 IF $DATA(SDERRORS)
MERGE SDJSONERRORS=SDERRORS
DO BUILDJSON^SDES2JSON(.SDRETURN,.SDJSONERRORS)
+24 ;
+25 if '$GET(SDCLINICIEN)
QUIT
+26 ; Add multiple fields after creation of clinic
+27 DO ADDMULTIPLES(.SDERRORS,.SDFILEDATA,.SDCLINICIEN)
+28 ;
+29 DO ADDHASH2CLIN^SDES2CLINUT(SDCLINICIEN)
+30 ;
+31 DO ADDRESOURCE^SDES2CLINUT(SDCLINICIEN)
+32 ;
+33 IF +$GET(SDCLINICIEN)
SET SDCLINRETURN("CreateClinic","IEN")=SDCLINICIEN
+34 DO BUILDJSON^SDES2JSON(.SDRETURN,.SDCLINRETURN)
+35 QUIT
+36 ;
CREATEFDAARRAY(FILEDATA,SDFDA) ;
+1 ; Clinic Data - Required Fields
+2 IF $GET(FILEDATA("ALLOWABLE CONSECUTIVE NO-SHOWS"))'=""
SET SDFDA(44,"+1,",2001)=FILEDATA("ALLOWABLE CONSECUTIVE NO-SHOWS")
+3 IF $GET(FILEDATA("DIRECT PATIENT SCHEDULING"))'=""
SET SDFDA(44,"+1,",61)=FILEDATA("DIRECT PATIENT SCHEDULING")
+4 IF $GET(FILEDATA("DISPLAY APPOINTMENTS"))'=""
SET SDFDA(44,"+1,",62)=FILEDATA("DISPLAY APPOINTMENTS")
+5 IF $GET(FILEDATA("DISPLAY INCREMENTS PER HOUR"))'=""
SET SDFDA(44,"+1,",1917)=FILEDATA("DISPLAY INCREMENTS PER HOUR")
+6 IF $GET(FILEDATA("DIVISION"))'=""
SET SDFDA(44,"+1,",3.5)=FILEDATA("DIVISION")
+7 IF $GET(FILEDATA("E-CHECKIN ALLOWED"))'=""
SET SDFDA(44,"+1,",20)=FILEDATA("E-CHECKIN ALLOWED")
+8 IF $GET(FILEDATA("LENGTH OF APPOINTMENT"))'=""
SET SDFDA(44,"+1,",1912)=FILEDATA("LENGTH OF APPOINTMENT")
+9 IF $GET(FILEDATA("MAX DAYS FUTURE BOOKING"))'=""
SET SDFDA(44,"+1,",2002)=FILEDATA("MAX DAYS FUTURE BOOKING")
+10 IF $GET(FILEDATA("NAME"))'=""
SET SDFDA(44,"+1,",.01)=FILEDATA("NAME")
+11 IF $GET(FILEDATA("NON-COUNT"))'=""
SET SDFDA(44,"+1,",2502)=FILEDATA("NON-COUNT")
+12 IF $GET(FILEDATA("OVERBOOKS/DAY MAX"))'=""
SET SDFDA(44,"+1,",1918)=FILEDATA("OVERBOOKS/DAY MAX")
+13 IF $GET(FILEDATA("PRE-CHECKIN ALLOWED"))'=""
SET SDFDA(44,"+1,",21)=FILEDATA("PRE-CHECKIN ALLOWED")
+14 IF $GET(FILEDATA("PRIMARY AMIS"))'=""
SET SDFDA(44,"+1,",8)=FILEDATA("PRIMARY AMIS")
+15 IF $GET(FILEDATA("REQUIRE ACTION PROFILES"))'=""
SET SDFDA(44,"+1,",2000.5)=FILEDATA("REQUIRE ACTION PROFILES")
+16 IF $GET(FILEDATA("SERVICE"))'=""
SET SDFDA(44,"+1,",9)=FILEDATA("SERVICE")
+17 ;Type Extension pointer to 40.9
SET SDFDA(44,"+1,",2.1)=$$FIND1^DIC(40.9,,,"CLINIC")
+18 ; Optional Fields
+19 IF $GET(FILEDATA("ABBREVIATION"))'=""
SET SDFDA(44,"+1,",1)=FILEDATA("ABBREVIATION")
+20 IF $GET(FILEDATA("ADMIN INPATIENT MEDS"))'=""
SET SDFDA(44,"+1,",2802)=FILEDATA("ADMIN INPATIENT MEDS")
+21 IF $GET(FILEDATA("APPOINTMENT CANCELLATION LETTER"))'=""
SET SDFDA(44,"+1,",2511)=FILEDATA("APPOINTMENT CANCELLATION LETTER")
+22 IF $GET(FILEDATA("ASK CHECK IN/OUT"))'=""
SET SDFDA(44,"+1,",24)=FILEDATA("ASK CHECK IN/OUT")
+23 IF $GET(FILEDATA("CLINIC CANCELLATION LETTER"))'=""
SET SDFDA(44,"+1,",2510)=FILEDATA("CLINIC CANCELLATION LETTER")
+24 IF $GET(FILEDATA("CREDIT AMIS"))'=""
SET SDFDA(44,"+1,",2503)=FILEDATA("CREDIT AMIS")
+25 IF $GET(FILEDATA("DEFAULT APPOINTMENT TYPE"))'=""
SET SDFDA(44,"+1,",2507)=FILEDATA("DEFAULT APPOINTMENT TYPE")
+26 IF $GET(FILEDATA("DEFAULT TO PC PRACTITIONER"))'=""
SET SDFDA(44,"+1,",2801)=FILEDATA("DEFAULT TO PC PRACTITIONER")
+27 IF $GET(FILEDATA("HOUR CLINIC DISPLAY BEGINS"))'=""
SET SDFDA(44,"+1,",1914)=FILEDATA("HOUR CLINIC DISPLAY BEGINS")
+28 IF $GET(FILEDATA("MEETS AT FACILITY"))'=""
SET SDFDA(44,"+1,",2504)=FILEDATA("MEETS AT FACILITY")
+29 IF $GET(FILEDATA("NO-SHOW LETTER"))'=""
SET SDFDA(44,"+1,",2508)=FILEDATA("NO-SHOW LETTER")
+30 IF $GET(FILEDATA("PATIENT FRIENDLY NAME"))'=""
SET SDFDA(44,"+1,",60)=FILEDATA("PATIENT FRIENDLY NAME")
+31 IF $GET(FILEDATA("PBSPID"))'=""
SET SDFDA(44,"+1,",200)=FILEDATA("PBSPID")
+32 IF $GET(FILEDATA("PHYSICAL LOCATION"))'=""
SET SDFDA(44,"+1,",10)=FILEDATA("PHYSICAL LOCATION")
+33 IF $GET(FILEDATA("PRE-APPOINTMENT LETTER"))'=""
SET SDFDA(44,"+1,",2509)=FILEDATA("PRE-APPOINTMENT LETTER")
+34 IF $GET(FILEDATA("PRINCIPAL CLINIC"))'=""
SET SDFDA(44,"+1,",1916)=FILEDATA("PRINCIPAL CLINIC")
+35 IF $GET(FILEDATA("PROHIBIT ACCESS TO CLINIC"))'=""
SET SDFDA(44,"+1,",2500)=FILEDATA("PROHIBIT ACCESS TO CLINIC")
+36 IF $GET(FILEDATA("REQUIRE X-RAY"))'=""
SET SDFDA(44,"+1,",2000)=FILEDATA("REQUIRE X-RAY")
+37 IF $GET(FILEDATA("SCHEDULE ON HOLIDAYS"))'=""
SET SDFDA(44,"+1,",1918.5)=FILEDATA("SCHEDULE ON HOLIDAYS")
+38 IF $GET(FILEDATA("TELEPHONE"))'=""
SET SDFDA(44,"+1,",99)=FILEDATA("TELEPHONE")
+39 IF $GET(FILEDATA("TELEPHONE EXTENSION"))'=""
SET SDFDA(44,"+1,",99.1)=FILEDATA("TELEPHONE EXTENSION")
+40 IF $GET(FILEDATA("VARIABLE APPOINTMENT LENGTH"))'=""
SET SDFDA(44,"+1,",1913)=FILEDATA("VARIABLE APPOINTMENT LENGTH")
+41 IF $GET(FILEDATA("WORKLOAD VALIDATION"))'=""
SET SDFDA(44,"+1,",30)=FILEDATA("WORKLOAD VALIDATION")
+42 IF $GET(FILEDATA("VETERAN SELF-CANCEL"))'=""
SET SDFDA(44,"+1,",63)=FILEDATA("VETERAN SELF-CANCEL")
+43 ; C:CLINIC
SET SDFDA(44,"+1,",2)="C"
+44 QUIT
+45 ;
FILECLINIC(SDERRORS,SDFILEDATA,SDCLINICIEN) ;
+1 NEW SDCLINRET,SDCLINMSG,SDCNT,SDERRNUM
+2 DO UPDATE^DIE("","SDFILEDATA","SDCLINRET","SDCLINMSG")
+3 IF $DATA(SDCLINMSG)
Begin DoDot:1
+4 FOR SDERRNUM=1:1:$GET(SDCLINMSG("DIERR"))
DO ERRLOG^SDES2JSON(.SDERRORS,464,$GET(CLINMSG("DIERR",SDERRNUM,"TEXT",1)))
End DoDot:1
QUIT
+5 KILL CLINMSG("DIERR")
+6 SET SDCLINICIEN=SDCLINRET(1)
+7 QUIT
+8 ;
ADDMULTIPLES(SDERRORS,SDFILEDATA,SDCLINICIEN) ; Add multiple fields after Clinic creation
+1 IF $DATA(SDCLINIC("PROVIDER"))
DO SAVEPROVIDERS^SDES2CLINUT(.SDERRORS,.SDFILEDATA,SDCLINICIEN)
+2 IF $DATA(SDCLINIC("DIAGNOSIS"))
DO SAVEDIAG^SDES2CLINUT(.SDERRORS,.SDFILEDATA,SDCLINICIEN)
+3 IF $DATA(SDCLINIC("PRIVILEGED USER"))
DO SAVEPRIVUSERS^SDES2CLINUT(.SDERRORS,.SDFILEDATA,SDCLINICIEN)
+4 IF $DATA(SDCLINIC("SPECIAL INSTRUCTIONS"))
DO SAVEINSTRUCT^SDES2CLINUT(.SDERRORS,.SDFILEDATA,SDCLINICIEN)
+5 QUIT
+6 ;
ERRLOG(ERNUM,OPTIONALTXT) ;
+1 DO ERRLOG^SDES2JSON(.SDCLINIC,$GET(ERNUM),$GET(OPTIONALTXT))
+2 QUIT