|
@@ -41,12 +41,12 @@ func AddOffices(offices models.SgjPatientOffices) error {
|
41
|
41
|
return err
|
42
|
42
|
}
|
43
|
43
|
|
44
|
|
-func AddDoctor(doctor models.SgjPatientDoctor) error {
|
|
44
|
+func AddDoctor(doctor models.SgjPatientDocinfo) error {
|
45
|
45
|
err := service.PatientWriteDB().Create(&doctor).Error
|
46
|
46
|
return err
|
47
|
47
|
}
|
48
|
48
|
|
49
|
|
-func AddDoctorInfo(doctor models.SgjPatientDoctor) error{
|
|
49
|
+func AddDoctorInfo(doctor models.SgjPatientEditdoctor) error{
|
50
|
50
|
err := service.PatientWriteDB().Create(&doctor).Error
|
51
|
51
|
return err
|
52
|
52
|
}
|
|
@@ -76,19 +76,13 @@ func GetOfficeInfo(orgID int64)(models.SgjPatientOffices,error) {
|
76
|
76
|
return offices,err
|
77
|
77
|
}
|
78
|
78
|
|
79
|
|
-func GetDoctorInfo(orgID int64)(doc []*models.SgjPatientDoctor,err error) {
|
80
|
|
- err = service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgID, 1).Limit(2).Find(&doc).Error
|
81
|
|
- fmt.Println("错误是什么",err)
|
82
|
|
- return
|
83
|
|
-}
|
84
|
|
-
|
85
|
79
|
func GetQueryDocInfo(orgID int64)(doc []*models.SgjUserStaffInfo,err error) {
|
86
|
80
|
err = service.UserReadDB().Where("user_org_id = ? AND status = ?", orgID, 1).Find(&doc).Error
|
87
|
81
|
fmt.Println("错误是什么",err)
|
88
|
82
|
return
|
89
|
83
|
}
|
90
|
84
|
|
91
|
|
-func GetQueryDocHead(orgID int64) (doc []*models.SgjPatientDoctor,err error) {
|
|
85
|
+func GetQueryDocHead(orgID int64) (doc []*models.SgjPatientEditdoctor,err error) {
|
92
|
86
|
err = service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgID, 1).Order("doc_sort").Find(&doc).Error
|
93
|
87
|
return
|
94
|
88
|
}
|
|
@@ -100,12 +94,12 @@ func GetOffEnvironment(orgID int64)(models.SgjPatientOffenvironment,error) {
|
100
|
94
|
return offenvironment,err
|
101
|
95
|
}
|
102
|
96
|
|
103
|
|
-func AddWorkTime(connecmodel models.SgjPatientConnecmodel) error {
|
|
97
|
+func AddWorkTime(connecmodel *models.SgjPatientWorktime) error {
|
104
|
98
|
err := service.PatientWriteDB().Create(&connecmodel).Error
|
105
|
99
|
return err
|
106
|
100
|
}
|
107
|
101
|
|
108
|
|
-func AddRideWay(connecmodel models.SgjPatientConnecmodel) error {
|
|
102
|
+func AddRideWay(connecmodel models.SgjPatientRideway) error {
|
109
|
103
|
err := service.PatientWriteDB().Create(&connecmodel).Error
|
110
|
104
|
return err
|
111
|
105
|
}
|
|
@@ -120,11 +114,21 @@ func GetQueryConnection( orgID int64)(conection []*models.SgjPatientConnection,e
|
120
|
114
|
return
|
121
|
115
|
}
|
122
|
116
|
|
123
|
|
-func DeleteConnecWay(orgid int64,id int64)(error){
|
124
|
|
- err := service.PatientWriteDB().Model(&models.SgjPatientConnection{}).Where("user_org_id =? AND id = ?", orgid, id).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
|
|
117
|
+func DeleteRideWay(orgid int64,id int64)(error){
|
|
118
|
+ err := service.PatientWriteDB().Model(&models.SgjPatientRideway{}).Where("user_org_id =? AND mode_id = ?", orgid, id).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
|
125
|
119
|
return err
|
126
|
120
|
}
|
127
|
121
|
|
|
122
|
+func DeleteConnecWay(orgid int64,id int64)(error) {
|
|
123
|
+ err := service.PatientWriteDB().Model(&models.SgjPatientConnection{}).Where("user_org_id = ? AND id =?", orgid, id).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
|
|
124
|
+ return err
|
|
125
|
+}
|
|
126
|
+
|
|
127
|
+func DeleteWorkTime(orgid int64,id int64)(error) {
|
|
128
|
+ err := service.PatientWriteDB().Model(models.SgjPatientWorktime{}).Where("user_org_id = ? AND mode_id = ?", orgid, id).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
|
|
129
|
+ return err
|
|
130
|
+}
|
|
131
|
+
|
128
|
132
|
func EditConnecWay(orgid int64,id int64)(models.SgjPatientConnection,error){
|
129
|
133
|
sgj := models.SgjPatientConnection{}
|
130
|
134
|
err := service.PatientReadDB().Model(&sgj).Where("user_org_id = ? AND id =?", orgid, id).Find(&sgj).Error
|
|
@@ -135,7 +139,7 @@ func UpadateConnec(connection *models.SgjPatientConnection,orgID int64,id int64)
|
135
|
139
|
service.PatientWriteDB().Model(connection).Where("user_org_id = ? AND id = ? AND status = ?",orgID,id,1).Update(map[string]interface{}{"title":connection.Title,"connecway":connection.Connecway,"content":connection.Content,})
|
136
|
140
|
}
|
137
|
141
|
|
138
|
|
-func GetUserModel(orgid int64)(model []*models.SgjPatientConnecmodel,err error){
|
|
142
|
+func GetUserModel(orgid int64)(model []*models.SgjPatientOrdmodel,err error){
|
139
|
143
|
err = service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgid, 1).Order("sort").Find(&model).Error
|
140
|
144
|
return
|
141
|
145
|
}
|
|
@@ -146,18 +150,30 @@ func GetQueryNewModel(orgid int64)(model []*models.SgjPatientModel,err error) {
|
146
|
150
|
return
|
147
|
151
|
}
|
148
|
152
|
|
149
|
|
-func GetEditModel(orgid int64,id int64)(models.SgjPatientConnecmodel,error){
|
150
|
|
- connecmodel := models.SgjPatientConnecmodel{}
|
151
|
|
- err := service.PatientReadDB().Model(&connecmodel).Where("user_org_id = ? AND id = ?", orgid, id).Find(&connecmodel).Error
|
152
|
|
- return connecmodel,err;
|
|
153
|
+func GetEditModel(orgid int64,id int64)(models.SgjPatientWorktime,error){
|
|
154
|
+ worktime := models.SgjPatientWorktime{}
|
|
155
|
+ err := service.PatientReadDB().Model(&worktime).Where("user_org_id = ? AND mode_id = ?", orgid, id).Find(&worktime).Error
|
|
156
|
+ return worktime,err;
|
153
|
157
|
}
|
154
|
158
|
|
155
|
|
-func UpdateWorkTime(id int64,orgID int64,connecmodel models.SgjPatientConnecmodel) {
|
156
|
|
- service.PatientWriteDB().Model(connecmodel).Where("id = ? AND user_org_id = ? AND status = ?",id,orgID,1).Update(map[string]interface{}{"title":connecmodel.Title,"sort":connecmodel.Sort,"worktime":connecmodel.Worktime,"mtime":time.Now().Unix()})
|
|
159
|
+func GetEditRideWay(orgid int64,id int64)(models.SgjPatientRideway,error) {
|
|
160
|
+ rideway := models.SgjPatientRideway{}
|
|
161
|
+ err := service.PatientReadDB().Model(&rideway).Where("user_org_id = ? AND mode_id = ?", orgid, id).Find(&rideway).Error
|
|
162
|
+ return rideway,err;
|
157
|
163
|
}
|
158
|
164
|
|
159
|
|
-func UpdateRideWay(id int64,orgID int64,connecmodel models.SgjPatientConnecmodel) error {
|
160
|
|
- err := service.PatientWriteDB().Model(connecmodel).Where("id = ? AND user_org_id = ? AND status =?", id, orgID, 1).Update(map[string]interface{}{"title": connecmodel.Title, "sort": connecmodel.Sort, "rideway": connecmodel.Rideway, "mtime": time.Now().Unix()}).Error
|
|
165
|
+func UpdateWorkTime(mid int64,orgID int64,worktime models.SgjPatientWorktime) error {
|
|
166
|
+ err := service.PatientWriteDB().Model(worktime).Where("id = ? AND user_org_id = ? AND status = ?", mid, orgID, 1).Update(map[string]interface{}{"title": worktime.Title, "sort": worktime.Sort, "worktime": worktime.Worktime, "mtime": time.Now().Unix()}).Error
|
|
167
|
+ return err
|
|
168
|
+}
|
|
169
|
+
|
|
170
|
+func UpdateOrdeModel(id int64,orgID int64,ordmodel models.SgjPatientOrdmodel) error {
|
|
171
|
+ err := service.PatientWriteDB().Model(ordmodel).Where("id = ? AND user_org_id = ? AND status = ?", id, orgID, 1).Update(map[string]interface{}{"title": ordmodel.Title, "sort": ordmodel.Sort, "mtime": time.Now().Unix()}).Error
|
|
172
|
+ return err
|
|
173
|
+}
|
|
174
|
+
|
|
175
|
+func UpdateRideWay(id int64,orgID int64,rideway models.SgjPatientRideway) error {
|
|
176
|
+ err := service.PatientWriteDB().Model(rideway).Where("id = ? AND user_org_id = ? AND status =?", id, orgID, 1).Update(map[string]interface{}{"title": rideway.Title, "sort": rideway.Sort, "rideway": rideway.RideWay, "mtime": time.Now().Unix()}).Error
|
161
|
177
|
return err
|
162
|
178
|
}
|
163
|
179
|
|
|
@@ -167,19 +183,8 @@ func QueryDocById(orgID int64,id int64)(models.SgjUserStaffInfo,error) {
|
167
|
183
|
return info,err
|
168
|
184
|
}
|
169
|
185
|
|
170
|
|
-func EditDoctorInfo(id int64,orgID int64)(models.SgjPatientDoctor,error) {
|
171
|
|
- doctor := models.SgjPatientDoctor{}
|
172
|
|
- err := service.PatientReadDB().Model(&doctor).Where("id = ? AND user_org_id = ?", id, orgID).Find(&doctor).Error
|
173
|
|
- return doctor,err
|
174
|
|
-}
|
175
|
|
-
|
176
|
|
-func UpdateDocInfo(id int64,orgID int64,doctor models.SgjPatientDoctor) error {
|
177
|
|
- err := service.PatientWriteDB().Model(doctor).Where("id = ? AND user_org_id = ? AND status = ?", id, orgID, 1).Update(map[string]interface{}{"docname": doctor.Docname, "doc_position": doctor.DocPosition, "dochead": doctor.Dochead, "doc_sort": doctor.DocSort, "docintroduction": doctor.Docintroduction, "mtime": time.Now().Unix()}).Error
|
178
|
|
- return err
|
179
|
|
-}
|
180
|
|
-
|
181
|
186
|
func DeleteDoctor(id int64,orgID int64)(error) {
|
182
|
|
- err := service.PatientWriteDB().Model(&models.SgjPatientDoctor{}).Where("id = ? AND user_org_id = ?", id, orgID).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
|
|
187
|
+ err := service.PatientWriteDB().Model(&models.SgjPatientEditdoctor{}).Where("id = ? AND user_org_id = ?", id, orgID).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
|
183
|
188
|
return err
|
184
|
189
|
}
|
185
|
190
|
|
|
@@ -234,8 +239,153 @@ func GetData(orgid int64)(model []*models.SgjPatientModel,err error) {
|
234
|
239
|
if(orgid > 0){
|
235
|
240
|
db = db.Where("user_org_id = ? ", orgid)
|
236
|
241
|
}
|
237
|
|
- err = db.Preload("Hospitals").Preload("Offices").Select("m.id,m.title,m.sort,m.ctime,m.mtime,m.user_org_id,m.status,m.mode_type").Order("sort").Find(&model).Error
|
|
242
|
+ err = db.Preload("Hospitals").Preload("Offices").Preload("Doctors").Preload("OfficeEnviroment").Preload("Editdoctor").
|
|
243
|
+ Select("m.id,m.title,m.sort,m.ctime,m.mtime,m.user_org_id,m.status,m.mode_type").Order("sort").Find(&model).Error
|
|
244
|
+ return
|
|
245
|
+}
|
|
246
|
+
|
|
247
|
+func UpdateDoctorsInfo(orgID int64,ids[] int64,editdoctor models.SgjPatientEditdoctor)(err error) {
|
|
248
|
+ if(len(ids)==1){
|
|
249
|
+ err = service.PatientWriteDB().Model(&models.SgjPatientEditdoctor{}).Where("id = ? and user_org_id = ?", ids[0], orgID).Update(map[string]interface{}{ "modleid": editdoctor.Modleid, "status": 1, "mtime": time.Now().Unix()}).Error
|
|
250
|
+ }else {
|
|
251
|
+ err = service.PatientWriteDB().Model(&models.SgjPatientEditdoctor{}).Where("id IN(?) and user_org_id = ?", ids, orgID).Update(map[string]interface{}{"modleid": editdoctor.Modleid, "status": 1, "mtime": time.Now().Unix()}).Error
|
|
252
|
+ }
|
|
253
|
+ return
|
|
254
|
+}
|
|
255
|
+
|
|
256
|
+func QueryEditDoc(mid int64,orgid int64)(models.SgjPatientDocinfo, error) {
|
|
257
|
+ editdotor := models.SgjPatientDocinfo{}
|
|
258
|
+ err := service.PatientReadDB().Model(&editdotor).Where("modelid = ? AND user_org_id = ? AND status = ?", mid, orgid, 1).Find(&editdotor).Error
|
|
259
|
+ return editdotor,err
|
|
260
|
+}
|
|
261
|
+
|
|
262
|
+func QuerEditDocByid(mid int64,orgid int64)(editdoctor []*models.SgjPatientEditdoctor,err error) {
|
|
263
|
+ err = service.PatientReadDB().Model(&editdoctor).Where("modleid = ? AND user_org_id = ? AND status = ?", mid, orgid, 1).Order("doc_sort").Find(&editdoctor).Error
|
|
264
|
+ return
|
|
265
|
+}
|
|
266
|
+
|
|
267
|
+func QueryEditImages(orgid int64,id int64)(models.SgjPatientEditdoctor,error) {
|
|
268
|
+ editdoctor := models.SgjPatientEditdoctor{}
|
|
269
|
+ err := service.PatientReadDB().Model(&editdoctor).Where("user_org_id = ? AND id = ? AND status = ?", orgid, id, 1).Find(&editdoctor).Error
|
|
270
|
+ return editdoctor,err
|
|
271
|
+}
|
|
272
|
+
|
|
273
|
+func QueryEditDoctor(id int64,orgid int64)(models.SgjPatientEditdoctor,error) {
|
|
274
|
+ docinfo := models.SgjPatientEditdoctor{}
|
|
275
|
+ err := service.PatientReadDB().Model(&docinfo).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Find(&docinfo).Error
|
|
276
|
+ return docinfo,err
|
|
277
|
+}
|
|
278
|
+
|
|
279
|
+func UpDateEditdoctor(id int64,orgid int64,editdoctor models.SgjPatientEditdoctor) error {
|
|
280
|
+ err := service.PatientWriteDB().Model(editdoctor).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"doc_name":editdoctor.DocName,"doc_postion": editdoctor.DocPostion, "dochead": editdoctor.Dochead, "doc_sort": editdoctor.DocSort, "docintroduction": editdoctor.Docintroduction, "mtime": time.Now().Unix()}).Error
|
|
281
|
+ return err
|
|
282
|
+}
|
|
283
|
+
|
|
284
|
+func Upadatedocdata(orgid int64,id int64,docinfo models.SgjPatientDocinfo) error {
|
|
285
|
+ err := service.PatientWriteDB().Model(docinfo).Where("user_org_id = ? AND id = ? AND status = ?", orgid, id, 1).Update(map[string]interface{}{"title": docinfo.Title, "sort": docinfo.Sort, "docimages": docinfo.Docimages, "mtime": time.Now().Unix()}).Error
|
|
286
|
+ return err
|
|
287
|
+}
|
|
288
|
+
|
|
289
|
+func QuerOfficeEnviroment(id int64,orgid int64)(models.SgjPatientOffenvironment,error) {
|
|
290
|
+ offenvironment := models.SgjPatientOffenvironment{}
|
|
291
|
+ err := service.PatientReadDB().Model(&offenvironment).Where("modelid = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Find(&offenvironment).Error
|
|
292
|
+ return offenvironment,err
|
|
293
|
+}
|
|
294
|
+
|
|
295
|
+func UpdateOfficeEnvironment(id int64,orgid int64,offenvironment models.SgjPatientOffenvironment) error {
|
|
296
|
+ err := service.PatientReadDB().Model(&offenvironment).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Find(&offenvironment).Error
|
|
297
|
+ return err
|
|
298
|
+}
|
|
299
|
+
|
|
300
|
+func QueryHispitalDetail(orgid int64,id int64)(models.SgjPatientHospital,error) {
|
|
301
|
+ hospital := models.SgjPatientHospital{}
|
|
302
|
+ err := service.PatientReadDB().Model(&hospital).Where("user_org_id = ? AND modleid = ? AND status = ?", orgid, id, 1).Find(&hospital).Error
|
|
303
|
+ return hospital,err
|
|
304
|
+}
|
|
305
|
+
|
|
306
|
+func GetOfficeDetail(orgid int64,id int64)(models.SgjPatientOffices,error) {
|
|
307
|
+ offices := models.SgjPatientOffices{}
|
|
308
|
+ err := service.PatientReadDB().Model(&offices).Where("user_org_id = ? AND modleid = ? AND status = ?", orgid, id, 1).Find(&offices).Error
|
|
309
|
+ return offices,err
|
|
310
|
+}
|
|
311
|
+
|
|
312
|
+func GetDoctorDetail(orgid int64,id int64)(editdoctor []*models.SgjPatientEditdoctor,err error) {
|
|
313
|
+ err = service.PatientReadDB().Model(&editdoctor).Where("user_org_id = ? AND modleid = ? AND status = ?", orgid, id, 1).Order("doc_sort").Find(&editdoctor).Error
|
|
314
|
+ return
|
|
315
|
+}
|
|
316
|
+
|
|
317
|
+func AddNavigation(navigation *models.SgjPatientNavigation)error {
|
|
318
|
+ err := service.PatientWriteDB().Create(&navigation).Error
|
|
319
|
+ return err
|
|
320
|
+}
|
|
321
|
+
|
|
322
|
+func GetNavigationList(orgid int64)(navigation []*models.SgjPatientNavigation,err error) {
|
|
323
|
+ err = service.PatientReadDB().Model(&navigation).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&navigation).Error
|
|
324
|
+ return
|
|
325
|
+}
|
|
326
|
+
|
|
327
|
+func AddShareInfo(share *models.SgjPatientShare) error {
|
|
328
|
+ err := service.PatientWriteDB().Create(&share).Error
|
|
329
|
+
|
|
330
|
+ return err
|
|
331
|
+}
|
|
332
|
+
|
|
333
|
+func GetShareInfo(orgid int64)(models.SgjPatientShare,error) {
|
|
334
|
+ share := models.SgjPatientShare{}
|
|
335
|
+ err := service.PatientReadDB().Model(&share).Where("user_org_id = ? AND status = ?", orgid, 1).Last(&share).Error
|
|
336
|
+ return share,err
|
|
337
|
+}
|
|
338
|
+
|
|
339
|
+func DeleteNavitionById(orgID int64,id int64)(error) {
|
|
340
|
+ err := service.PatientWriteDB().Model(models.SgjPatientNavigation{}).Where("user_org_id = ? AND id = ?", orgID, id).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
|
|
341
|
+ return err
|
|
342
|
+}
|
|
343
|
+
|
|
344
|
+func AddConnecWay(connectway *models.SgjPatientConnectway) error {
|
|
345
|
+ err := service.PatientWriteDB().Create(&connectway).Error
|
|
346
|
+ return err
|
|
347
|
+}
|
|
348
|
+
|
|
349
|
+func AddOrdModel(ordmodel *models.SgjPatientOrdmodel)error {
|
|
350
|
+ err := service.PatientWriteDB().Create(ºodel).Error
|
|
351
|
+ return err
|
|
352
|
+}
|
|
353
|
+
|
|
354
|
+func QueryOrdeModelByID(orgid int64)(models.SgjPatientOrdmodel,error) {
|
|
355
|
+ ordmodel := models.SgjPatientOrdmodel{}
|
|
356
|
+ err := service.PatientReadDB().Where("user_org_id = ? AND status = ? ", orgid, 1).Last(ºodel).Error
|
|
357
|
+ return ordmodel,err
|
|
358
|
+}
|
|
359
|
+
|
|
360
|
+func DeleteModle(orgid int64,id int64)(error) {
|
|
361
|
+ err := service.PatientWriteDB().Model(models.SgjPatientOrdmodel{}).Where("user_org_id = ? AND id = ?", orgid, id).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
|
|
362
|
+ return err
|
|
363
|
+}
|
|
364
|
+
|
|
365
|
+func DeleteModleByModeID(orgid int64,mid int64)(error) {
|
|
366
|
+ err := service.PatientWriteDB().Model(models.SgjPatientConnectway{}).Where("user_org_id = ? AND mode_id = ?", orgid, mid).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
|
|
367
|
+ return err
|
|
368
|
+}
|
|
369
|
+
|
|
370
|
+func GetOrederModel(orgid int64)(model []*models.SgjPatientOrdmodel,err error) {
|
|
371
|
+ db := service.PatientReadDB().Table("sgj_patient_ordmodel as o").Where("o.status = ?", 1)
|
|
372
|
+ if(orgid > 0){
|
|
373
|
+ db = db.Where("user_org_id = ?", orgid)
|
|
374
|
+ }
|
|
375
|
+ err = db.Preload("Connectway").Preload("Worktime").Preload("Rideway").
|
|
376
|
+ Select("o.id,o.title,o.sort,o.ctime,o.mtime,o.mode_type").Order("sort").Find(&model).Error
|
|
377
|
+ fmt.Println("sql错误是什么",err)
|
238
|
378
|
return
|
|
379
|
+
|
239
|
380
|
}
|
240
|
381
|
|
|
382
|
+//func GetData(orgid int64)(model []*models.SgjPatientModel,err error) {
|
|
383
|
+// db := service.PatientReadDB().Table("sgj_patient_model as m").Where(" m.status = ?", 1)
|
|
384
|
+// if(orgid > 0){
|
|
385
|
+// db = db.Where("user_org_id = ? ", orgid)
|
|
386
|
+// }
|
|
387
|
+// err = db.Preload("Hospitals").Preload("Offices").Preload("Doctors").Preload("OfficeEnviroment").Preload("Editdoctor").
|
|
388
|
+// Select("m.id,m.title,m.sort,m.ctime,m.mtime,m.user_org_id,m.status,m.mode_type").Order("sort").Find(&model).Error
|
|
389
|
+// return
|
|
390
|
+//}
|
241
|
391
|
|