Browse Source

合并代码

csx 4 years ago
parent
commit
8cf8d981ca

BIN
XT_New View File


+ 1 - 1
conf/app.conf View File

@@ -2,7 +2,7 @@ appname = 血透
2 2
 httpport = 9531
3 3
 runmode = dev
4 4
 
5
-
5
+# 1
6 6
 copyrequestbody = true
7 7
 sessionon = true
8 8
 sessiongcmaxlifetime = 64800

+ 6 - 4
controllers/base_api_controller.go View File

@@ -3,6 +3,8 @@ package controllers
3 3
 import (
4 4
 	"XT_New/enums"
5 5
 	"XT_New/models"
6
+
7
+	//"XT_New/models"
6 8
 	"XT_New/service"
7 9
 	"fmt"
8 10
 	"strconv"
@@ -77,7 +79,7 @@ func (this *BaseAuthAPIController) Prepare() {
77 79
 		userAdmin.ModifyTime = 1530786071
78 80
 		var subscibe models.ServeSubscibe
79 81
 		subscibe.ID = 1
80
-		subscibe.OrgId = 12
82
+		subscibe.OrgId = 9538
81 83
 		subscibe.PeriodStart = 1538035409
82 84
 		subscibe.PeriodEnd = 1569571409
83 85
 		subscibe.State = 1
@@ -87,7 +89,7 @@ func (this *BaseAuthAPIController) Prepare() {
87 89
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
88 90
 		subscibes[4] = &subscibe
89 91
 		var adminUserInfo service.AdminUserInfo
90
-		adminUserInfo.CurrentOrgId = 12
92
+		adminUserInfo.CurrentOrgId = 9538
91 93
 		adminUserInfo.CurrentAppId = 18
92 94
 		adminUserInfo.AdminUser = &userAdmin
93 95
 		adminUserInfo.Subscibes = subscibes
@@ -327,7 +329,7 @@ func (this *BaseServeAPIController) Prepare() {
327 329
 		userAdmin.ModifyTime = 1530786071
328 330
 		var subscibe models.ServeSubscibe
329 331
 		subscibe.ID = 1
330
-		subscibe.OrgId = 12
332
+		subscibe.OrgId = 9538
331 333
 		subscibe.PeriodStart = 1538035409
332 334
 		subscibe.PeriodEnd = 1569571409
333 335
 		subscibe.State = 1
@@ -337,7 +339,7 @@ func (this *BaseServeAPIController) Prepare() {
337 339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
338 340
 		subscibes[4] = &subscibe
339 341
 		var adminUserInfo service.AdminUserInfo
340
-		adminUserInfo.CurrentOrgId = 12
342
+		adminUserInfo.CurrentOrgId = 9538
341 343
 		adminUserInfo.CurrentAppId = 18
342 344
 		adminUserInfo.AdminUser = &userAdmin
343 345
 		adminUserInfo.Subscibes = subscibes

+ 3 - 3
controllers/data_api_controller.go View File

@@ -71,6 +71,7 @@ func (c *DataApiController) CreateConfig() {
71 71
 	var dataconfig models.Dataconfig
72 72
 	var resultConfig models.ConfigViewModel
73 73
 	code := configFormData(&dataconfig, c.Ctx.Input.RequestBody)
74
+	fmt.Println("code----------", code)
74 75
 	if code > 0 {
75 76
 		c.ServeFailJSONWithSGJErrorCode(code)
76 77
 		return
@@ -111,7 +112,7 @@ func (c *DataApiController) CreateConfig() {
111 112
 	} else {
112 113
 		dataconfig.Order = 0
113 114
 	}
114
-
115
+	fmt.Println("dataconfig-------------", dataconfig)
115 116
 	err = service.CreateConfig(&dataconfig)
116 117
 	if err != nil {
117 118
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
@@ -390,7 +391,7 @@ func configFormData(dataconfig *models.Dataconfig, data []byte) (code int) {
390 391
 	}
391 392
 	dataconfig.Module = module
392 393
 
393
-	if module == "education" || module == "summary" || module == "course_disease" || module == "rescue_record" {
394
+	if module == "education" || module == "summary" || module == "course_disease" || module == "rescue_record" || module == "nursing_record" || module == "special_record" {
394 395
 		if configBody["title"] == nil || reflect.TypeOf(configBody["title"]).String() != "string" {
395 396
 			utils.ErrorLog("title")
396 397
 			code = enums.ErrorCodeParamWrong
@@ -527,7 +528,6 @@ func configChildFormData(dataconfig *models.Dataconfig, data []byte) (code int)
527 528
 
528 529
 func (c *DataApiController) GetAdviceConfigs() {
529 530
 	advice_type, _ := c.GetInt64("type", 0)
530
-
531 531
 	adminUserInfo := c.GetAdminUserInfo()
532 532
 	var drugs []models.DrugDic
533 533
 	drugways, _, _ := service.GetDrugWayDics(adminUserInfo.CurrentOrgId)

+ 44 - 21
controllers/device_api_controller.go View File

@@ -652,15 +652,22 @@ func (this *DeviceAPIController) CreateGroup() {
652 652
 	}
653 653
 
654 654
 	adminInfo := this.GetAdminUserInfo()
655
-	group, createErr := service.CreateDeviceGroup(adminInfo.CurrentOrgId, name)
656
-	if createErr != nil {
657
-		this.ErrorLog("创建设备分组失败:%v", createErr)
655
+	_, errcode := service.GetDeviceGroupName(name, adminInfo.CurrentOrgId)
656
+	if errcode == gorm.ErrRecordNotFound {
657
+		group, createErr := service.CreateDeviceGroup(adminInfo.CurrentOrgId, name)
658
+		if createErr != nil {
659
+			this.ErrorLog("创建设备分组失败:%v", createErr)
660
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBCreate)
661
+			return
662
+		}
663
+		this.ServeSuccessJSON(map[string]interface{}{
664
+			"group": group,
665
+		})
666
+	} else if errcode == nil {
658 667
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBCreate)
659 668
 		return
660 669
 	}
661
-	this.ServeSuccessJSON(map[string]interface{}{
662
-		"group": group,
663
-	})
670
+
664 671
 }
665 672
 
666 673
 // /api/device/group/modify [post] ModifyGroup
@@ -687,7 +694,11 @@ func (this *DeviceAPIController) ModifyGroup() {
687 694
 
688 695
 	group.Name = name
689 696
 	group.ModifyTime = time.Now().Unix()
690
-
697
+	byName, getGroupErr := service.GetUpdateDeviceGroupByName(name, adminInfo.CurrentOrgId)
698
+	if byName.ID > 0 && byName.ID != id {
699
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
700
+		return
701
+	}
691 702
 	updateErr := service.UpdateDeviceGroup(group)
692 703
 	if updateErr != nil {
693 704
 		this.ErrorLog("修改设备分组失败:%v", updateErr)
@@ -787,23 +798,30 @@ func (this *DeviceAPIController) CreateNumber() {
787 798
 		return
788 799
 	}
789 800
 
790
-	number, createErr := service.CreateDeviceNumber(adminInfo.CurrentOrgId, num, zoneID, groupID)
791
-	if createErr != nil {
792
-		this.ErrorLog("创建机号失败:%v", createErr)
801
+	_, errcode := service.GetCreateDeviceNumber(num, adminInfo.CurrentOrgId)
802
+	if errcode == gorm.ErrRecordNotFound {
803
+		number, createErr := service.CreateDeviceNumber(adminInfo.CurrentOrgId, num, zoneID, groupID)
804
+		if createErr != nil {
805
+			this.ErrorLog("创建机号失败:%v", createErr)
806
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBCreate)
807
+			return
808
+		}
809
+		numberJson := map[string]interface{}{
810
+			"id":         number.ID,
811
+			"number":     number.Number,
812
+			"zone_id":    number.ZoneID,
813
+			"group_id":   number.GroupID,
814
+			"zone_name":  zone.Name,
815
+			"group_name": group.Name,
816
+		}
817
+		this.ServeSuccessJSON(map[string]interface{}{
818
+			"number": numberJson,
819
+		})
820
+	} else if errcode == nil {
793 821
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBCreate)
794 822
 		return
795 823
 	}
796
-	numberJson := map[string]interface{}{
797
-		"id":         number.ID,
798
-		"number":     number.Number,
799
-		"zone_id":    number.ZoneID,
800
-		"group_id":   number.GroupID,
801
-		"zone_name":  zone.Name,
802
-		"group_name": group.Name,
803
-	}
804
-	this.ServeSuccessJSON(map[string]interface{}{
805
-		"number": numberJson,
806
-	})
824
+
807 825
 }
808 826
 
809 827
 // /api/device/number/modify [post] ModifyNumber
@@ -856,6 +874,11 @@ func (this *DeviceAPIController) ModifyNumber() {
856 874
 	number.Number = num
857 875
 	number.ZoneID = zoneID
858 876
 	number.GroupID = groupID
877
+	byName, _ := service.GetDeviceNumberByName(num, adminInfo.CurrentOrgId)
878
+	if byName.ID > 0 && byName.ID != id {
879
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
880
+		return
881
+	}
859 882
 	updateErr := service.UpdateDeviceNumber(number)
860 883
 	if updateErr != nil {
861 884
 		this.ErrorLog("修改机号失败:%v", updateErr)

+ 4 - 0
controllers/dialysis_api_controller.go View File

@@ -3495,6 +3495,8 @@ func (c *DialysisApiController) PostTreatmentSummary() {
3495 3495
 
3496 3496
 	mission := c.GetString("mission")
3497 3497
 	dialysis_summary := c.GetString("dialysis_summary")
3498
+	nursingRecord := c.GetString("nursing_record")
3499
+	specialRecord := c.GetString("special_record")
3498 3500
 	sj_nurse := adminUserInfo.AdminUser.Id
3499 3501
 	zl_nurse := adminUserInfo.AdminUser.Id
3500 3502
 	hd_nurse := adminUserInfo.AdminUser.Id
@@ -3514,6 +3516,8 @@ func (c *DialysisApiController) PostTreatmentSummary() {
3514 3516
 		ZlDoctor:        zl_doctor,
3515 3517
 		Status:          1,
3516 3518
 		CreatedTime:     time.Now().Unix(),
3519
+		NursingRecord:   nursingRecord,
3520
+		SpecialRecord:   specialRecord,
3517 3521
 	}
3518 3522
 
3519 3523
 	_, tempTreatmentSummary := service.FindTreatmentSummaryByReordDate(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)

+ 5 - 1
controllers/inspection_api_controller.go View File

@@ -226,9 +226,13 @@ func (c *InspectionApiController) CreatePatientInspection() {
226 226
 }
227 227
 
228 228
 func (c *InspectionApiController) EditPatientInspection() {
229
+	fmt.Println("触发了没有---------------------------------------")
229 230
 	patient, _ := c.GetInt64("patient", 0)
230 231
 	remind_cycle, _ := c.GetInt64("remind_cycle", 0)
231
-
232
+	dates := c.GetString("dates")
233
+	projectid := c.GetString("projectid")
234
+	fmt.Println("日期---", dates)
235
+	fmt.Println("projectid", projectid)
232 236
 	if patient <= 0 {
233 237
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
234 238
 		return

+ 8 - 3
controllers/mobile_api_controllers/dialysis_api_controller.go View File

@@ -350,6 +350,7 @@ func (this *DialysisAPIController) DialysisRecord() {
350 350
 	//}
351 351
 
352 352
 	lastDialysisPrescribe, _ := service.MobileGetLastDialysisPrescribeByModeId(adminInfo.Org.Id, patientID, schedual.ModeId)
353
+	//fmt.Println("上次透析处方",lastDialysisPrescribe.DialyzerPerfusionApparatus)
353 354
 	//if getDialysisPrescribeErr != nil {
354 355
 	//	this.ErrorLog("获取透析处方失败:%v", getDialysisPrescribeErr)
355 356
 	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -388,8 +389,7 @@ func (this *DialysisAPIController) DialysisRecord() {
388 389
 	goodInfos, _ := service.FindAllGoodInfo(adminInfo.Org.Id) //查出所有库存配置的系统类型
389 390
 
390 391
 	operators, err := service.GetAllStarfEs(adminInfo.Org.Id)
391
-	fmt.Println("报错-------", err)
392
-	fmt.Println("op----------------------------------------------------------", operators)
392
+	fmt.Println("报错", err)
393 393
 
394 394
 	returnData := map[string]interface{}{
395 395
 		"patient":                        patient,
@@ -445,7 +445,10 @@ func (c *DialysisAPIController) PostAtreatmentInfo() {
445 445
 	checkStaffId, _ := c.GetInt64("checkStaff", 0)
446 446
 	deboardNurseId, _ := c.GetInt64("deboardNurse", 0)
447 447
 	treatDoctor, _ := c.GetInt64("treatDoctor", 0)
448
-
448
+	nursingRecord := c.GetString("nursing_record")
449
+	fmt.Println("护理记录", nursingRecord)
450
+	specialRecord := c.GetString("special_record")
451
+	fmt.Println("特殊记录", specialRecord)
449 452
 	adminUserInfo := c.GetMobileAdminUserInfo()
450 453
 
451 454
 	changeMedicalNurseId = adminUserInfo.AdminUser.Id
@@ -491,6 +494,8 @@ func (c *DialysisAPIController) PostAtreatmentInfo() {
491 494
 		ZlDoctor:        treatDoctor,
492 495
 		CreatedTime:     time.Now().Unix(),
493 496
 		Status:          1,
497
+		NursingRecord:   nursingRecord,
498
+		SpecialRecord:   specialRecord,
494 499
 	}
495 500
 	_, treatmentSummary := service.FindTreatmentSummaryByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
496 501
 	if treatmentSummary.ID == 0 { //新增

+ 30 - 2
controllers/patient_api_controller.go View File

@@ -68,6 +68,7 @@ func PatientApiRegistRouters() {
68 68
 
69 69
 	beego.Router("/api/patients/export", &PatientApiController{}, "Post:ExportPatients")
70 70
 
71
+	beego.Router("/api/patients/advices/saveditadvices", &PatientApiController{}, "Get:SaveEditAdvices")
71 72
 }
72 73
 
73 74
 //GetPatientsList 取患者列表
@@ -239,7 +240,7 @@ func (c *PatientApiController) CreatePatient() {
239 240
 	// patient.Lapseto = 1
240 241
 
241 242
 	err := service.CreatePatient(&patient, contagions, diseases)
242
-	fmt.Println("创建病人失败---------------------------------------------err")
243
+	fmt.Println("创建病人失败err")
243 244
 	if err != nil {
244 245
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreatePatient)
245 246
 		return
@@ -337,6 +338,7 @@ func (c *PatientApiController) CreatePatient() {
337 338
 		MemberPatienttype:        0,
338 339
 		MemberTreatement:         0,
339 340
 		EquitmentId:              "",
341
+		UserSysBeforeCount:       patient.UserSysBeforeCount,
340 342
 	}
341 343
 
342 344
 	err = service.CreatePatientsNew(&patientsNew)
@@ -2027,7 +2029,7 @@ func (c *PatientApiController) GetDoctorAdvices() {
2027 2029
 		theEndtTIme = theTime.Unix()
2028 2030
 	}
2029 2031
 
2030
-	advices, total, _ := service.GetDoctorAdviceList(adminUserInfo.CurrentOrgId, id, adviceType, stopType, theStartTIme, theEndtTIme, keywords)
2032
+	advices, total, _ := service.GetDoctorAdviceListOne(adminUserInfo.CurrentOrgId, id, adviceType, stopType, theStartTIme, theEndtTIme, keywords, page, limit)
2031 2033
 	advicestwo, _, _ := service.GetDoctorAdviceListTwo(adminUserInfo.CurrentOrgId, id, adviceType, stopType, theStartTIme, theEndtTIme, keywords, limit, page)
2032 2034
 
2033 2035
 	if len(advices) > 0 {
@@ -3704,3 +3706,29 @@ func IsIdCard(idCard string) (res bool) {
3704 3706
 	res, _ = regexp.Match("^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}$|^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}([0-9]|X)$", []byte(idCard))
3705 3707
 	return
3706 3708
 }
3709
+
3710
+func (c *PatientApiController) SaveEditAdvices() {
3711
+	adminInfo := c.GetAdminUserInfo()
3712
+	orgid := adminInfo.CurrentOrgId
3713
+	startTime := c.GetString("start_time")
3714
+	fmt.Println("开始时间", startTime)
3715
+	theTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", startTime)
3716
+	fmt.Println(theTime.Unix())
3717
+	groupno, _ := c.GetInt64("groupno")
3718
+	fmt.Println("组", groupno)
3719
+	date, _ := c.GetInt64("date")
3720
+	fmt.Println("date", date)
3721
+	patient_id, _ := c.GetInt64("patient_id")
3722
+	fmt.Println("paitent_id", patient_id)
3723
+	advice := models.XtDoctorAdvice{
3724
+		StartTime: theTime.Unix(),
3725
+	}
3726
+	err := service.UpdateDoctorEditAdvice(advice, orgid, groupno, date, patient_id)
3727
+	if err != nil {
3728
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3729
+		return
3730
+	}
3731
+	c.ServeSuccessJSON(map[string]interface{}{
3732
+		"advice": advice,
3733
+	})
3734
+}

+ 2 - 0
models/dialysis.go View File

@@ -580,6 +580,8 @@ type TreatmentSummary struct {
580 580
 	UpdatedTime       int64  `gorm:"column:updated_time" json:"updated_time"`
581 581
 	Creater           int64  `gorm:"column:creater" json:"creater"`
582 582
 	Modifier          int64  `gorm:"column:modifier" json:"modifier"`
583
+	NursingRecord     string `gorm:"column:nursing_record" json:"nursing_record" form:"nursing_record"`
584
+	SpecialRecord     string `gorm:"column:special_record" json:"special_record" form:"special_record"`
583 585
 }
584 586
 
585 587
 func (TreatmentSummary) TableName() string {

+ 1 - 0
models/patient_models.go View File

@@ -488,6 +488,7 @@ type XtPatientsNew struct {
488 488
 	MemberTreatement             int64   `gorm:"column:member_treatement" json:"member_treatement" form:"member_treatement"`
489 489
 	EquitmentId                  string  `gorm:"column:equitment_id" json:"equitment_id" form:"equitment_id"`
490 490
 	UserSysBeforeCount           int64   `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
491
+	IsExcelExport                int64   `gorm:"column:is_excel_export" json:"is_excel_export" form:"is_excel_export"`
491 492
 }
492 493
 
493 494
 func (XtPatientsNew) TableName() string {

+ 2 - 0
models/user_models.go View File

@@ -457,6 +457,8 @@ type XtTreatmentSummary struct {
457 457
 	UpdatedTime       int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
458 458
 	Creater           int64  `gorm:"column:creater" json:"creater" form:"creater"`
459 459
 	Modifier          int64  `gorm:"column:modifier" json:"modifier" form:"modifier"`
460
+	NursingRecord     string `gorm:"column:nursing_record" json:"nursing_record" form:"nursing_record"`
461
+	SpecialRecord     string `gorm:"column:special_record" json:"special_record" form:"special_record"`
460 462
 }
461 463
 
462 464
 func (XtTreatmentSummary) TableName() string {

+ 38 - 0
service/device_service.go View File

@@ -337,6 +337,20 @@ func GetDeviceGroupByID(orgID int64, groupID int64) (*models.DeviceGroup, error)
337 337
 	return &group, nil
338 338
 }
339 339
 
340
+func GetDeviceGroupName(name string, orgid int64) (*models.DeviceGroup, error) {
341
+	group := models.DeviceGroup{}
342
+	err := XTReadDB().Model(&group).Where("name = ? and org_id = ? and status =1", name, orgid).Find(&group).Error
343
+	if err == gorm.ErrRecordNotFound {
344
+		return nil, err
345
+	}
346
+	if err != nil {
347
+		return nil, err
348
+	}
349
+
350
+	return &group, nil
351
+
352
+}
353
+
340 354
 func CreateDeviceGroup(orgID int64, name string) (*models.DeviceGroup, error) {
341 355
 	now := time.Now().Unix()
342 356
 	group := models.DeviceGroup{
@@ -353,6 +367,11 @@ func CreateDeviceGroup(orgID int64, name string) (*models.DeviceGroup, error) {
353 367
 	return &group, nil
354 368
 }
355 369
 
370
+func GetUpdateDeviceGroupByName(name string, orgid int64) (group models.DeviceGroup, err error) {
371
+	err = XTReadDB().Model(&group).Where("name = ? and org_id = ? and status =1", name, orgid).Find(&group).Error
372
+	return group, err
373
+}
374
+
356 375
 func UpdateDeviceGroup(group *models.DeviceGroup) error {
357 376
 	err := writeDb.Save(group).Error
358 377
 	return err
@@ -427,6 +446,19 @@ func GetDeviceNumberByID(orgID int64, numberID int64) (*models.DeviceNumber, err
427 446
 	return &number, nil
428 447
 }
429 448
 
449
+func GetCreateDeviceNumber(num string, orgid int64) (*models.DeviceNumber, error) {
450
+	number := models.DeviceNumber{}
451
+	err := XTReadDB().Model(&number).Where("number = ? and org_id = ? and status = 1", num, orgid).Find(&number).Error
452
+	if err == gorm.ErrRecordNotFound {
453
+		return nil, err
454
+	}
455
+	if err != nil {
456
+		return nil, err
457
+	}
458
+
459
+	return &number, nil
460
+}
461
+
430 462
 func CreateDeviceNumber(orgID int64, number string, zoneID int64, groupID int64) (*models.DeviceNumber, error) {
431 463
 	now := time.Now().Unix()
432 464
 	numberModel := models.DeviceNumber{
@@ -445,6 +477,12 @@ func CreateDeviceNumber(orgID int64, number string, zoneID int64, groupID int64)
445 477
 	return &numberModel, nil
446 478
 }
447 479
 
480
+func GetDeviceNumberByName(num string, orgid int64) (number models.DeviceNumber, err error) {
481
+
482
+	err = XTReadDB().Model(&number).Where("number = ? and org_id = ? and status =1", num, orgid).First(&number).Error
483
+	return number, err
484
+}
485
+
448 486
 func UpdateDeviceNumber(number *models.DeviceNumber) error {
449 487
 	now := time.Now().Unix()
450 488
 	number.ModifyTime = now

+ 13 - 11
service/mobile_dialysis_service.go View File

@@ -446,7 +446,7 @@ func MobileGetDoctorAdvices(orgID int64, patientID int64, recordDate int64) ([]*
446 446
 
447 447
 	err := readDb.
448 448
 		Model(&models.DoctorAdvice{}).
449
-		Where("patient_id = ? and user_org_id = ? and status = 1 and record_date = ? and advice_type = 2", patientID, orgID, recordDate).
449
+		Where("patient_id = ? and user_org_id = ? and status = 1 and record_date = ? and (advice_type = 2 or advice_type = 3)", patientID, orgID, recordDate).
450 450
 		Select("id,user_org_id,patient_id,advice_type,advice_date,record_date,start_time,advice_name,advice_desc,reminder_date, drug_spec, drug_spec_unit,single_dose,single_dose_unit,prescribing_number,prescribing_number_unit,delivery_way,execution_frequency,advice_doctor,status,created_time,updated_time,advice_affirm,remark,stop_time,stop_reason,stop_doctor,stop_state,parent_id,execution_time,execution_staff,execution_state,checker, check_state, check_time,IF(parent_id>0, parent_id, id) as advice_order,groupno").
451 451
 		Order("start_time asc, groupno desc, advice_order desc, id").
452 452
 		Scan(&records).Error
@@ -650,16 +650,15 @@ func GetMonitor(orgID int64, patientID int64, id int64) (*models.MonitoringRecor
650 650
 }
651 651
 
652 652
 type MScheduleDoctorAdviceVM struct {
653
-	ID           int64 `gorm:"column:id" json:"id"`
654
-	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id"`
655
-	PartitionId  int64 `gorm:"column:partition_id" json:"partition_id"`
656
-	BedId        int64 `gorm:"column:bed_id" json:"bed_id"`
657
-	PatientId    int64 `gorm:"column:patient_id" json:"patient_id"`
658
-	ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date"`
659
-	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type"`
660
-	ModeId       int64 `gorm:"column:mode_id" json:"mode_id"`
661
-	Status       int64 `gorm:"column:status" json:"status"`
662
-
653
+	ID              int64               `gorm:"column:id" json:"id"`
654
+	UserOrgId       int64               `gorm:"column:user_org_id" json:"user_org_id"`
655
+	PartitionId     int64               `gorm:"column:partition_id" json:"partition_id"`
656
+	BedId           int64               `gorm:"column:bed_id" json:"bed_id"`
657
+	PatientId       int64               `gorm:"column:patient_id" json:"patient_id"`
658
+	ScheduleDate    int64               `gorm:"column:schedule_date" json:"schedule_date"`
659
+	ScheduleType    int64               `gorm:"column:schedule_type" json:"schedule_type"`
660
+	ModeId          int64               `gorm:"column:mode_id" json:"mode_id"`
661
+	Status          int64               `gorm:"column:status" json:"status"`
663 662
 	DialysisOrder   *MDialysisOrderVM   `gorm:"ForeignKey:DialysisDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"dialysis_order"`
664 663
 	SchedualPatient *MSchedualPatientVM `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
665 664
 	DeviceNumber    *MDeviceNumberVM    `gorm:"ForeignKey:BedId" json:"device_number"`
@@ -723,6 +722,9 @@ func (MDoctorAdviceVM) TableName() string {
723 722
 func MobileGetScheduleDoctorAdvices(orgID int64, scheduleDate int64, adviceType int, patientType int, adminUserId int64) ([]*MScheduleDoctorAdviceVM, error) {
724 723
 	var vms []*MScheduleDoctorAdviceVM
725 724
 	adviceWhere := ""
725
+	fmt.Println("advicetype", adviceType)
726
+	fmt.Println("patientType", patientType)
727
+	fmt.Println("adminUserId", adminUserId)
726 728
 	adviceCondition := []interface{}{}
727 729
 	if adviceType == 0 {
728 730
 		if patientType == 0 {

+ 9 - 2
service/patient_service.go View File

@@ -719,7 +719,7 @@ func GetDoctorAdviceList(orgID, patientID, advice_type, stop, start, end int64,
719 719
 	return
720 720
 }
721 721
 
722
-func GetDoctorAdviceListOne(orgID, patientID, advice_type, stop, start, end int64, keywords string) (advices []*models.DoctorAdvices, total int64, err error) {
722
+func GetDoctorAdviceListOne(orgID, patientID, advice_type, stop, start, end int64, keywords string, page int64, limit int64) (advices []*models.DoctorAdvices, total int64, err error) {
723 723
 
724 724
 	db := readDb.Table("xt_doctor_advice as x").Where("x.status = 1")
725 725
 	table := UserReadDB().Table("sgj_user_admin_role as r")
@@ -752,7 +752,8 @@ func GetDoctorAdviceListOne(orgID, patientID, advice_type, stop, start, end int6
752 752
 		likeKey := "%" + keywords + "%"
753 753
 		db = db.Where("x.advice_name LIKE ?", likeKey)
754 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
755
+	offset := (page - 1) * limit
756
+	err = db.Group("x.id").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").Order("start_time desc, groupno desc, advice_order desc, id asc").Scan(&advices).Error
756 757
 	fmt.Print("err", err)
757 758
 	return
758 759
 }
@@ -1280,3 +1281,9 @@ func FindPatientExportLog(org_id int64, export_time int64) (errLogs []*models.Ex
1280 1281
 func CreateExportLog(log *models.ExportLog) {
1281 1282
 	writeDb.Create(&log)
1282 1283
 }
1284
+
1285
+func UpdateDoctorEditAdvice(advice models.XtDoctorAdvice, orgid int64, groupno int64, date int64, patientid int64) error {
1286
+
1287
+	err := XTWriteDB().Model(&advice).Where("user_org_id = ? and groupno = ? and advice_date = ? and patient_id = ?", orgid, groupno, date, patientid).Update(map[string]interface{}{"start_time": advice.StartTime, "updated_time": advice.UpdatedTime}).Error
1288
+	return err
1289
+}

+ 2 - 0
service/print_data_service/schedule_dialysis/print_schedule_dialysis_models.go View File

@@ -692,6 +692,8 @@ type SummerVM struct {
692 692
 	UpdatedTime       int64  `gorm:"column:updated_time" json:"updated_time"`
693 693
 	Creater           int64  `gorm:"column:creater" json:"creater"`
694 694
 	Modifier          int64  `gorm:"column:modifier" json:"modifier"`
695
+	NursingRecord     string `gorm:"column:nursing_record" json:"nursing_record" form:"nursing_record"`
696
+	SpecialRecord     string `gorm:"column:special_record" json:"special_record" form:"special_record"`
695 697
 }
696 698
 
697 699
 func (SummerVM) TableName() string {