'use strict'; const Schema = require('mongoose').Schema; const moment = require('moment'); const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); // 基本信息 const base = new Schema({ achieve_name: { type: String }, // 成果名称 achieve_type: { type: String }, // 成果类别 achieve_num: { type: String }, // 成果编号 achieve_date: { type: String }, // 成果取得时间 achieve_form: { type: String }, // 成果形式 apply_personal: { type: String }, // 申请人 apply_company: { type: String }, // 申请单位 address: { type: String }, // 地址 apply_nature: { type: String }, // 申请单位/申请人属性 contacts: { type: String }, // 联系人 phone: { type: String }, // 联系电话 email: { type: String }, // 邮箱 fax: { type: String }, // 传真 objective: { type: String }, // 评价目的 stage: { type: String }, // 成果所处阶段 output: { type: String }, // 经济效益产值 profit: { type: String }, // 经济效益利润 revenue: { type: String }, // 经济效益税收 }); base.index({ id: 1 }); // 内容简介 const brief = new Schema({ achieve_brief: { type: String }, // 成果简介 field: { type: String }, // 应用领域和技术原理 kpi_index: { type: String }, // 性能指标 compare: { type: String }, // 与国内外同类技术比较 advanced: { type: String }, // 成果的创造性,先进性 sense: { type: String }, // 作用意义 prospect: { type: String }, // 推广应用的范围,条件和前景 opinion: { type: String }, // 存在的问题和改进意见 }); brief.index({ id: 1 }); // 主研人员名单 const research = new Schema({ research_name: { type: String }, // 姓名 card: { type: String }, // 证件号码 gender: { type: String }, // 性别 position: { type: String }, // 技术职称 education: { type: String }, // 文化程度 degree: { type: String }, // 学位 abroad: { type: String }, // 是否留学归国 research_company: { type: String }, // 工作单位 devote: { type: String }, // 对成果创造性贡献 }); research.index({ id: 1 }); // 委托方提供资料清单 const datalist = new Schema({ work_report: { type: String, required: true }, // 研究工作报告(必备) techol_report: { type: String, required: true }, // 研究技术报告(必备) benefit: { type: String, required: true }, // 经济效益分析(必备) science_report: { type: String, required: true }, // 科技查新报告(科技项目成果,必备) assess_report: { type: String, required: true }, // 法律价值评估报告(专利成果,必备) app_prove: { type: String, required: true }, // 推广应用证明(两家以上应用单位,必备) techol_ppt: { type: String, required: true }, // 成果技术汇报PPT(必备) testing_report: { type: String }, // 检测报告(根据项目需要提供) quality: { type: String }, // 质量标准(检测报告所依据的标准,企业标准,行业标准,国家标准,国际标准) patent: { type: String }, // 与本成果相关的授权专利证书 special: { type: String }, // 特殊行业需要提供的相应证明材料 budget: { type: String }, // 项目经费预算书 final: { type: String }, // 项目经费决算书 }); datalist.index({ id: 1 }); // 成果评价申请表 const achieve_apply = { basic: { type: base }, brief: { type: brief }, research: { type: [ research ] }, datalist: { type: datalist }, remark: { type: String, maxLength: 200 }, create_time: { type: String, default: moment().format('YYYY-MM-DD HH:mm:ss') }, }; const schema = new Schema(achieve_apply, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.index({ 'meta.createdAt': 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Achieve_apply', schema, 'achieve_apply'); };