public with sharing class AgencyAccountCmp { public AgencyAccountCmp() { } @AuraEnabled public static List getAccounts() { //List aoList = [select Id, Agency_Hospital_Target__c, Agency_Hospital_Target__r.Name from Agency_Opportunity__c where Id = :recordId]; //if (aoList.size() > 0) { // Map res = new Map(); // res.put('Id', aoList[0].Agency_Hospital_Target__c); // res.put('Name', aoList[0].Agency_Hospital_Target__r.Name); // return res; //} else { // throw new AuraHandledException('找不到经销商医院'); //} Set hospitalSet = new Set(); Set aHospitalSet = new Set(); List ahls = [select Id, Hospital__c from Agency_Hospital_Link__c order by createddate desc limit 2000]; //deloitte-zhj 20230927 限制查询不能超过5w for (Agency_Hospital_Link__c ahl : ahls) { hospitalSet.add(ahl.Hospital__c); aHospitalSet.add(ahl.Id); } List acList1 = LightningUtil.selectOCMAgencyContact(hospitalSet, aHospitalSet); //List acList2 = [select Id, Name, Doctor_Division1__c, Type__c, Hospital_DC_Name__c from Agency_Contact__c where Department_Class__c = null order by Name]; //acList1.addAll(acList2); return acList1; } @AuraEnabled public static Map getfiledsmap() { Map schemaMap = Schema.getGlobalDescribe(); Map> typemap = new Map> (); Map fieldMap = schemaMap.get('Agency_Contact__c').getDescribe().fields.getMap(); Map mappingmap = new Map(); for(Schema.SObjectField sfield : fieldMap.Values()) { Schema.describefieldresult dfield = sfield.getDescribe(); String lab = ''; lab = dfield.getLabel(); mappingmap.put(dfield.name,lab); } return mappingmap; } @AuraEnabled public static List searchAccounts(String hosStr, String conStr) { //List aoList = [select Id, Agency_Hospital_Target__c, Agency_Hospital_Target__r.Name from Agency_Opportunity__c where Id = :recordId]; //if (aoList.size() > 0) { // Map res = new Map(); // res.put('Id', aoList[0].Agency_Hospital_Target__c); // res.put('Name', aoList[0].Agency_Hospital_Target__r.Name); // return res; //} else { // throw new AuraHandledException('找不到经销商医院'); //} String f1 = '%'+hosStr+'%'; String f2 = '%'+conStr+'%'; if (String.isBlank(hosStr)) f1 = '%'; if (String.isBlank(conStr)) f2 = '%'; Set hospitalSet = new Set(); Set aHospitalSet = new Set(); List ahls = [select Id, Hospital__c from Agency_Hospital_Link__c order by createddate desc limit 2000]; for (Agency_Hospital_Link__c ahl : ahls) { hospitalSet.add(ahl.Hospital__c); aHospitalSet.add(ahl.Id); } System.debug('=====>' + JSON.serialize(ahls) + '=======' + JSON.serialize(hospitalSet) + '=======' + JSON.serialize(aHospitalSet)); System.debug('f1='+f1); System.debug('f2='+f2); List acList1 = LightningUtil.searchOCMAgencyContact(hospitalSet, aHospitalSet, f1, f2); //List acList2 = [select Id, Name, Doctor_Division1__c, Type__c, Hospital_DC_Name__c from Agency_Contact__c where Department_Class__c = null and Hospital_DC_Name__c like :f1 and Name like :f2 order by Name]; //acList1.addAll(acList2); return acList1; } //deloitte-zhj 20231115 PIPL还原 // @AuraEnabled // public static void SaveLog(String module,String content,String status,String respMsg){ // string awsDataId = ''; // string sfId = ''; // string transId = ''; // try { // Map mso = (Map)JSON.deserializeUntyped(respMsg); // awsDataId = String.valueOf(mso.get('AWS_Data_Id__c')); // transId = String.valueOf(mso.get('txId')); // } catch (Exception e) { // } // PIHelper.saveTransLog(module, awsDataId, sfId, transId, content, status, respMsg); // } // 20220222 PI改造 by Bright--start @AuraEnabled public static Map GetConfig() { Map result = new Map(); //result.put('staticResource', JSON.serialize(PIHelper.getPIIntegrationInfo('Agency_Contact__c'))); //deloitte-zhj 20231115 PIPL还原 //result.put('sessionId', UserInfo.getSessionId()); return result; } @AuraEnabled public static List searchAccounts2(String hosStr, List awsids) { System.debug('hosStr='+hosStr); System.debug('awsids='+awsids); String f1 = '%'+hosStr+'%'; if (String.isBlank(hosStr)) f1 = '%'; Set hospitalSet = new Set(); Set aHospitalSet = new Set(); List ahls = [select Id, Hospital__c from Agency_Hospital_Link__c order by createddate desc limit 2000]; for (Agency_Hospital_Link__c ahl : ahls) { hospitalSet.add(ahl.Hospital__c); aHospitalSet.add(ahl.Id); } List acList1 = LightningUtil.searchOCMAgencyContact(hospitalSet, aHospitalSet, f1, awsids); return acList1; } // 20220222 PI改造 by Bright--end }