tPolicyDeclaration.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. const {Secret} = require('naf-framework-mongoose/lib/model/schema');
  5. // 审批信息
  6. const approvalInfo = new Schema({
  7. state: {type: String, required: false},//状态,-1-停用,0-未审核,1-审核通过,2-审核未通过
  8. state_description: {type: String, required: false},//状态描述,-1-停用,0-未审核,1-审核通过,2-审核未通过
  9. result_description: {type: String, required: false},//结果描述
  10. state_time: {type: Number},//状态时间
  11. approval_id: {type: String, required: false},//审批人id
  12. approval: {type: String, required: false},//审批人
  13. });
  14. // 附件
  15. const enclosure = new Schema({
  16. name: {type: String, required: false},//原文件名
  17. url: {type: String, required: false},//存储文件名
  18. });
  19. // 政策申报内容管理
  20. const TPolicyDeclarationSchema = {
  21. title: {type: String, required: true},//标题
  22. issuing_organ: {type: String, required: true},//发文机关
  23. index_number: {type: String, required: false},//索引号
  24. subject_classification: {type: String, required: true},//主题分类
  25. issued_number: {type: String, required: false},//发文字号
  26. subject_headings: {type: String, required: true},//主题词
  27. publish_time: {type: Number},//发布日期
  28. brief_introduction: {type: String, required: false},//简介
  29. description: {type: String, required: true},//内容
  30. type: {type: String, required: true},//类型 ,0-工信厅,1-金融办,2-其他政府部门
  31. type_description: {type: String, required: false},//类型描述,0-工信厅,1-金融办,2-其他政府部门
  32. link: {type: String, required: false},//链接
  33. current_state: {type: String, default: '0'},//状态,-1-停用,0-未审核,1-审核通过,2-审核未通过
  34. current_state_description: {type: String, default: '未审核'},//状态描述,-1-停用,0-未审核,1-审核通过,2-审核未通过
  35. current_result_description: {type: String, default: ''},//结果描述
  36. current_state_time: {type: Number/*, default: Date.now*/},//状态时间
  37. current_approval_id: {type: String, default: ''},//审批人id
  38. current_approval: {type: String, default: ''},//审批人
  39. approval_info: {type: [approvalInfo], required: false}, // 审批信息
  40. enclosure: {type: [enclosure], required: false}, // 附件
  41. image: {type: String, required: false},//图片
  42. create_time: {type: Number, default: Date.now},//创建时间
  43. update_time: {type: Number, default: Date.now},//更新时间
  44. };
  45. const schema = new Schema(TPolicyDeclarationSchema, {toJSON: {virtuals: true}});
  46. schema.index({id: 1});
  47. schema.plugin(metaPlugin);
  48. module.exports = app => {
  49. const {mongoose} = app;
  50. return mongoose.model('TPolicyDeclaration', schema, 't_policy_declaration');
  51. };