public without sharing class LightningUtil {
    public LightningUtil() {
    }
    // 精琢科技  zxk 查询用户的用户产品区分字段  start
    public static User loginUserId() {
        system.debug('UserInfo.getUserId()================>' + UserInfo.getUserId());
        return [SELECT UserPro_Type__c FROM User WHERE id = :UserInfo.getUserId()];
    }
    // 精琢科技  zxk 查询用户的用户产品区分字段  end
    public static List<Agency_Contact__c> selectOCMAgencyContact(Set<String> hospitalSet, Set<String> ahospitalSet) {
        return [
            SELECT
                Id,
                Agency_Hospital__c,
                IsOlympusContact__c,
                Name,
                Doctor_Division1__c,
                Type__c,
                Hospital_DC_Name__c,
                Department_Cateogy_F__c,
                Hospital_Name__c,
                AWS_Data_Id__c // 20220222 PI改造 by Bright
            FROM Agency_Contact__c
            WHERE
                Department_Class__r.Hospital_Department_Class__c IN :hospitalSet
                OR (Department_Class__c = NULL
                AND Agency_Hospital__c IN :aHospitalSet)
            ORDER BY Name
        ];
    }
    public static List<Agency_Contact__c> searchOCMAgencyContact(
        Set<String> hospitalSet,
        Set<String> aHospitalSet,
        String hosStr,
        String conStr
    ) {
        return [
            SELECT
                Id,
                Agency_Hospital__c,
                IsOlympusContact__c,
                Name,
                Doctor_Division1__c,
                Type__c,
                Hospital_DC_Name__c,
                Department_Cateogy_F__c,
                Hospital_Name__c
            FROM Agency_Contact__c
            WHERE
                (Department_Class__r.Hospital_Department_Class__c IN :hospitalSet
                OR (Department_Class__c = NULL
                AND Agency_Hospital__c IN :aHospitalSet))
                AND Name LIKE :conStr
                AND Hospital_DC_Name__c LIKE :hosStr
            ORDER BY Name
        ];
    }

    // 20220222 PI改造 by Bright--start
    public static List<Agency_Contact__c> searchOCMAgencyContact(
        Set<String> hospitalSet,
        Set<String> aHospitalSet,
        String hosStr,
        List<string> awsids
    ) {
        string sql = 'select Id, Agency_Hospital__c, IsOlympusContact__c, Name, Doctor_Division1__c, Type__c, Hospital_DC_Name__c,Department_Cateogy_F__c,Hospital_Name__c,AWS_Data_Id__c from Agency_Contact__c';
        sql += ' where (Department_Class__r.Hospital_Department_Class__c in :hospitalSet or (Department_Class__c = null and Agency_Hospital__c in :aHospitalSet)) and Hospital_DC_Name__c like :hosStr';

        if (awsids != null && awsids.size() > 0) {
            sql += ' and AWS_Data_Id__c in :awsids ';
        }
        sql += ' order by Hospital_DC_Name__c';
        system.debug('sql=' + sql);
        return Database.query(sql);
    }
    // 20220222 PI改造 by Bright--end
    public static List<Contact> selectContact(String cId) {
        return [SELECT Id, AccountId, Name FROM Contact WHERE id = :cId];
    }

    public static List<Agency_Contact__c> selectAgencyContactList(String hospital_id) {
        //return [select id,Name,Doctor_Division1__c FROM Contact WHERE Strategic_dept_Class__c in (select Id From Account where Hospital_Department_Class__c=:hospital_id and RecordTypeId=:record_type_id)];
        Agency_Hospital_Link__c ahl = [SELECT Hospital__c FROM Agency_Hospital_Link__c WHERE id = :hospital_id];
        return [
            SELECT id, Name, Doctor_Division1__c, Type__c, Agency_Hospital__c
            FROM Agency_Contact__c
            WHERE Hospital_ID18__c = :ahl.Hospital__c
        ];
    }

    public static List<contact> selectAgencyPerson() {
        String login_user_id = UserInfo.getUserId();
        // PIPL update Yin Mingjie 21/02/2022 start
        // return [select id, Name, Agency_User__c from contact where  Agency_User__c = true and  Isactive__c = '有效' and AccountId in
        // (select AccountId from User where id=:login_user_id)];
        return [
            SELECT id, Name, Agency_User__c, AWS_Data_Id__c
            FROM contact
            WHERE Agency_User__c = TRUE AND Isactive__c = '有效' AND AccountId IN (SELECT AccountId FROM User WHERE id = :login_user_id)
        ];
        // PIPL update Yin Mingjie 21/02/2022 end
    }
    public static List<contact> selectAgencyPerson01() {
        String login_user_id = UserInfo.getUserId();
        system.debug('login_user_id=============>' + login_user_id);
        return [
            SELECT id, Name, Agency_User__c
            FROM contact
            WHERE Agency_User__c = FALSE AND Isactive__c = '有效' AND id IN (SELECT ContactId FROM User WHERE id = :login_user_id)
        ];
    }

    public static List<contact> selectAgencyPerson02() {
        String login_user_id = UserInfo.getUserId();
        return [
            SELECT id, Name, Agency_User__c
            FROM contact
            WHERE Isactive__c = '有效' AND AccountId IN (SELECT AccountId FROM User WHERE id = :login_user_id)
        ];
    }

    public static List<contact> selectAgencyPerson03() {
        String login_user_id = UserInfo.getUserId();
        system.debug('login_user_id=============>' + login_user_id);
        return [
            SELECT id, Name, Agency_User__c
            FROM contact
            WHERE Isactive__c = '有效' AND id IN (SELECT ContactId FROM User WHERE id = :login_user_id)
        ];
    }

    public static void updateAccMaxActivityDate(String accId, Date week) {
        Agency_Hospital_Link__c account = [SELECT Id, MaxActivityDate__c FROM Agency_Hospital_Link__c WHERE id = :accId];
        account.MaxActivityDate__c = week;
        update account;
    }

    public static Agency_Report_Header__c upsertAgencyReportHeader(Agency_Report_Header__c data) {
        upsert data Agency_Report_Header__c.HeaderInputKey__c;
        return data;
    }

    public static void upsertMAgencyReportHeader(List<Agency_Report_Header__c> data) {
        upsert data Agency_Report_Header__c.HeaderInputKey__c;
        // return data;
    }

    // PIPL update Yin Mingjie 21/02/2022 start
    public static Map<String, String> insertAgencyContact(Agency_Contact__c data) {
        Map<String, String> acmap = new Map<String, String>();
        acmap.put('AgencyContactId', '');
        acmap.put('errormsg', '');
        try {
            insert data;
            acmap.put('AgencyContactId', data.Id);
        } catch (Exception e) {
            acmap.put('errormsg', e.getMessage());
        }
        return acmap;
    }
    // PIPL update Yin Mingjie 21/02/2022 end

    public static Agency_Report__c insertAgencyReport(Agency_Report__c data) {
        if (String.isBlank(data.Hospital__c)) {
            List<Agency_Hospital_Link__c> agency_hospital_link = [
                SELECT Id, Hospital__c
                FROM Agency_Hospital_Link__c
                WHERE Id = :data.Agency_Hospital__c
            ];
            data.Hospital__c = agency_hospital_link[0].Hospital__c;
        }
        if (String.isBlank(data.Department_Class__c)) {
            String record_type_id = getRecordTypeId(data.Department_Cateogy__c);
            List<Account> account = [
                SELECT Id, RecordTypeId
                FROM account
                WHERE Hospital_Department_Class__c = :data.Hospital__c AND RecordTypeId = :record_type_id
            ];
            data.Department_Class__c = account[0].Id;
        }

        insert data;
        return data;
    }

    public static void insertMAgencyReport(List<Agency_Report__c> data) {
        // if (String.isBlank(data.Hospital__c)) {
        //     List<Agency_Hospital_Link__c> agency_hospital_link = [select Id, Hospital__c from Agency_Hospital_Link__c where Id=:data.Agency_Hospital__c];
        //     data.Hospital__c = agency_hospital_link[0].Hospital__c;
        // }
        // if (String.isBlank(data.Department_Class__c)) {
        //     String record_type_id = getRecordTypeId(data.Department_Cateogy__c);
        //     List<Account> account = [select Id, RecordTypeId from account where Hospital_Department_Class__c=:data.Hospital__c and RecordTypeId=:record_type_id];
        //     data.Department_Class__c = account[0].Id;
        // }

        insert data;
        // return data;
    }

    public static Agency_Report__c updateAgencyReport(Agency_Report__c data) {
        if (String.isBlank(data.Hospital__c)) {
            List<Agency_Hospital_Link__c> agency_hospital_link = [
                SELECT Id, Hospital__c
                FROM Agency_Hospital_Link__c
                WHERE Id = :data.Agency_Hospital__c
            ];
            data.Hospital__c = agency_hospital_link[0].Hospital__c;
        }
        if (String.isBlank(data.Department_Class__c)) {
            String record_type_id = getRecordTypeId(data.Department_Cateogy__c);
            List<Account> account = [
                SELECT Id, RecordTypeId
                FROM account
                WHERE Hospital_Department_Class__c = :data.Hospital__c AND RecordTypeId = :record_type_id
            ];
            data.Department_Class__c = account[0].Id;
        }

        update data;
        return data;
    }

    public static List<Account> getDeptListByRecordType(String hospital_id, Set<String> recordIds) {
        return [
            SELECT Id, RecordTypeId, Name
            FROM account
            WHERE Hospital_Department_Class__c = :hospital_id AND RecordTypeId IN :recordIds
        ];
    }

    public static List<RecordType> getAccRecordType(String[] deptTypes) {
        return [
            SELECT Id, Name, DeveloperName
            FROM RecordType
            WHERE IsActive = TRUE AND SobjectType = 'Account' AND DeveloperName IN :deptTypes
        ];
    }

    public static void upsertAgencyOpportunity(List<Agency_Opportunity__c> upsertList) {
        upsert upsertList Agency_Opportunity__c.TargetInputKey__c;
    }
    //经销商系统
    public static List<Agency_Report__c> selectAgencyReport(Date week, String person_str) {
        if (String.isBlank(person_str)) {
            List<Contact> person_list = selectAgencyPerson(); //fy Department_Cateogy_text__c
            return [
                SELECT
                    Id,
                    Name,
                    Report_Date__c,
                    Product_Category1__r.Name,
                    Product_Category2__r.Name,
                    Product_Category3__r.Name,
                    Product_Category1__c,
                    Product_Category2__c,
                    Product_Category3__c,
                    ConsumptionOfConsumables__c,
                    WorkMark__c,
                    warlocksNumber__c,
                    Department_Cateogy__c,
                    Department_Cateogy_text__c,
                    ProductClassification__c,
                    WarlockClassification__c,
                    ProductCcategory__c,
                    productCategories__c,
                    DealerPersonnel__c,
                    WorkRecord__c,
                    Purpose_Type__c,
                    SupportNeeds__c,
                    Agency_Report_Header__c,
                    Agency_Hospital__r.Name,
                    Agency_Hospital__r.Hospital__c,
                    OppName__c,
                    Person_In_Charge2__c,
                    DealerPersonnel__r.Name,
                    Person_In_Charge2__r.Name,
                    doctor2__c,
                    doctor2__r.Name,
                    Submit_date__c,
                    doctor2__r.AWS_Data_Id__c,
                    Person_In_Charge2__r.AWS_Data_Id__c, // 20220222 PI改造 by Bright
                    Product_Category__c,
                    Product_Category__r.Name,
                    Result__c,
                    visitor_title__c,
                    Opportunity__c,
                    Opportunity__r.Name,
                    EffectProgress__c,
                    UseProduct1__c,
                    UseProduct2__c,
                    UseProduct3__c,
                    UseProduct1__r.Name,
                    UseProduct2__r.Name,
                    UseProduct3__r.Name
                FROM Agency_Report__c
                WHERE Submit_date__c = :week AND Person_In_Charge2__c IN :person_list AND WeeklyReportClassification__c = ''
                ORDER BY LastModifiedDate DESC
            ];
        } else {
            //fy Department_Cateogy_text__c
            return [
                SELECT
                    Id,
                    Name,
                    Report_Date__c,
                    Product_Category1__r.Name,
                    Product_Category2__r.Name,
                    Product_Category3__r.Name,
                    Product_Category1__c,
                    Product_Category2__c,
                    Product_Category3__c,
                    ConsumptionOfConsumables__c,
                    WorkMark__c,
                    warlocksNumber__c,
                    Department_Cateogy__c,
                    Department_Cateogy_text__c,
                    DealerPersonnel__c,
                    ProductClassification__c,
                    WarlockClassification__c,
                    ProductCcategory__c,
                    productCategories__c,
                    WorkRecord__c,
                    Purpose_Type__c,
                    SupportNeeds__c,
                    Agency_Report_Header__c,
                    Agency_Hospital__r.Name,
                    Agency_Hospital__r.Hospital__c,
                    OppName__c,
                    Person_In_Charge2__c,
                    DealerPersonnel__r.Name,
                    Person_In_Charge2__r.Name,
                    doctor2__c,
                    doctor2__r.Name,
                    Submit_date__c,
                    doctor2__r.AWS_Data_Id__c,
                    Person_In_Charge2__r.AWS_Data_Id__c, // 20220222 PI改造 by Bright
                    Product_Category__c,
                    Product_Category__r.Name,
                    Result__c,
                    visitor_title__c,
                    Opportunity__c,
                    Opportunity__r.Name,
                    EffectProgress__c,
                    UseProduct1__c,
                    UseProduct2__c,
                    UseProduct3__c,
                    UseProduct1__r.Name,
                    UseProduct2__r.Name,
                    UseProduct3__r.Name
                FROM Agency_Report__c
                WHERE Submit_date__c = :week AND Person_In_Charge2__c = :person_str AND WeeklyReportClassification__c = ''
                ORDER BY LastModifiedDate DESC
            ];
        }
    }
    //追溯系统
    public static List<Agency_Report__c> selectAgencyReport01(Date week, String person_str) {
        system.debug('person_strperson_str=================>' + person_str);
        if (String.isBlank(person_str)) {
            List<Contact> person_list = selectAgencyPerson01(); //fy Department_Cateogy_text__c  doctor3__c
            return [
                SELECT
                    Id,
                    Name,
                    Report_Date__c,
                    Product_Category1__r.Name,
                    Product_Category2__r.Name,
                    Product_Category3__r.Name,
                    Product_Category1__c,
                    Product_Category2__c,
                    Product_Category3__c,
                    ConsumptionOfConsumables__c,
                    WorkMark__c,
                    warlocksNumber__c,
                    Department_Cateogy__c,
                    Department_Cateogy_text__c,
                    ProductClassification__c,
                    WarlockClassification__c,
                    ProductCcategory__c,
                    productCategories__c,
                    DealerPersonnel__c,
                    WorkRecord__c,
                    Agency_Report_Header__c,
                    Agency_Hospital__r.Name,
                    Agency_Hospital__r.Hospital__c,
                    OppName__c,
                    Person_In_Charge2__c,
                    DealerPersonnel__r.Name,
                    Person_In_Charge2__r.Name,
                    doctor2__c,
                    doctor3__c,
                    doctor2__r.Name,
                    Submit_date__c,
                    Product_Category__c,
                    Product_Category__r.Name,
                    Result__c,
                    visitor_title__c,
                    Opportunity__c,
                    Opportunity__r.Name,
                    EffectProgress__c,
                    doctor2__r.AWS_Data_Id__c, // 20220222 PI改造 by Bright
                    UseProduct1__c,
                    UseProduct2__c,
                    UseProduct3__c,
                    UseProduct1__r.Name,
                    UseProduct2__r.Name,
                    UseProduct3__r.Name,
                    UseProduct1__r.Asset_Model_No__c,
                    UseProduct2__r.Asset_Model_No__c,
                    UseProduct3__r.Asset_Model_No__c
                FROM Agency_Report__c
                WHERE Submit_date__c = :week AND Person_In_Charge2__c IN :person_list AND WeeklyReportClassification__c != ''
                ORDER BY LastModifiedDate DESC
            ];
        } else {
            //fy Department_Cateogy_text__c  doctor3__c
            return [
                SELECT
                    Id,
                    Name,
                    Report_Date__c,
                    Product_Category1__r.Name,
                    Product_Category2__r.Name,
                    Product_Category3__r.Name,
                    Product_Category1__c,
                    Product_Category2__c,
                    Product_Category3__c,
                    ConsumptionOfConsumables__c,
                    WorkMark__c,
                    warlocksNumber__c,
                    Department_Cateogy__c,
                    Department_Cateogy_text__c,
                    DealerPersonnel__c,
                    ProductClassification__c,
                    WarlockClassification__c,
                    ProductCcategory__c,
                    productCategories__c,
                    WorkRecord__c,
                    Agency_Report_Header__c,
                    Agency_Hospital__r.Name,
                    Agency_Hospital__r.Hospital__c,
                    OppName__c,
                    Person_In_Charge2__c,
                    DealerPersonnel__r.Name,
                    Person_In_Charge2__r.Name,
                    doctor2__c,
                    doctor3__c,
                    doctor2__r.Name,
                    Submit_date__c,
                    doctor2__r.AWS_Data_Id__c, // 20220222 PI改造 by Bright
                    Product_Category__c,
                    Product_Category__r.Name,
                    Result__c,
                    visitor_title__c,
                    Opportunity__c,
                    Opportunity__r.Name,
                    EffectProgress__c,
                    UseProduct1__c,
                    UseProduct2__c,
                    UseProduct3__c,
                    UseProduct1__r.Name,
                    UseProduct2__r.Name,
                    UseProduct3__r.Name,
                    UseProduct1__r.Asset_Model_No__c,
                    UseProduct2__r.Asset_Model_No__c,
                    UseProduct3__r.Asset_Model_No__c
                FROM Agency_Report__c
                WHERE Submit_date__c = :week AND Person_In_Charge2__c = :person_str AND WeeklyReportClassification__c != ''
                ORDER BY LastModifiedDate DESC
            ];
        }
    }
    //经销商系统
    public static List<Agency_Report__c> selectMAgencyReport(Date date1, Date date2, List<Contact> conMList) {
        //fy Department_Cateogy_text__c
        List<Agency_Report__c> reportlist = [
            SELECT
                Id,
                Name,
                Report_Date__c,
                Product_Category1__r.Name,
                Product_Category2__r.Name,
                Product_Category3__r.Name,
                Product_Category1__c,
                Product_Category2__c,
                Product_Category3__c,
                ConsumptionOfConsumables__c,
                warlocksNumber__c,
                WorkMark__c,
                Department_Cateogy__c,
                Department_Cateogy_text__c,
                DealerPersonnel__c,
                WorkRecord__c,
                ProductClassification__c,
                WarlockClassification__c,
                ProductCcategory__c,
                productCategories__c,
                Purpose_Type__c,
                Agency_Report_Header__c,
                Agency_Hospital__r.Name,
                Agency_Hospital__r.Hospital__c,
                OppName__c,
                Person_In_Charge2__c,
                DealerPersonnel__r.Name,
                Person_In_Charge2__r.Name,
                doctor2__c,
                doctor2__r.Name,
                Submit_date__c, //支援需求SupportNeeds__c
                doctor2__r.AWS_Data_Id__c, // 20220222 PI改造 by Bright
                Product_Category__c,
                Product_Category__r.Name,
                Result__c,
                visitor_title__c,
                Opportunity__c,
                Opportunity__r.Name,
                EffectProgress__c,
                SupportNeeds__c,
                UseProduct1__c,
                UseProduct2__c,
                UseProduct3__c,
                UseProduct1__r.Name,
                UseProduct2__r.Name,
                UseProduct3__r.Name
            FROM Agency_Report__c
            WHERE
                Person_In_Charge2__c IN :conMList
                AND Report_Date__c >= :date1
                AND Report_Date__c <= :date2
                AND WeeklyReportClassification__c = ''
        ];
        return reportlist;
    }
    //追溯系统
    public static List<Agency_Report__c> selectMAgencyReport01(Date date1, Date date2, List<Contact> conMList) {
        //fy Department_Cateogy_text__c  doctor3__c
        List<Agency_Report__c> reportlist = [
            SELECT
                Id,
                Name,
                Report_Date__c,
                Product_Category1__r.Name,
                Product_Category2__r.Name,
                Product_Category3__r.Name,
                Product_Category1__c,
                Product_Category2__c,
                Product_Category3__c,
                ConsumptionOfConsumables__c,
                warlocksNumber__c,
                WorkMark__c,
                Department_Cateogy__c,
                Department_Cateogy_text__c,
                DealerPersonnel__c,
                WorkRecord__c,
                ProductClassification__c,
                WarlockClassification__c,
                ProductCcategory__c,
                productCategories__c,
                Agency_Report_Header__c,
                Agency_Hospital__r.Name,
                Agency_Hospital__r.Hospital__c,
                OppName__c,
                Person_In_Charge2__c,
                DealerPersonnel__r.Name,
                Person_In_Charge2__r.Name,
                doctor2__c,
                doctor3__c,
                doctor2__r.Name,
                Submit_date__c,
                doctor2__r.AWS_Data_Id__c, // 20220222 PI改造 by Bright
                Product_Category__c,
                Product_Category__r.Name,
                Result__c,
                visitor_title__c,
                Opportunity__c,
                Opportunity__r.Name,
                EffectProgress__c,
                UseProduct1__c,
                UseProduct2__c,
                UseProduct3__c,
                UseProduct1__r.Name,
                UseProduct2__r.Name,
                UseProduct3__r.Name,
                UseProduct1__r.Asset_Model_No__c,
                UseProduct2__r.Asset_Model_No__c,
                UseProduct3__r.Asset_Model_No__c
            FROM Agency_Report__c
            WHERE
                Person_In_Charge2__c IN :conMList
                AND Report_Date__c >= :date1
                AND Report_Date__c <= :date2
                AND WeeklyReportClassification__c != ''
        ];
        return reportlist;
    }
    //经销商系统的
    public static List<Agency_Report__c> selectAgencyReportById(String report_id) {
        //fy Department_Cateogy_text__c
        return [
            SELECT
                Id,
                Name,
                Department_Cateogy__c,
                Department_Cateogy_text__c,
                Purpose_Type__c,
                ConsumptionOfConsumables__c,
                warlocksNumber__c,
                WorkMark__c,
                WorkRecord__c,
                EffectProgress__c,
                ProductClassification__c,
                ProductCcategory__c,
                productCategories__c,
                Agency_Report_Header__c,
                Agency_Hospital__r.Name,
                Agency_Hospital__r.Hospital__c,
                OppName__c,
                Person_In_Charge2__c,
                DealerPersonnel__c,
                DealerPersonnel__r.Name,
                Person_In_Charge2__r.Name,
                doctor2__c,
                doctor2__r.Name,
                Submit_date__c,
                doctor2__r.AWS_Data_Id__c, // 20220222 PI改造 by Bright
                Product_Category__c,
                Product_Category__r.Name,
                Result__c,
                visitor_title__c,
                Opportunity__c,
                Opportunity__r.Name
            FROM Agency_Report__c
            WHERE id = :report_id
        ];
    }
    //追溯系统的
    public static List<Agency_Report__c> selectAgencyReportById01(String report_id) {
        //fy Department_Cateogy_text__c doctor3__c
        return [
            SELECT
                Id,
                Name,
                Department_Cateogy__c,
                Department_Cateogy_text__c,
                ConsumptionOfConsumables__c,
                warlocksNumber__c,
                WorkMark__c,
                WorkRecord__c,
                EffectProgress__c,
                ProductClassification__c,
                ProductCcategory__c,
                productCategories__c,
                Agency_Report_Header__c,
                Agency_Hospital__r.Name,
                Agency_Hospital__r.Hospital__c,
                OppName__c,
                Person_In_Charge2__c,
                DealerPersonnel__c,
                DealerPersonnel__r.Name,
                Person_In_Charge2__r.Name,
                doctor2__c,
                doctor3__c,
                doctor2__r.Name,
                Submit_date__c,
                doctor2__r.AWS_Data_Id__c, // 20220222 PI改造 by Bright
                Product_Category__c,
                Product_Category__r.Name,
                Result__c,
                visitor_title__c
            FROM Agency_Report__c
            WHERE id = :report_id
        ];
    }

    public static List<Agency_Opportunity__c> selectOpportunityByIdAndHospitalLinkId(
        String opportunity_id,
        String agency_hospital_link_id
    ) {
        return [
            SELECT
                Id,
                Name,
                StageName__c,
                StageName2__c,
                RecordTypeId,
                Amount__c,
                OCMSale_Price__c,
                Close_Forecasted_Date__c,
                TargetInputKey__c,
                Agency_Hospital__c,
                Agency_Hospital__r.Name,
                Department_Cateogy__c,
                Product_Category__c,
                Product_Category__r.Name
            FROM Agency_Opportunity__c
            WHERE id = :opportunity_id AND Agency_Hospital__c = :agency_hospital_link_id
        ];
    }

    public static String getRecordTypeId(String department_str) {
        String record_type_id = '';
        if (department_str == 'GI') {
            // 消化科
            record_type_id = '01210000000QemLAAS';
        } else if (department_str == 'BF') {
            // 呼吸科
            record_type_id = '01210000000QezZAAS';
        } else if (department_str == 'GYN') {
            // 婦人科
            record_type_id = '01210000000QezoAAC';
        } else if (department_str == 'GS') {
            // 普外科
            record_type_id = '01210000000QezeAAC';
        } else if (department_str == 'URO') {
            // 泌尿科
            record_type_id = '01210000000QezjAAC';
        } else if (department_str == 'ENT') {
            // 耳鼻喉科
            record_type_id = '01210000000QeztAAC';
        } else if (department_str == 'ET') {
            record_type_id = '01210000000QemQAAS';
        } else if (department_str == 'OTH') {
            // その他
            record_type_id = '01210000000QezyAAC';
        }

        return record_type_id;
    }

    public static void updateAgencyOpportunity(Agency_Opportunity__c updaterecord) {
        upsert updaterecord;
    }

    public static Integer ControllerUtil() {
        Integer i = 0;

        return i;
    }
}
