binxie
2024-01-16 1b08402678deb31bba4a347bfd388eba8360cbc1
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
public with sharing class LexAWSServicePIPLDao {
    public static List<Contact> searchContactInit(String HospitalId) {
        List<Contact> conList = new List<Contact>(
            [
                SELECT Id, AWS_Data_Id__c, Account.Name
                FROM Contact
                WHERE Account.Hospital__c = :HospitalId AND AWS_Data_Id__c != '' limit 100
            ]
        );
        return conList;
    }
 
    public static List<Contact>  getNoPIContact(String searchContactName,String accountId){
        if(searchContactName!='' || accountId!=''){
            String noPISQL = 'select Id,Name,Email,Phone,Account.Name,MobilePhone,AWS_Data_Id__c from Contact where Account_Record_Type_DeveloperName__c in('+'\'Agency\''+','+'\'Office\''+',\'AgencyContact\''+')';
            if(String.isNotEmpty(accountId)){
                noPISQL += ' and AccountId=\''+accountId+'\'';
            }
            if(String.isNotEmpty(searchContactName)){
                noPISQL += ' and Name like \'%'+searchContactName+'%\'';
            }
            system.debug('noPISQL = ' + noPISQL);
            List<Contact> partnerContactList = Database.query(noPISQL);
            return partnerContactList;
        }else{
            String noPISQL = 'select Id,Name,Email,Phone,Account.Name,MobilePhone,AWS_Data_Id__c from Contact where Account_Record_Type_DeveloperName__c in('+'\'Agency\''+','+'\'Office\''+',\'AgencyContact\''+') limit 100';
            system.debug('noPISQL = ' + noPISQL);
            List<Contact> partnerContactList = Database.query(noPISQL);
            return partnerContactList;
        }
    }
 
 
    public static List<Contact> searchContactInitNoAccountId() {
        List<Contact> conList = new List<Contact>(
            [
                SELECT Id, AWS_Data_Id__c, Account.Name
                FROM Contact
                WHERE  AWS_Data_Id__c != '' And Account.Name!=''limit 100
            ]
        );
        return conList;
    }
 
    //deloitte-zhj 20231011 with sharing start
    public static List<Contact> searchContactWithAccountId(String hospitalId,List<String> awsDataIds) {
        List<Contact> conList = new List<Contact>(
            [
                SELECT Id, AWS_Data_Id__c, Account.Name
                FROM Contact
                WHERE Account.Hospital__c = :hospitalId AND AWS_Data_Id__c IN:awsDataIds
            ]
        );
        return conList;
    }
 
    public static List<Contact> searchContactNoWithAccountId(List<String> awsDataIds) {
        List<Contact> conList = new List<Contact>(
            [
                SELECT Id, AWS_Data_Id__c, Account.Name
                FROM Contact
                WHERE AWS_Data_Id__c IN:awsDataIds
            ]
        );
        return conList;
    }
 
    public static List<Contact> searchContactNoPI(String contactName) {
        List<Contact> conList = new List<Contact>(
            [
                select Id,Name,Account.Name,Phone,Email,MobilePhone from Contact where Name like :contactName
            ]
        );
        return conList;
    }
    //deloitte-zhj 20231011 with sharing end
 
 
    public static List<Contact> searchContactByAWSIds(List<String> conAWSIds) {
        List<Contact> conList = new List<Contact>(
            [
                select Id,Name,Account.Name,Phone,Email,MobilePhone,AWS_Data_Id__c from Contact where AWS_Data_Id__c in :conAWSIds
            ]
        );
        return conList;
    }
}