English
Fx.hospital
About 684 wordsAbout 2 min
2026-01-09
1. updateHospital Hospital Data Cleansing
Hospital Data Cleansing
Fx.hospital.updateHospital()
Code examples
// Hospital level definitions:
//0: No grade
//1: Level 1
//2: Level 1A
//3: Level 1B
//4: Level 1C
//5: Level 2
//6: Level 2A
//7: Level 2B
//8: Level 2C
//9: Level 3
//10: Level 3A
//11: Level 3B
//12: Level 3C
//Hospital level mapping (medical database level -> CRM object radio field). Optional if hospital level is not required.
Map levelMappings = [
"0":"NX0f3im1Q",
"1":"zbgZAGOF0",
"2":"BeO329j4c",
"3":"W3k2ckIcc",
"4":"pLpRx6sc5",
"5":"zmGAx3uvr",
"6":"CrgOr0azE",
"7":"u4vWS9Sit",
"8":"f2E34oH61",
"9":"3sqq01lRy",
"10":"40vHB1xfa",
"11":"4kzl2BbpE",
"12":"sqamVsQ00"
]
//Data collection to be processed (maximum 100 records)
List dataIdList = ["642645d0bca58400013719a3"]
// Medical database fields:
// name: Hospital name
// alias: Alias
// profit_attribute: Profit attribute
// level: Hospital level
// province: Province
// city: City
// district: District
// address: Address
// latitude_and_longitude: Latitude and longitude
// contact_phone_number: Contact phone number
// official_website: Official website
// dean: Dean
// bed_num: Number of beds
// daily_outpatient_num: Daily outpatient volume
// introduction: Introduction
// type: Hospital type
//Medical database field -> CRM object field mapping
Map mappings = ["name":"url"]
//Required fields: objectApiName, isUpdateNull, medicalRegister, mappings
def(Boolean error, List data, String message) = Fx.hospital.updateHospital("AccountObj",dataIdList,mappings,true,"is_hospital_register",levelMappings)
if (error) {
log.info("error :" + message)
}
log.info(data)Owner:刘诗林liushilin
2. initHospital Initialize Hospital
Initialize Hospital
Fx.hospital.initHospital()
Code examples
// Medical database fields:
// name: Hospital name
// alias: Alias
// profit_attribute: Profit attribute
// level: Hospital grade
// province: Province
// city: City
// district: District
// address: Address
// latitude_and_longitude: Latitude and longitude
// contact_phone_number: Contact phone number
// official_website: Official website
// dean: Dean
// bed_num: Number of beds
// daily_outpatient_num: Daily outpatient volume
// introduction: Introduction
// type: Hospital type
// Medical database fields -> CRM object field mapping
Map mappings = [
"level":"field_Zi8Pw__c",
"latitude_and_longitude":"location",
"district":"district",
"city":"city",
"province":"province",
"country":"country",
"contact_phone_number":"tel",
"official_website":"url",
"address":"address",
"name":"name"
]
// Hospital grade corresponding meanings:
// 0: No grade
// 1: Grade I
// 2: Grade I-A
// 3: Grade I-B
// 4: Grade I-C
// 5: Grade II
// 6: Grade II-A
// 7: Grade II-B
// 8: Grade II-C
// 9: Grade III
// 10: Grade III-A
// 11: Grade III-B
// 12: Grade III-C
// Hospital grade mapping (Medical database grade -> CRM object radio field), optional if hospital grade is not needed
Map levelMappings = [
"0":"NX0f3im1Q",
"1":"zbgZAGOF0",
"2":"BeO329j4c",
"3":"W3k2ckIcc",
"4":"pLpRx6sc5",
"5":"zmGAx3uvr",
"6":"CrgOr0azE",
"7":"u4vWS9Sit",
"8":"f2E34oH61",
"9":"3sqq01lRy",
"10":"40vHB1xfa",
"11":"4kzl2BbpE",
"12":"4kzl2BbpE"
]
// Required fields: hospitalObjectApiName, recordType, medicalRegister, mappings
def(Boolean error, Integer data, String message) = Fx.hospital.initHospital("AccountObj","record_PRkkc__c","4","Beijing",null,null,null,mappings,"is_hospital_register",levelMappings)
if (error) {
log.info("error :" + message)
}
log.info(data)Owner:刘诗林liushilin
3. initDepartment Initialize Department
Initialize Department
Fx.hospital.initDepartment()
Code examples
// Medical library department fields:
// name: Department name
// director: Department head
// classification: Category
// introduction: Department overview
// Medical library department fields -> CRM object fields mapping
Map mappings = [
"name":"name",
"classification":"field_56YfM__c"
]
// Department category definitions:
// 1: Internal Medicine
// 2: Surgery
// 3: Orthopedics
// 4: Obstetrics & Gynecology
// 5: Andrology
// 6: Pediatrics
// 7: Otolaryngology Head and Neck Surgery
// 8: Ophthalmology
// 9: Stomatology
// 10: Oncology
// 11: Dermatology & Venereology
// 12: Traditional Chinese Medicine
// 13: Infectious Diseases
// 14: Psychiatry & Psychology
// 15: Anesthesiology
// 16: Medical Imaging
// 17: Other Departments
// Department category mapping (key: Medical library department category, value: CRM object department category)
Map classificationMappings = [
"0":"0",
"1":"1",
"2":"2",
"3":"3",
"4":"4",
"5":"5",
"6":"6",
"7":"7",
"8":"8",
"9":"9",
"10":"10",
"11":"11",
"13":"13",
"14":"14",
"15":"15",
"16":"16",
"17":"17",
"12":"12"
]
// Required fields: hospitalObjectApiName, departmentObjectApiName, recordType, objectId, mappings, medicalRegister, parentApiName
def(Boolean error, Integer data, String message) = Fx.hospital.initDepartment("AccountObj","AccountObj","record_PRkkc__c","6440f25a8d392e00011ffbfb",null,mappings,"is_hospital_register",classificationMappings,"parent_account_id")
if (error) {
log.info("error :" + message)
}
log.info(data)Owner:刘诗林liushilin
