|
@@ -21,7 +21,6 @@ func (this *CommonApiController) GetInspectionMajor() {
|
21
|
21
|
adminInfo := this.GetAdminUserInfo()
|
22
|
22
|
orgid := adminInfo.CurrentOrgId
|
23
|
23
|
major, err := service.GetInspectionMajor(orgid)
|
24
|
|
-
|
25
|
24
|
if len(major) == 0 {
|
26
|
25
|
major, _ := service.GetInspectionMajor(0)
|
27
|
26
|
if err != nil {
|
|
@@ -106,32 +105,67 @@ func (this *CommonApiController) SaveConfiguration() {
|
106
|
105
|
if rangvalue == "0" {
|
107
|
106
|
rangvalue = ""
|
108
|
107
|
}
|
109
|
|
- _, errcode := service.GetConfigurationById(inspectionmajor, inspectionMinor, orgid)
|
110
|
|
- if errcode == gorm.ErrRecordNotFound {
|
111
|
|
- standard := models.XtQualityControlStandard{
|
112
|
|
- InspectionMajor: inspectionmajor,
|
113
|
|
- InspectionMinor: inspectionMinor,
|
114
|
|
- MinRange: minrange,
|
115
|
|
- LargeRange: largerange,
|
116
|
|
- Sort: sorts,
|
117
|
|
- UserOrgId: orgid,
|
118
|
|
- Status: 1,
|
119
|
|
- RangeType: checktype,
|
120
|
|
- RangeValue: rangvalue,
|
121
|
|
- CreatedTime: time.Now().Unix(),
|
|
108
|
+ // 参与集成的机构根据小项id获取item_id
|
|
109
|
+ itemid, err := service.GetItemid(inspectionMinor)
|
|
110
|
+ //查询小项是否有值
|
|
111
|
+ fmt.Println("小项id", itemid.ItemId)
|
|
112
|
+ major, err := service.GetInspectionMajor(orgid)
|
|
113
|
+ if len(major) == 0 {
|
|
114
|
+ _, errcode := service.GetConfigurationById(inspectionmajor, inspectionMinor, orgid)
|
|
115
|
+ if errcode == gorm.ErrRecordNotFound {
|
|
116
|
+ standard := models.XtQualityControlStandard{
|
|
117
|
+ InspectionMajor: inspectionmajor,
|
|
118
|
+ InspectionMinor: inspectionMinor,
|
|
119
|
+ MinRange: minrange,
|
|
120
|
+ LargeRange: largerange,
|
|
121
|
+ Sort: sorts,
|
|
122
|
+ UserOrgId: orgid,
|
|
123
|
+ Status: 1,
|
|
124
|
+ RangeType: checktype,
|
|
125
|
+ RangeValue: rangvalue,
|
|
126
|
+ CreatedTime: time.Now().Unix(),
|
|
127
|
+ }
|
|
128
|
+ fmt.Println(standard)
|
|
129
|
+ err = service.SaveInspection(&standard)
|
|
130
|
+ if err != nil {
|
|
131
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
132
|
+ return
|
|
133
|
+ }
|
|
134
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
135
|
+ "standard": standard,
|
|
136
|
+ })
|
|
137
|
+ } else if errcode == nil {
|
|
138
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
139
|
+ return
|
122
|
140
|
}
|
123
|
|
- fmt.Println(standard)
|
124
|
|
- err = service.SaveInspection(&standard)
|
125
|
|
- if err != nil {
|
126
|
|
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
141
|
+ } else {
|
|
142
|
+ _, errcode := service.GetConfigurationById(inspectionmajor, inspectionMinor, orgid)
|
|
143
|
+ if errcode == gorm.ErrRecordNotFound {
|
|
144
|
+ standard := models.XtQualityControlStandard{
|
|
145
|
+ InspectionMajor: inspectionmajor,
|
|
146
|
+ InspectionMinor: itemid.ItemId,
|
|
147
|
+ MinRange: minrange,
|
|
148
|
+ LargeRange: largerange,
|
|
149
|
+ Sort: sorts,
|
|
150
|
+ UserOrgId: orgid,
|
|
151
|
+ Status: 1,
|
|
152
|
+ RangeType: checktype,
|
|
153
|
+ RangeValue: rangvalue,
|
|
154
|
+ CreatedTime: time.Now().Unix(),
|
|
155
|
+ }
|
|
156
|
+ fmt.Println(standard)
|
|
157
|
+ err = service.SaveInspection(&standard)
|
|
158
|
+ if err != nil {
|
|
159
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
160
|
+ return
|
|
161
|
+ }
|
|
162
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
163
|
+ "standard": standard,
|
|
164
|
+ })
|
|
165
|
+ } else if errcode == nil {
|
|
166
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
127
|
167
|
return
|
128
|
168
|
}
|
129
|
|
- this.ServeSuccessJSON(map[string]interface{}{
|
130
|
|
- "standard": standard,
|
131
|
|
- })
|
132
|
|
- } else if errcode == nil {
|
133
|
|
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
134
|
|
- return
|
135
|
169
|
}
|
136
|
170
|
|
137
|
171
|
}
|
|
@@ -141,28 +175,59 @@ func (this *CommonApiController) GetConfigurationlist() {
|
141
|
175
|
page, _ := this.GetInt64("page")
|
142
|
176
|
adminUser := this.GetAdminUserInfo()
|
143
|
177
|
orgid := adminUser.CurrentOrgId
|
144
|
|
- configurationlist, total, err := service.GetConfigurationlist(orgid, limit, page)
|
145
|
|
- if err != nil {
|
146
|
|
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
147
|
|
- return
|
|
178
|
+ major, _ := service.GetInspectionMajor(orgid)
|
|
179
|
+ if len(major) == 0 {
|
|
180
|
+ configurationlist, total, err := service.GetConfigurationlist(orgid, limit, page)
|
|
181
|
+ if err != nil {
|
|
182
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
183
|
+ return
|
|
184
|
+ }
|
|
185
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
186
|
+ "configurationlist": configurationlist,
|
|
187
|
+ "total": total,
|
|
188
|
+ })
|
|
189
|
+ } else {
|
|
190
|
+ configurationlist, total, err := service.GetConfigurationListTwo(orgid, limit, page)
|
|
191
|
+ if err != nil {
|
|
192
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
193
|
+ return
|
|
194
|
+ }
|
|
195
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
196
|
+ "configurationlist": configurationlist,
|
|
197
|
+ "total": total,
|
|
198
|
+ })
|
148
|
199
|
}
|
149
|
|
- this.ServeSuccessJSON(map[string]interface{}{
|
150
|
|
- "configurationlist": configurationlist,
|
151
|
|
- "total": total,
|
152
|
|
- })
|
|
200
|
+
|
153
|
201
|
}
|
154
|
202
|
|
155
|
203
|
func (this *CommonApiController) GetConfigurationDetail() {
|
156
|
204
|
id, _ := this.GetInt64("id")
|
157
|
205
|
//fmt.Println("id是", id)
|
|
206
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
158
|
207
|
detail, err := service.GetConfigurationDetail(id)
|
159
|
|
- if err != nil {
|
160
|
|
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
161
|
|
- return
|
|
208
|
+ major, err := service.GetInspectionMajor(orgId)
|
|
209
|
+ var vid = 0
|
|
210
|
+ if len(major) == 0 {
|
|
211
|
+ if err != nil {
|
|
212
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
213
|
+ return
|
|
214
|
+ }
|
|
215
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
216
|
+ "configurationdetail": detail,
|
|
217
|
+ "vid": vid,
|
|
218
|
+ })
|
|
219
|
+ } else {
|
|
220
|
+ itemId, err := service.GetIdByItemId(detail.InspectionMinor, orgId)
|
|
221
|
+ if err != nil {
|
|
222
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
223
|
+ return
|
|
224
|
+ }
|
|
225
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
226
|
+ "configurationdetail": detail,
|
|
227
|
+ "vid": itemId.ID,
|
|
228
|
+ })
|
162
|
229
|
}
|
163
|
|
- this.ServeSuccessJSON(map[string]interface{}{
|
164
|
|
- "configurationdetail": detail,
|
165
|
|
- })
|
|
230
|
+
|
166
|
231
|
}
|
167
|
232
|
|
168
|
233
|
func (this *CommonApiController) GetAllInspectionminor() {
|
|
@@ -223,27 +288,54 @@ func (this *CommonApiController) UpdateConfiguration() {
|
223
|
288
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
224
|
289
|
return
|
225
|
290
|
}
|
226
|
|
- standard := models.XtQualityControlStandard{
|
227
|
|
- InspectionMajor: inspectionmajor,
|
228
|
|
- InspectionMinor: inspectionMinor,
|
229
|
|
- MinRange: minrange,
|
230
|
|
- LargeRange: largerange,
|
231
|
|
- Sort: sort,
|
232
|
|
- RangeValue: rangvalue,
|
233
|
|
- RangeType: rangtype,
|
234
|
|
- Status: 1,
|
235
|
|
- UserOrgId: orgId,
|
236
|
|
- CreatedTime: time.Now().Unix(),
|
237
|
|
- UpdatedTime: time.Now().Unix(),
|
238
|
|
- }
|
239
|
|
- err = service.UpdarteConfiguration(&standard, id)
|
240
|
|
- if err != nil {
|
241
|
|
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
242
|
|
- return
|
|
291
|
+
|
|
292
|
+ major, err := service.GetInspectionMajor(orgId)
|
|
293
|
+ if len(major) == 0 {
|
|
294
|
+ standard := models.XtQualityControlStandard{
|
|
295
|
+ InspectionMajor: inspectionmajor,
|
|
296
|
+ InspectionMinor: inspectionMinor,
|
|
297
|
+ MinRange: minrange,
|
|
298
|
+ LargeRange: largerange,
|
|
299
|
+ Sort: sort,
|
|
300
|
+ RangeValue: rangvalue,
|
|
301
|
+ RangeType: rangtype,
|
|
302
|
+ Status: 1,
|
|
303
|
+ UserOrgId: orgId,
|
|
304
|
+ CreatedTime: time.Now().Unix(),
|
|
305
|
+ UpdatedTime: time.Now().Unix(),
|
|
306
|
+ }
|
|
307
|
+ err = service.UpdarteConfiguration(&standard, id)
|
|
308
|
+ if err != nil {
|
|
309
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
310
|
+ return
|
|
311
|
+ }
|
|
312
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
313
|
+ "standard": standard,
|
|
314
|
+ })
|
|
315
|
+ } else {
|
|
316
|
+ itemid, _ := service.GetItemid(inspectionMinor)
|
|
317
|
+ standard := models.XtQualityControlStandard{
|
|
318
|
+ InspectionMajor: inspectionmajor,
|
|
319
|
+ InspectionMinor: itemid.ItemId,
|
|
320
|
+ MinRange: minrange,
|
|
321
|
+ LargeRange: largerange,
|
|
322
|
+ Sort: sort,
|
|
323
|
+ RangeValue: rangvalue,
|
|
324
|
+ RangeType: rangtype,
|
|
325
|
+ Status: 1,
|
|
326
|
+ UserOrgId: orgId,
|
|
327
|
+ CreatedTime: time.Now().Unix(),
|
|
328
|
+ UpdatedTime: time.Now().Unix(),
|
|
329
|
+ }
|
|
330
|
+ err = service.UpdarteConfiguration(&standard, id)
|
|
331
|
+ if err != nil {
|
|
332
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
333
|
+ return
|
|
334
|
+ }
|
|
335
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
336
|
+ "standard": standard,
|
|
337
|
+ })
|
243
|
338
|
}
|
244
|
|
- this.ServeSuccessJSON(map[string]interface{}{
|
245
|
|
- "standard": standard,
|
246
|
|
- })
|
247
|
339
|
|
248
|
340
|
}
|
249
|
341
|
|
|
@@ -1299,9 +1391,9 @@ func (this *CommonApiController) GetPatientscontrol() {
|
1299
|
1391
|
limit, _ := this.GetInt64("limit")
|
1300
|
1392
|
fmt.Println("limit", limit)
|
1301
|
1393
|
patients, total, err := service.GetPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix, page, limit)
|
1302
|
|
- //统计非传染病类型
|
|
1394
|
+
|
1303
|
1395
|
control, err := service.GetLastPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix)
|
1304
|
|
- //统计传染病类型
|
|
1396
|
+
|
1305
|
1397
|
infectiousControl, err := service.GetInfectiousControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix)
|
1306
|
1398
|
|
1307
|
1399
|
if err != nil {
|
|
@@ -1334,20 +1426,29 @@ func (this *CommonApiController) GetCartogramList() {
|
1334
|
1426
|
endtimeStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endtimeStr)
|
1335
|
1427
|
endtimeStrsUnix := endtimeStrs.Unix()
|
1336
|
1428
|
fmt.Println("结束时间搓", endtimeStrsUnix)
|
1337
|
|
- limit, _ := this.GetInt64("limit")
|
1338
|
|
- page, _ := this.GetInt64("page")
|
1339
|
|
- cartogramlist, err := service.GetLastPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix)
|
1340
|
|
- infectiouscontrol, err := service.GetInfectiousPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix)
|
1341
|
|
- _, total, err := service.GetPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix, page, limit)
|
|
1429
|
+ //limit, _ := this.GetInt64("limit")
|
|
1430
|
+ //page, _ := this.GetInt64("page")
|
|
1431
|
+
|
|
1432
|
+ //统计总共
|
|
1433
|
+ _, total, err := service.GetTotalPatientsControl(orgid, startimeStrUnix, endtimeStrsUnix)
|
|
1434
|
+ fmt.Println("total=================", total)
|
|
1435
|
+ //统计rangetype= 1
|
|
1436
|
+ _, standtotal, err := service.GetStandControl(orgid, startimeStrUnix, endtimeStrsUnix)
|
|
1437
|
+ fmt.Println(standtotal)
|
|
1438
|
+ _, standtotalOne, err := service.GetStandControlOne(orgid, startimeStrUnix, endtimeStrsUnix)
|
|
1439
|
+ fmt.Println(standtotalOne)
|
|
1440
|
+ //cartogramlist, err := service.GetLastPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix)
|
|
1441
|
+ //infectiouscontrol, err := service.GetInfectiousPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix)
|
|
1442
|
+ //_, total, err := service.GetPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix, page, limit)
|
1342
|
1443
|
if err != nil {
|
1343
|
1444
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
1344
|
1445
|
return
|
1345
|
1446
|
}
|
1346
|
1447
|
|
1347
|
1448
|
this.ServeSuccessJSON(map[string]interface{}{
|
1348
|
|
- "cartogramlist": cartogramlist,
|
1349
|
|
- "total": total,
|
1350
|
|
- "infectiouscontrol": infectiouscontrol,
|
|
1449
|
+ "total": total,
|
|
1450
|
+ "standtotal": standtotal,
|
|
1451
|
+ "standtotalOne": standtotalOne,
|
1351
|
1452
|
})
|
1352
|
1453
|
}
|
1353
|
1454
|
|