patentapply.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const moment = require('moment');
  4. const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
  5. const { ObjectId } = require('mongoose').Types;
  6. // 专利申请-审批单
  7. const patentapply = {
  8. user_id: { type: ObjectId }, // 用户id
  9. user_name: { type: String }, // 用户姓名
  10. mech_id: { type: ObjectId }, // 机构id
  11. mech_name: { type: String }, // 机构名称
  12. admin_id: { type: ObjectId }, // 管理员id
  13. admin_name: { type: String }, // 管理员姓名
  14. agentmech_id: { type: ObjectId }, // 代理机构id
  15. agentmech_name: { type: String }, // 代理机构姓名
  16. create_number: { type: String }, // 申请号
  17. name: { type: String }, // 发明名称
  18. apply_name: { type: String }, // 申请人
  19. type: { type: String }, // 申请类型
  20. inventor: { type: String }, // 发明人
  21. contact: { type: String }, // 技术联系人
  22. phone: { type: String }, // 联系电话
  23. email: { type: String }, // 电子邮箱
  24. questions: { type: Object, default: {} }, // 问题
  25. check_url: { type: Array }, // 审查文件
  26. agent_url: { type: Array }, // 申请文件
  27. record: { type: Array }, // 记录
  28. status: { type: String, default: '0' }, // 状态0:待审查,1:审查通过,-1:审查未通过,2:科企&&代理机构,3:代理机构选择科企,-3:自己走,4:科企上传并下发
  29. remark: { type: String },
  30. };
  31. const schema = new Schema(patentapply, { toJSON: { virtuals: true } });
  32. schema.index({ id: 1 });
  33. schema.index({ user_id: 1 });
  34. schema.index({ mech_id: 1 });
  35. schema.index({ admin_id: 1 });
  36. schema.index({ agentmech_id: 1 });
  37. schema.index({ create_number: 1 });
  38. schema.index({ name: 1 });
  39. schema.index({ apply_name: 1 });
  40. schema.index({ type: 1 });
  41. schema.index({ status: 1 });
  42. schema.index({ 'meta.createdAt': 1 });
  43. schema.plugin(metaPlugin);
  44. module.exports = app => {
  45. const { mongoose } = app;
  46. return mongoose.model('Patentapply', schema, 'patent_apply');
  47. };