高章伟
2023-03-03 d8dc84a3d56df839895f1c417a4d9cbee763d262
force-app/main/default/classes/NFM624Rest.cls
@@ -61,6 +61,7 @@
 
        // 取得接口传输内容
        String strData = RestContext.request.requestBody.toString();
        system.debug('strData---'+strData);
        GeDatas ges = (GeDatas) JSON.deserializeStrict(strData, GeDatas.class);
        system.debug('ges---'+ges);
 
@@ -201,9 +202,11 @@
                }
                //查询市区Id 
                Map < String, String > CityMap = new Map < String, String > (); //市Map
                List < Address_Level2__c > citytempList = [select Id, Name from Address_Level2__c where Name IN: CityList];
                //省市对应该关系 LY 20230206 start
                List < Address_Level2__c > citytempList = [select Id, Name,Level1_Name__c  from Address_Level2__c where Name IN: CityList];
                for (Address_Level2__c temp: citytempList) {
                    CityMap.put(temp.Name, temp.Id);
                    CityMap.put(temp.Level1_Name__c+temp.Name, temp.Id);
                //省市对应该关系 LY 20230206 end
                }
 
                //查询医院所有人
@@ -585,7 +588,10 @@
                            //Ly 省文本赋值 start
                            hp.State_Text__c = gedata.State; //  省(文本)
                            //Ly 省文本赋值 end
                            hp.City_Master__c = CityMap.get(gedata.City); //     市
                            //省市对应该关系 LY 20230206 start
                            //hp.City_Master__c = CityMap.get(gedata.City); //     市
                            hp.City_Master__c = CityMap.get(gedata.State+gedata.City); //     市
                            //省市对应该关系 LY 20230206 end
                            hp.Hospital_Source__c = '智慧医疗';
                            upsertAccountList.add(hp);
                            System.debug('upsertAccountList'+upsertAccountList);
@@ -740,7 +746,7 @@
        List<CampaignMember__c> campaignMemberList = new List<CampaignMember__c>();
        List<Inquiry_form__c> inquiryFormList = new List<Inquiry_form__c>();
        //根据统一用户Id查询询问单
        List<Inquiry_form__c> InquiryList = [select Id,Inquiry_No__c,ContactId__c,Hospital_Name__c,Department_Class__c,Contact_Name__c from Inquiry_form__c where ContactId__c = :ContactId];
        List<Inquiry_form__c> InquiryList = [select Id,Inquiry_No__c,ContactId__c,Hospital_Name__c,Department_Class__c,Contact_Name__c from Inquiry_form__c where ContactId__c = :ContactId and Hospital_Name__c = null and Department_Class__c = null and Contact_Name__c = null];
        system.debug('InquiryList'+InquiryList);
        //根据统一用户Id查询联系人
        List<Contact> contactList = [select Id,Name,UnifiedI_Contact_ID__c,Account.Id,Strategic_dept_Class__c,AccountId,Account.Name,Strategic_dept_Class__r.OwnerId from Contact where UnifiedI_Contact_ID__c = :ContactId];
@@ -782,7 +788,7 @@
        
        //补充学会部分 start
        //List<CampaignMember__c> campaignMemberList = new List<CampaignMember__c>();
        List<CampaignMember__c> capMemList = [select Id,Contact_ID__c,Campaign__c,Campaign__r.Num__c,ViewContactId__c from CampaignMember__c where Contact_ID__c = :ContactId];
        List<CampaignMember__c> capMemList = [select Id,Contact_ID__c,Campaign__c,Campaign__r.Num__c,ViewContactId__c from CampaignMember__c where ViewContactId__c = :ContactId and Contact_ID__c = null];
        if(capMemList.size() > 0){
            system.debug('capMemList=================>'+capMemList);
            Map<String, String> capMemMap = new Map<String, String>();