liuyn
2024-03-11 a87f1c3df03078814ee97ad0c8ac200a232419e9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
public with sharing class lexAccountController {
    @AuraEnabled
    public static InitData init(String recordId){
        InitData res = new InitData();
        try {
            Account acc = [
                select
                Name
                from Account where Id =: recordId
            ]; 
            res.name = acc.Name;
        } catch (Exception e) {
            System.debug(e.getMessage());
        }
        return res;
    }
    @AuraEnabled
    public static InitData initForNewSolutonProButton(String recordId){
        InitData res = new InitData();
        try {
            Account acc = [
                select
                Id, 
                Hospital__r.Salesdepartment_HP__c,
                Hospital__r.Id, 
                //chenjingwu 20240301 start 
                CreatedBy.Product_specialist_incharge_product__c,
                 //chenjingwu 20240301 end
                Hospital__r.OCM_Category__c
                from Account where Id =: recordId
            ];
            //chenjingwu 20240301 start 
            User u = [select Product_specialist_incharge_product__c from User where Id =: System.UserInfo.getUserId()];
            res.productSpecialistInchargeProduct = u.Product_specialist_incharge_product__c;
             //chenjingwu 20240301 end 
            res.hospitalSalesdepartmentHP = acc.Hospital__r.Salesdepartment_HP__c;
            res.hospitalId = acc.Hospital__r.Id;
            res.hospitalOCMCategory = acc.Hospital__r.OCM_Category__c;
        } catch (Exception e) {
            System.debug(e.getMessage());
        }
        return res;
    }
    @AuraEnabled
    public static InitData initForOTHCreateButton(String recordId){
        InitData res = new InitData();
        try {
           res.recordTypeId = Schema.SObjectType.Account_Number_of_case__c.getRecordTypeInfosByDeveloperName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_OTHER).getRecordTypeId(); 
        } catch (Exception e) {
            System.debug(e.getMessage());
        }
        return res;
    }
 
    @AuraEnabled
    public static InitData initForDepartmentCreate(String recordId,String type){
        InitData res = new InitData();
        try {
            Account acc = [
            select
            Hospital_Department_Class__c
            from Account where Id =: recordId
            ];
            res.hospitalDepartmentClass = acc.Hospital_Department_Class__c;
            if(type == 'BF'){
                res.recordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_BF).getRecordTypeId(); 
            }else if(type == 'ENT'){
                res.recordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_ENT).getRecordTypeId(); 
            }else if(type == 'GI'){
                res.recordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_GI).getRecordTypeId(); 
            }else if(type == 'GS'){
                res.recordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_GS).getRecordTypeId(); 
            }else if(type == 'GYN'){
                res.recordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_GYN).getRecordTypeId(); 
            }else if(type == 'OTH'){
                res.recordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_OTH).getRecordTypeId(); 
            }else if(type == 'URO'){
                res.recordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_URO).getRecordTypeId(); 
            }        
         } catch (Exception e) {
            System.debug(e.getMessage());
         }
         return res;
        
        
    }
 
    @AuraEnabled
    public static InitData initForRepairContact(String recordId){
        InitData res = new InitData();
        try{
            res.recordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_CON).getRecordTypeId(); 
        }catch(Exception e){
            System.debug(e.getMessage());
        }
        return res;
    }
    public class InitData{
        @AuraEnabled
        public String hospitalSalesdepartmentHP;
        @AuraEnabled
        public String hospitalId;
        @AuraEnabled
        public String hospitalOCMCategory;
        @AuraEnabled
        public String recordTypeId;
        @AuraEnabled
        public String hospitalDepartmentClass;
        @AuraEnabled
        public String name;
        // chenjingwu 20240301 start
        @AuraEnabled
        public String productSpecialistInchargeProduct;
        // chenjingwu 20240301 end
    }
}