|
@@ -19,12 +19,27 @@ func QueryModel(orgID int64)( models.SgjPatientModel,error) {
|
19
|
19
|
return model,err
|
20
|
20
|
}
|
21
|
21
|
|
|
22
|
+func UpdateEditpicLink(orgID int64,ids[] int64,editpiclink models.SgjPatientEditpiclink)(err error) {
|
|
23
|
+ if(len(ids)==1){
|
|
24
|
+ err = service.PatientWriteDB().Model(&models.SgjPatientEditpiclink{}).Where("id = ? AND user_org_id = ? ", ids[0], orgID).Update(map[string]interface{}{"modeid": editpiclink.Modeid, "status": 1,"img_show":0, "mtime": time.Now().Unix()}).Error
|
|
25
|
+ }else {
|
|
26
|
+ err = service.PatientWriteDB().Model(&models.SgjPatientEditpiclink{}).Where("id IN(?) and user_org_id = ? ", ids, orgID).Update(map[string]interface{}{"modeid": editpiclink.Modeid, "status": 1,"img_show":0, "mtime": time.Now().Unix()}).Error
|
|
27
|
+ }
|
|
28
|
+ return
|
|
29
|
+}
|
|
30
|
+
|
22
|
31
|
func AddRotation(rotation models.SgjPatientRotation) error {
|
23
|
32
|
err := service.PatientWriteDB().Create(&rotation).Error
|
24
|
33
|
fmt.Println("插入数据",err)
|
25
|
34
|
return err
|
26
|
35
|
}
|
27
|
36
|
|
|
37
|
+func GetRotationByLastData(orgid int64)(models.SgjPatientRotation,error) {
|
|
38
|
+ rotation := models.SgjPatientRotation{}
|
|
39
|
+ err := service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgid, 1).Last(&rotation).Error
|
|
40
|
+ return rotation,err
|
|
41
|
+}
|
|
42
|
+
|
28
|
43
|
func AddRotationUpload(connecmodel *models.SgjPatientConnecmodel) error {
|
29
|
44
|
err := service.PatientWriteDB().Create(&connecmodel).Error
|
30
|
45
|
fmt.Println("错误是什么,err",err)
|
|
@@ -51,6 +66,11 @@ func AddDoctorInfo(doctor models.SgjPatientEditdoctor) error{
|
51
|
66
|
return err
|
52
|
67
|
}
|
53
|
68
|
|
|
69
|
+func AddImages(enviroimages *models.SgjPatientEnviroimages) error {
|
|
70
|
+ err := service.PatientWriteDB().Create(&enviroimages).Error
|
|
71
|
+ return err
|
|
72
|
+}
|
|
73
|
+
|
54
|
74
|
func AddOffEnvironment(officenviroment models.SgjPatientOffenvironment) error {
|
55
|
75
|
err := service.PatientWriteDB().Create(&officenviroment).Error
|
56
|
76
|
return err
|
|
@@ -236,6 +256,7 @@ func GetHospital(Orgid int64)(hostital []*models.SgjPatientHospital,err error)
|
236
|
256
|
|
237
|
257
|
func GetData(orgid int64)(model []*models.SgjPatientModel,err error) {
|
238
|
258
|
db := service.PatientReadDB().Table("sgj_patient_model as m").Where(" m.status = ?", 1)
|
|
259
|
+ fmt.Println("db是什么?",db)
|
239
|
260
|
if(orgid > 0){
|
240
|
261
|
db = db.Where("user_org_id = ? ", orgid)
|
241
|
262
|
}
|
|
@@ -293,9 +314,20 @@ func QuerOfficeEnviroment(id int64,orgid int64)(models.SgjPatientOffenvironment,
|
293
|
314
|
return offenvironment,err
|
294
|
315
|
}
|
295
|
316
|
|
296
|
|
-func UpdateOfficeEnvironment(id int64,orgid int64,offenvironment models.SgjPatientOffenvironment) error {
|
|
317
|
+func QueryOfficeformById(modeid int64,orgid int64)(patientenviroimages []*models.SgjPatientEnviroimages,err error) {
|
|
318
|
+ err = service.PatientReadDB().Model(&patientenviroimages).Where("modeid = ? AND user_org_id = ? AND status = ?", modeid, orgid, 1).Find(&patientenviroimages).Error
|
|
319
|
+ return
|
|
320
|
+}
|
|
321
|
+
|
|
322
|
+func UpdateOfficeEnvironment(id int64,orgid int64)(models.SgjPatientOffenvironment,error) {
|
|
323
|
+ offenvironment := models.SgjPatientOffenvironment{}
|
297
|
324
|
err := service.PatientReadDB().Model(&offenvironment).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Find(&offenvironment).Error
|
298
|
|
- return err
|
|
325
|
+ return offenvironment , err
|
|
326
|
+}
|
|
327
|
+
|
|
328
|
+func UpdatePatientOffenvironment(id int64,orgid int64,offenvironment models.SgjPatientOffenvironment)(error) {
|
|
329
|
+ err := service.PatientWriteDB().Model(offenvironment).Where("id= ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"title": offenvironment.Title, "sort": offenvironment.Sort, "keimages": offenvironment.Keimages, "mtime": time.Now().Unix()}).Error
|
|
330
|
+ return err
|
299
|
331
|
}
|
300
|
332
|
|
301
|
333
|
func QueryHispitalDetail(orgid int64,id int64)(models.SgjPatientHospital,error) {
|
|
@@ -314,6 +346,11 @@ func GetDoctorDetail(orgid int64,id int64)(editdoctor []*models.SgjPatientEditdo
|
314
|
346
|
err = service.PatientReadDB().Model(&editdoctor).Where("user_org_id = ? AND modleid = ? AND status = ?", orgid, id, 1).Order("doc_sort").Find(&editdoctor).Error
|
315
|
347
|
return
|
316
|
348
|
}
|
|
349
|
+func GetOfficEnviromentDetail(orgid int64,id int64)(models.SgjPatientOffenvironment,error) {
|
|
350
|
+ offenvironment := models.SgjPatientOffenvironment{}
|
|
351
|
+ err := service.PatientReadDB().Model(&offenvironment).Where("user_org_id = ? AND modelid = ? AND status = ?", orgid, id, 1).Order("sort").Find(&offenvironment).Error
|
|
352
|
+ return offenvironment,err
|
|
353
|
+}
|
317
|
354
|
|
318
|
355
|
func AddNavigation(navigation *models.SgjPatientNavigation)error {
|
319
|
356
|
err := service.PatientWriteDB().Create(&navigation).Error
|
|
@@ -364,6 +401,16 @@ func QueryOrdeModelByID(orgid int64)(models.SgjPatientOrdmodel,error) {
|
364
|
401
|
return ordmodel,err
|
365
|
402
|
}
|
366
|
403
|
|
|
404
|
+func UpdateConrotaions(orgid int64,ids[] int64,conrotation models.SgjPatientConrotation)(err error) {
|
|
405
|
+ if(len(ids)==1){
|
|
406
|
+ err = service.PatientWriteDB().Model(&models.SgjPatientConrotation{}).Where("id = ? and user_org_id = ?", ids[0], orgid).Update(map[string]interface{}{"modeid": conrotation.Modeid, "status": 1, "mtime": time.Now().Unix()}).Error
|
|
407
|
+ }else {
|
|
408
|
+ err = service.PatientWriteDB().Model(&models.SgjPatientConrotation{}).Where("id IN(?) and user_org_id = ?", ids, orgid).Update(map[string]interface{}{"modeid": conrotation.Modeid, "status": 1, "mtime": time.Now().Unix()}).Error
|
|
409
|
+ }
|
|
410
|
+ return
|
|
411
|
+}
|
|
412
|
+
|
|
413
|
+
|
367
|
414
|
func DeleteModle(orgid int64,id int64)(error) {
|
368
|
415
|
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
|
369
|
416
|
return err
|
|
@@ -392,7 +439,7 @@ func AddRotationpic(conrotation models.SgjPatientConrotation) error {
|
392
|
439
|
}
|
393
|
440
|
|
394
|
441
|
func GetRotationImages(orgid int64)(conrotation []models.SgjPatientConrotation,err error) {
|
395
|
|
- err = service.PatientReadDB().Model(&conrotation).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&conrotation).Error
|
|
442
|
+ err = service.PatientReadDB().Model(&conrotation).Where("user_org_id = ? AND status = ? AND img_show = ?", orgid, 1,1).Find(&conrotation).Error
|
396
|
443
|
return conrotation,err
|
397
|
444
|
}
|
398
|
445
|
|
|
@@ -401,13 +448,48 @@ func AddrotationImage(oldrotation *models.SgjPatientOldrotation) error {
|
401
|
448
|
return err
|
402
|
449
|
}
|
403
|
450
|
|
|
451
|
+func UpdateConrotation(orgid int64,ids[] int64,conrotation models.SgjPatientConrotation)(err error) {
|
|
452
|
+ if(len(ids)==1){
|
|
453
|
+ err = service.PatientWriteDB().Model(&models.SgjPatientConrotation{}).Where("id = ? AND user_org_id = ?", ids[0], orgid).Update(map[string]interface{}{"modeid": conrotation.Modeid, "status": 1, "img_show": 0, "mtime": time.Now().Unix()}).Error
|
|
454
|
+ }else {
|
|
455
|
+ err = service.PatientWriteDB().Model(&models.SgjPatientConrotation{}).Where("id IN(?) and user_org_id = ?", ids, orgid).Update(map[string]interface{}{"modeid": conrotation.Modeid, "status": 1, "img_show": 0, "mtime": time.Now().Unix()}).Error
|
|
456
|
+ }
|
|
457
|
+ return
|
|
458
|
+}
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
|
404
|
462
|
func AddImageslink(editpiclink *models.SgjPatientEditpiclink) error {
|
405
|
463
|
err := service.PatientWriteDB().Create(&editpiclink).Error
|
406
|
464
|
return err
|
407
|
465
|
}
|
|
466
|
+func GetEnImages(orgid int64)(enviroimages []models.SgjPatientEnviroimages,err error) {
|
|
467
|
+ err = service.PatientReadDB().Model(&enviroimages).Where("user_org_id = ? AND status = ?", orgid, 1).Order("sort").Find(&enviroimages).Error
|
|
468
|
+ return enviroimages,err
|
|
469
|
+}
|
|
470
|
+
|
|
471
|
+func UpdateImages(orgid int64,ids [] int64,enviroimages models.SgjPatientEnviroimages)(err error) {
|
|
472
|
+ if(len(ids)==1){
|
|
473
|
+ err = service.PatientWriteDB().Model(&models.SgjPatientEnviroimages{}).Where("id = ? AND user_org_id = ?", ids[0], orgid).Update(map[string]interface{}{"modeid": enviroimages.Modeid, "status": 1, "mtime": time.Now().Unix()}).Error
|
|
474
|
+ }else {
|
|
475
|
+ err = service.PatientWriteDB().Model(&models.SgjPatientEnviroimages{}).Where("id IN(?) and user_org_id = ?", ids, orgid).Update(map[string]interface{}{"modeid": enviroimages.Modeid, "status": 1, "mtime": time.Now().Unix()}).Error
|
|
476
|
+ }
|
|
477
|
+ return
|
|
478
|
+}
|
|
479
|
+
|
|
480
|
+func GetEditEnvirimagesById(orgid int64,id int64)(models.SgjPatientEnviroimages,error) {
|
|
481
|
+ enviroimages := models.SgjPatientEnviroimages{}
|
|
482
|
+ err := service.PatientReadDB().Model(&enviroimages).Where("user_org_id = ? AND id =? AND status = ?", orgid, id, 1).Find(&enviroimages).Error
|
|
483
|
+ return enviroimages,err
|
|
484
|
+}
|
|
485
|
+
|
|
486
|
+func UpdateEnviroimages(id int64,orgid int64,enviroimages models.SgjPatientEnviroimages)( err error) {
|
|
487
|
+ err = service.PatientReadDB().Model(&enviroimages).Where("id = ? AND user_org_id = ? AND status =?", id, orgid, 1).Update(map[string]interface{}{"enviroimages": enviroimages.Enviroimages, "sort": enviroimages.Sort, "mtime": time.Now().Unix()}).Error
|
|
488
|
+ return err
|
|
489
|
+}
|
408
|
490
|
|
409
|
491
|
func GetEditImages(orgid int64)(editpiclink []models.SgjPatientEditpiclink,err error) {
|
410
|
|
- err = service.PatientReadDB().Model(&editpiclink).Where("user_org_id = ? AND status = ?",orgid,1).Find(&editpiclink).Error
|
|
492
|
+ err = service.PatientReadDB().Model(&editpiclink).Where("user_org_id = ? AND status = ? AND img_show = ?",orgid,1,1).Find(&editpiclink).Error
|
411
|
493
|
return editpiclink,err
|
412
|
494
|
}
|
413
|
495
|
|
|
@@ -417,7 +499,7 @@ func AddMagicNavi(editmargin *models.SgjPatientEditmargin) error {
|
417
|
499
|
}
|
418
|
500
|
|
419
|
501
|
func GetMagicImages(orgid int64)( editmargin []models.SgjPatientEditmargin,err error) {
|
420
|
|
- err = service.PatientReadDB().Model(&editmargin).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&editmargin).Error
|
|
502
|
+ err = service.PatientReadDB().Model(&editmargin).Where("user_org_id = ? AND status = ? AND img_show = ?", orgid, 1,1).Find(&editmargin).Error
|
421
|
503
|
return editmargin,err
|
422
|
504
|
}
|
423
|
505
|
|
|
@@ -458,7 +540,373 @@ func DeleteImages(id int64,orgid int64)(error) {
|
458
|
540
|
err := service.PatientWriteDB().Model(models.SgjPatientConrotation{}).Where("id = ? AND user_org_id = ?", id, orgid).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
|
459
|
541
|
return err
|
460
|
542
|
}
|
|
543
|
+func DeleteSingleImages(id int64,orgid int64) (error) {
|
|
544
|
+ err := service.PatientWriteDB().Model(models.SgjPatientEditpiclink{}).Where("id = ? AND user_org_id = ?", id, orgid).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
|
|
545
|
+ return err
|
|
546
|
+}
|
461
|
547
|
|
|
548
|
+func AddActivity(addactivity *models.SgjPatientAddactivity) error {
|
|
549
|
+
|
|
550
|
+ err := service.PatientWriteDB().Create(&addactivity).Error
|
|
551
|
+ return err
|
|
552
|
+}
|
|
553
|
+
|
|
554
|
+func QueryActivity(id int64,orgid int64)(models.SgjPatientAddactivity,error) {
|
|
555
|
+ addactivity := models.SgjPatientAddactivity{}
|
|
556
|
+ err := service.PatientReadDB().Model(addactivity).Where("modeid = ? AND user_org_id = ?", id, orgid).Find(&addactivity).Error
|
|
557
|
+ return addactivity,err
|
|
558
|
+}
|
|
559
|
+
|
|
560
|
+func UpdateActivit(id int64,orgid int64,addactivity models.SgjPatientAddactivity) error {
|
|
561
|
+
|
|
562
|
+ err := service.PatientWriteDB().Model(addactivity).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"title": addactivity.Title, "sort": addactivity.Sort, "number": addactivity.Number, "mtime":time.Now().Unix()}).Error
|
|
563
|
+ return err
|
|
564
|
+}
|
462
|
565
|
|
|
566
|
+func DeleteMargin(id int64,orgid int64)(error) {
|
|
567
|
+ err := service.PatientWriteDB().Model(models.SgjPatientEditmargin{}).Where("id = ? AND user_org_id = ?", id, orgid).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
|
|
568
|
+ return err
|
|
569
|
+}
|
|
570
|
+
|
|
571
|
+func GetEditRotationImages(id int64,orgid int64)(models.SgjPatientOldrotation,error) {
|
|
572
|
+ oldrotation := models.SgjPatientOldrotation{}
|
|
573
|
+ err := service.PatientReadDB().Model(oldrotation).Where("mode_id = ? AND user_org_id = ?", id, orgid).Find(&oldrotation).Error
|
|
574
|
+ return oldrotation,err
|
|
575
|
+}
|
|
576
|
+
|
|
577
|
+func GetEditConrotion(id int64,orgid int64)(conrotation []models.SgjPatientConrotation, err error) {
|
|
578
|
+ err = service.PatientReadDB().Model(conrotation).Where("modeid = ? AND user_org_id = ?", id, orgid).Find(&conrotation).Error
|
|
579
|
+ return conrotation,err
|
|
580
|
+}
|
|
581
|
+
|
|
582
|
+func EditVisibleById(id int64,orgid int64)(models.SgjPatientConrotation,error) {
|
|
583
|
+ conrotation := models.SgjPatientConrotation{}
|
|
584
|
+ err := service.PatientReadDB().Model(conrotation).Where("id = ? AND user_org_id = ?", id, orgid).Find(&conrotation).Error
|
|
585
|
+ return conrotation,err
|
|
586
|
+}
|
|
587
|
+
|
|
588
|
+func UpdateEditpic(id int64,orgid int64,conrotation models.SgjPatientConrotation) error {
|
|
589
|
+ err := service.PatientWriteDB().Model(conrotation).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"images": conrotation.Images, "sort": conrotation.Sort, "piclink": conrotation.Piclink, "linkaddress": conrotation.Linkaddress}).Error
|
|
590
|
+ return err
|
|
591
|
+}
|
|
592
|
+
|
|
593
|
+func GetPatientConrotationLast(orgid int64)( models.SgjPatientConrotation,error){
|
|
594
|
+ conrotation := models.SgjPatientConrotation{}
|
|
595
|
+ err := service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgid, 1).Last(&conrotation).Error
|
|
596
|
+ return conrotation,err
|
|
597
|
+}
|
|
598
|
+func UpdateConLinkAddress(orgid int64,conid int64,conlinkaddress models.SgjPatientConlinkaddress) error {
|
|
599
|
+ err := service.PatientWriteDB().Model(&conlinkaddress).Where("user_org_id = ? and status = ? and con_id = ?", orgid, 1, conid).Update(map[string]interface{}{"con_id": conlinkaddress.ConId, "mtime": time.Now().Unix()}).Error
|
|
600
|
+ return err
|
|
601
|
+}
|
|
602
|
+
|
|
603
|
+func AddEditpic(conrotation *models.SgjPatientConrotation)(error) {
|
|
604
|
+
|
|
605
|
+ err := service.PatientWriteDB().Create(&conrotation).Error
|
|
606
|
+ return err
|
|
607
|
+}
|
|
608
|
+
|
|
609
|
+func QueryOldrotion(id int64,orgid int64)(models.SgjPatientOldrotation,error) {
|
|
610
|
+ conrotation := models.SgjPatientOldrotation{}
|
|
611
|
+ err := service.PatientReadDB().Model(conrotation).Where("id = ? AND user_org_id = ? ", id, orgid).Find(&conrotation).Error
|
|
612
|
+ return conrotation,err
|
|
613
|
+
|
|
614
|
+}
|
|
615
|
+
|
|
616
|
+func UpdateConrotaionById(id int64,orgid int64,oldrotation models.SgjPatientOldrotation)(error) {
|
|
617
|
+
|
|
618
|
+ err := service.PatientWriteDB().Model(oldrotation).Where("id = ? AND user_org_id =? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"title": oldrotation.Title, "sort": oldrotation.Sort, "rotation_images": oldrotation.RotationImages, "mtime": time.Now().Unix()}).Error
|
|
619
|
+ return err
|
|
620
|
+}
|
|
621
|
+
|
|
622
|
+func GetPatientRotaion(id int64,orgid int64)(models.SgjPatientRotation,error) {
|
|
623
|
+ rotation := models.SgjPatientRotation{}
|
|
624
|
+ err := service.PatientReadDB().Model(&rotation).Where("model_id = ? AND user_org_id = ?", id, orgid).Find(&rotation).Error
|
|
625
|
+ return rotation,err
|
|
626
|
+}
|
|
627
|
+
|
|
628
|
+func GetPatientRotationById(id int64,orgid int64)(models.SgjPatientRotation,error) {
|
|
629
|
+ rotation := models.SgjPatientRotation{}
|
|
630
|
+ err := service.PatientReadDB().Model(&rotation).Where("id = ? AND user_org_id =?", id, orgid).Find(&rotation).Error
|
|
631
|
+ return rotation,err
|
|
632
|
+}
|
|
633
|
+
|
|
634
|
+func QueryEditpiclink(id int64,orgid int64)(editpiclink []models.SgjPatientEditpiclink,err error) {
|
|
635
|
+ err = service.PatientReadDB().Model(editpiclink).Where("modeid = ? AND user_org_id = ?", id, orgid).Find(&editpiclink).Error
|
|
636
|
+ return editpiclink,err
|
|
637
|
+}
|
|
638
|
+
|
|
639
|
+func GetEditSingleVisible(id int64,orgid int64)(models.SgjPatientEditpiclink,error) {
|
|
640
|
+ editpiclink := models.SgjPatientEditpiclink{}
|
|
641
|
+ err := service.PatientReadDB().Model(&editpiclink).Where("id = ? AND user_org_id = ?", id, orgid).Find(&editpiclink).Error
|
|
642
|
+ return editpiclink,err
|
|
643
|
+}
|
|
644
|
+
|
|
645
|
+func GetQueryEditpiclink(id int64,orgid int64)(editpiclink []models.SgjPatientEditpiclink,err error) {
|
|
646
|
+ err = service.PatientReadDB().Model(&editpiclink).Where("id=? AND user_org_id = ?", id, orgid).Find(&editpiclink).Error
|
|
647
|
+ return editpiclink,err
|
|
648
|
+
|
|
649
|
+}
|
|
650
|
+
|
|
651
|
+func UpdateEditPatPicLink(id int64,orgid int64,editpiclink models.SgjPatientEditpiclink)(error) {
|
|
652
|
+
|
|
653
|
+ err := service.PatientWriteDB().Model(editpiclink).Where("id = ? AND user_org_id =? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"images": editpiclink.Images, "sort": editpiclink.Sort, "piclink": editpiclink.Piclink, "linkaddress": editpiclink.Linkaddress, "mtime": time.Now().Unix()}).Error
|
|
654
|
+ return err
|
|
655
|
+}
|
|
656
|
+
|
|
657
|
+func GetPatientRotations(id int64,orgid int64)(models.SgjPatientRotation,error) {
|
|
658
|
+ rotation := models.SgjPatientRotation{}
|
|
659
|
+ err := service.PatientReadDB().Model(&rotation).Where("id = ? AND user_org_id = ?", id, orgid).Find(&rotation).Error
|
|
660
|
+ return rotation,err
|
|
661
|
+}
|
|
662
|
+
|
|
663
|
+func UpdateRotationByid(id int64,orgid int64,rotation models.SgjPatientRotation)(error) {
|
|
664
|
+ err := service.PatientWriteDB().Model(rotation).Where("id=? AND user_org_id = ? AND status =?", id, orgid, 1).Update(map[string]interface{}{"title": rotation.Title, "sort": rotation.Sort, "rotation_images": rotation.RotationImages, "mtime": time.Now().Unix()}).Error
|
|
665
|
+ return err
|
|
666
|
+}
|
|
667
|
+
|
|
668
|
+func UpdateModelById(id int64,orgid int64,model models.SgjPatientModel) error {
|
|
669
|
+ err := service.PatientWriteDB().Model(model).Where("id=? AND user_org_id =? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"title": model.Title, "sort": model.Sort, "mtime": time.Now().Unix()}).Error
|
|
670
|
+ return err
|
|
671
|
+}
|
|
672
|
+
|
|
673
|
+func QuerEditMarginById(id int64,orgid int64)(models.SgjPatientEditmargin,error) {
|
|
674
|
+ editmargin := models.SgjPatientEditmargin{}
|
|
675
|
+ err := service.PatientReadDB().Model(editmargin).Where("id = ? AND user_org_id =? AND status = ?", id, orgid, 1).Find(&editmargin).Error
|
|
676
|
+ return editmargin,err
|
|
677
|
+}
|
463
|
678
|
|
|
679
|
+func UpdateMarginById(id int64,orgid int64,editmargin models.SgjPatientEditmargin) error {
|
464
|
680
|
|
|
681
|
+ err := service.PatientWriteDB().Model(editmargin).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"margintitle": editmargin.Margtitle, "margimage": editmargin.Margimage, "marginaddress": editmargin.Marginaddress}).Error
|
|
682
|
+
|
|
683
|
+ return err
|
|
684
|
+}
|
|
685
|
+
|
|
686
|
+func GetActivitiesById(orgid int64)(models.SgjPatientAddactivity,error) {
|
|
687
|
+ addactivity := models.SgjPatientAddactivity{}
|
|
688
|
+ err := service.PatientReadDB().Where("user_org_id = ? AND status = ?", orgid, 1).Last(&addactivity).Error
|
|
689
|
+ fmt.Println("查询活动列表错误",err)
|
|
690
|
+ return addactivity,err
|
|
691
|
+}
|
|
692
|
+
|
|
693
|
+func GetAllActivities(orgid int64,limit int64)(activity []models.Activity,err error) {
|
|
694
|
+ err = service.PatientReadDB().Model(activity).Where("user_org_id = ? AND status = ?", orgid, 1).Limit(limit).Find(&activity).Error
|
|
695
|
+ return
|
|
696
|
+}
|
|
697
|
+
|
|
698
|
+func GetArticleType(orgid int64)(category []models.ArticleCategory,err error) {
|
|
699
|
+ err = service.PatientReadDB().Model(category).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&category).Error
|
|
700
|
+ return category,err
|
|
701
|
+}
|
|
702
|
+
|
|
703
|
+func AddActiclelist(articlelist *models.SgjPatientArticlelist)(error) {
|
|
704
|
+
|
|
705
|
+ err := service.PatientWriteDB().Model(articlelist).Create(&articlelist).Error
|
|
706
|
+ return err
|
|
707
|
+}
|
|
708
|
+
|
|
709
|
+func GetArticlelist(orgid int64)(models.SgjPatientArticlelist,error) {
|
|
710
|
+ articlelist := models.SgjPatientArticlelist{}
|
|
711
|
+ err := service.PatientReadDB().Where("user_org_id = ? AND Status = ?", orgid, 1).Last(&articlelist).Error
|
|
712
|
+ fmt.Println("错误",err)
|
|
713
|
+ return articlelist,err
|
|
714
|
+}
|
|
715
|
+
|
|
716
|
+func GetAllArticles(orgid int64,limit int64)(articlelist []models.Articles,err error) {
|
|
717
|
+ err = service.PatientReadDB().Model(articlelist).Where("user_org_id = ? AND Status = ?", orgid, 1).Limit(limit).Find(&articlelist).Error
|
|
718
|
+ return
|
|
719
|
+}
|
|
720
|
+
|
|
721
|
+//func GetAllArticlesDetail(id int64) {
|
|
722
|
+//
|
|
723
|
+//}
|
|
724
|
+
|
|
725
|
+func GetArticlelistById(modeid int64,orgID int64)(models.SgjPatientArticlelist,error) {
|
|
726
|
+ articlelist := models.SgjPatientArticlelist{}
|
|
727
|
+ err := service.PatientReadDB().Model(articlelist).Where("modeid = ? AND user_org_id = ? AND Status = ?", modeid, orgID, 1).Find(&articlelist).Error
|
|
728
|
+ return articlelist,err
|
|
729
|
+}
|
|
730
|
+
|
|
731
|
+func GetAllActivitiById(modeid int64,orgID int64)(models.SgjPatientAddactivity,error) {
|
|
732
|
+ addactivity := models.SgjPatientAddactivity{}
|
|
733
|
+ err := service.PatientReadDB().Model(addactivity).Where("modeid = ? AND user_org_id = ? AND Status = ?", modeid, orgID, 1).Find(&addactivity).Error
|
|
734
|
+ return addactivity,err
|
|
735
|
+}
|
|
736
|
+
|
|
737
|
+func UpdateArticeDetail(id int64,orgid int64,articlelist models.SgjPatientArticlelist)error {
|
|
738
|
+
|
|
739
|
+ err := service.PatientWriteDB().Model(articlelist).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"title": articlelist.Title, "sort": articlelist.Sort, "number": articlelist.Number, "mtime": time.Now().Unix()}).Error
|
|
740
|
+ return err
|
|
741
|
+}
|
|
742
|
+
|
|
743
|
+func GetMacImagesByModeid(modeid int64,orgid int64)(models.SgjPatientMacnavigation,error) {
|
|
744
|
+ macnavigation := models.SgjPatientMacnavigation{}
|
|
745
|
+ err := service.PatientReadDB().Model(macnavigation).Where("modeid = ? AND user_org_id = ? AND status = ?", modeid, orgid, 1).Find(&macnavigation).Error
|
|
746
|
+ return macnavigation,err
|
|
747
|
+}
|
|
748
|
+
|
|
749
|
+func GetModelById(id int64 ,orgid int64)(models.SgjPatientModel,error) {
|
|
750
|
+ model := models.SgjPatientModel{}
|
|
751
|
+ err := service.PatientReadDB().Model(model).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Find(&model).Error
|
|
752
|
+ return model,err
|
|
753
|
+}
|
|
754
|
+
|
|
755
|
+func GetOffENvironmentById(id int64,orgid int64)(models.SgjPatientOffenvironment,error) {
|
|
756
|
+ offenvironment := models.SgjPatientOffenvironment{}
|
|
757
|
+ err := service.PatientReadDB().Model(offenvironment).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Find(&offenvironment).Error
|
|
758
|
+ return offenvironment,err
|
|
759
|
+}
|
|
760
|
+
|
|
761
|
+func AddOfficeThree(enviroimages *models.SgjPatientEnviroimages)(error) {
|
|
762
|
+ err := service.PatientWriteDB().Model(&enviroimages).Create(&enviroimages).Error
|
|
763
|
+ return err
|
|
764
|
+}
|
|
765
|
+func GetOfficeTwoVisible(orgid int64,id int64)(models.SgjPatientEnviroimages,error) {
|
|
766
|
+ enviroimages := models.SgjPatientEnviroimages{}
|
|
767
|
+ err := service.PatientReadDB().Where("user_org_id = ? AND id = ? AND status = ?", orgid, id, 1).Find(&enviroimages).Error
|
|
768
|
+ return enviroimages,err
|
|
769
|
+}
|
|
770
|
+
|
|
771
|
+func UpdateOfficeTwo(orgid int64,id int64,enviroimages models.SgjPatientEnviroimages) error {
|
|
772
|
+ err := service.PatientWriteDB().Model(&enviroimages).Where("user_org_id = ? AND id = ? AND status = ?", orgid, id, 1).Update(map[string]interface{}{"enviroimages": enviroimages.Enviroimages, "sort": enviroimages.Sort, "mtime": time.Now().Unix()}).Error
|
|
773
|
+ return err
|
|
774
|
+}
|
|
775
|
+
|
|
776
|
+func DeleteOfficeById(id int64,orgid int64)(error) {
|
|
777
|
+ err := service.PatientWriteDB().Model(models.SgjPatientEnviroimages{}).Where("id = ? AND user_org_id = ?", id, orgid).Update(map[string]interface{}{"status": 0, "mtime": time.Now().Unix()}).Error
|
|
778
|
+ return err
|
|
779
|
+}
|
|
780
|
+
|
|
781
|
+func GetArticleById(classid int64,orgid int64)(articlelist []models.Articles,err error) {
|
|
782
|
+
|
|
783
|
+ err = service.PatientReadDB().Model(models.Articles{}).Where("class_id = ? AND user_org_id = ? AND status = ?", classid, orgid,1).Find(&articlelist).Error
|
|
784
|
+ return
|
|
785
|
+}
|
|
786
|
+
|
|
787
|
+func GetAllActivity(orgid int64)(activtity []models.Activity,err error) {
|
|
788
|
+
|
|
789
|
+ err = service.PatientReadDB().Model(models.Activity{}).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&activtity).Error
|
|
790
|
+ return
|
|
791
|
+}
|
|
792
|
+
|
|
793
|
+func AddLinkAddress(linkaddress *models.SgjPatientLinkaddress) error {
|
|
794
|
+ err := service.PatientWriteDB().Create(&linkaddress).Error
|
|
795
|
+ return err
|
|
796
|
+}
|
|
797
|
+
|
|
798
|
+func GetLinkAddress(orgid int64)(models.SgjPatientLinkaddress,error) {
|
|
799
|
+
|
|
800
|
+ linkaddress := models.SgjPatientLinkaddress{}
|
|
801
|
+ err := service.PatientReadDB().Model(&linkaddress).Where("user_org_id = ? AND status = ? ", orgid, 1).Last(&linkaddress).Error
|
|
802
|
+ return linkaddress,err
|
|
803
|
+}
|
|
804
|
+
|
|
805
|
+func QuerylinkAddress(id int64,orgid int64)(models.SgjPatientLinkaddress,error) {
|
|
806
|
+ linkaddress := models.SgjPatientLinkaddress{}
|
|
807
|
+ err := service.PatientReadDB().Model(&linkaddress).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Find(&linkaddress).Error
|
|
808
|
+ return linkaddress,err
|
|
809
|
+}
|
|
810
|
+
|
|
811
|
+func GetAllConnecway(orgid int64)(connect []models.SgjPatientConnection,err error) {
|
|
812
|
+ err = service.PatientReadDB().Model(&connect).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&connect).Error
|
|
813
|
+ return
|
|
814
|
+}
|
|
815
|
+
|
|
816
|
+func GetConnecway(orgid int64,id int64)(models.SgjPatientOrdmodel,error) {
|
|
817
|
+ ordmodel := models.SgjPatientOrdmodel{}
|
|
818
|
+ err := service.PatientReadDB().Model(ºodel).Where("user_org_id = ? AND status = ? AND id = ?", orgid, 1,id).Find(ºodel).Error
|
|
819
|
+ return ordmodel,err
|
|
820
|
+}
|
|
821
|
+
|
|
822
|
+func GetConnecwayById(orgid int64,id int64)(models.SgjPatientConnection,error) {
|
|
823
|
+ connection := models.SgjPatientConnection{}
|
|
824
|
+ err := service.PatientReadDB().Model(&connection).Where("user_org_id = ? AND id = ? AND status = ?", orgid, id, 1).Find(&connection).Error
|
|
825
|
+ return connection,err
|
|
826
|
+}
|
|
827
|
+
|
|
828
|
+func UpdateConnectway(id int64,orgid int64,connection models.SgjPatientConnection) error {
|
|
829
|
+ err := service.PatientWriteDB().Model(&connection).Where("id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"title": connection.Title, "connecway": connection.Connecway, "content": connection.Content,"mtime":time.Now().Unix()}).Error
|
|
830
|
+ return err
|
|
831
|
+}
|
|
832
|
+
|
|
833
|
+func AddConnectways(connection *models.SgjPatientConnection) error {
|
|
834
|
+ err := service.PatientWriteDB().Create(&connection).Error
|
|
835
|
+ return err
|
|
836
|
+}
|
|
837
|
+
|
|
838
|
+func UpdateConnectways(id int64,orgid int64,connectway models.SgjPatientConnectway) error {
|
|
839
|
+ err := service.PatientWriteDB().Model(&connectway).Where("mode_id = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"title": connectway.Title, "sort": connectway.Sort, "ctime": time.Now().Unix()}).Error
|
|
840
|
+ return err
|
|
841
|
+}
|
|
842
|
+
|
|
843
|
+func GetHostpitalIntroduction(orgid int64,id int64)(models.SgjPatientOrdmodel,error) {
|
|
844
|
+ ordmodel := models.SgjPatientOrdmodel{}
|
|
845
|
+ err := service.PatientReadDB().Model(ºodel).Where("user_org_id = ? AND id = ? AND status = ?", orgid, id, 1).Find(ºodel).Error
|
|
846
|
+ return ordmodel,err
|
|
847
|
+}
|
|
848
|
+
|
|
849
|
+func GetHostpitaAddress(orgid int64,moid int64)(models.SgjPatientHosaddress,error) {
|
|
850
|
+ hosaddress := models.SgjPatientHosaddress{}
|
|
851
|
+ err := service.PatientReadDB().Model(&hosaddress).Where("user_org_id = ? AND modeid = ? AND status = ?", orgid, moid, 1).Find(&hosaddress).Error
|
|
852
|
+ return hosaddress,err
|
|
853
|
+}
|
|
854
|
+
|
|
855
|
+func UpdateHosAddress(id int64,orgid int64,hosaddress models.SgjPatientHosaddress)error {
|
|
856
|
+ err := service.PatientWriteDB().Model(&hosaddress).Where("modeid = ? AND user_org_id = ? AND status = ?", id, orgid, 1).Update(map[string]interface{}{"title": hosaddress.Title, "sort": hosaddress.Sort, "address": hosaddress.Address, "mtime": time.Now().Unix()}).Error
|
|
857
|
+ return err
|
|
858
|
+}
|
|
859
|
+
|
|
860
|
+func AddPicLinkAddress(conlinkaddress *models.SgjPatientConlinkaddress) error {
|
|
861
|
+ err := service.PatientWriteDB().Create(&conlinkaddress).Error
|
|
862
|
+ return err
|
|
863
|
+}
|
|
864
|
+
|
|
865
|
+func GetConLinkAddressById(orgid int64)(models.SgjPatientConlinkaddress,error) {
|
|
866
|
+ conlinkaddress := models.SgjPatientConlinkaddress{}
|
|
867
|
+ err := service.PatientReadDB().Model(&conlinkaddress).Where("user_org_id = ? AND status = ?", orgid, 1).Last(&conlinkaddress).Error
|
|
868
|
+ return conlinkaddress,err
|
|
869
|
+}
|
|
870
|
+
|
|
871
|
+func GetLinkAddressDetail(orgid int64,conid int64)(models.SgjPatientConlinkaddress,error) {
|
|
872
|
+ conlinkaddress := models.SgjPatientConlinkaddress{}
|
|
873
|
+ err := service.PatientReadDB().Where("user_org_id = ? AND con_id = ? AND status = ?", orgid, conid, 1).Find(&conlinkaddress).Error
|
|
874
|
+ return conlinkaddress,err
|
|
875
|
+}
|
|
876
|
+
|
|
877
|
+func UpdatePicFformThree(orgid int64,id int64,conlinkaddress models.SgjPatientConlinkaddress) error {
|
|
878
|
+
|
|
879
|
+ err := service.PatientReadDB().Model(&conlinkaddress).Where("user_org_id = ? AND id = ? AND status = ?", orgid, id, 1).Update(map[string]interface{}{"linktype": conlinkaddress.Linktype, "linktypetwo": conlinkaddress.Linktypetwo, "linktypethree": conlinkaddress.Linktypethree, "linktypefour": conlinkaddress.Linktypefour,"linkaddress":conlinkaddress.Linkaddress,"defineaddress":conlinkaddress.Defineaddress}).Error
|
|
880
|
+ return err
|
|
881
|
+}
|
|
882
|
+
|
|
883
|
+func GetEnImagesTwo(orgid int64)(editpiclink []models.SgjPatientEditpiclink,err error) {
|
|
884
|
+ err = service.PatientReadDB().Model(&editpiclink).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&editpiclink).Error
|
|
885
|
+ return editpiclink,err
|
|
886
|
+}
|
|
887
|
+
|
|
888
|
+func GetEnImagesThree(orgid int64)(conrotation []models.SgjPatientConrotation,err error) {
|
|
889
|
+ err = service.PatientReadDB().Model(&conrotation).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&conrotation).Error
|
|
890
|
+ return conrotation,err
|
|
891
|
+}
|
|
892
|
+
|
|
893
|
+func AddMagiclinkData(magiclink *models.SgjPatientMagiclink)error {
|
|
894
|
+
|
|
895
|
+ err := service.PatientWriteDB().Create(&magiclink).Error
|
|
896
|
+ return err
|
|
897
|
+}
|
|
898
|
+
|
|
899
|
+func GetMacLinkAddress(orgid int64)(models.SgjPatientMagiclink,error) {
|
|
900
|
+ patientMagiclink := models.SgjPatientMagiclink{}
|
|
901
|
+ err := service.PatientReadDB().Model(&patientMagiclink).Where("user_org_id = ? AND status = ?", orgid, 1).Last(&patientMagiclink).Error
|
|
902
|
+ return patientMagiclink,err
|
|
903
|
+}
|
|
904
|
+
|
|
905
|
+func UpdateEditMagin(orgid int64,ids[] int64,editmargin models.SgjPatientEditmargin)(err error) {
|
|
906
|
+ if(len(ids) == 1){
|
|
907
|
+ err = service.PatientWriteDB().Model(&models.SgjPatientEditmargin{}).Where("id= ? AND user_org_id = ?", ids[0], orgid).Update(map[string]interface{}{"modeid": editmargin.Modeid, "status": 1, "img_show": 0, "mtime": time.Now().Unix()}).Error
|
|
908
|
+ }else {
|
|
909
|
+ err = service.PatientWriteDB().Model(&models.SgjPatientEditmargin{}).Where("id IN(?) and user_org_id = ? ", ids, orgid).Update(map[string]interface{}{"modeid": editmargin.Modeid, "status": 1,"img_show":0, "mtime": time.Now().Unix()}).Error
|
|
910
|
+ }
|
|
911
|
+ return
|
|
912
|
+}
|