Fx.hospital

Fx.hospital:医疗主数据

1. updateHospital 医院数据清洗

Fx.hospital.updateHospital(<String objectApiName>, <List objectIds>, <Map mappings>, <Boolean isUpdateNull>, <String medicalRegister>, <Map levelMapping>)

参数说明

参数 类型 说明
objectApiName String 对象apiName
objectIds List 数据id列表
mappings Map 医院字段与客户字段的映射
isUpdateNull Boolean 空值是否更新
medicalRegister String 医疗注册字段apiName
levelMapping Map 医院等级映射

返回值类型

APIResult

返回值说明

返回的数据类型: List

Java举例

Map levelMappings = Maps.newHashMap();
levelMappings.put("0", "NX0f3im1Q");
levelMappings.put("1", "zbgZAGOF0");
levelMappings.put("2", "BeO329j4c");
levelMappings.put("3", "W3k2ckIcc");
levelMappings.put("4", "pLpRx6sc5");
levelMappings.put("5", "zmGAx3uvr");
levelMappings.put("6", "CrgOr0azE");
levelMappings.put("7", "u4vWS9Sit");
levelMappings.put("8", "f2E34oH61");
levelMappings.put("9", "3sqq01lRy");
levelMappings.put("10", "40vHB1xfa");
levelMappings.put("11", "4kzl2BbpE");
levelMappings.put("12", "sqamVsQ00");
//需要清洗的数据集合(最多100条)
List dataIdList = Lists.newArrayList("642645d0bca58400013719a3");

Map mappings = Maps.newHashMap();
mappings.put("name", "url");

//必填字段:objectApiName、isUpdateNull、medicalRegister、mappings
APIResult ret = Fx.hospital.updateHospital("AccountObj",dataIdList,mappings,true,"is_hospital_register",levelMappings);
log.info(ret);
if (ret.isError()) {
  log.info(ret.message());
} else{
  log.info(ret.getData());
}

Groovy举例

// 医院等级对应含义:
//0:无等级
//1:一级
//2:一级甲等
//3:一级乙等
//4:一级丙等
//5:二级
//6:二级甲等
//7:二级乙等
//8:二级丙等
//9:三级
//10:三级甲等
//11:三级乙等
//12:三级丙等
//医院等级映射(医院库等级->crm对象上单选字段),无需医院等级可不传
 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"
]
//需要清洗的数据集合(最多100条)
List dataIdList = ["642645d0bca58400013719a3"]
//   医疗库字段:
//  name:医院名称
//  alias:别名
//  profit_attribute:盈利属性
//  level:医院等级
//  province:省份
//  city:城市
//  district:县区
//  address:地址
//  latitude_and_longitude:经纬度
//  contact_phone_number:联系电话
//  official_website:官网
//  dean:院长
//  bed_num:床位数
//  daily_outpatient_num:日门诊量
//  introduction:简介
//  type:医院类型
 //医疗库字段->crm对象字段映射
Map mappings = ["name":"url"]
//必填字段: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)

2. initHospital 初始化医院

Fx.hospital.initHospital(<String hospitalObjectApiName>, <String recordType>, <String level>, <String province>, <String city>, <String district>, <String classification>, <Map mappings>, <String medicalRegister>, <Map levelMapping>)

参数说明

参数 类型 说明
hospitalObjectApiName String 医院ApiName
recordType String 业务类型
level String 等级
province String
city String
district String
classification String 科室分类
mappings Map 医院字段与客户字段的映射
medicalRegister String 医疗注册字段apiName
levelMapping Map 医院等级映射

返回值类型

APIResult

返回值说明

返回的数据类型: Integer

Java举例

Map mappings = Maps.newHashMap();
mappings.put("level", "field_Zi8Pw__c");
mappings.put("latitude_and_longitude", "location");
mappings.put("district", "district");
mappings.put("city", "city");
mappings.put("province", "province");
mappings.put("country", "country");
mappings.put("contact_phone_number", "tel");
mappings.put("official_website", "url");
mappings.put("address", "address");
mappings.put("name", "name");

Map levelMappings = Maps.newHashMap();
levelMappings.put("0", "NX0f3im1Q");
levelMappings.put("1", "zbgZAGOF0");
levelMappings.put("2", "BeO329j4c");
levelMappings.put("3", "W3k2ckIcc");
levelMappings.put("4", "pLpRx6sc5");
levelMappings.put("5", "zmGAx3uvr");
levelMappings.put("6", "CrgOr0azE");
levelMappings.put("7", "u4vWS9Sit");
levelMappings.put("8", "f2E34oH61");
levelMappings.put("9", "3sqq01lRy");
levelMappings.put("10", "40vHB1xfa");
levelMappings.put("11", "4kzl2BbpE");
levelMappings.put("12", "4kzl2BbpE");

APIResult ret = Fx.hospital.initHospital("AccountObj","record_PRkkc__c","4","北京市",null,null,null,mappings,"is_hospital_register",levelMappings);
log.info(ret);
if (ret.isError()) {
  log.info(ret.message());
} else{
  log.info(ret.getData());
}

Groovy举例

//  医疗库字段:
//  name:医院名称
//  alias:别名
//  profit_attribute:盈利属性
//  level:医院等级
//  province:省份
//  city:城市
//  district:县区
//  address:地址
//  latitude_and_longitude:经纬度
//  contact_phone_number:联系电话
//  official_website:官网
//  dean:院长
//  bed_num:床位数
//  daily_outpatient_num:日门诊量
//  introduction:简介
//  type:医院类型
//医疗库字段->crm对象字段映射
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"
]

//   医院等级对应含义:
//  0:无等级
//  1:一级
//  2:一级甲等
//  3:一级乙等
//  4:一级丙等
//  5:二级
//  6:二级甲等
//  7:二级乙等
//  8:二级丙等
//  9:三级
//  10:三级甲等
//  11:三级乙等
//  12:三级丙等

//医院等级映射(医院库等级->crm对象上单选字段),无需医院等级可不传
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"
]
//必填字段:hospitalObjectApiName、recordType、medicalRegister、mappings
def(Boolean error, Integer data, String message) = Fx.hospital.initHospital("AccountObj","record_PRkkc__c","4","北京市",null,null,null,mappings,"is_hospital_register",levelMappings)
if (error) {
  log.info("error :" + message)
}
log.info(data)

3. initDepartment 初始化科室

Fx.hospital.initDepartment(<String hospitalObjectApiName>, <String departmentObjectApiName>, <String recordType>, <String objectId>, <String classification>, <Map mappings>, <String medicalRegister>, <Map classificationMapping>, <String parentApiName>)

参数说明

参数 类型 说明
hospitalObjectApiName String 医院ApiName
departmentObjectApiName String 科室ApiName
recordType String 业务类型
objectId String 医院数据id
classification String 科室分类
mappings Map 科室库字段与对象字段的映射
medicalRegister String 医疗注册字段apiName
classificationMapping Map 科室分类映射
parentApiName String 科室与医院查找关联字段的ApiName

返回值类型

APIResult

返回值说明

返回的数据类型: Integer

Java举例

Map mappings = Maps.newHashMap();
mappings.put("name", "name");
mappings.put("classification", "field_56YfM__c");

Map classificationMappings = Maps.newHashMap();
classificationMappings.put("0", "0");
classificationMappings.put("1", "1");
classificationMappings.put("2", "2");
classificationMappings.put("2", "2");
classificationMappings.put("3", "3");
classificationMappings.put("4", "4");
classificationMappings.put("5", "5");
classificationMappings.put("6", "6");
classificationMappings.put("7", "7");
classificationMappings.put("8", "8");
classificationMappings.put("9", "9");
classificationMappings.put("10", "10");
classificationMappings.put("11", "11");
classificationMappings.put("13", "13");
classificationMappings.put("14", "14");
classificationMappings.put("15", "15");
classificationMappings.put("16", "16");
classificationMappings.put("17", "17");
classificationMappings.put("12", "12");
//必填字段:hospitalObjectApiName、departmentObjectApiName、recordType、objectId、mappings、medicalRegister、parentApiName
APIResult ret = Fx.hospital.initDepartment("AccountObj","AccountObj","record_PRkkc__c","6440f25a8d392e00011ffbfb",null,mappings,"is_hospital_register",classificationMappings,"parent_account_id");
log.info(ret);
if (ret.isError()) {
  log.info(ret.message());
} else{
  log.info(ret.getData());
}

Groovy举例

// 医疗库科室字段:
// name:科室名称
// director:科室主任
// classification:分类
// introduction:科室简介
// 医疗库科室字段->crm对象字段
Map mappings = [
  "name":"name",
  "classification":"field_56YfM__c"
]

//科室分类含义:
//1:内科
//2:外科
//3:骨科
//4:妇产科
//5:男科
//6:儿科
//7:耳鼻喉头颈外科
//8:眼科
//9:口腔科
//10:肿瘤科
//11:皮肤性病科
//12:中医科
//13:传染病科
//14:精神心理科
//15:麻醉医学科
//16:医学影像科
//17:其他科室
//科室分类映射(key:医疗库科室分类,value:crm对象科室分类)
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"
]
//必填字段: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)

2024-09-15
0 1