csx пре 5 година
родитељ
комит
8cf8d981ca

+ 1 - 1
conf/app.conf Прегледај датотеку

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

+ 6 - 4
controllers/base_api_controller.go Прегледај датотеку

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

+ 3 - 3
controllers/data_api_controller.go Прегледај датотеку

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

+ 44 - 21
controllers/device_api_controller.go Прегледај датотеку

652
 	}
652
 	}
653
 
653
 
654
 	adminInfo := this.GetAdminUserInfo()
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
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBCreate)
667
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBCreate)
659
 		return
668
 		return
660
 	}
669
 	}
661
-	this.ServeSuccessJSON(map[string]interface{}{
662
-		"group": group,
663
-	})
670
+
664
 }
671
 }
665
 
672
 
666
 // /api/device/group/modify [post] ModifyGroup
673
 // /api/device/group/modify [post] ModifyGroup
687
 
694
 
688
 	group.Name = name
695
 	group.Name = name
689
 	group.ModifyTime = time.Now().Unix()
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
 	updateErr := service.UpdateDeviceGroup(group)
702
 	updateErr := service.UpdateDeviceGroup(group)
692
 	if updateErr != nil {
703
 	if updateErr != nil {
693
 		this.ErrorLog("修改设备分组失败:%v", updateErr)
704
 		this.ErrorLog("修改设备分组失败:%v", updateErr)
787
 		return
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
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBCreate)
821
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBCreate)
794
 		return
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
 // /api/device/number/modify [post] ModifyNumber
827
 // /api/device/number/modify [post] ModifyNumber
856
 	number.Number = num
874
 	number.Number = num
857
 	number.ZoneID = zoneID
875
 	number.ZoneID = zoneID
858
 	number.GroupID = groupID
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
 	updateErr := service.UpdateDeviceNumber(number)
882
 	updateErr := service.UpdateDeviceNumber(number)
860
 	if updateErr != nil {
883
 	if updateErr != nil {
861
 		this.ErrorLog("修改机号失败:%v", updateErr)
884
 		this.ErrorLog("修改机号失败:%v", updateErr)

+ 4 - 0
controllers/dialysis_api_controller.go Прегледај датотеку

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

+ 5 - 1
controllers/inspection_api_controller.go Прегледај датотеку

226
 }
226
 }
227
 
227
 
228
 func (c *InspectionApiController) EditPatientInspection() {
228
 func (c *InspectionApiController) EditPatientInspection() {
229
+	fmt.Println("触发了没有---------------------------------------")
229
 	patient, _ := c.GetInt64("patient", 0)
230
 	patient, _ := c.GetInt64("patient", 0)
230
 	remind_cycle, _ := c.GetInt64("remind_cycle", 0)
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
 	if patient <= 0 {
236
 	if patient <= 0 {
233
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
237
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
234
 		return
238
 		return

+ 8 - 3
controllers/mobile_api_controllers/dialysis_api_controller.go Прегледај датотеку

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

+ 30 - 2
controllers/patient_api_controller.go Прегледај датотеку

68
 
68
 
69
 	beego.Router("/api/patients/export", &PatientApiController{}, "Post:ExportPatients")
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
 //GetPatientsList 取患者列表
74
 //GetPatientsList 取患者列表
239
 	// patient.Lapseto = 1
240
 	// patient.Lapseto = 1
240
 
241
 
241
 	err := service.CreatePatient(&patient, contagions, diseases)
242
 	err := service.CreatePatient(&patient, contagions, diseases)
242
-	fmt.Println("创建病人失败---------------------------------------------err")
243
+	fmt.Println("创建病人失败err")
243
 	if err != nil {
244
 	if err != nil {
244
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreatePatient)
245
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreatePatient)
245
 		return
246
 		return
337
 		MemberPatienttype:        0,
338
 		MemberPatienttype:        0,
338
 		MemberTreatement:         0,
339
 		MemberTreatement:         0,
339
 		EquitmentId:              "",
340
 		EquitmentId:              "",
341
+		UserSysBeforeCount:       patient.UserSysBeforeCount,
340
 	}
342
 	}
341
 
343
 
342
 	err = service.CreatePatientsNew(&patientsNew)
344
 	err = service.CreatePatientsNew(&patientsNew)
2027
 		theEndtTIme = theTime.Unix()
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
 	advicestwo, _, _ := service.GetDoctorAdviceListTwo(adminUserInfo.CurrentOrgId, id, adviceType, stopType, theStartTIme, theEndtTIme, keywords, limit, page)
2033
 	advicestwo, _, _ := service.GetDoctorAdviceListTwo(adminUserInfo.CurrentOrgId, id, adviceType, stopType, theStartTIme, theEndtTIme, keywords, limit, page)
2032
 
2034
 
2033
 	if len(advices) > 0 {
2035
 	if len(advices) > 0 {
3704
 	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))
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
 	return
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 Прегледај датотеку

580
 	UpdatedTime       int64  `gorm:"column:updated_time" json:"updated_time"`
580
 	UpdatedTime       int64  `gorm:"column:updated_time" json:"updated_time"`
581
 	Creater           int64  `gorm:"column:creater" json:"creater"`
581
 	Creater           int64  `gorm:"column:creater" json:"creater"`
582
 	Modifier          int64  `gorm:"column:modifier" json:"modifier"`
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
 func (TreatmentSummary) TableName() string {
587
 func (TreatmentSummary) TableName() string {

+ 1 - 0
models/patient_models.go Прегледај датотеку

488
 	MemberTreatement             int64   `gorm:"column:member_treatement" json:"member_treatement" form:"member_treatement"`
488
 	MemberTreatement             int64   `gorm:"column:member_treatement" json:"member_treatement" form:"member_treatement"`
489
 	EquitmentId                  string  `gorm:"column:equitment_id" json:"equitment_id" form:"equitment_id"`
489
 	EquitmentId                  string  `gorm:"column:equitment_id" json:"equitment_id" form:"equitment_id"`
490
 	UserSysBeforeCount           int64   `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
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
 func (XtPatientsNew) TableName() string {
494
 func (XtPatientsNew) TableName() string {

+ 2 - 0
models/user_models.go Прегледај датотеку

457
 	UpdatedTime       int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
457
 	UpdatedTime       int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
458
 	Creater           int64  `gorm:"column:creater" json:"creater" form:"creater"`
458
 	Creater           int64  `gorm:"column:creater" json:"creater" form:"creater"`
459
 	Modifier          int64  `gorm:"column:modifier" json:"modifier" form:"modifier"`
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
 func (XtTreatmentSummary) TableName() string {
464
 func (XtTreatmentSummary) TableName() string {

+ 38 - 0
service/device_service.go Прегледај датотеку

337
 	return &group, nil
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
 func CreateDeviceGroup(orgID int64, name string) (*models.DeviceGroup, error) {
354
 func CreateDeviceGroup(orgID int64, name string) (*models.DeviceGroup, error) {
341
 	now := time.Now().Unix()
355
 	now := time.Now().Unix()
342
 	group := models.DeviceGroup{
356
 	group := models.DeviceGroup{
353
 	return &group, nil
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
 func UpdateDeviceGroup(group *models.DeviceGroup) error {
375
 func UpdateDeviceGroup(group *models.DeviceGroup) error {
357
 	err := writeDb.Save(group).Error
376
 	err := writeDb.Save(group).Error
358
 	return err
377
 	return err
427
 	return &number, nil
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
 func CreateDeviceNumber(orgID int64, number string, zoneID int64, groupID int64) (*models.DeviceNumber, error) {
462
 func CreateDeviceNumber(orgID int64, number string, zoneID int64, groupID int64) (*models.DeviceNumber, error) {
431
 	now := time.Now().Unix()
463
 	now := time.Now().Unix()
432
 	numberModel := models.DeviceNumber{
464
 	numberModel := models.DeviceNumber{
445
 	return &numberModel, nil
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
 func UpdateDeviceNumber(number *models.DeviceNumber) error {
486
 func UpdateDeviceNumber(number *models.DeviceNumber) error {
449
 	now := time.Now().Unix()
487
 	now := time.Now().Unix()
450
 	number.ModifyTime = now
488
 	number.ModifyTime = now

+ 13 - 11
service/mobile_dialysis_service.go Прегледај датотеку

446
 
446
 
447
 	err := readDb.
447
 	err := readDb.
448
 		Model(&models.DoctorAdvice{}).
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
 		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").
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
 		Order("start_time asc, groupno desc, advice_order desc, id").
451
 		Order("start_time asc, groupno desc, advice_order desc, id").
452
 		Scan(&records).Error
452
 		Scan(&records).Error
650
 }
650
 }
651
 
651
 
652
 type MScheduleDoctorAdviceVM struct {
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
 	DialysisOrder   *MDialysisOrderVM   `gorm:"ForeignKey:DialysisDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"dialysis_order"`
662
 	DialysisOrder   *MDialysisOrderVM   `gorm:"ForeignKey:DialysisDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"dialysis_order"`
664
 	SchedualPatient *MSchedualPatientVM `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
663
 	SchedualPatient *MSchedualPatientVM `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
665
 	DeviceNumber    *MDeviceNumberVM    `gorm:"ForeignKey:BedId" json:"device_number"`
664
 	DeviceNumber    *MDeviceNumberVM    `gorm:"ForeignKey:BedId" json:"device_number"`
723
 func MobileGetScheduleDoctorAdvices(orgID int64, scheduleDate int64, adviceType int, patientType int, adminUserId int64) ([]*MScheduleDoctorAdviceVM, error) {
722
 func MobileGetScheduleDoctorAdvices(orgID int64, scheduleDate int64, adviceType int, patientType int, adminUserId int64) ([]*MScheduleDoctorAdviceVM, error) {
724
 	var vms []*MScheduleDoctorAdviceVM
723
 	var vms []*MScheduleDoctorAdviceVM
725
 	adviceWhere := ""
724
 	adviceWhere := ""
725
+	fmt.Println("advicetype", adviceType)
726
+	fmt.Println("patientType", patientType)
727
+	fmt.Println("adminUserId", adminUserId)
726
 	adviceCondition := []interface{}{}
728
 	adviceCondition := []interface{}{}
727
 	if adviceType == 0 {
729
 	if adviceType == 0 {
728
 		if patientType == 0 {
730
 		if patientType == 0 {

+ 9 - 2
service/patient_service.go Прегледај датотеку

719
 	return
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
 	db := readDb.Table("xt_doctor_advice as x").Where("x.status = 1")
724
 	db := readDb.Table("xt_doctor_advice as x").Where("x.status = 1")
725
 	table := UserReadDB().Table("sgj_user_admin_role as r")
725
 	table := UserReadDB().Table("sgj_user_admin_role as r")
752
 		likeKey := "%" + keywords + "%"
752
 		likeKey := "%" + keywords + "%"
753
 		db = db.Where("x.advice_name LIKE ?", likeKey)
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
 	fmt.Print("err", err)
757
 	fmt.Print("err", err)
757
 	return
758
 	return
758
 }
759
 }
1280
 func CreateExportLog(log *models.ExportLog) {
1281
 func CreateExportLog(log *models.ExportLog) {
1281
 	writeDb.Create(&log)
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 Прегледај датотеку

692
 	UpdatedTime       int64  `gorm:"column:updated_time" json:"updated_time"`
692
 	UpdatedTime       int64  `gorm:"column:updated_time" json:"updated_time"`
693
 	Creater           int64  `gorm:"column:creater" json:"creater"`
693
 	Creater           int64  `gorm:"column:creater" json:"creater"`
694
 	Modifier          int64  `gorm:"column:modifier" json:"modifier"`
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
 func (SummerVM) TableName() string {
699
 func (SummerVM) TableName() string {