group.interface.ts 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import { Rule, RuleType } from '@midwayjs/validate';
  2. import { ApiProperty } from '@midwayjs/swagger';
  3. import { SearchBase } from 'free-midway-component';
  4. import get = require('lodash/get');
  5. const dealVO = (cla, data) => {
  6. for (const key in cla) {
  7. const val = get(data, key);
  8. if (val || val === 0) cla[key] = val;
  9. }
  10. };
  11. export class FVO_group {
  12. constructor(data: object) {
  13. dealVO(this, data);
  14. }
  15. @ApiProperty({ description: '数据id' })
  16. _id: string = undefined;
  17. @ApiProperty({ description: '管理医生' })
  18. 'doctor': string = undefined;
  19. @ApiProperty({ description: '群组病人' })
  20. 'patients': Array<any> = undefined;
  21. @ApiProperty({ description: '群组名称' })
  22. 'name': string = undefined;
  23. @ApiProperty({ description: '群简介' })
  24. 'content': string = undefined;
  25. }
  26. export class QDTO_group extends SearchBase {
  27. constructor() {
  28. const like_prop = ['name'];
  29. const props = ['doctor', 'patients'];
  30. const mapping = [];
  31. super({ like_prop, props, mapping });
  32. }
  33. @ApiProperty({ description: '群组名称' })
  34. 'name': string = undefined;
  35. @ApiProperty({ description: '管理医生' })
  36. 'doctor': string = undefined;
  37. @ApiProperty({ description: '群组病人' })
  38. 'patients': Array<any> = undefined;
  39. }
  40. export class QVO_group extends FVO_group {
  41. constructor(data: object) {
  42. super(data);
  43. dealVO(this, data);
  44. }
  45. }
  46. export class CDTO_group {
  47. @ApiProperty({ description: '管理医生' })
  48. @Rule(RuleType['string']().empty(''))
  49. 'doctor': string = undefined;
  50. @ApiProperty({ description: '群组病人' })
  51. @Rule(RuleType['array']().empty(''))
  52. 'patients': Array<any> = undefined;
  53. @ApiProperty({ description: '群组名称' })
  54. @Rule(RuleType['string']().empty(''))
  55. 'name': string = undefined;
  56. @ApiProperty({ description: '群简介' })
  57. @Rule(RuleType['string']().empty(''))
  58. 'content': string = undefined;
  59. }
  60. export class CVO_group extends FVO_group {
  61. constructor(data: object) {
  62. super(data);
  63. dealVO(this, data);
  64. }
  65. }
  66. export class UDTO_group extends CDTO_group {
  67. @ApiProperty({ description: '数据id' })
  68. @Rule(RuleType['string']().empty(''))
  69. _id: string = undefined;
  70. }
  71. export class UVAO_group extends FVO_group {
  72. constructor(data: object) {
  73. super(data);
  74. dealVO(this, data);
  75. }
  76. }