public with sharing class lexConsumApply_FromOPDPlanCtl { public lexConsumApply_FromOPDPlanCtl() { } @AuraEnabled public static List fieldDefineApp(){ try { List rep = [Select QualifiedApiName, EntityDefinition.KeyPrefix, DurableId From FieldDefinition WHERE EntityDefinition.QualifiedApiName = 'Consum_Apply__c']; return rep; } catch (Exception e) { throw new AuraHandledException(e.getMessage()); } } //获取当前登录人的 id @AuraEnabled public static UserResult UserInfo_Owner() { UserResult result = new UserResult(); ID myUserID = UserInfo.getUserId(); try { User tempUser = [select Id,isFormal_Stuff__c,FirstName,LastName from user where id = : myUserID ]; result.id = tempUser.Id; result.isFormalStuff = tempUser.isFormal_Stuff__c; result.firstName = tempUser.FirstName == null ? '' : tempUser.FirstName; result.lastName = tempUser.LastName == null ? '' : tempUser.LastName; } catch (exception e) { result.result = e.getMessage(); } return result; } @AuraEnabled public static InitData init(String recordId){ InitData res = new initData(); try { OPDPlan__c rep = [select Id,OPDPlan_Report__c,Name,Rental_Apply2__c,HospitalName__c,HospitalID__c,OCM_category_ID__c,OCM_category_Name__c,Account_Laboratory__c from OPDPlan__c where Id =: recordId]; res.opdPlan = rep.OPDPlan_Report__c == null ? '' : rep.OPDPlan_Report__c; res.name = rep.Id; res.rentalApply2 = rep.Rental_Apply2__c == null ? '' : rep.Rental_Apply2__c; res.hospitalName = rep.HospitalID__c == null ? '' : rep.HospitalID__c; res.ocmCategoryName = rep.OCM_category_ID__c == null ? '' : rep.OCM_category_ID__c; res.accountLab = rep.Account_Laboratory__c == null ? '' : rep.Account_Laboratory__c; return res; } catch (Exception e) { throw new AuraHandledException(e.getMessage()); } } public class InitData{ @AuraEnabled public String opdPlan; @AuraEnabled public String rentalApply2; @AuraEnabled public String hospitalName; @AuraEnabled public String ocmCategoryName; @AuraEnabled public String accountLab; @AuraEnabled public String name; } public class UserResult { @AuraEnabled public string result; public UserResult( ) { result = 'Success'; } @AuraEnabled public string id; @AuraEnabled public Boolean isFormalStuff; @AuraEnabled public string firstName; @AuraEnabled public string lastName; } }