public with sharing class LexNewAndEditContactPIPLController { public static Map schemaMap = Schema.getGlobalDescribe(); // 字段信息 public static Map fieldMap = new Map(); @AuraEnabled public static ResponseBodyLWC initData(Id rid, String recordTypeId, String sobjectType, String accid) { ResponseBodyLWC res = new ResponseBodyLWC(); Map data = new Map(); res.entity = data; Boolean isDoctor = true; string s = null; //如果有记录类型,判断是不是医院类型 if (String.isNotBlank(recordTypeId)) { System.debug('recordTypeId = ' + recordTypeId); s = Schema.SObjectType.Contact.getRecordTypeInfosById().get(recordTypeId).getDeveloperName(); //说明无需加密 if (s == 'Agency' || s == 'Internal_staff') { isDoctor = false; data.put('isDoctor', isDoctor); return new ResponseBodyLWC('Success', 200, '', data); } } //说明无需加密 if (String.isNotBlank(accid)) { List accs = [SELECT RecordType.DeveloperName FROM account WHERE id = :accid]; if (accs.size() > 0) { s = accs[0].RecordType.DeveloperName; if (s == 'Office' || s == 'AgencyContact' || s == 'Agency') { isDoctor = false; data.put('isDoctor', isDoctor); return new ResponseBodyLWC('Success', 200, '', data); } } } //说明无需加密 if (String.isNotBlank(rid)) { List contact = [select Id,RecordTypeId from Contact where Id=:rid]; if(String.isNotBlank(contact[0].RecordTypeId)){ s = Schema.SObjectType.Contact.getRecordTypeInfosById().get(contact[0].RecordTypeId).getDeveloperName(); if (s == 'Agency' || s == 'Internal_staff') { isDoctor = false; data.put('isDoctor', isDoctor); return new ResponseBodyLWC('Success', 200, '', data); } } } ResponseBodyLWC rbl = LexNewAndEditBasePIPLController.initData(rid, recordTypeId, sobjectType); if(rbl.status == 'Success'){ data = (Map)rbl.entity; data.put('isDoctor', isDoctor); rbl.entity = data; } return rbl; } }