package thyyxxk.webserver.dao.his.medicalinsurance;

import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.*;
import thyyxxk.webserver.entity.medicalinsurance.download.*;

import java.util.List;

@Mapper
public interface SiDownloadDao {

    @Update("truncate table t_si_dl_chns_hbl")
    void truncateChnsHblTable();

    @Delete("delete from t_si_dl_chns_hbl where version_name>=#{version}")
    void deleteChnsHblTableByVersion(String version);

    @Select("select count(1) from t_si_dl_chns_hbl where version_name>=#{version}")
    int selectCount(String version);

    @Insert("<script>" +
            "insert into t_si_dl_chns_hbl (standard_name, standard_page_number, standard_electronic_archives, " +
            "herbal_medicine_year, medical_materials_name, medicinal_materials_source, national_payment_policy, " +
            "provincial_payment_policy, valid_flag, code, monoo_name, single_compound_mark, quality_grade, " +
            "medicinal_site, safety_measurement, general_usage, property_and_flavor, channel_tropism, variety, " +
            "start_time, end_time, unique_record_number, data_creation_time, data_update_time, version_number, " +
            "version_name, functional_governance, processing_method, efficacy_classification) " +
            "values " +
            "<foreach collection='list' item='itm' open='' separator=',' close=''>" +
            "(#{itm.standardName}, #{itm.standardPageNumber}, #{itm.standardElectronicArchives}, #{itm.herbalMedicineYear}, " +
            "#{itm.medicalMaterialsName}, #{itm.medicinalMaterialsSource}, #{itm.nationalPaymentPolicy}, #{itm.provincialPaymentPolicy}, " +
            "#{itm.validFlag}, #{itm.code}, #{itm.monooName}, #{itm.singleCompoundMark}, #{itm.qualityGrade}, #{itm.medicinalSite}, " +
            "#{itm.safetyMeasurement}, #{itm.generalUsage}, #{itm.propertyAndFlavor}, #{itm.channelTropism}, #{itm.variety}, " +
            "#{itm.startTime}, #{itm.endTime}, #{itm.uniqueRecordNumber}, #{itm.dataCreationTime}, #{itm.dataUpdateTime}, " +
            "#{itm.versionNumber}, #{itm.versionName}, #{itm.functionalGovernance}, #{itm.processingMethod}, #{itm.efficacyClassification})" +
            "</foreach>" +
            "</script>")
    void insertChnsHblBatch(List<SiDlChnsHbl> list);

    @Select("select * from t_si_dl_chns_hbl with(nolock) order by version_name desc")
    IPage<SiDlChnsHbl> selectSiDlChnsHblPage(IPage<SiDlChnsHbl> iPage);

    @Update("truncate table t_si_dl_dss_dns")
    void truncateDssDnsTable();

    @Delete("delete from t_si_dl_dss_dns where version_name>=#{version}")
    void deleteDssDnsTableByVersion(String version);

    @Insert("<script>" +
            "insert into t_si_dl_dss_dns (code, chapter, chapter_code_range, chapter_name, section_code_range, " +
            "section_name, class_order_code, class_order_name, subcode, subname, diagnosis_code, diagnosis_name, " +
            "use_the_tag, remarks, unique_record_number, data_creation_time, data_update_time, version_number, " +
            "version_name, national_diagnostic_code, national_diagnostic_name, clinical_diagnostic_code, " +
            "clinical_diagnostic_name, valid_flag, py_code, del_flag) " +
            "values " +
            "<foreach collection='list' item='itm' open='' separator=',' close=''>" +
            "(#{itm.code}, #{itm.chapter}, #{itm.chapterCodeRange}, #{itm.chapterName}, #{itm.sectionCodeRange}, " +
            "#{itm.sectionName}, #{itm.classOrderCode}, #{itm.classOrderName}, #{itm.subcode}, #{itm.subname}, " +
            "#{itm.diagnosisCode}, #{itm.diagnosisName}, #{itm.useTheTag}, #{itm.remarks}, #{itm.uniqueRecordNumber}, " +
            "#{itm.dataCreationTime}, #{itm.dataUpdateTime}, #{itm.versionNumber}, #{itm.versionName}, " +
            "#{itm.nationalDiagnosticCode}, #{itm.nationalDiagnosticName}, #{itm.clinicalDiagnosticCode}, " +
            "#{itm.clinicalDiagnosticName}, #{itm.validFlag}, #{itm.pyCode}, 0)" +
            "</foreach>" +
            "</script>")
    void insertDssDnsBatch(List<SiDlDssDns> list);

    @Select("select * from t_si_dl_dss_dns with(nolock) where del_flag=0")
    IPage<SiDlDssDns> selectSiDlDssDnsPage(IPage<SiDlDssDns> iPage);

    @Update("truncate table t_si_dl_dytm_srgy_dss")
    void truncateDytmSrgyDssTable();

    @Delete("delete from t_si_dl_dytm_srgy_dss where version_name>=#{version}")
    void deleteDytmSrgyDssTableByVersion(String version);

    @Insert("<script>" +
            "insert into t_si_dl_dytm_srgy_dss (code, unique_record_number, data_creation_time, data_update_time, " +
            "version_number, disease_connotation, remarks, version_name, daytime_surgery_code, daytime_surgery_name, " +
            "guide_page_num, electronic_guide_archives, operation_name, operation_code, valid_flag) " +
            "values " +
            "<foreach collection='list' item='itm' open='' separator=',' close=''>" +
            "(#{itm.code}, #{itm.uniqueRecordNumber}, #{itm.dataCreationTime}, #{itm.dataUpdateTime}, " +
            "#{itm.versionNumber}, #{itm.diseaseConnotation}, #{itm.remarks}, #{itm.versionName}, " +
            "#{itm.daytimeSurgeryCode}, #{itm.daytimeSurgeryName}, #{itm.guidePageNum}, #{itm.electronicGuideArchives}, " +
            "#{itm.operationName}, #{itm.operationCode}, #{itm.validFlag})" +
            "</foreach>" +
            "</script>")
    void insertDytmSrgyDssBatch(List<SiDlDytmSrgyDss> list);

    @Select("select * from t_si_dl_dytm_srgy_dss with(nolock)")
    IPage<SiDlDytmSrgyDss> selectSiDlDytmSrgyDssPage(IPage<SiDlDytmSrgyDss> iPage);

    @Update("truncate table t_si_dl_inst_prptn")
    void truncateInstPrptnTable();

    @Insert("<script>" +
            "insert into t_si_dl_inst_prptn (code, alias, english_name, ingredient, functional_governance, garner, " +
            "each_dosage, packaging_material, packaging_material_name, packing_specifications, instructions, " +
            "package_quantity, minimum_unit, minimum_sales_unit, minimum_packing_quantity, minimum_packing_unit, " +
            "minimum_preparation_unit, minimum_preparation_unit_name, minimum_pricing_unit, untoward_effect, " +
            "matters_needing_attention, taboo, production_number, production_name, drug_registration_certificate_number, " +
            "conversion_ratio, registration_name, subpackaging_manufacturer, market_status, remarks, unique_record_number, " +
            "data_creation_time, data_update_time, version_number, version_name, trade_name, dosage, dosage_name, " +
            "registration_dosage, properties, specifications, specification_code, registration_specification, " +
            "registration_specification_code, usage_way, frequency, category, category_name, nonprescription_flag, " +
            "nonprescription_flag_name, minimum_measurement_unit, validity_period, producer_address, special_limited_flag, " +
            "approval, approval_start_date, approval_end_date, certificate_start_date, certificate_end_date, " +
            "usage_range_limit, min_packaging_unit_name, registration_electronic_file, supplementary_electronic_file, " +
            "national_catalogue_no, national_catalogue_remark, adjusted_tax_flag, adjusted_tax_drug_name, " +
            "listed_drugs_set, health_commission_drug_code, start_time, end_time, self_preparation_license, " +
            "drugs_for_children, drugs_for_elderly, institution_contact_name, institution_contact_name_tel, " +
            "self_preparation_electronic_files, valid_flag) " +
            "values " +
            "<foreach collection='list' item='itm' open='' separator=',' close=''>" +
            "(#{itm.code}, #{itm.alias}, #{itm.englishName}, #{itm.ingredient}, #{itm.functionalGovernance}, " +
            "#{itm.garner}, #{itm.eachDosage}, #{itm.packagingMaterial}, #{itm.packagingMaterialName}, " +
            "#{itm.packingSpecifications}, #{itm.instructions}, #{itm.packageQuantity}, #{itm.minimumUnit}, " +
            "#{itm.minimumSalesUnit}, #{itm.minimumPackingQuantity}, #{itm.minimumPackingUnit}, " +
            "#{itm.minimumPreparationUnit}, #{itm.minimumPreparationUnitName}, #{itm.minimumPricingUnit}, " +
            "#{itm.untowardEffect}, #{itm.mattersNeedingAttention}, #{itm.taboo}, #{itm.productionNumber}, " +
            "#{itm.productionName}, #{itm.drugRegistrationCertificateNumber}, #{itm.conversionRatio}, " +
            "#{itm.registrationName}, #{itm.subpackagingManufacturer}, #{itm.marketStatus}, #{itm.remarks}, " +
            "#{itm.uniqueRecordNumber}, #{itm.dataCreationTime}, #{itm.dataUpdateTime}, #{itm.versionNumber}, " +
            "#{itm.versionName}, #{itm.tradeName}, #{itm.dosage}, #{itm.dosageName}, #{itm.registrationDosage}," +
            " #{itm.properties}, #{itm.specifications}, #{itm.specificationCode}, #{itm.registrationSpecification}, " +
            "#{itm.registrationSpecificationCode}, #{itm.usageWay}, #{itm.frequency}, #{itm.category}, " +
            "#{itm.categoryName}, #{itm.nonprescriptionFlag}, #{itm.nonprescriptionFlagName}, " +
            "#{itm.minimumMeasurementUnit}, #{itm.validityPeriod}, #{itm.producerAddress}, #{itm.specialLimitedFlag}, " +
            "#{itm.approval}, #{itm.approvalStartDate}, #{itm.approvalEndDate}, #{itm.certificateStartDate}, " +
            "#{itm.certificateEndDate}, #{itm.usageRangeLimit}, #{itm.minPackagingUnitName}, " +
            "#{itm.registrationElectronicFile}, #{itm.supplementaryElectronicFile}, #{itm.nationalCatalogueNo}, " +
            "#{itm.nationalCatalogueRemark}, #{itm.adjustedTaxFlag}, #{itm.adjustedTaxDrugName}, #{itm.listedDrugsSet}, " +
            "#{itm.healthCommissionDrugCode}, #{itm.startTime}, #{itm.endTime}, #{itm.selfPreparationLicense}, " +
            "#{itm.drugsForChildren}, #{itm.drugsForElderly}, #{itm.institutionContactName}, " +
            "#{itm.institutionContactNameTel}, #{itm.selfPreparationElectronicFiles}, #{itm.validFlag})" +
            "</foreach>" +
            "</script>")
    void insertInstPrptnBatch(List<SiDlInstPrptn> list);

    @Select("select * from t_si_dl_inst_prptn with(nolock) order by version_name desc")
    IPage<SiDlInstPrptn> selectSiDlInstPrptnPage(IPage<SiDlInstPrptn> iPage);

    @Update("truncate table t_si_dl_mdcn_sply")
    void truncateMdcnSplyTable();

    @Delete("delete from t_si_dl_mdcn_sply where version_name>=#{version}")
    void deleteMdcnSplyTableByVersion(String version);

    @Insert("<script>" +
            "insert into t_si_dl_mdcn_sply (code, supplies_name, product_model, specification_code, spec, " +
            "consumable_classification, specifications_and_models, material_code, consumable_material, " +
            "package_quantity, product_packaging_material, packing_unit, product_conversion_ratio, minimum_unit, " +
            "product_standard, expdt, scope_of_application, product_usage_method, product_picture_number, " +
            "product_quality_standard, instructions, other_supporting_materials, minimum_sales_unit, start_time, " +
            "end_time, structure_and_composition, approval_date, production_number, production_name, production_address, " +
            "agenterprise, product_image, unique_record_number, version_number, version_name, medical_device_unique_code, " +
            "si_universal_code, si_universal_name, production_addr_category, production_addr_category_name, " +
            "performance_structure, special_machine_flag, special_machine_name, group_name, group_logo, limit_using_flag, " +
            "si_limit_range, high_value_flag, classification_code, implant_and_organ_flag, sterization_flag, " +
            "sterilization_flag_name, implant_interventional_flag, implant_interventional_class_name, disposable_flag, " +
            "disposable_flag_name, registrant_name, management_category, management_category_name, registration_record_no, " +
            "registered_product_name, other_content, registered_applicant_addr, certificate_start_time, " +
            "certificate_end_time, agenterprise_address, production_country, sales_service_organization, " +
            "certificate_electronic_file, packing_specifications, valid_flag) " +
            "values " +
            "<foreach collection='list' item='itm' open='' separator=',' close=''>" +
            "(#{itm.code}, #{itm.suppliesName}, #{itm.productModel}, #{itm.specificationCode}, #{itm.spec}, " +
            "#{itm.consumableClassification}, #{itm.specificationsAndModels}, #{itm.materialCode}, #{itm.consumableMaterial}, " +
            "#{itm.packageQuantity}, #{itm.productPackagingMaterial}, #{itm.packingUnit}, #{itm.productConversionRatio}, " +
            "#{itm.minimumUnit}, #{itm.productStandard}, #{itm.expdt}, #{itm.scopeOfApplication}, #{itm.productUsageMethod}, " +
            "#{itm.productPictureNumber}, #{itm.productQualityStandard}, #{itm.instructions}, #{itm.otherSupportingMaterials}, " +
            "#{itm.minimumSalesUnit}, #{itm.startTime}, #{itm.endTime}, #{itm.structureAndComposition}, #{itm.approvalDate}, " +
            "#{itm.productionNumber}, #{itm.productionName}, #{itm.productionAddress}, #{itm.agenterprise}, #{itm.productImage}, " +
            "#{itm.uniqueRecordNumber}, #{itm.versionNumber}, #{itm.versionName}, #{itm.medicalDeviceUniqueCode}, " +
            "#{itm.siUniversalCode}, #{itm.siUniversalName}, #{itm.productionAddrCategory}, #{itm.productionAddrCategoryName}, " +
            "#{itm.performanceStructure}, #{itm.specialMachineFlag}, #{itm.specialMachineName}, #{itm.groupName}, " +
            "#{itm.groupLogo}, #{itm.limitUsingFlag}, #{itm.siLimitRange}, #{itm.highValueFlag}, #{itm.classificationCode}, " +
            "#{itm.implantAndOrganFlag}, #{itm.sterizationFlag}, #{itm.sterilizationFlagName}, #{itm.implantInterventionalFlag}, " +
            "#{itm.implantInterventionalClassName}, #{itm.disposableFlag}, #{itm.disposableFlagName}, #{itm.registrantName}, " +
            "#{itm.managementCategory}, #{itm.managementCategoryName}, #{itm.registrationRecordNo}, #{itm.registeredProductName}, " +
            "#{itm.otherContent}, #{itm.registeredApplicantAddr}, #{itm.certificateStartTime}, #{itm.certificateEndTime}, " +
            "#{itm.agenterpriseAddress}, #{itm.productionCountry}, #{itm.salesServiceOrganization}, #{itm.certificateElectronicFile}, " +
            "#{itm.packingSpecifications}, #{itm.validFlag})" +
            "</foreach>" +
            "</script>")
    void insertMdcnSplyBatch(List<SiDlMdcnSply> list);

    @Select("select * from t_si_dl_mdcn_sply with(nolock) order by version_name desc")
    IPage<SiDlMdcnSply> selectSiDlMdcnSplyPage(IPage<SiDlMdcnSply> iPage);

    @Update("truncate table t_si_dl_mdcn_srvc")
    void truncateMdcnSrvcTable();

    @Delete("delete from t_si_dl_mdcn_srvc where version_name>=#{version}")
    void deleteMdcnSrvcTableByVersionId(String version);

    @Insert("<script>" +
            "insert into t_si_dl_mdcn_srvc (code, charge_unit, valof_name, descriptions, exclude_content, connotation, " +
            "remarks, service_category, service_name, entry_specification, start_date, end_date, unique_record_number, " +
            "version_number, version_name, valid_flag) " +
            "values " +
            "<foreach collection='list' item='itm' open='' separator=',' close=''>" +
            "(#{itm.code}, #{itm.chargeUnit}, #{itm.valofName}, #{itm.descriptions}, #{itm.excludeContent}, " +
            "#{itm.connotation}, #{itm.remarks}, #{itm.serviceCategory}, #{itm.serviceName}, #{itm.entrySpecification}, " +
            "#{itm.startDate}, #{itm.endDate}, #{itm.uniqueRecordNumber}, #{itm.versionNumber}, #{itm.versionName}, #{itm.validFlag})" +
            "</foreach>" +
            "</script>")
    void insertMdcnSrvcBatch(List<SiDlMdcnSrvc> list);

    @Select("select * from t_si_dl_mdcn_srvc with(nolock) order by version_name desc")
    IPage<SiDlMdcnSrvc> selectSiDlMdcnSrvcPage(IPage<SiDlMdcnSrvc> iPage);

    @Update("truncate table t_si_dl_oprtn")
    void truncateOprtnTable();

    @Delete("delete from t_si_dl_oprtn where version_name>=#{version}")
    void deleteOprtnTableByVersion(String version);

    @Insert("<script>" +
            "insert into t_si_dl_oprtn (code, chapter, chapter_code_range, chapter_name, class_order_code, class_order_name, " +
            "subcode, subname, fine_code, details_name, surgical_operation_code, operation_operation_name, use_the_tag, remarks, " +
            "unique_record_number, data_creation_time, data_update_time, version_number, version_name, national_operation_code, " +
            "national_operation_name, clinical_operation_code, clinical_operation_name, valid_flag, py_code) " +
            "values " +
            "<foreach collection='list' item='itm' open='' separator=',' close=''>" +
            "(#{itm.code}, #{itm.chapter}, #{itm.chapterCodeRange}, #{itm.chapterName}, #{itm.classOrderCode}, #{itm.classOrderName}, " +
            "#{itm.subcode}, #{itm.subname}, #{itm.fineCode}, #{itm.detailsName}, #{itm.surgicalOperationCode}, #{itm.operationOperationName}, " +
            "#{itm.useTheTag}, #{itm.remarks}, #{itm.uniqueRecordNumber}, #{itm.dataCreationTime}, #{itm.dataUpdateTime}, " +
            "#{itm.versionNumber}, #{itm.versionName}, #{itm.nationalOperationCode}, #{itm.nationalOperationName}, " +
            "#{itm.clinicalOperationCode}, #{itm.clinicalOperationName}, #{itm.validFlag}, #{itm.pyCode})" +
            "</foreach>" +
            "</script>")
    void insertOprtnBatch(List<SiDlOprtn> list);

    @Select("select * from t_si_dl_oprtn with(nolock) order by version_name desc")
    IPage<SiDlOprtn> selectSiDlOprtnPage(IPage<SiDlOprtn> iPage);

    @Update("truncate table t_si_dl_pay_by_dss")
    void truncatePayByDssTable();

    @Delete("delete from t_si_dl_pay_by_dss where version_name>=#{version}")
    void deletePayByDssTableByVersion(String version);

    @Insert("<script>" +
            "insert into t_si_dl_pay_by_dss (code, unique_record_number, version_number, remarks, version_name, " +
            "settlement_code, settlement_name, limited_operation_code, limited_operation_name, valid_flag, connotation, " +
            "guide_page_number, guide_electronic_archives, data_creation_time, data_update_time) " +
            "values " +
            "<foreach collection='list' item='itm' open='' separator=',' close=''>" +
            "(#{itm.code}, #{itm.uniqueRecordNumber}, #{itm.versionNumber}, #{itm.remarks}, #{itm.versionName}, " +
            "#{itm.settlementCode}, #{itm.settlementName}, #{itm.limitedOperationCode}, #{itm.limitedOperationName}, " +
            "#{itm.validFlag}, #{itm.connotation}, #{itm.guidePageNumber}, #{itm.guideElectronicArchives}, " +
            "#{itm.dataCreationTime}, #{itm.dataUpdateTime})" +
            "</foreach>" +
            "</script>")
    void insertPayByDssBatch(List<SiDlPayByDss> list);

    @Select("select * from t_si_dl_pay_by_dss with(nolock) order by version_name desc")
    IPage<SiDlPayByDss> selectSiDlPayByDssPage(IPage<SiDlPayByDss> iPage);

    @Update("truncate table t_si_dl_ptnt_wstn_mdcn")
    void truncatePtntWstnMdcnTable();

    @Delete("delete from t_si_dl_ptnt_wstn_mdcn where version_name>=#{version}")
    void deletePtntWstnMdcnTableByVersion(String version);

    @Insert("<script>" +
            "insert into t_si_dl_ptnt_wstn_mdcn (drug_trade_name, universal_name_number, general_drug_name, chemical_name, " +
            "alias, english_name, registration_name, drug_supervision_local_code, drug_dosage_forms, drug_dosage_form_name, " +
            "drug_category, drug_category_name, drug_specifications, drug_specification_code, registration_dosage_type, " +
            "registration_specifications, each_dosage, frequency_of_usage, aate_group, national_drug_no, usr, " +
            "production_site_category, production_site_category_name, unit_type, packaging_material, packaging_material_name, " +
            "packing_specifications, package_quantity, functional_governance, route_of_medication, instructions, start_time, " +
            "end_time, minimum_unit, minimum_sales_unit, minimum_unit_of_measurement, minimum_packing_quantity, " +
            "minimum_packing_unit, minimum_preparation_unit, minimum_packaging_unit_name, minimum_preparation_unit_name, " +
            "conversion_ratio, validity_period_of_the_drug, minimum_unit_valuation, wb_code, py_code, subpackaging_manufacturer, " +
            "production_number, production_name, special_drug_mark, limit_the_usage_range, limit_using_flags, license_number, " +
            "market_status, market_status_name, remarks, unique_record_number, data_creation_time, data_update_time, version_number, " +
            "version_name, corporate_name, distributing_business, contact, registration_specification_code, patent_flag, " +
            "nonprescription_flag, nonprescription_flag_name, limited_drug_flag, certificate_number, certificate_start_date, " +
            "certificate_end_date, approval_start_date, approval_end_date, registration_electronic_file, " +
            "supplementary_electronic_file, national_si_catalogue_remark, basic_drug_flag_name, basic_drug_flag, " +
            "adjusted_tax_flag, adjusted_tax_flag_name, listed_drugs_set, negotiated_drug_flag, negotiated_drug_flag_name, " +
            "health_commission_drug_code, valid_flag, drugs_for_children, consistency_drugs, enterprise_electronic_file, " +
            "national_dosage, national_class_flag, code) " +
            "values " +
            "<foreach collection='list' item='itm' open='' separator=',' close=''>" +
            "(#{itm.drugTradeName}, #{itm.universalNameNumber}, #{itm.generalDrugName}, #{itm.chemicalName}, #{itm.alias}, " +
            "#{itm.englishName}, #{itm.registrationName}, #{itm.drugSupervisionLocalCode}, #{itm.drugDosageForms}, " +
            "#{itm.drugDosageFormName}, #{itm.drugCategory}, #{itm.drugCategoryName}, #{itm.drugSpecifications}, " +
            "#{itm.drugSpecificationCode}, #{itm.registrationDosageType}, #{itm.registrationSpecifications}, #{itm.eachDosage}, " +
            "#{itm.frequencyOfUsage}, #{itm.aateGroup}, #{itm.nationalDrugNo}, #{itm.usr}, #{itm.productionSiteCategory}, " +
            "#{itm.productionSiteCategoryName}, #{itm.unitType}, #{itm.packagingMaterial}, #{itm.packagingMaterialName}, " +
            "#{itm.packingSpecifications}, #{itm.packageQuantity}, #{itm.functionalGovernance}, #{itm.routeOfMedication}, " +
            "#{itm.instructions}, #{itm.startTime}, #{itm.endTime}, #{itm.minimumUnit}, #{itm.minimumSalesUnit}, " +
            "#{itm.minimumUnitOfMeasurement}, #{itm.minimumPackingQuantity}, #{itm.minimumPackingUnit}, #{itm.minimumPreparationUnit}, " +
            "#{itm.minimumPackagingUnitName}, #{itm.minimumPreparationUnitName}, #{itm.conversionRatio}, #{itm.validityPeriodOfTheDrug}, " +
            "#{itm.minimumUnitValuation}, #{itm.wbCode}, #{itm.pyCode}, #{itm.subpackagingManufacturer}, #{itm.productionNumber}, " +
            "#{itm.productionName}, #{itm.specialDrugMark}, #{itm.limitTheUsageRange}, #{itm.limitUsingFlags}, #{itm.licenseNumber}, " +
            "#{itm.marketStatus}, #{itm.marketStatusName}, #{itm.remarks}, #{itm.uniqueRecordNumber}, #{itm.dataCreationTime}, " +
            "#{itm.dataUpdateTime}, #{itm.versionNumber}, #{itm.versionName}, #{itm.corporateName}, #{itm.distributingBusiness}, " +
            "#{itm.contact}, #{itm.registrationSpecificationCode}, #{itm.patentFlag}, #{itm.nonprescriptionFlag}, " +
            "#{itm.nonprescriptionFlagName}, #{itm.limitedDrugFlag}, #{itm.certificateNumber}, #{itm.certificateStartDate}, " +
            "#{itm.certificateEndDate}, #{itm.approvalStartDate}, #{itm.approvalEndDate}, #{itm.registrationElectronicFile}, " +
            "#{itm.supplementaryElectronicFile}, #{itm.nationalSiCatalogueRemark}, #{itm.basicDrugFlagName}, #{itm.basicDrugFlag}, " +
            "#{itm.adjustedTaxFlag}, #{itm.adjustedTaxFlagName}, #{itm.listedDrugsSet}, #{itm.negotiatedDrugFlag}, " +
            "#{itm.negotiatedDrugFlagName}, #{itm.healthCommissionDrugCode}, #{itm.validFlag}, #{itm.drugsForChildren}, " +
            "#{itm.consistencyDrugs}, #{itm.enterpriseElectronicFile}, #{itm.nationalDosage}, #{itm.nationalClassFlag}, #{itm.code})" +
            "</foreach>" +
            "</script>")
    void insertPtntWstnMdcnBatch(List<SiDlPtntWstnMdcn> list);

    @Select("select * from t_si_dl_ptnt_wstn_mdcn with(nolock) order by version_name desc")
    IPage<SiDlPtntWstnMdcn> selectSiDlPtntWstnMdcnPage(IPage<SiDlPtntWstnMdcn> iPage);

    @Update("truncate table t_si_dl_slw_spc_chr")
    void truncateSlwSpcChrTable();

    @Delete("delete from t_si_dl_slw_spc_chr where version_name>=#{version}")
    void deleteSlwSpcChrTableByVersion(String version);

    @Insert("<script>" +
            "insert into t_si_dl_slw_spc_chr (code, medical_insurance_division, remarks, unique_record_number, " +
            "version_name, category_name, detail_diseases_name, valid_flag, version, connotation, guide_page_number, " +
            "guide_electronic_archives, disease_name, category_code, data_creation_time, data_update_time) " +
            "values " +
            "<foreach collection='list' item='itm' open='' separator=',' close=''>" +
            "(#{itm.code}, #{itm.medicalInsuranceDivision}, #{itm.remarks}, #{itm.uniqueRecordNumber}, #{itm.versionName}, " +
            "#{itm.categoryName}, #{itm.detailDiseasesName}, #{itm.validFlag}, #{itm.version}, #{itm.connotation}, " +
            "#{itm.guidePageNumber}, #{itm.guideElectronicArchives}, #{itm.diseaseName}, #{itm.categoryCode}, " +
            "#{itm.dataCreationTime}, #{itm.dataUpdateTime})" +
            "</foreach>" +
            "</script>")
    void insertSlwSpcChrBatch(List<SiDlSlwSpcChr> list);

    @Select("select * from t_si_dl_slw_spc_chr with(nolock) order by version_name desc")
    IPage<SiDlSlwSpcChr> selectSiDlSlwSpcChrPage(IPage<SiDlSlwSpcChr> iPage);

    @Update("truncate table t_si_dl_tcm_syndr")
    void truncateTcmSyndrTable();

    @Delete("delete from t_si_dl_tcm_syndr where version_name>=#{version}")
    void deleteTcmSyndrTableByVersion(String version);

    @Insert("<script>" +
            "insert into t_si_dl_tcm_syndr (code, remarks, unique_record_number, version_name, catalogue_code, " +
            "catalogue_name, property_code, properties, classification_code, classification_name, valid_flag, " +
            "version, data_creation_time, data_update_time) " +
            "values " +
            "<foreach collection='list' item='itm' open='' separator=',' close=''>" +
            "(#{itm.code}, #{itm.remarks}, #{itm.uniqueRecordNumber}, #{itm.versionName}, #{itm.catalogueCode}, " +
            "#{itm.catalogueName}, #{itm.propertyCode}, #{itm.properties}, #{itm.classificationCode}, " +
            "#{itm.classificationName}, #{itm.validFlag}, #{itm.version}, #{itm.dataCreationTime}, #{itm.dataUpdateTime})" +
            "</foreach>" +
            "</script>")
    void insertTcmSyndrBatch(List<SiDlTcmSyndr> list);

    @Select("select * from t_si_dl_tcm_syndr with(nolock) order by version_name desc")
    IPage<SiDlTcmSyndr> selectSiDlTcmSyndrPage(IPage<SiDlTcmSyndr> iPage);

    @Update("truncate table t_si_dl_tmr_mrphlgy")
    void truncateTmrMrphlgyTable();

    @Delete("delete from t_si_dl_tmr_mrphlgy where version_number>=#{version}")
    void deleteTmrMrphlgyTableByVersion(String version);

    @Insert("<script>" +
            "insert into t_si_dl_tmr_mrphlgy (code, tumor_cell_type_code, tumor_cell_type, " +
            "morphology_classification_code, morphological_classification, unique_record_number, " +
            "data_creation_time, data_update_time, version_number, version_name, valid_flag) " +
            "values " +
            "<foreach collection='list' item='itm' open='' separator=',' close=''>" +
            "(#{itm.code}, #{itm.tumorCellTypeCode}, #{itm.tumorCellType}, #{itm.morphologyClassificationCode}, " +
            "#{itm.morphologicalClassification}, #{itm.uniqueRecordNumber}, #{itm.dataCreationTime}, " +
            "#{itm.dataUpdateTime}, #{itm.versionNumber}, #{itm.versionName}, #{itm.validFlag})" +
            "</foreach>" +
            "</script>")
    void insertTmrMrphlgyBatch(List<SiDlTmrMrphlgy> list);

    @Select("select * from t_si_dl_tmr_mrphlgy with(nolock) order by version_name desc")
    IPage<SiDlTmrMrphlgy> selectSiDlTmrMrphlgyPage(IPage<SiDlTmrMrphlgy> iPage);

    @Update("truncate table t_si_dl_trdtnl_chns_dss")
    void truncateTrdtnlChnsDssTable();

    @Delete("delete from t_si_dl_trdtnl_chns_dss where version_name>=#{version}")
    void deleteTrdtnlChnsDssByVersion(String version);

    @Insert("<script>" +
            "insert into t_si_dl_trdtnl_chns_dss (code, disease_classification_code, disease_classification_name, " +
            "remarks, unique_record_number, version_name, category_code, category_name, classification_list_code, " +
            "classification_list_name, valid_flag, version, data_creation_time, data_update_time) " +
            "values " +
            "<foreach collection='list' item='itm' open='' separator=',' close=''>" +
            "(#{itm.code}, #{itm.diseaseClassificationCode}, #{itm.diseaseClassificationName}, #{itm.remarks}, " +
            "#{itm.uniqueRecordNumber}, #{itm.versionName}, #{itm.categoryCode}, #{itm.categoryName}, " +
            "#{itm.classificationListCode}, #{itm.classificationListName}, #{itm.validFlag}, #{itm.version}, " +
            "#{itm.dataCreationTime}, #{itm.dataUpdateTime})" +
            "</foreach>" +
            "</script>")
    void insertTrdtnlChnsDssBatch(List<SiDlTrdtnlChnsDss> list);

    @Update("truncate table t_si_selfpay_first_catalogue")
    void truncateSelfPayCatalogue();

    @Insert("<script>" +
            "insert into t_si_selfpay_first_catalogue (hilist_code, selfpay_prop_psn_type, selfpay_prop_type, " +
            "insu_admdvs, begndate, enddate, selfpay_prop, vali_flag, rid, updt_time, crter_id, crter_name, crte_time, " +
            "crte_optins_no, opter_id, opter_name, opt_time, optins_no, tabname, poolarea_no) " +
            "values " +
            "<foreach collection='list' item='item' open='' separator=',' close=''>" +
            "(#{item.hilistCode},#{item.selfpayPropPsnType},#{item.selfpayPropType},#{item.insuAdmdvs},#{item.begndate}," +
            "#{item.enddate},#{item.selfpayProp},#{item.valiFlag},#{item.rid},#{item.updtTime},#{item.crterId}," +
            "#{item.crterName},#{item.crteTime},#{item.crteOptinsNo},#{item.opterId},#{item.opterName},#{item.optTime}," +
            "#{item.optinsNo},#{item.tabname},#{item.poolareaNo}) " +
            "</foreach>" +
            "</script>")
    void insertSelfPayCatalogue(List<SelfPayFirstCatalogue> list);

    @Select("select * from t_si_dl_trdtnl_chns_dss with(nolock) order by version_name desc")
    IPage<SiDlTrdtnlChnsDss> selectSiDlTrdtnlChnsDssPage(IPage<SiDlTrdtnlChnsDss> iPage);

    @Select("select distinct national_code as code from ${table} " +
            "where national_status=1 and selfpay_prop is null ")
    List<String> selectHospitalItems(@Param("table") String table);

    @Update("update ${table} set selfpay_prop=#{prop} where national_code=#{code}")
    void updatePsnpayProp(@Param("table") String table, @Param("code") String code, @Param("prop") String prop);
}
