patentinfo.js 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. const user = new Schema(
  7. {
  8. user_id: { type: ObjectId, required: false, maxLength: 500 }, // 名称,
  9. name: { type: String, required: false, maxLength: 500 }, // 链接地址,
  10. }
  11. );
  12. // 专利信息表
  13. const patentinfo = {
  14. create_number: { type: String, required: false }, // 申请号
  15. create_date: { type: String, required: false }, // 申请日
  16. success_number: { type: String, required: false }, // 公开(公告)号
  17. success_date: { type: String, required: false }, // 公开(公告)日
  18. name: { type: String, required: false }, // 标题
  19. inventor: { type: [ user ] }, // 发明人
  20. address: { type: String, required: false }, // 发明人地址
  21. apply_personal: { type: String, required: false }, // 申请人
  22. term: { type: String, required: false }, // 专利有效性
  23. type: { type: String, required: false }, // 专利类型
  24. agent_personal: { type: String, required: false }, // 代理人
  25. agent: { type: String, required: false }, // 代理机构
  26. abstract: { type: String, required: false }, // 摘要
  27. img_url: { type: Array }, // 图片
  28. origin: { type: String }, // 数据来源(手写的)
  29. user_id: { type: [ ObjectId ] },
  30. status: { type: String, required: false, default: '0' }, // 状态
  31. trans_status: { type: String, required: false, default: '0' }, // 交易状态
  32. // 数据新增属性2021-09-06
  33. nationality: { type: String }, // 公开国别
  34. ipc_type: { type: String }, // ipc主分类
  35. onlegal_status: { type: String }, // 当前法律状态
  36. legal_status: { type: String }, // 法律状态
  37. law_date: { type: String }, // 法律文书日期
  38. on_obligee: { type: String }, // 当前权利人
  39. apply_address: { type: String }, // 申请人地址(其他)
  40. apply_other: { type: String }, // 申请人(其他)
  41. law_num: { type: String }, // 法律文书编号
  42. first_opendate: { type: String }, // 首次公开日
  43. empower_date: { type: String }, // 授权公告日
  44. lose_date: { type: String }, // 失效日
  45. examine_date: { type: String }, // 实际审查失效日
  46. invention_design: { type: String }, // 发明人(设计)其他
  47. };
  48. const schema = new Schema(patentinfo, { toJSON: { virtuals: true } });
  49. schema.index({ id: 1 });
  50. schema.index({ create_number: 1 });
  51. schema.index({ create_date: 1 });
  52. schema.index({ success_number: 1 });
  53. schema.index({ success_date: 1 });
  54. schema.index({ name: 1 });
  55. schema.index({ inventor: 1 });
  56. schema.index({ address: 1 });
  57. schema.index({ apply_personal: 1 });
  58. schema.index({ term: 1 });
  59. schema.index({ type: 1 });
  60. schema.index({ agent_personal: 1 });
  61. schema.index({ agent: 1 });
  62. schema.index({ origin: 1 });
  63. schema.index({ status: 1 });
  64. schema.index({ trans_status: 1 });
  65. schema.index({ nationality: 1 });
  66. schema.index({ ipc_type: 1 });
  67. schema.index({ onlegal_status: 1 });
  68. schema.index({ law_date: 1 });
  69. schema.index({ on_obligee: 1 });
  70. schema.index({ law_num: 1 });
  71. schema.index({ first_opendate: 1 });
  72. schema.index({ empower_date: 1 });
  73. schema.index({ lose_date: 1 });
  74. schema.index({ examine_date: 1 });
  75. schema.index({ 'meta.createdAt': 1 });
  76. schema.plugin(metaPlugin);
  77. module.exports = app => {
  78. const { mongoose } = app;
  79. return mongoose.model('Patentinfo', schema, 'patent_info');
  80. };