public class InquiryFormController {
    @AuraEnabled
    public static InitData init(String recordId){
        InitData res = new initData();
        try{
            Inquiry_form__c report = [SELECT Id,Name,Service_Status__c,FSE_Owner__c,FSE_Owner_id__c,Status__c,Lead_link__c,Opp_Name_Search__c,Contact_Name__c,Contact_Id__c,Hospital_Name__c,Hospital_ID__c,Department_Class__c,Department_ID__c,Opp_Name_Search_ID__c,Campaign__c,Campaign_ID__c,Cancel_Reason__c,Product_Owner__c,Phone__c,Email__c,Last_Name__c,LeadSource__c,Opportunity_Division__c,Request1__c,Urgent__c,Family_Name__c FROM Inquiry_form__c WHERE Id = :recordId LIMIT 1];
            res.Id = report.Id;
            res.Name = report.Name;
            res.ServiceStatus = report.Service_Status__c;
            res.Status = report.Status__c;
            res.profileId = UserInfo.getProfileId();
            res.userId = UserInfo.getUserId();
            res.LeadLink= report.Lead_link__c;
            res.OppNameSearch= report.Opp_Name_Search__c;
            res.ContactName= report.Contact_Name__c;
            res.ContactId = report.Contact_Id__c;
            res.HospitalName = report.Hospital_Name__c;
            res.HospitalID = report.Hospital_ID__c;
            res.DepartmentClass= report.Department_Class__c;
            res.DepartmentID = report.Department_ID__c;
            res.OppNameSearchID= report.Opp_Name_Search_ID__c;
            res.Campaign= report.Campaign__c;
            res.CampaignID = report.Campaign_ID__c;
            res.CancelReason= report.Cancel_Reason__c;
            res.Phone = report.Phone__c;
            res.Email= report.Email__c;
            res.LastName = report.Last_Name__c;
            res.LeadSource = report.LeadSource__c;
            res.OpportunityDivision = report.Opportunity_Division__c;
            res.Request1 = report.Request1__c;
            res.Urgent = report.Urgent__c;
            res.FSEOwner = report.FSE_Owner__c;
            res.FSEOwnerId = report.FSE_Owner_id__c;
            res.FamilyName = report.Family_Name__c;
            res.JINGZHUOJISHU = getUserName(LightingButtonConstant.JINGZHUO_JISHU);
            System.debug(LoggingLevel.INFO, '*** xu: ' + res);
        }catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** exu: ' + e);
        }
        return res;
    }  
    //新建一项
    @AuraEnabled
    public static List<Inquiry_form__c> sqlResult (String id) {
        try { 
            List<Inquiry_form__c> records = [SELECT id,Request_Detail__c FROM Inquiry_form__c WHERE id = :id];
            System.debug(LoggingLevel.INFO, '*** xu1: ' + records);
            return records;
        } catch (exception e) {
            System.debug(LoggingLevel.INFO, '*** xu1111111: ' + e);
            throw new AuraHandledException(e.getMessage());
        }
    }
    @AuraEnabled
    public static string getUserName(String name){
        User user = null;
        try {
            user = [select Id from user where Name =:name];
        } catch (Exception e) {
            throw new AuraHandledException(e.getMessage());
        }
        return user.Id;
    }
    public class InitData{
        @AuraEnabled
        public String Id;
        @AuraEnabled
        public String ServiceStatus;
        @AuraEnabled
        public String profileId;
        @AuraEnabled
        public String userId;
        @AuraEnabled
        public String Status;
        @AuraEnabled
        public String LeadLink;
        @AuraEnabled
        public String OppNameSearch;
        @AuraEnabled
        public String ContactName;
        @AuraEnabled
        public String ContactId;
        @AuraEnabled
        public String HospitalName;
        @AuraEnabled
        public String HospitalID;
        @AuraEnabled
        public String DepartmentClass;
        @AuraEnabled
        public String DepartmentID;
        @AuraEnabled
        public String OppNameSearchID;
        @AuraEnabled
        public String Campaign;
        @AuraEnabled
        public String CampaignID;
        @AuraEnabled
        public String Name;
        @AuraEnabled
        public String CancelReason;
        @AuraEnabled
        public String Phone;
        @AuraEnabled
        public String Email;
        @AuraEnabled
        public String LastName;
        @AuraEnabled
        public String LeadSource;
        @AuraEnabled
        public String OpportunityDivision;
        @AuraEnabled
        public String Request1;
        @AuraEnabled
        public Boolean Urgent;
        @AuraEnabled
        public String FSEOwner;
        @AuraEnabled
        public String FSEOwnerId;
        @AuraEnabled
        public String FamilyName;
        @AuraEnabled
        public String JINGZHUOJISHU;
    }
}