patenttrans.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const moment = require('moment');
  4. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  5. const { ObjectId } = require('mongoose').Types;
  6. // 专利交易表
  7. const patenttrans = {
  8. user_id: { type: ObjectId }, // 用户id
  9. user_name: { type: String }, // 用户姓名
  10. mech_id: { type: ObjectId }, // 机构id
  11. mech_name: { type: String }, // 机构姓名
  12. patent_id: { type: ObjectId }, // 专利id
  13. patent_name: { type: String }, // 专利名称
  14. create_number: { type: String }, // 专利号
  15. on_obligee: { type: String }, // 当前权利人(变更前专利权人)
  16. contact: { type: String }, // 联系人
  17. phone: { type: String }, // 联系电话
  18. email: { type: String }, // 电子邮箱
  19. budget: { type: String }, // 投资预算
  20. type: { type: String }, // 交易类型(转让,许可,免费许可,招商,质押)
  21. promise_file: { type: Object }, // 交易类型为免费许可时,需填写免费许可承诺书
  22. is_report: { type: Boolean, default: false }, // 评估报告
  23. report: { type: Array }, // 评估报告
  24. requirementdesc: { type: String }, // 技术说明
  25. expect: { type: String }, // 商业预期
  26. condition: { type: String }, // 合作条件及要求
  27. abstract: { type: String }, // 摘要
  28. on_afterobligee: { type: String }, // 变更后专利权人
  29. transfer_date: { type: String }, // 专利权转移日期
  30. is_contract: { type: String }, // 0:线下合同,1:线上合同
  31. contract: { type: Object }, // 线上合同
  32. offine_contract: { type: Array }, // 线下合同
  33. status: { type: String, default: '0' }, // 状态,0:待审,1:通过,-1:拒绝,2:合同审核,3:合同通过,-3:合同拒绝,4:用户确认,5:归档交易完成
  34. record: { type: Array }, // 记录
  35. remark: { type: String },
  36. isdel: { type: String, required: false, default: '0' }, // 0=>未删除;1=>已撤回
  37. };
  38. const schema = new Schema(patenttrans, { toJSON: { virtuals: true } });
  39. schema.index({ id: 1 });
  40. schema.index({ user_id: 1 });
  41. schema.index({ mech_id: 1 });
  42. schema.index({ patent_id: 1 });
  43. schema.index({ create_number: 1 });
  44. schema.index({ type: 1 });
  45. schema.index({ transfer_date: 1 });
  46. schema.index({ status: 1 });
  47. schema.index({ 'meta.createdAt': 1 });
  48. schema.plugin(metaPlugin);
  49. module.exports = app => {
  50. const { mongoose } = app;
  51. return mongoose.model('Patenttrans', schema, 'patent_trans');
  52. };