public  class ProductScoreHistoryService{

  
      //通用类
      public class SearchDataBean {
        public String Id;

        public String BiddingProjectNameBidc;
   
      }

      public static string getYear(){
         Date dateNow = Date.today();
         Integer year = dateNow.year();
        Integer month = dateNow.month();
        if (month < 4) {
            year -= 1;
        }
        Integer tempiYear = year+1;
        string currentPeriod = String.valueOf('FY'+tempiYear);
        return currentPeriod;
      }
      @AuraEnabled
      public  static string GetNotCompleteData(String HospitalId){
        // GZW 取科室对应的医院Parent.Parent start
        String hosid = [select Parent.Parentid FROM Account WHERE Id = : HospitalId].Parent.Parentid;
        QueryWrapper query = new QueryWrapper(Product_Score_Table_History__c.SObjectType);
        query.eq('OCSM_Period__c',getYear());
        // query.eq('Hospital__c', HospitalId);
        query.eq('Hospital__c', hosid);
        // GZW 取科室对应的医院Parent.Parent end
        query.eq('recordtype.developername','TargetPDCA');
        List<Product_Score_Table_History__c> arrays = DataBasePlus.listPlus(query);
        String TempStr = Json.serialize(arrays);
        return TempStr;

      }


      @AuraEnabled
      public  static string SaveData(String JsonData){
        System.debug('JsonData+++ ' + JsonData);
         try{
          List<Product_Score_Table_History__c> ProductList = (List<Product_Score_Table_History__c>)JSON.deserialize(JsonData,List<Product_Score_Table_History__c>.class);
          // GZW update 禁止循环中做DML操作 start
          Database.update(ProductList,false);
          // for(Product_Score_Table_History__c itms:ProductList){
          //   Database.update(itms,false);
          // }
          // GZW update 禁止循环中做DML操作 end
        }
        catch(Exception ex)
        {
          return ex.getMessage();
        }
        return '成功';
      }
      ///  撤销
      @AuraEnabled
      public  static string RevokeData(String Id){
         try{
            QueryWrapper query = new QueryWrapper(Product_Score_Table_History__c.SObjectType);
            query.eq('Id',Id);
            List<Product_Score_Table_History__c> arrays = DataBasePlus.listPlus(query);
            Product_Score_Table_History__c TempData = arrays[0];
            TempData.Result__c = null;
            TempData.Revoke__c = true;
            TempData.Agency_Linkage__c = false;
            Database.update(TempData,false);
          }catch(Exception ex)
          {
            return '失败';
          }
          return '成功';
      }
      

      @AuraEnabled
      public  static string GetDoContentC(){
        String JsonData = CommonUtils.GetSelectedValues( Product_Score_Table_History__c.Do_Content__c.getDescribe());
        return JsonData;
      }

      @AuraEnabled
      public  static string GetCheckPurchaseC(){
        String JsonData = CommonUtils.GetSelectedValues( Product_Score_Table_History__c.Check_Purchase__c.getDescribe());
        return JsonData;
      }

      @AuraEnabled
      public  static string GetActionContentC(){
        String JsonData = CommonUtils.GetSelectedValues( Product_Score_Table_History__c.Action_Content__c.getDescribe());
        return JsonData;
      }




}