Browse Source

Merge branch 'master' of http://git.shengws.com/csx/XT_New

csx 4 years ago
parent
commit
07caad1ee0

+ 2 - 0
.idea/.gitignore View File

@@ -0,0 +1,2 @@
1
+# Default ignored files
2
+/workspace.xml

+ 1 - 1
conf/app.conf View File

@@ -1,5 +1,5 @@
1 1
 appname = 血透
2
-httpport = 9531
2
+httpport = 9529
3 3
 runmode = dev
4 4
 
5 5
 

+ 5 - 0
controllers/device_api_controller.go View File

@@ -572,6 +572,11 @@ func (this *DeviceAPIController) ModifyZone() {
572 572
 	zone.Type = type_
573 573
 	zone.ModifyTime = time.Now().Unix()
574 574
 
575
+	byName, _ := service.GetZoneByNameOne(name, adminInfo.CurrentOrgId)
576
+	if byName.ID > 0 && byName.ID != id {
577
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
578
+		return
579
+	}
575 580
 	updateErr := service.UpdateDeviceZone(zone)
576 581
 	if updateErr != nil {
577 582
 		this.ErrorLog("修改设备分区失败:%v", updateErr)

+ 2 - 0
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go View File

@@ -2353,6 +2353,7 @@ func (this *NewDialysisApiController) UpdateGroup() {
2353 2353
 	name := this.GetString("name")
2354 2354
 	byName, _ := service.GetGroupByNameOne(name, orgid)
2355 2355
 	if byName.ID > 0 && byName.ID != id {
2356
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2356 2357
 		return
2357 2358
 	}
2358 2359
 	group := models.DeviceGroup{Name: name}
@@ -2397,6 +2398,7 @@ func (this *NewDialysisApiController) UpdatedBed() {
2397 2398
 	BedName, _ := service.GetBedByNameOne(name, orgId)
2398 2399
 	fmt.Println("-----", BedName.ID)
2399 2400
 	if BedName.ID > 0 && BedName.ID != id {
2401
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2400 2402
 		return
2401 2403
 	}
2402 2404
 	number := models.DeviceNumber{

+ 110 - 79
controllers/patient_api_controller.go View File

@@ -62,6 +62,7 @@ func PatientApiRegistRouters() {
62 62
 	beego.Router("/api/infectious/remind", &PatientApiController{}, "Get:GetRemindPatientList")
63 63
 
64 64
 	beego.Router("/api/remind/is_open", &PatientApiController{}, "Post:PostIsOpenRemind")
65
+	beego.Router("/api/patients/advices/getpatientschedules", &PatientApiController{}, "Get:GetPatientScheduleOne")
65 66
 
66 67
 }
67 68
 
@@ -243,29 +244,29 @@ func (c *PatientApiController) CreatePatient() {
243 244
 	//获取老表的最后一条数据
244 245
 	patients, err := service.GetLastPatientData(adminUserInfo.CurrentOrgId)
245 246
 	patientsNew := models.XtPatientsNew{
246
-		UserOrgId:          adminUserInfo.CurrentOrgId,
247
-		UserId:             0,
248
-		Avatar:             patients.Avatar,
249
-		PatientType:        patients.PatientType,
250
-		DialysisNo:         patients.DialysisNo,
251
-		AdmissionNumber:    patients.AdmissionNumber,
252
-		Source:             patients.Source,
253
-		Lapseto:            patients.Lapseto,
254
-		PartitionId:        patients.PartitionId,
255
-		BedId:              patients.BedId,
256
-		Name:               patients.Name,
257
-		Alias:              patients.Alias,
258
-		Gender:             patients.Gender,
259
-		MaritalStatus:      patients.MaritalStatus,
260
-		IdCardNo:           patients.IdCardNo,
261
-		Birthday:           patients.Birthday,
262
-		ReimbursementWayId: patients.ReimbursementWayId,
263
-		HealthCareType:     patients.HealthCareType,
264
-		HealthCareNo:       patients.HealthCareNo,
265
-		HealthCareDueDate:  patients.HealthCareDueDate,
266
-		Height:             patients.Height,
267
-		BloodType:          patients.BloodType,
268
-		Rh:                 patients.Rh,
247
+		UserOrgId:                    adminUserInfo.CurrentOrgId,
248
+		UserId:                       0,
249
+		Avatar:                       patients.Avatar,
250
+		PatientType:                  patients.PatientType,
251
+		DialysisNo:                   patients.DialysisNo,
252
+		AdmissionNumber:              patients.AdmissionNumber,
253
+		Source:                       patients.Source,
254
+		Lapseto:                      patients.Lapseto,
255
+		PartitionId:                  patients.PartitionId,
256
+		BedId:                        patients.BedId,
257
+		Name:                         patients.Name,
258
+		Alias:                        patients.Alias,
259
+		Gender:                       patients.Gender,
260
+		MaritalStatus:                patients.MaritalStatus,
261
+		IdCardNo:                     patients.IdCardNo,
262
+		Birthday:                     patients.Birthday,
263
+		ReimbursementWayId:           patients.ReimbursementWayId,
264
+		HealthCareType:               patients.HealthCareType,
265
+		HealthCareNo:                 patients.HealthCareNo,
266
+		HealthCareDueDate:            patients.HealthCareDueDate,
267
+		Height:                       patients.Height,
268
+		BloodType:                    patients.BloodType,
269
+		Rh:                           patients.Rh,
269 270
 		HealthCareDueAlertDate:       patients.HealthCareDueAlertDate,
270 271
 		EducationLevel:               patients.EducationLevel,
271 272
 		Profession:                   patients.Profession,
@@ -311,27 +312,27 @@ func (c *PatientApiController) CreatePatient() {
311 312
 		Nation:                       patients.Nation,
312 313
 		NativePlace:                  patients.NativePlace,
313 314
 		Age:                          patients.Age,
314
-		InfectiousNextRecordTime: patients.InfectiousNextRecordTime,
315
-		IsInfectious:             patients.IsInfectious,
316
-		RemindCycle:              patients.RemindCycle,
317
-		ResponseResult:           patients.ResponseResult,
318
-		IsOpenRemind:             patients.IsOpenRemind,
319
-		FirstTreatmentDate:       patients.FirstTreatmentDate,
320
-		DialysisAge:              patients.DialysisAge,
321
-		ExpenseKind:              patients.ExpenseKind,
322
-		TellPhone:                patients.TellPhone,
323
-		ContactName:              patients.ContactName,
324
-		BloodPatients:            1,
325
-		SlowPatients:             0,
326
-		MemberPatients:           0,
327
-		EcommerPatients:          "",
328
-		BloodId:                  patients.ID,
329
-		SlowId:                   0,
330
-		MemberId:                 0,
331
-		MemberFistdate:           0,
332
-		MemberPatienttype:        0,
333
-		MemberTreatement:         0,
334
-		EquitmentId:              "",
315
+		InfectiousNextRecordTime:     patients.InfectiousNextRecordTime,
316
+		IsInfectious:                 patients.IsInfectious,
317
+		RemindCycle:                  patients.RemindCycle,
318
+		ResponseResult:               patients.ResponseResult,
319
+		IsOpenRemind:                 patients.IsOpenRemind,
320
+		FirstTreatmentDate:           patients.FirstTreatmentDate,
321
+		DialysisAge:                  patients.DialysisAge,
322
+		ExpenseKind:                  patients.ExpenseKind,
323
+		TellPhone:                    patients.TellPhone,
324
+		ContactName:                  patients.ContactName,
325
+		BloodPatients:                1,
326
+		SlowPatients:                 0,
327
+		MemberPatients:               0,
328
+		EcommerPatients:              "",
329
+		BloodId:                      patients.ID,
330
+		SlowId:                       0,
331
+		MemberId:                     0,
332
+		MemberFistdate:               0,
333
+		MemberPatienttype:            0,
334
+		MemberTreatement:             0,
335
+		EquitmentId:                  "",
335 336
 	}
336 337
 
337 338
 	err = service.CreatePatientsNew(&patientsNew)
@@ -459,29 +460,29 @@ func (c *PatientApiController) EditPatient() {
459 460
 	}
460 461
 	fmt.Println("病人--------------------------------------------------------------", patient.Name, patient.Age)
461 462
 	patientsNew := models.XtPatientsNew{
462
-		UserOrgId:          patient.UserOrgId,
463
-		UserId:             patient.UserId,
464
-		Avatar:             patient.Avatar,
465
-		PatientType:        patient.PatientType,
466
-		DialysisNo:         patient.DialysisNo,
467
-		AdmissionNumber:    patient.AdmissionNumber,
468
-		Source:             patient.Source,
469
-		Lapseto:            patient.Lapseto,
470
-		PartitionId:        patient.PartitionId,
471
-		BedId:              patient.BedId,
472
-		Name:               patient.Name,
473
-		Alias:              patient.Alias,
474
-		Gender:             patient.Gender,
475
-		MaritalStatus:      patient.MaritalStatus,
476
-		IdCardNo:           patient.IdCardNo,
477
-		Birthday:           patient.Birthday,
478
-		ReimbursementWayId: patient.ReimbursementWayId,
479
-		HealthCareType:     patient.HealthCareType,
480
-		HealthCareNo:       patient.HealthCareNo,
481
-		HealthCareDueDate:  patient.HealthCareDueDate,
482
-		Height:             patient.Height,
483
-		BloodType:          patient.BloodType,
484
-		Rh:                 patient.Rh,
463
+		UserOrgId:                 patient.UserOrgId,
464
+		UserId:                    patient.UserId,
465
+		Avatar:                    patient.Avatar,
466
+		PatientType:               patient.PatientType,
467
+		DialysisNo:                patient.DialysisNo,
468
+		AdmissionNumber:           patient.AdmissionNumber,
469
+		Source:                    patient.Source,
470
+		Lapseto:                   patient.Lapseto,
471
+		PartitionId:               patient.PartitionId,
472
+		BedId:                     patient.BedId,
473
+		Name:                      patient.Name,
474
+		Alias:                     patient.Alias,
475
+		Gender:                    patient.Gender,
476
+		MaritalStatus:             patient.MaritalStatus,
477
+		IdCardNo:                  patient.IdCardNo,
478
+		Birthday:                  patient.Birthday,
479
+		ReimbursementWayId:        patient.ReimbursementWayId,
480
+		HealthCareType:            patient.HealthCareType,
481
+		HealthCareNo:              patient.HealthCareNo,
482
+		HealthCareDueDate:         patient.HealthCareDueDate,
483
+		Height:                    patient.Height,
484
+		BloodType:                 patient.BloodType,
485
+		Rh:                        patient.Rh,
485 486
 		HealthCareDueAlertDate:    patient.HealthCareDueAlertDate,
486 487
 		EducationLevel:            patient.EducationLevel,
487 488
 		Profession:                patient.Profession,
@@ -523,17 +524,17 @@ func (c *PatientApiController) EditPatient() {
523 524
 		Nation:                    patient.Nation,
524 525
 		NativePlace:               patient.NativePlace,
525 526
 		Age:                       patient.Age,
526
-		InfectiousNextRecordTime: patient.InfectiousNextRecordTime,
527
-		IsInfectious:             patient.IsInfectious,
528
-		RemindCycle:              patient.RemindCycle,
529
-		ResponseResult:           patient.ResponseResult,
530
-		IsOpenRemind:             patient.IsOpenRemind,
531
-		FirstTreatmentDate:       patient.FirstTreatmentDate,
532
-		DialysisAge:              patient.DialysisAge,
533
-		ExpenseKind:              patient.ExpenseKind,
534
-		TellPhone:                patient.TellPhone,
535
-		ContactName:              patient.ContactName,
536
-		UpdatedTime:              time.Now().Unix(),
527
+		InfectiousNextRecordTime:  patient.InfectiousNextRecordTime,
528
+		IsInfectious:              patient.IsInfectious,
529
+		RemindCycle:               patient.RemindCycle,
530
+		ResponseResult:            patient.ResponseResult,
531
+		IsOpenRemind:              patient.IsOpenRemind,
532
+		FirstTreatmentDate:        patient.FirstTreatmentDate,
533
+		DialysisAge:               patient.DialysisAge,
534
+		ExpenseKind:               patient.ExpenseKind,
535
+		TellPhone:                 patient.TellPhone,
536
+		ContactName:               patient.ContactName,
537
+		UpdatedTime:               time.Now().Unix(),
537 538
 	}
538 539
 	//	//更新病人ID获取新表病人ID
539 540
 	err = service.UpdatepatientTwo(&patientsNew, id)
@@ -1990,7 +1991,10 @@ func (c *PatientApiController) GetDoctorAdvices() {
1990 1991
 	startTime := c.GetString("start_time", "")
1991 1992
 	endTime := c.GetString("end_time", "")
1992 1993
 	keywords := c.GetString("keywords", "")
1993
-
1994
+	page, _ := c.GetInt64("page")
1995
+	fmt.Println("page", page)
1996
+	limit, _ := c.GetInt64("limit")
1997
+	fmt.Println("limit", limit)
1994 1998
 	adminUserInfo := c.GetAdminUserInfo()
1995 1999
 
1996 2000
 	operatorIDs := make([]int64, 0)
@@ -2020,6 +2024,8 @@ func (c *PatientApiController) GetDoctorAdvices() {
2020 2024
 	}
2021 2025
 
2022 2026
 	advices, total, _ := service.GetDoctorAdviceList(adminUserInfo.CurrentOrgId, id, adviceType, stopType, theStartTIme, theEndtTIme, keywords)
2027
+	advicestwo, _, _ := service.GetDoctorAdviceListTwo(adminUserInfo.CurrentOrgId, id, adviceType, stopType, theStartTIme, theEndtTIme, keywords, limit, page)
2028
+
2023 2029
 	if len(advices) > 0 {
2024 2030
 		for _, item := range advices {
2025 2031
 			if item.AdviceDoctor > 0 {
@@ -2044,6 +2050,7 @@ func (c *PatientApiController) GetDoctorAdvices() {
2044 2050
 		"advices":   advices,
2045 2051
 		"operators": operators,
2046 2052
 		"total":     total,
2053
+		"advicetwo": advicestwo,
2047 2054
 	})
2048 2055
 	return
2049 2056
 
@@ -3343,3 +3350,27 @@ func (c *PatientApiController) PostIsOpenRemind() {
3343 3350
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3344 3351
 	}
3345 3352
 }
3353
+
3354
+func (c *PatientApiController) GetPatientScheduleOne() {
3355
+	id, _ := c.GetInt64("id")
3356
+	//查询该病人是否当天是排班
3357
+	nowDateTime := time.Now()
3358
+	nowDate := nowDateTime.Format("2006-01-02")
3359
+	nowDate += " 00:00:00"
3360
+	timeLayout := "2006-01-02"
3361
+	loc, _ := time.LoadLocation("Local")
3362
+	theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", nowDate, loc)
3363
+	nowdate := theTime.Unix()
3364
+	fmt.Println("nowdate", nowdate)
3365
+	adminUser := c.GetAdminUserInfo()
3366
+	orgId := adminUser.CurrentOrgId
3367
+	fmt.Println("orgid", orgId)
3368
+	scheduls, err := service.GetPatientScheduleOne(id, nowdate, orgId)
3369
+	if err != nil {
3370
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3371
+		return
3372
+	}
3373
+	c.ServeSuccessJSON(map[string]interface{}{
3374
+		"scheduls": scheduls,
3375
+	})
3376
+}

+ 11 - 5
service/device_service.go View File

@@ -275,16 +275,22 @@ func GetDeviceZoneByID(orgID int64, zoneID int64) (*models.DeviceZone, error) {
275 275
 func GetZoneByName(name string, orgid int64) (*models.DeviceZone, error) {
276 276
 	zones := models.DeviceZone{}
277 277
 	err := XTReadDB().Model(&zones).Where("name = ? and org_id = ? and status = 1", name, orgid).Find(&zones).Error
278
+	if err == gorm.ErrRecordNotFound {
279
+		return nil, err
280
+	}
278 281
 	if err != nil {
279
-		if err == gorm.ErrRecordNotFound {
280
-			return nil, nil
281
-		} else {
282
-			return nil, err
283
-		}
282
+		return nil, err
284 283
 	}
284
+
285 285
 	return &zones, nil
286 286
 }
287 287
 
288
+func GetZoneByNameOne(name string, orgid int64) (zone models.DeviceZone, err error) {
289
+
290
+	err = XTReadDB().Model(&zone).Where("name = ? and org_id=? and status = 1", name, orgid).First(&zone).Error
291
+	return zone, err
292
+}
293
+
288 294
 func CreateDeviceZone(orgID int64, name string, type_ int) (*models.DeviceZone, error) {
289 295
 	now := time.Now().Unix()
290 296
 	zone := models.DeviceZone{

+ 11 - 2
service/dialysis_service.go View File

@@ -695,9 +695,18 @@ func GetAdminUserES(orgID int64, appID int64, ids []int64) (es []*models.AdminUs
695 695
 	return
696 696
 }
697 697
 
698
-func GetAdminUserEsOne(orgid int64) (admin []*models.UserAdminRoles, err error) {
698
+//
699
+//func GetAdminUserEsOne(orgid int64) (admin []*models.UserAdminRoles, err error) {
700
+//
701
+//	db := readUserDb.Table("sgj_user_admin_role as x").Where("x.status = 1")
702
+//	table := readUserDb.Table("sgj_user_admin_electronic_signature as s")
703
+//	fmt.Println("table", table)
704
+//	err = db.Select("x.id,x.admin_user_id,x.user_name,x.org_id,s.creator,s.url,s.hash").Joins("left join sgj_user_admin_electronic_signature as s on s.creator = x.admin_user_id").Where("x.org_id = ?", orgid).Scan(&admin).Error
705
+//	return admin, err
706
+//}
699 707
 
700
-	db := readUserDb.Table("sgj_user_admin_role as x").Where("x.status = 1")
708
+func GetAdminUserEsOne(orgid int64) (admin []*models.UserAdminRoles, err error) {
709
+	db := readUserDb.Table("sgj_user_admin_role as x").Where("x.status =1")
701 710
 	table := readUserDb.Table("sgj_user_admin_electronic_signature as s")
702 711
 	fmt.Println("table", table)
703 712
 	err = db.Select("x.id,x.admin_user_id,x.user_name,x.org_id,s.creator,s.url,s.hash").Joins("left join sgj_user_admin_electronic_signature as s on s.creator = x.admin_user_id").Where("x.org_id = ?", orgid).Scan(&admin).Error

+ 88 - 1
service/patient_service.go View File

@@ -682,7 +682,7 @@ func FindDoctorAdviceByGroupNo(orgID, groupNo int64) (advice models.DoctorAdvice
682 682
 	return
683 683
 }
684 684
 func GetDoctorAdviceList(orgID, patientID, advice_type, stop, start, end int64, keywords string) (advices []*models.DoctorAdvices, total int64, err error) {
685
-	//db := readDb.Model(&models.DoctorAdvice{}).Where("status=1")
685
+
686 686
 	db := readDb.Table("xt_doctor_advice as x").Where("x.status = 1")
687 687
 	table := UserReadDB().Table("sgj_user_admin_role as r")
688 688
 	fmt.Print("table", table)
@@ -697,6 +697,7 @@ func GetDoctorAdviceList(orgID, patientID, advice_type, stop, start, end int64,
697 697
 	} else if advice_type == 0 {
698 698
 		db = db.Where("x.advice_type in (?)", []int{1, 3})
699 699
 	}
700
+
700 701
 	if stop == 1 {
701 702
 		db = db.Where("(x.stop_state=? or x.execution_state=?)", stop, stop)
702 703
 	} else if stop == 2 {
@@ -717,6 +718,86 @@ func GetDoctorAdviceList(orgID, patientID, advice_type, stop, start, end int64,
717 718
 	fmt.Print("err", err)
718 719
 	return
719 720
 }
721
+
722
+func GetDoctorAdviceListOne(orgID, patientID, advice_type, stop, start, end int64, keywords string) (advices []*models.DoctorAdvices, total int64, err error) {
723
+
724
+	db := readDb.Table("xt_doctor_advice as x").Where("x.status = 1")
725
+	table := UserReadDB().Table("sgj_user_admin_role as r")
726
+	fmt.Print("table", table)
727
+	if orgID > 0 {
728
+		db = db.Where("x.user_org_id=?", orgID)
729
+	}
730
+	if patientID > 0 {
731
+		db = db.Where("x.patient_id = ?", patientID)
732
+	}
733
+	if advice_type == 1 && advice_type > 0 {
734
+		db = db.Where("x.advice_type = ?", advice_type)
735
+	}
736
+	if advice_type == 3 && advice_type > 0 {
737
+		db = db.Where("x.advice_type = 2 or x.advice_type = 3")
738
+	}
739
+	if stop == 1 {
740
+		db = db.Where("(x.stop_state=? or x.execution_state=?)", stop, stop)
741
+	} else if stop == 2 {
742
+		db = db.Where("x.stop_state=? and x.execution_state=?", stop, stop)
743
+	}
744
+
745
+	if start != 0 {
746
+		db = db.Where("x.start_time>=?", start)
747
+	}
748
+	if end != 0 {
749
+		db = db.Where("start_time<=?", end)
750
+	}
751
+	if len(keywords) > 0 {
752
+		likeKey := "%" + keywords + "%"
753
+		db = db.Where("x.advice_name LIKE ?", likeKey)
754
+	}
755
+	err = db.Group("x.id").Count(&total).Select("x.id, x.user_org_id, x.patient_id, x.advice_type, x.advice_date, x.record_date, x.start_time, x.advice_name,x.advice_desc, x.reminder_date, x.drug_spec, x.drug_spec_unit, x.single_dose, x.single_dose_unit, x.prescribing_number, x.prescribing_number_unit, x.delivery_way, x.execution_frequency, x.advice_doctor, x.status, x.created_time,x.updated_time, x.advice_affirm, x.remark, x.stop_time, x.stop_reason, x.stop_doctor, x.stop_state, x.parent_id, x.execution_time, x.execution_staff, x.execution_state, x.checker, x.check_state, x.check_time, x.groupno,x.remind_type,x.frequency_type,x.day_count,x.week_day,x.parent_id,r.user_name, IF(x.parent_id > 0, x.parent_id, x.id) as advice_order").Joins("Left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = x.advice_doctor").Order("start_time desc, groupno desc, advice_order desc, id asc").Scan(&advices).Error
756
+	fmt.Print("err", err)
757
+	return
758
+}
759
+
760
+func GetDoctorAdviceListTwo(orgID int64, patientID int64, advice_type int64, stop int64, start int64, end int64, keywords string, limit int64, page int64) (advices []*models.DoctorAdvices, total int64, err error) {
761
+
762
+	db := readDb.Table("xt_doctor_advice as x").Where("x.status = 1")
763
+	table := UserReadDB().Table("sgj_user_admin_role as r")
764
+	fmt.Println(table)
765
+	if orgID > 0 {
766
+		db = db.Where("x.user_org_id=?", orgID)
767
+	}
768
+	if patientID > 0 {
769
+		db = db.Where("x.patient_id = ?", patientID)
770
+	}
771
+	if advice_type == 1 {
772
+		db = db.Where("x.advice_type = ?", advice_type)
773
+	}
774
+	if advice_type == 3 {
775
+		db = db.Where("x.advice_type <> 1")
776
+	}
777
+
778
+	if stop == 1 {
779
+		db = db.Where("(x.stop_state=? or x.execution_state=?)", stop, stop)
780
+	} else if stop == 2 {
781
+		db = db.Where("x.stop_state=? and x.execution_state=?", stop, stop)
782
+	}
783
+
784
+	if start != 0 {
785
+		db = db.Where("x.start_time>=?", start)
786
+	}
787
+	if end != 0 {
788
+		db = db.Where("start_time<=?", end)
789
+	}
790
+	if len(keywords) > 0 {
791
+		likeKey := "%" + keywords + "%"
792
+		db = db.Where("x.advice_name LIKE ?", likeKey)
793
+	}
794
+	offset := (page - 1) * limit
795
+	err = db.Order("x.start_time desc").Group("x.start_time").Count(&total).Offset(offset).Limit(limit).Select("x.id, x.user_org_id, x.patient_id, x.advice_type, x.advice_date, x.record_date, x.start_time, x.advice_name,x.advice_desc, x.reminder_date, x.drug_spec, x.drug_spec_unit, x.single_dose, x.single_dose_unit, x.prescribing_number, x.prescribing_number_unit, x.delivery_way, x.execution_frequency, x.advice_doctor, x.status, x.created_time,x.updated_time, x.advice_affirm, x.remark, x.stop_time, x.stop_reason, x.stop_doctor, x.stop_state, x.parent_id, x.execution_time, x.execution_staff, x.execution_state, x.checker, x.check_state, x.check_time, x.groupno,x.remind_type,x.frequency_type,x.day_count,x.week_day,x.parent_id,r.user_name, IF(x.parent_id > 0, x.parent_id, x.id) as advice_order").Joins("Left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = x.advice_doctor").Scan(&advices).Error
796
+	fmt.Print("错误是什么", err)
797
+	return
798
+
799
+}
800
+
720 801
 func GetDoctorAdvicePageList(orgID, patientID, advice_type, stop, start, end int64, keywords string, page, limit int64) (advices []*models.DoctorAdvice, total int64, err error) {
721 802
 
722 803
 	offset := (page - 1) * limit
@@ -1073,3 +1154,9 @@ func GetSchedualPatientByKeyWord(orgID int64, keywords string, date int64) (pati
1073 1154
 	}
1074 1155
 	return
1075 1156
 }
1157
+
1158
+func GetPatientScheduleOne(patientid int64, nowdate int64, orgid int64) (models.XtSchedule, error) {
1159
+	schedule := models.XtSchedule{}
1160
+	err := XTReadDB().Model(&schedule).Where("patient_id = ? and schedule_date = ? and user_org_id = ? and status =1", patientid, nowdate, orgid).Find(&schedule).Error
1161
+	return schedule, err
1162
+}

+ 0 - 1
service/patientmanage_service.go View File

@@ -524,7 +524,6 @@ func GetNewDoctorAdvice(patientID int64, advice_type int64, start int64, end int
524 524
 }
525 525
 
526 526
 func GetNewDoctorAdviceOne(patientID int64, advice_type int64, start int64, end int64, limit int64, page int64, orgID int64) (doctoradvice []*models.DoctorAdvice, total int64, err error) {
527
-	fmt.Println("advicetype------------------------------", advice_type)
528 527
 	db := readDb.Table("xt_doctor_advice as x").Where("x.status = 1")
529 528
 	table := UserReadDB().Table("sgj_user_admin_role as r")
530 529
 	fmt.Println("table", table)