Browse Source

排队叫号配置

张保健 4 years ago
parent
commit
64f4838619
3 changed files with 124 additions and 0 deletions
  1. 90 0
      controllers/dialysis_api_controller.go
  2. 21 0
      models/dialysis.go
  3. 13 0
      service/dialysis_service.go

+ 90 - 0
controllers/dialysis_api_controller.go View File

@@ -60,7 +60,97 @@ func DialysisApiRegistRouters() {
60 60
 
61 61
 	beego.Router("/api/dialysisgoods/get", &DialysisApiController{}, "Get:GetDialysisGoods")
62 62
 	beego.Router("/api/goodstatistics/get", &DialysisApiController{}, "Get:GetDialysisGoodsStatistics")
63
+	beego.Router("/api/queue/get", &DialysisApiController{}, "Get:GetQueueCall")
64
+	beego.Router("/api/queue/update", &DialysisApiController{}, "Get:UpdateQueueCall")
65
+}
66
+
67
+func (c *DialysisApiController) GetQueueCall() {
68
+	adminUserInfo := c.GetAdminUserInfo()
69
+	queueConfig, _ := service.FindQueueCallInfo(adminUserInfo.CurrentOrgId)
70
+
71
+	if queueConfig.ID <= 0 {
72
+		queueConfig.OrgId = adminUserInfo.CurrentOrgId
73
+		queueConfig.Qhsj = 10
74
+		queueConfig.Jzdcbbcs = 3
75
+		queueConfig.Jzbbsy = 1
76
+		queueConfig.Jzjhyc = 0
77
+		queueConfig.Sjdcbbcs = 3
78
+		queueConfig.Sjbbsy = 0
79
+		queueConfig.Sjjhyc = 0
80
+		queueConfig.Txxqyxs = 0
81
+		queueConfig.Txglsyxs = 0
82
+	}
83
+
84
+	c.ServeSuccessJSON(map[string]interface{}{
85
+		"queue_config": queueConfig,
86
+	})
87
+}
88
+
89
+func (c *DialysisApiController) UpdateQueueCall() {
90
+	adminUserInfo := c.GetAdminUserInfo()
91
+	queueConfig, _ := service.FindQueueCallInfo(adminUserInfo.CurrentOrgId)
92
+
93
+	if queueConfig.ID <= 0 {
94
+		queueConfig.OrgId = adminUserInfo.CurrentOrgId
95
+		queueConfig.Qhsj = 10
96
+		queueConfig.Jzdcbbcs = 3
97
+		queueConfig.Jzbbsy = 1
98
+		queueConfig.Jzjhyc = 0
99
+		queueConfig.Sjdcbbcs = 3
100
+		queueConfig.Sjbbsy = 0
101
+		queueConfig.Sjjhyc = 0
102
+		queueConfig.Txxqyxs = 0
103
+		queueConfig.Txglsyxs = 0
104
+		queueConfig.CreateTime = time.Now().Unix()
105
+		queueConfig.UpdateTime = time.Now().Unix()
106
+	}
107
+
108
+	qhsj, _ := c.GetInt64("qhsj", 0)
109
+	if qhsj > 0 {
110
+		queueConfig.Qhsj = qhsj
111
+	}
112
+	
113
+	jzdcbbcs, _ := c.GetInt64("jzdcbbcs", 0)
114
+	if jzdcbbcs > 0 {
115
+		queueConfig.Jzdcbbcs = jzdcbbcs
116
+	}
117
+
118
+	jzbbsy, _ := c.GetInt64("jzbbsy", 0)
119
+	if jzbbsy > 0 {
120
+		queueConfig.Jzbbsy = jzbbsy
121
+	}
122
+
123
+	jzjhyc, _ := c.GetInt64("jzjhyc", 0)
124
+	queueConfig.Jzjhyc = jzjhyc
125
+	
126
+
127
+	sjdcbbcs, _ := c.GetInt64("sjdcbbcs", 0)
128
+	if sjdcbbcs > 0 {
129
+		queueConfig.Sjdcbbcs = sjdcbbcs
130
+	}
131
+
132
+	sjbbsy, _ := c.GetInt64("sjbbsy", 0)
133
+	if sjbbsy > 0 {
134
+		queueConfig.Sjbbsy = sjbbsy
135
+	}
63 136
 
137
+	sjjhyc, _ := c.GetInt64("sjjhyc", 0)
138
+	queueConfig.Sjjhyc = sjjhyc
139
+
140
+
141
+	txxqyxs, _ := c.GetInt64("txxqyxs", 0)
142
+	queueConfig.Txxqyxs = txxqyxs
143
+
144
+	txglsyxs, _ := c.GetInt64("txglsyxs", 0)
145
+	queueConfig.Txglsyxs = txglsyxs
146
+	
147
+	queueConfig.UpdateTime = time.Now().Unix()
148
+
149
+	service.UpDateQueueCallInfo(queueConfig)
150
+
151
+	c.ServeSuccessJSON(map[string]interface{}{
152
+		"queue_config": queueConfig,
153
+	})
64 154
 }
65 155
 
66 156
 func (c *DialysisApiController) PostPrescription() {

+ 21 - 0
models/dialysis.go View File

@@ -955,3 +955,24 @@ type DialysisBeforePrepare struct {
955 955
 func (DialysisBeforePrepare) TableName() string {
956 956
 	return "dialysis_before_prepare"
957 957
 }
958
+
959
+type QueueCallConfig struct {
960
+	ID         	int64 `gorm:"column:id" json:"id" form:"id"`
961
+	OrgId     	int64 `gorm:"column:org_id" json:"org_id" form:"org_id"`
962
+	Qhsj  		int64 `gorm:"column:qhsj" json:"qhsj" form:"qhsj"`
963
+	Jzdcbbcs	int64 `gorm:"column:jzdcbbcs" json:"jzdcbbcs" form:"jzdcbbcs"`
964
+	Jzbbsy		int64 `gorm:"column:jzbbsy" json:"jzbbsy" form:"jzbbsy"`
965
+	Jzjhyc		int64 `gorm:"column:jzjhyc" json:"jzjhyc" form:"jzjhyc"`
966
+	Sjdcbbcs 	int64 `gorm:"column:sjdcbbcs" json:"sjdcbbcs" form:"sjdcbbcs"`
967
+	Sjbbsy 		int64 `gorm:"column:sjbbsy" json:"sjbbsy" form:"sjbbsy"`
968
+	Sjjhyc		int64 `gorm:"column:sjjhyc" json:"sjjhyc" form:"sjjhyc"`
969
+	Txxqyxs		int64 `gorm:"column:txxqyxs" json:"txxqyxs" form:"txxqyxs"`
970
+	Txglsyxs	int64 `gorm:"column:txglsyxs" json:"txglsyxs" form:"txglsyxs"`
971
+	CreateTime	int64 `gorm:"column:create_time" json:"create_time" form:"create_time"`
972
+	UpdateTime  int64 `gorm:"column:update_time" json:"update_time" form:"update_time"`
973
+
974
+}
975
+
976
+func (QueueCallConfig) TableName() string {
977
+	return "xt_queue_call_config"
978
+}

+ 13 - 0
service/dialysis_service.go View File

@@ -165,6 +165,19 @@ func FindTreatmentSummaryById(orgID int64, patientsId int64, recordDate int64) (
165 165
 	return
166 166
 }
167 167
 
168
+//机构叫号配置
169
+func FindQueueCallInfo(orgID int64) (queueConfig models.QueueCallConfig, err error) {
170
+	err = readDb.Model(&models.QueueCallConfig{}).Where("org_id=? ", orgID).First(&queueConfig).Error
171
+	return
172
+}
173
+
174
+
175
+//修改机构叫号配置
176
+func UpDateQueueCallInfo(queueConfig models.QueueCallConfig) error {
177
+	err := writeDb.Save(&queueConfig).Error
178
+	return err
179
+}
180
+
168 181
 //所有设备信息
169 182
 func FindAllDeviceInfo(orgID int64) (device []*models.Device, err error) {
170 183
 	err = readDb.Model(&models.Device{}).Where("org_id=? and status=1 and device_type = 1", orgID).Find(&device).Error