import { Http,Util } from '@/utils';
import EntityService from '../entity-service';



/**
 * 科研成果服务对象基类
 *
 * @export
 * @class PimResearchFindingsServiceBase
 * @extends {EntityServie}
 */
export default class PimResearchFindingsServiceBase extends EntityService {

    /**
     * Creates an instance of  PimResearchFindingsServiceBase.
     * 
     * @param {*} [opts={}]
     * @memberof  PimResearchFindingsServiceBase
     */
    constructor(opts: any = {}) {
        super(opts);
    }

    /**
     * 初始化基础数据
     *
     * @memberof PimResearchFindingsServiceBase
     */
    public initBasicData(){
        this.APPLYDEKEY ='pimresearchfindings';
        this.APPDEKEY = 'pimresearchfindingsid';
        this.APPDENAME = 'pimresearchfindings';
        this.APPDETEXT = 'pimresearchfindingsname';
        this.APPNAME = 'ehrpim';
        this.SYSTEMNAME = 'ehr_practice02';
    }

// 实体接口

    /**
     * Select接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof PimResearchFindingsServiceBase
     */
    public async Select(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && context.pimresearchfindings){
            return Http.getInstance().get(`/pimpeople/${context.pimperson}/pimresearchfindings/${context.pimresearchfindings}/select`,isloading);
        }
            return Http.getInstance().get(`/pimresearchfindings/${context.pimresearchfindings}/select`,isloading);
    }

    /**
     * Update接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof PimResearchFindingsServiceBase
     */
    public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && context.pimresearchfindings){
            return Http.getInstance().put(`/pimpeople/${context.pimperson}/pimresearchfindings/${context.pimresearchfindings}`,data,isloading);
        }
        let masterData:any = {};
        Object.assign(data,masterData);
            let res:any = await  Http.getInstance().put(`/pimresearchfindings/${context.pimresearchfindings}`,data,isloading);
            return res;
    }

    /**
     * Remove接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof PimResearchFindingsServiceBase
     */
    public async Remove(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && context.pimresearchfindings){
            return Http.getInstance().delete(`/pimpeople/${context.pimperson}/pimresearchfindings/${context.pimresearchfindings}`,isloading);
        }
            return Http.getInstance().delete(`/pimresearchfindings/${context.pimresearchfindings}`,isloading);

    }

    /**
     * Get接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof PimResearchFindingsServiceBase
     */
    public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && context.pimresearchfindings){
            return Http.getInstance().get(`/pimpeople/${context.pimperson}/pimresearchfindings/${context.pimresearchfindings}`,isloading);
        }
            let res:any = await Http.getInstance().get(`/pimresearchfindings/${context.pimresearchfindings}`,isloading);
            return res;

    }

    /**
     * GetDraft接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof PimResearchFindingsServiceBase
     */
    public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && true){
            return Http.getInstance().get(`/pimpeople/${context.pimperson}/pimresearchfindings/getdraft`,isloading);
        }
        let res:any = await  Http.getInstance().get(`/pimresearchfindings/getdraft`,isloading);
        res.data.pimresearchfindings = data.pimresearchfindings;
        return res;
    }

    /**
     * CheckKey接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof PimResearchFindingsServiceBase
     */
    public async CheckKey(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && context.pimresearchfindings){
            return Http.getInstance().post(`/pimpeople/${context.pimperson}/pimresearchfindings/${context.pimresearchfindings}/checkkey`,data,isloading);
        }
            return Http.getInstance().post(`/pimresearchfindings/${context.pimresearchfindings}/checkkey`,data,isloading);
    }

    /**
     * Save接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof PimResearchFindingsServiceBase
     */
    public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && context.pimresearchfindings){
            return Http.getInstance().post(`/pimpeople/${context.pimperson}/pimresearchfindings/${context.pimresearchfindings}/save`,data,isloading);
        }
        let masterData:any = {};
        Object.assign(data,masterData);
            let res:any = await  Http.getInstance().post(`/pimresearchfindings/${context.pimresearchfindings}/save`,data,isloading);
            return res;
    }

    /**
     * Create接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof PimResearchFindingsServiceBase
     */
    public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && true){
            if(!data.srffrontuf || data.srffrontuf !== "1"){
                data[this.APPDEKEY] = null;
            }
            if(data.srffrontuf){
                delete data.srffrontuf;
            }
            return Http.getInstance().post(`/pimpeople/${context.pimperson}/pimresearchfindings`,data,isloading);
        }
        let masterData:any = {};
        Object.assign(data,masterData);
        if(!data.srffrontuf || data.srffrontuf !== "1"){
            data[this.APPDEKEY] = null;
        }
        if(data.srffrontuf){
            delete data.srffrontuf;
        }
        let tempContext:any = JSON.parse(JSON.stringify(context));
        let res:any = await Http.getInstance().post(`/pimresearchfindings`,data,isloading);
        return res;
    }

    /**
     * FetchDefault接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof PimResearchFindingsServiceBase
     */
    public async FetchDefault(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && true){
            let tempData:any = JSON.parse(JSON.stringify(data));
            return Http.getInstance().get(`/pimpeople/${context.pimperson}/pimresearchfindings/fetchdefault`,tempData,isloading);
        }
        let tempData:any = JSON.parse(JSON.stringify(data));
        return Http.getInstance().get(`/pimresearchfindings/fetchdefault`,tempData,isloading);
    }

    /**
     * FetchJLSSGLY接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof PimResearchFindingsServiceBase
     */
    public async FetchJLSSGLY(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && true){
            let tempData:any = JSON.parse(JSON.stringify(data));
            return Http.getInstance().get(`/pimpeople/${context.pimperson}/pimresearchfindings/fetchjlssgly`,tempData,isloading);
        }
        let tempData:any = JSON.parse(JSON.stringify(data));
        return Http.getInstance().get(`/pimresearchfindings/fetchjlssgly`,tempData,isloading);
    }

    /**
     * FetchJLSSGR接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof PimResearchFindingsServiceBase
     */
    public async FetchJLSSGR(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        if(context.pimperson && true){
            let tempData:any = JSON.parse(JSON.stringify(data));
            return Http.getInstance().get(`/pimpeople/${context.pimperson}/pimresearchfindings/fetchjlssgr`,tempData,isloading);
        }
        let tempData:any = JSON.parse(JSON.stringify(data));
        return Http.getInstance().get(`/pimresearchfindings/fetchjlssgr`,tempData,isloading);
    }
}