Browse Source

Merge branch '20230223_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20230223_xt_api_new_branch

陈少旭 4 weeks ago
parent
commit
b341496edc

BIN
XT_New.exe View File


+ 4 - 4
controllers/base_api_controller.go View File

83
 		userAdmin.ModifyTime = 1530786071
83
 		userAdmin.ModifyTime = 1530786071
84
 		var subscibe models.ServeSubscibe
84
 		var subscibe models.ServeSubscibe
85
 		subscibe.ID = 11
85
 		subscibe.ID = 11
86
-		subscibe.OrgId = 10278 //机构id
86
+		subscibe.OrgId = 10727 //机构id
87
 		subscibe.PeriodStart = 1547447814
87
 		subscibe.PeriodStart = 1547447814
88
 		subscibe.PeriodEnd = 1550039814
88
 		subscibe.PeriodEnd = 1550039814
89
 		subscibe.State = 1
89
 		subscibe.State = 1
93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
94
 		subscibes[4] = &subscibe
94
 		subscibes[4] = &subscibe
95
 		var adminUserInfo service.AdminUserInfo
95
 		var adminUserInfo service.AdminUserInfo
96
-		adminUserInfo.CurrentOrgId = 10278 //机构id小英9675或4
96
+		adminUserInfo.CurrentOrgId = 10727 //机构id小英9675或4
97
 		adminUserInfo.CurrentAppId = 18470 //4
97
 		adminUserInfo.CurrentAppId = 18470 //4
98
 		adminUserInfo.AdminUser = &userAdmin
98
 		adminUserInfo.AdminUser = &userAdmin
99
 		adminUserInfo.Subscibes = subscibes
99
 		adminUserInfo.Subscibes = subscibes
329
 		userAdmin.ModifyTime = 1530786071
329
 		userAdmin.ModifyTime = 1530786071
330
 		var subscibe models.ServeSubscibe
330
 		var subscibe models.ServeSubscibe
331
 		subscibe.ID = 11
331
 		subscibe.ID = 11
332
-		subscibe.OrgId = 10278 //机构id小英9675或4
332
+		subscibe.OrgId = 10727 //机构id小英9675或4
333
 		subscibe.PeriodStart = 1538035409
333
 		subscibe.PeriodStart = 1538035409
334
 		subscibe.PeriodEnd = 1569571409
334
 		subscibe.PeriodEnd = 1569571409
335
 		subscibe.State = 1
335
 		subscibe.State = 1
339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
340
 		subscibes[4] = &subscibe
340
 		subscibes[4] = &subscibe
341
 		var adminUserInfo service.AdminUserInfo
341
 		var adminUserInfo service.AdminUserInfo
342
-		adminUserInfo.CurrentOrgId = 10278 //机构id小英9675或4
342
+		adminUserInfo.CurrentOrgId = 10727 //机构id小英9675或4
343
 		adminUserInfo.CurrentAppId = 18470 //4
343
 		adminUserInfo.CurrentAppId = 18470 //4
344
 		adminUserInfo.AdminUser = &userAdmin
344
 		adminUserInfo.AdminUser = &userAdmin
345
 		adminUserInfo.Subscibes = subscibes
345
 		adminUserInfo.Subscibes = subscibes

+ 5 - 1
controllers/dialysis_api_controller.go View File

2839
 			service.CreateDialysisFinish(finish)
2839
 			service.CreateDialysisFinish(finish)
2840
 		}
2840
 		}
2841
 
2841
 
2842
-		if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 10469 || adminUserInfo.CurrentOrgId == 10551 || adminUserInfo.CurrentOrgId == 10579 || adminUserInfo.CurrentOrgId == 10580 || adminUserInfo.CurrentOrgId == 10585 || adminUserInfo.CurrentOrgId == 10344 || adminUserInfo.CurrentOrgId == 10622 || adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10635 || adminUserInfo.CurrentOrgId == 10723 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10727 || adminUserInfo.CurrentOrgId == 10726 {
2842
+		if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 10469 || adminUserInfo.CurrentOrgId == 10551 || adminUserInfo.CurrentOrgId == 10579 || adminUserInfo.CurrentOrgId == 10580 || adminUserInfo.CurrentOrgId == 10585 || adminUserInfo.CurrentOrgId == 10344 || adminUserInfo.CurrentOrgId == 10622 || adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10635 || adminUserInfo.CurrentOrgId == 10723 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10727 || adminUserInfo.CurrentOrgId == 10726 || adminUserInfo.CurrentOrgId == 10731 || adminUserInfo.CurrentOrgId == 10727 {
2843
 			var dewater_amount float64
2843
 			var dewater_amount float64
2844
 			dewater_amount = 0
2844
 			dewater_amount = 0
2845
 			if dry_weight > 0 {
2845
 			if dry_weight > 0 {
2940
 				newprescribe.TargetUltrafiltration = dewater_amount
2940
 				newprescribe.TargetUltrafiltration = dewater_amount
2941
 				newprescribe.PrescriptionWater = dewater_amount
2941
 				newprescribe.PrescriptionWater = dewater_amount
2942
 				newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
2942
 				newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
2943
+				newprescribe.Amylaceum = dialysisSolution.Amylaceum
2943
 				newprescribe.Status = 1
2944
 				newprescribe.Status = 1
2944
 
2945
 
2945
 				if adminUserInfo.CurrentOrgId == 10579 {
2946
 				if adminUserInfo.CurrentOrgId == 10579 {
3013
 					newprescribe.DialysisStrainer = lastDialysisPrescribe.DialysisStrainer
3014
 					newprescribe.DialysisStrainer = lastDialysisPrescribe.DialysisStrainer
3014
 					newprescribe.DialysisIrrigation = lastDialysisPrescribe.DialysisIrrigation
3015
 					newprescribe.DialysisIrrigation = lastDialysisPrescribe.DialysisIrrigation
3015
 					newprescribe.DialysisDialyszers = lastDialysisPrescribe.DialysisDialyszers
3016
 					newprescribe.DialysisDialyszers = lastDialysisPrescribe.DialysisDialyszers
3017
+					newprescribe.Amylaceum = lastDialysisPrescribe.Amylaceum
3016
 					newprescribe.CreatedTime = time.Now().Unix()
3018
 					newprescribe.CreatedTime = time.Now().Unix()
3017
 					newprescribe.UpdatedTime = time.Now().Unix()
3019
 					newprescribe.UpdatedTime = time.Now().Unix()
3018
 					newprescribe.RecordDate = recordDate.Unix()
3020
 					newprescribe.RecordDate = recordDate.Unix()
3301
 			newprescribe.TargetUltrafiltration = dewater_amount
3303
 			newprescribe.TargetUltrafiltration = dewater_amount
3302
 			newprescribe.PrescriptionWater = dewater_amount
3304
 			newprescribe.PrescriptionWater = dewater_amount
3303
 			newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
3305
 			newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
3306
+			newprescribe.Amylaceum = dialysisSolution.Amylaceum
3304
 			newprescribe.Status = 1
3307
 			newprescribe.Status = 1
3305
 			if adminUserInfo.CurrentOrgId == 10579 {
3308
 			if adminUserInfo.CurrentOrgId == 10579 {
3306
 				newprescribe.Modifier = 0
3309
 				newprescribe.Modifier = 0
3379
 				newprescribe.DialysisStrainer = lastDialysisPrescribe.DialysisStrainer
3382
 				newprescribe.DialysisStrainer = lastDialysisPrescribe.DialysisStrainer
3380
 				newprescribe.DialysisIrrigation = lastDialysisPrescribe.DialysisIrrigation
3383
 				newprescribe.DialysisIrrigation = lastDialysisPrescribe.DialysisIrrigation
3381
 				newprescribe.DialysisDialyszers = lastDialysisPrescribe.DialysisDialyszers
3384
 				newprescribe.DialysisDialyszers = lastDialysisPrescribe.DialysisDialyszers
3385
+				newprescribe.Amylaceum = lastDialysisPrescribe.Amylaceum
3382
 				newprescribe.Status = 1
3386
 				newprescribe.Status = 1
3383
 				if adminUserInfo.CurrentOrgId == 10579 {
3387
 				if adminUserInfo.CurrentOrgId == 10579 {
3384
 					newprescribe.Modifier = 0
3388
 					newprescribe.Modifier = 0

+ 29 - 3
controllers/doctor_schedule_api_controller.go View File

430
 	adminUserInfo := this.GetAdminUserInfo()
430
 	adminUserInfo := this.GetAdminUserInfo()
431
 	orgId := adminUserInfo.CurrentOrgId
431
 	orgId := adminUserInfo.CurrentOrgId
432
 	start_time, _ := this.GetInt64("start_time")
432
 	start_time, _ := this.GetInt64("start_time")
433
-	fmt.Println("start_time", start_time)
433
+
434
 	end_time, _ := this.GetInt64("end_time")
434
 	end_time, _ := this.GetInt64("end_time")
435
-	fmt.Println("end_time", end_time)
435
+
436
 	copy_startime, _ := this.GetInt64("copy_startime")
436
 	copy_startime, _ := this.GetInt64("copy_startime")
437
-	fmt.Println("copy_startime", copy_startime)
437
+
438
 	copy_endtime, _ := this.GetInt64("copy_endtime")
438
 	copy_endtime, _ := this.GetInt64("copy_endtime")
439
+
440
+	remark := this.GetString("remark")
441
+
442
+	if len(remark) > 0 {
443
+		scheduleRemark, _ := service.GetStaffScheduleRemark(orgId, copy_startime, copy_endtime)
444
+
445
+		remark := models.XtStaffScheduleRemark{
446
+			ID:        scheduleRemark.ID,
447
+			StartTime: copy_startime,
448
+			EndTime:   copy_endtime,
449
+			Remark:    remark,
450
+			UserOrgId: orgId,
451
+			Status:    1,
452
+			Ctime:     0,
453
+			Mtime:     0,
454
+		}
455
+
456
+		if scheduleRemark.ID == 0 {
457
+			service.CreateStaffScheduleRemark(remark)
458
+		}
459
+
460
+		if scheduleRemark.ID > 0 {
461
+			service.SaveStaffScheduleRemarkOne(remark)
462
+		}
463
+	}
439
 	schedule, err := service.GetStaffScheduleListTwo(orgId, start_time, end_time)
464
 	schedule, err := service.GetStaffScheduleListTwo(orgId, start_time, end_time)
440
 	//查询选中日期的排班是否存在
465
 	//查询选中日期的排班是否存在
441
 	_, errcode := service.GetNextWeekSchedule(orgId, copy_startime, copy_endtime)
466
 	_, errcode := service.GetNextWeekSchedule(orgId, copy_startime, copy_endtime)
477
 				Status:       1,
502
 				Status:       1,
478
 				Ctime:        time.Now().Unix(),
503
 				Ctime:        time.Now().Unix(),
479
 				ScheduleDate: item.ScheduleDate,
504
 				ScheduleDate: item.ScheduleDate,
505
+				Remark:       item.Remark,
480
 			}
506
 			}
481
 			service.AddSchedule(&staffSchedule)
507
 			service.AddSchedule(&staffSchedule)
482
 		}
508
 		}

+ 2 - 3
controllers/his_api_controller.go View File

3390
 	var adviceList []models.HisDoctorAdviceInfo
3390
 	var adviceList []models.HisDoctorAdviceInfo
3391
 	var projectList []models.HisPrescriptionProject
3391
 	var projectList []models.HisPrescriptionProject
3392
 
3392
 
3393
-	if adminInfo.CurrentOrgId == 10489 || adminInfo.CurrentOrgId == 10510 || adminInfo.CurrentOrgId == 10164 || adminInfo.CurrentOrgId == 10478 || adminInfo.CurrentOrgId == 10318 || adminInfo.CurrentOrgId == 10480 || adminInfo.CurrentOrgId == 10633 || adminInfo.CurrentOrgId == 10610 || adminInfo.CurrentOrgId == 10402 || adminInfo.CurrentOrgId == 10138 || adminInfo.CurrentOrgId == 10278 || adminInfo.CurrentOrgId == 10537 || adminInfo.CurrentOrgId == 10265 || adminInfo.CurrentOrgId == 10644 || adminInfo.CurrentOrgId == 10635 || adminInfo.CurrentOrgId == 10598 || adminInfo.CurrentOrgId == 10028 || adminInfo.CurrentOrgId == 10721 || adminInfo.CurrentOrgId == 10726 {
3393
+	if adminInfo.CurrentOrgId == 10489 || adminInfo.CurrentOrgId == 10510 || adminInfo.CurrentOrgId == 10164 || adminInfo.CurrentOrgId == 10478 || adminInfo.CurrentOrgId == 10318 || adminInfo.CurrentOrgId == 10480 || adminInfo.CurrentOrgId == 10633 || adminInfo.CurrentOrgId == 10610 || adminInfo.CurrentOrgId == 10402 || adminInfo.CurrentOrgId == 10138 || adminInfo.CurrentOrgId == 10278 || adminInfo.CurrentOrgId == 10537 || adminInfo.CurrentOrgId == 10265 || adminInfo.CurrentOrgId == 10644 || adminInfo.CurrentOrgId == 10635 || adminInfo.CurrentOrgId == 10598 || adminInfo.CurrentOrgId == 10028 || adminInfo.CurrentOrgId == 10721 || adminInfo.CurrentOrgId == 10726 || adminInfo.CurrentOrgId == 10731 || adminInfo.CurrentOrgId == 10571 || adminInfo.CurrentOrgId == 10724 {
3394
 		if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
3394
 		if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
3395
 			prescriptions, _ := dataBody["prescriptions"].([]interface{})
3395
 			prescriptions, _ := dataBody["prescriptions"].([]interface{})
3396
 
3396
 
7068
 									ExpireDate:              it.ExpiryDate,
7068
 									ExpireDate:              it.ExpiryDate,
7069
 									StorehouseId:            houseConfig.StorehouseOutInfo,
7069
 									StorehouseId:            houseConfig.StorehouseOutInfo,
7070
 									OverCount:               flush_count_one,
7070
 									OverCount:               flush_count_one,
7071
+									OperateTime:             time.Now().Unix(),
7071
 								}
7072
 								}
7072
 								service.CreateStockFlowOne(flow)
7073
 								service.CreateStockFlowOne(flow)
7073
 
7074
 
7701
 					//查询已出库数量
7702
 					//查询已出库数量
7702
 					dialysisInfo, _ := service.GetGoodDialysisOutInfoSix(adminInfo.CurrentOrgId, info.PatientId, info.SysRecordTime, project.ProjectId)
7703
 					dialysisInfo, _ := service.GetGoodDialysisOutInfoSix(adminInfo.CurrentOrgId, info.PatientId, info.SysRecordTime, project.ProjectId)
7703
 
7704
 
7704
-					//fmt.Println("aiwohonguo --------------------", prescribingNumber)
7705
-					//fmt.Println("aiwohonguo --------------------", dialysisInfo.Count)
7706
 					if prescribingNumber < dialysisInfo.Count {
7705
 					if prescribingNumber < dialysisInfo.Count {
7707
 						//改变数量
7706
 						//改变数量
7708
 						service.UpdateAutoGood(adminInfo.CurrentOrgId, info.PatientId, info.SysRecordTime, project.ProjectId, id, prescribingNumber)
7707
 						service.UpdateAutoGood(adminInfo.CurrentOrgId, info.PatientId, info.SysRecordTime, project.ProjectId, id, prescribingNumber)

+ 59 - 0
controllers/inspection_api_controller.go View File

42
 
42
 
43
 	beego.Router("/api/editpatientnewinspection", &InspectionApiController{}, "Post:EditPatientNewInspection")
43
 	beego.Router("/api/editpatientnewinspection", &InspectionApiController{}, "Post:EditPatientNewInspection")
44
 
44
 
45
+	beego.Router("/api/getinspecitonbypatientgroup", &InspectionApiController{}, "Get:GetInpsectionByPatientGroup")
46
+
47
+	beego.Router("/api/getinspectionchildlist", &InspectionApiController{}, "Get:GetInspectionChildList")
48
+
45
 }
49
 }
46
 func (c *InspectionApiController) SetInspectionRemind() {
50
 func (c *InspectionApiController) SetInspectionRemind() {
47
 	remind_cycle, _ := c.GetInt64("remind_cycle", 0)
51
 	remind_cycle, _ := c.GetInt64("remind_cycle", 0)
1140
 
1144
 
1141
 	fmt.Println("id------------------------------", id)
1145
 	fmt.Println("id------------------------------", id)
1142
 }
1146
 }
1147
+
1148
+func (c *InspectionApiController) GetInpsectionByPatientGroup() {
1149
+
1150
+	patient_id, _ := c.GetInt64("patient_id")
1151
+
1152
+	org_id := c.GetAdminUserInfo().CurrentOrgId
1153
+
1154
+	//patient, _ := service.GetPatientDetailTwo(patient_id)
1155
+	inspection, _ := service.GetInspectionGroup(patient_id, org_id)
1156
+
1157
+	if len(inspection) > 0 {
1158
+		for _, item := range inspection {
1159
+			lastInspection, _ := service.GetLastInspectionProject(patient_id, org_id, item.ProjectId)
1160
+			item.InspectDate = lastInspection.InspectDate
1161
+			inspecList, _ := service.GetInspectionByProjectId(patient_id, org_id, item.ProjectId)
1162
+			item.Count = int64(len(inspecList))
1163
+		}
1164
+	}
1165
+
1166
+	c.ServeSuccessJSON(map[string]interface{}{
1167
+		"inspection": inspection,
1168
+	})
1169
+}
1170
+
1171
+func (c *InspectionApiController) GetInspectionChildList() {
1172
+
1173
+	patient_id, _ := c.GetInt64("patient_id")
1174
+
1175
+	project_id, _ := c.GetInt64("project_id")
1176
+
1177
+	org_id := c.GetAdminUserInfo().CurrentOrgId
1178
+
1179
+	//patient, _ := service.GetPatientDetailTwo(patient_id)
1180
+
1181
+	referenceList, _ := service.GetInSpctionRerefce(project_id, org_id)
1182
+
1183
+	inspection, _ := service.GetInspectionGroupByRecordDate(patient_id, project_id, org_id)
1184
+
1185
+	if len(inspection) > 0 {
1186
+		for _, item := range inspection {
1187
+			inspeclist, _ := service.GetInspectionByProject(patient_id, project_id, org_id, item.InspectDate)
1188
+			for _, it := range inspeclist {
1189
+				item.Child = append(item.Child, it)
1190
+			}
1191
+		}
1192
+	}
1193
+
1194
+	patients, _ := service.GetPatientByIDOne(org_id, patient_id)
1195
+
1196
+	c.ServeSuccessJSON(map[string]interface{}{
1197
+		"inspection":    inspection,
1198
+		"patients":      patients,
1199
+		"referenceList": referenceList,
1200
+	})
1201
+}

+ 15 - 1
controllers/mobile_api_controllers/check_weight_api_controller.go View File

319
 
319
 
320
 	template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
320
 	template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
321
 
321
 
322
-	if template.TemplateId == 22 || template.TemplateId == 17 || template.TemplateId == 21 || template.TemplateId == 26 || template.TemplateId == 27 || template.TemplateId == 34 || template.TemplateId == 30 || template.TemplateId == 32 || template.TemplateId == 36 || template.TemplateId == 40 || template.TemplateId == 38 || template.TemplateId == 43 || template.TemplateId == 46 || template.TemplateId == 53 || template.TemplateId == 48 || adminUserInfo.Org.Id == 10345 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10441 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10138 || adminUserInfo.Org.Id == 10278 || adminUserInfo.Org.Id == 9829 || adminUserInfo.Org.Id == 10440 || adminUserInfo.Org.Id == 10469 || adminUserInfo.Org.Id == 10471 || adminUserInfo.Org.Id == 10537 || adminUserInfo.Org.Id == 10667 || adminUserInfo.Org.Id == 10723 {
322
+	if template.TemplateId == 22 || template.TemplateId == 17 || template.TemplateId == 21 || template.TemplateId == 26 || template.TemplateId == 27 || template.TemplateId == 34 || template.TemplateId == 30 || template.TemplateId == 32 || template.TemplateId == 36 || template.TemplateId == 40 || template.TemplateId == 38 || template.TemplateId == 43 || template.TemplateId == 46 || template.TemplateId == 53 || template.TemplateId == 48 || adminUserInfo.Org.Id == 10345 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10441 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10138 || adminUserInfo.Org.Id == 10278 || adminUserInfo.Org.Id == 9829 || adminUserInfo.Org.Id == 10440 || adminUserInfo.Org.Id == 10469 || adminUserInfo.Org.Id == 10471 || adminUserInfo.Org.Id == 10537 || adminUserInfo.Org.Id == 10667 || adminUserInfo.Org.Id == 10723 || adminUserInfo.Org.Id == 10731 {
323
 		if adminUserInfo.Org.Id != 10447 {
323
 		if adminUserInfo.Org.Id != 10447 {
324
 			dewater_amount = dewater_amount * 1000
324
 			dewater_amount = dewater_amount * 1000
325
 		}
325
 		}
437
 			newprescribe.Chaptalization = dialysisSolution.Chaptalization
437
 			newprescribe.Chaptalization = dialysisSolution.Chaptalization
438
 			newprescribe.PrescribingNumber = 1
438
 			newprescribe.PrescribingNumber = 1
439
 			newprescribe.BloodAccessPartId = dialysisSolution.BloodAccessPartId
439
 			newprescribe.BloodAccessPartId = dialysisSolution.BloodAccessPartId
440
+			newprescribe.Amylaceum = dialysisSolution.Amylaceum
440
 			newprescribe.Status = 1
441
 			newprescribe.Status = 1
441
 			if adminUserInfo.Org.Id != 10013 && adminUserInfo.Org.Id != 10014 && adminUserInfo.Org.Id != 10016 {
442
 			if adminUserInfo.Org.Id != 10013 && adminUserInfo.Org.Id != 10014 && adminUserInfo.Org.Id != 10016 {
442
 				newprescribe.Remark = dialysisSolution.Remark
443
 				newprescribe.Remark = dialysisSolution.Remark
587
 				newprescribe.BodyFluidOther = lastDialysisPrescribe.BodyFluidOther
588
 				newprescribe.BodyFluidOther = lastDialysisPrescribe.BodyFluidOther
588
 				newprescribe.TargetKtv = lastDialysisPrescribe.TargetKtv
589
 				newprescribe.TargetKtv = lastDialysisPrescribe.TargetKtv
589
 				newprescribe.BloodAccessPartId = lastDialysisPrescribe.BloodAccessPartId
590
 				newprescribe.BloodAccessPartId = lastDialysisPrescribe.BloodAccessPartId
591
+				newprescribe.Amylaceum = lastDialysisPrescribe.Amylaceum
590
 				newprescribe.CreatedTime = time.Now().Unix()
592
 				newprescribe.CreatedTime = time.Now().Unix()
591
 				newprescribe.UpdatedTime = time.Now().Unix()
593
 				newprescribe.UpdatedTime = time.Now().Unix()
592
 				newprescribe.RecordDate = theAssessmentDateTime
594
 				newprescribe.RecordDate = theAssessmentDateTime
713
 				newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
715
 				newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
714
 				newprescribe.BloodAccessPartId = lastDialysisPrescribe.BloodAccessPartId
716
 				newprescribe.BloodAccessPartId = lastDialysisPrescribe.BloodAccessPartId
715
 				newprescribe.Status = 1
717
 				newprescribe.Status = 1
718
+				newprescribe.Amylaceum = lastDialysisPrescribe.Amylaceum
716
 				newprescribe.PrescribingNumber = 1
719
 				newprescribe.PrescribingNumber = 1
717
 
720
 
718
 				if adminUserInfo.Org.Id == 10340 {
721
 				if adminUserInfo.Org.Id == 10340 {
954
 				if adminUserInfo.Org.Id == 10721 {
957
 				if adminUserInfo.Org.Id == 10721 {
955
 					evaluation.Temperature = 36.5
958
 					evaluation.Temperature = 36.5
956
 				}
959
 				}
960
+				if adminUserInfo.Org.Id == 10702 {
961
+					evaluation.PulseFrequency = 0
962
+				}
957
 			}
963
 			}
958
 		} else {
964
 		} else {
959
 			evaluation.UpdatedTime = time.Now().Unix()
965
 			evaluation.UpdatedTime = time.Now().Unix()
974
 			service.UpdateMobileGetDialysisPrescribeOne(lastDialysisPrescription.ID, dewater_amount)
980
 			service.UpdateMobileGetDialysisPrescribeOne(lastDialysisPrescription.ID, dewater_amount)
975
 		}
981
 		}
976
 
982
 
983
+		//针对古镇乐生
984
+		if adminUserInfo.Org.Id == 10727 || adminUserInfo.Org.Id == 10731 {
985
+
986
+			dewater_amount = (evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight) * 1000
987
+			lastDialysisPrescription, _ := service.GetLastDialysisPrescription(id, adminUserInfo.Org.Id)
988
+			service.UpdateMobileGetDialysisPrescribeOne(lastDialysisPrescription.ID, dewater_amount)
989
+		}
990
+
977
 		err := service.UpadatePredialysisEvaluation(&evaluation)
991
 		err := service.UpadatePredialysisEvaluation(&evaluation)
978
 
992
 
979
 		//记录日志
993
 		//记录日志

+ 89 - 4
controllers/mobile_api_controllers/dialysis_api_controller.go View File

3011
 
3011
 
3012
 	}
3012
 	}
3013
 
3013
 
3014
-	if adminUserInfo.Org.Id == 10101 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9675 || adminUserInfo.Org.Id == 10215 || adminUserInfo.Org.Id == 10233 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 10243 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 10414 || adminUserInfo.Org.Id == 10430 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 9829 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10440 || adminUserInfo.Org.Id == 10469 || adminUserInfo.Org.Id == 10693 {
3014
+	if adminUserInfo.Org.Id == 10101 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9675 || adminUserInfo.Org.Id == 10215 || adminUserInfo.Org.Id == 10233 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 10243 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 10414 || adminUserInfo.Org.Id == 10430 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 9829 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10440 || adminUserInfo.Org.Id == 10469 || adminUserInfo.Org.Id == 10693 || adminUserInfo.Org.Id == 10702 {
3015
 		evaluation, _ := service.MobileGetPredialysisEvaluationOne(adminUserInfo.Org.Id, id, recordDate.Unix())
3015
 		evaluation, _ := service.MobileGetPredialysisEvaluationOne(adminUserInfo.Org.Id, id, recordDate.Unix())
3016
 		if evaluation.SystolicBloodPressure == 0 {
3016
 		if evaluation.SystolicBloodPressure == 0 {
3017
 			evaluation.SystolicBloodPressure = fmonitorRecords.SystolicBloodPressure
3017
 			evaluation.SystolicBloodPressure = fmonitorRecords.SystolicBloodPressure
3937
 
3937
 
3938
 			}
3938
 			}
3939
 
3939
 
3940
+			if adminUserInfo.Org.Id == 10727 || adminUserInfo.Org.Id == 10731 {
3941
+				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60)
3942
+				ultrafiltration_rate = ultrafiltration_rate
3943
+
3944
+				ultrafiltration_rate_one = strconv.FormatFloat(ultrafiltration_rate, 'f', -1, 64)
3945
+
3946
+			}
3947
+
3940
 			if adminUserInfo.Org.Id == 10694 || adminUserInfo.Org.Id == 10697 {
3948
 			if adminUserInfo.Org.Id == 10694 || adminUserInfo.Org.Id == 10697 {
3941
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
3949
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
3942
 				ultrafiltration_rate = ultrafiltration_rate
3950
 				ultrafiltration_rate = ultrafiltration_rate
3972
 				}
3980
 				}
3973
 			}
3981
 			}
3974
 
3982
 
3983
+			if adminUserInfo.Org.Id == 10702 || adminUserInfo.Org.Id == 10731 || adminUserInfo.Org.Id == 10727 {
3984
+				if prescription.ModeId == 2 {
3985
+					totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
3986
+					if totalMin == 0 {
3987
+						totalMin = 240
3988
+					}
3989
+					if prescription.DisplaceLiquiValue == 0 {
3990
+						prescription.ReplacementTotal = 32
3991
+					}
3992
+
3993
+					//乘10 除10是为了保留一位小数
3994
+					replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*10) / 10
3995
+				}
3996
+			}
3997
+
3975
 		}
3998
 		}
3976
 	}
3999
 	}
3977
 
4000
 
5076
 				record.UltrafiltrationRate = ultrafiltration_rate
5099
 				record.UltrafiltrationRate = ultrafiltration_rate
5077
 			}
5100
 			}
5078
 
5101
 
5079
-			if template.TemplateId == 20 || template.TemplateId == 22 {
5102
+			if template.TemplateId == 20 || template.TemplateId == 22 || adminInfo.Org.Id == 10731 {
5080
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60)
5103
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60)
5081
 				record.UltrafiltrationRate = ultrafiltration_rate
5104
 				record.UltrafiltrationRate = ultrafiltration_rate
5082
 			}
5105
 			}
5153
 			if adminInfo.Org.Id == 10597 || adminInfo.Org.Id == 10599 || adminInfo.Org.Id == 10679 {
5176
 			if adminInfo.Org.Id == 10597 || adminInfo.Org.Id == 10599 || adminInfo.Org.Id == 10679 {
5154
 				record.UltrafiltrationRate = 0
5177
 				record.UltrafiltrationRate = 0
5155
 			}
5178
 			}
5179
+
5180
+			if adminInfo.Org.Id == 10727 || adminInfo.Org.Id == 10731 {
5181
+				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
5182
+				record.UltrafiltrationRate = ultrafiltration_rate / 1000
5183
+
5184
+				fmt.Println("record.UltrafiltrationRate ------------------------", record.UltrafiltrationRate)
5185
+			}
5156
 			//if template.TemplateId == 47 {
5186
 			//if template.TemplateId == 47 {
5157
 			//	ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 60 / float64(totalMin))
5187
 			//	ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 60 / float64(totalMin))
5158
 			//	record.UltrafiltrationRate = ultrafiltration_rate
5188
 			//	record.UltrafiltrationRate = ultrafiltration_rate
5226
 		record.UltrafiltrationVolume = 0
5256
 		record.UltrafiltrationVolume = 0
5227
 	}
5257
 	}
5228
 
5258
 
5229
-	if adminInfo.Org.Id == 10721 || adminInfo.Org.Id == 10164 {
5259
+	if adminInfo.Org.Id == 10721 || adminInfo.Org.Id == 10164 || adminInfo.Org.Id == 10731 {
5260
+		if ultrafiltration_rate > 0 {
5261
+			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5262
+			record.UltrafiltrationVolume = ultrafiltration_volume / 1000
5263
+		}
5264
+
5265
+	}
5266
+
5267
+	//古镇乐生
5268
+	if adminInfo.Org.Id == 10731 || adminInfo.Org.Id == 10727 {
5230
 		if ultrafiltration_rate > 0 {
5269
 		if ultrafiltration_rate > 0 {
5231
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5270
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5232
 			record.UltrafiltrationVolume = ultrafiltration_volume / 1000
5271
 			record.UltrafiltrationVolume = ultrafiltration_volume / 1000
5240
 		totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
5279
 		totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
5241
 		replacement_rate = math.Floor(prescription.ReplacementTotal*1000/float64(totalMin)*60) / 1000
5280
 		replacement_rate = math.Floor(prescription.ReplacementTotal*1000/float64(totalMin)*60) / 1000
5242
 
5281
 
5243
-		fmt.Println("replacement_rate--------------------------", replacement_rate)
5244
 		record.ReplacementRate = replacement_rate
5282
 		record.ReplacementRate = replacement_rate
5245
 
5283
 
5246
 		fmt.Println(math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600))
5284
 		fmt.Println(math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600))
5249
 
5287
 
5250
 	}
5288
 	}
5251
 
5289
 
5290
+	if adminInfo.Org.Id == 10731 || adminInfo.Org.Id == 10727 {
5291
+
5292
+		var replacement_rate float64
5293
+		var displacement_quantity float64
5294
+
5295
+		totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
5296
+		if totalMin == 0 {
5297
+			totalMin = 240
5298
+		}
5299
+		if prescription.DisplaceLiquiValue == 0 {
5300
+			prescription.ReplacementTotal = 32
5301
+		}
5302
+
5303
+		//乘10 除10是为了保留一位小数
5304
+		replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*10) / 10
5305
+
5306
+		fmt.Println(math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600))
5307
+		displacement_quantity = math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime)/3600) * replacement_rate
5308
+		record.DisplacementQuantity = displacement_quantity
5309
+	}
5310
+
5252
 	lastMonitorRecordList, _ := service.GetLastMonitorRecordList(patientID, monitorDate, adminInfo.Org.Id)
5311
 	lastMonitorRecordList, _ := service.GetLastMonitorRecordList(patientID, monitorDate, adminInfo.Org.Id)
5253
 
5312
 
5254
 	this.ServeSuccessJSON(map[string]interface{}{
5313
 	this.ServeSuccessJSON(map[string]interface{}{
12393
 		"advice": newAdvices,
12452
 		"advice": newAdvices,
12394
 	})
12453
 	})
12395
 }
12454
 }
12455
+
12456
+func (c *DialysisAPIController) StopLongAdvice() {
12457
+
12458
+	stop_time := c.GetString("execution_time")
12459
+	id, _ := c.GetInt64("id")
12460
+	if len(stop_time) <= 0 {
12461
+		utils.ErrorLog("stop_time")
12462
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
12463
+		return
12464
+	}
12465
+	timeLayout2 := "2006-01-02 15:04:05"
12466
+	loc, _ := time.LoadLocation("Local")
12467
+
12468
+	theTime, errs := time.ParseInLocation(timeLayout2, stop_time, loc)
12469
+	if errs != nil {
12470
+		utils.ErrorLog(errs.Error())
12471
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
12472
+		return
12473
+	}
12474
+
12475
+	advice, _ := service.StopLongAdvice(id, theTime.Unix())
12476
+
12477
+	c.ServeSuccessJSON(map[string]interface{}{
12478
+		"advice": advice,
12479
+	})
12480
+}

+ 2 - 0
controllers/mobile_api_controllers/mobile_api_router_register.go View File

231
 	beego.Router("/m/api/updateeditdrugorder", &DialysisAPIController{}, "Post:UpdateEditDrugOrder")
231
 	beego.Router("/m/api/updateeditdrugorder", &DialysisAPIController{}, "Post:UpdateEditDrugOrder")
232
 
232
 
233
 	beego.Router("/m/api/savelongadvicetemplate", &DialysisAPIController{}, "Post:SaveLongAdviceTemplate")
233
 	beego.Router("/m/api/savelongadvicetemplate", &DialysisAPIController{}, "Post:SaveLongAdviceTemplate")
234
+
235
+	beego.Router("/m/api/stoplongadvice", &DialysisAPIController{}, "Get:StopLongAdvice")
234
 }
236
 }

+ 36 - 10
controllers/mobile_api_controllers/patient_api_controller.go View File

1375
 
1375
 
1376
 							if medical.IsUse != 1 {
1376
 							if medical.IsUse != 1 {
1377
 								if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
1377
 								if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
1378
-									if advice.UserOrgId != 10278 && advice.UserOrgId != 10697 && advice.UserOrgId != 10635 {
1378
+									if advice.UserOrgId != 10278 && advice.UserOrgId != 10697 && advice.UserOrgId != 10635 && advice.UserOrgId != 10724 && advice.UserOrgId != 10571 && advice.UserOrgId != 10731 {
1379
 										service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
1379
 										service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
1380
 										advice.ExecutionTime = 0
1380
 										advice.ExecutionTime = 0
1381
 										advice.ExecutionState = 2
1381
 										advice.ExecutionState = 2
1391
 
1391
 
1392
 								}
1392
 								}
1393
 								if prescribing_number_total > total {
1393
 								if prescribing_number_total > total {
1394
-									if advice.UserOrgId != 10278 && advice.UserOrgId != 10697 && advice.UserOrgId != 10635 {
1394
+									if advice.UserOrgId != 10278 && advice.UserOrgId != 10697 && advice.UserOrgId != 10635 && advice.UserOrgId != 10724 && advice.UserOrgId != 10571 && advice.UserOrgId != 10731 {
1395
 										service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
1395
 										service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
1396
 										advice.ExecutionTime = 0
1396
 										advice.ExecutionTime = 0
1397
 										advice.ExecutionState = 2
1397
 										advice.ExecutionState = 2
1418
 											//查询今日是否出库
1418
 											//查询今日是否出库
1419
 											drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1419
 											drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1420
 											if drugOutInfo.ID == 0 {
1420
 											if drugOutInfo.ID == 0 {
1421
-												if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 {
1421
+												if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 && item.UserOrgId != 10724 && item.UserOrgId != 10571 && item.UserOrgId != 10731 {
1422
 													service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1422
 													service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1423
 												}
1423
 												}
1424
 
1424
 
1428
 										if pharmacyConfig.IsOpen != 1 {
1428
 										if pharmacyConfig.IsOpen != 1 {
1429
 											drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1429
 											drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1430
 											if drugOutInfo.ID == 0 {
1430
 											if drugOutInfo.ID == 0 {
1431
-												if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 {
1431
+												if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 && item.UserOrgId != 10724 && item.UserOrgId != 10571 && item.UserOrgId != 10731 {
1432
 													service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1432
 													service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1433
 												}
1433
 												}
1434
 
1434
 
1455
 									if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
1455
 									if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
1456
 										drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1456
 										drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1457
 										if drugOutInfo.ID == 0 {
1457
 										if drugOutInfo.ID == 0 {
1458
-											if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 {
1458
+											if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 && item.UserOrgId != 10724 && item.UserOrgId != 10571 && item.UserOrgId != 10731 {
1459
 												service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1459
 												service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1460
 											}
1460
 											}
1461
 
1461
 
1479
 										service.CreateDrugError(drugError)
1479
 										service.CreateDrugError(drugError)
1480
 										drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1480
 										drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1481
 										if drugOutInfo.ID == 0 {
1481
 										if drugOutInfo.ID == 0 {
1482
-											if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 {
1482
+											if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 && item.UserOrgId != 10724 && item.UserOrgId != 10571 && item.UserOrgId != 10731 {
1483
 												service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1483
 												service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1484
 											}
1484
 											}
1485
 
1485
 
1558
 							}
1558
 							}
1559
 							if medical.IsUse != 1 {
1559
 							if medical.IsUse != 1 {
1560
 								if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
1560
 								if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
1561
-									if advice.UserOrgId != 10278 && advice.UserOrgId != 10697 && advice.UserOrgId != 10635 {
1561
+									if advice.UserOrgId != 10278 && advice.UserOrgId != 10697 && advice.UserOrgId != 10635 && item.UserOrgId != 10724 && item.UserOrgId != 10571 && item.UserOrgId != 10731 {
1562
 										service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
1562
 										service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
1563
 										advice.ExecutionTime = 0
1563
 										advice.ExecutionTime = 0
1564
 										advice.ExecutionState = 2
1564
 										advice.ExecutionState = 2
1572
 									return
1572
 									return
1573
 								}
1573
 								}
1574
 								if prescribing_number_total > total {
1574
 								if prescribing_number_total > total {
1575
-									if advice.UserOrgId != 10278 && advice.UserOrgId != 10697 && advice.UserOrgId != 10635 {
1575
+									if advice.UserOrgId != 10278 && advice.UserOrgId != 10697 && advice.UserOrgId != 10635 && item.UserOrgId != 10724 && item.UserOrgId != 10571 && item.UserOrgId != 10731 {
1576
 										service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
1576
 										service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
1577
 										advice.ExecutionTime = 0
1577
 										advice.ExecutionTime = 0
1578
 										advice.ExecutionState = 2
1578
 										advice.ExecutionState = 2
1591
 									//查询今日是否出库
1591
 									//查询今日是否出库
1592
 									drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1592
 									drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1593
 									if drugOutInfo.ID == 0 {
1593
 									if drugOutInfo.ID == 0 {
1594
-										if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 {
1594
+										if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 && item.UserOrgId != 10724 && item.UserOrgId != 10571 && item.UserOrgId != 10731 {
1595
 											service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1595
 											service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1596
 										}
1596
 										}
1597
 
1597
 
1601
 									//查询今日是否出库
1601
 									//查询今日是否出库
1602
 									drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1602
 									drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1603
 									if drugOutInfo.ID == 0 {
1603
 									if drugOutInfo.ID == 0 {
1604
-										if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 {
1604
+										if item.UserOrgId != 10644 && item.UserOrgId != 10721 && item.UserOrgId != 10138 && item.UserOrgId != 10278 && item.UserOrgId != 10724 && item.UserOrgId != 10571 && item.UserOrgId != 10731 {
1605
 											service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1605
 											service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1606
 										}
1606
 										}
1607
 
1607
 
3494
 
3494
 
3495
 		}
3495
 		}
3496
 
3496
 
3497
+		if adminUserInfo.Org.Id == 10727 {
3498
+			dewater_amount = dewater_amount * 1000
3499
+		}
3500
+
3497
 		if dewater_amount <= 0 {
3501
 		if dewater_amount <= 0 {
3498
 			dewater_amount = 0
3502
 			dewater_amount = 0
3499
 		}
3503
 		}
4226
 
4230
 
4227
 	}
4231
 	}
4228
 
4232
 
4233
+	//古镇乐生
4234
+	if adminUserInfo.Org.Id == 10727 || adminUserInfo.Org.Id == 10731 {
4235
+		if evaluation.ID == 0 {
4236
+			dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
4237
+			if dialysisPrescribeOne.ID > 0 && evaluation.ID > 0 {
4238
+				dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
4239
+				dewater_amount = dewater_amount * 1000
4240
+				service.UpdateMobileGetDialysisPrescribe(dialysisPrescribeOne.ID, dewater_amount)
4241
+			}
4242
+		}
4243
+
4244
+		if evaluation.ID > 0 {
4245
+			dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
4246
+			if dialysisPrescribeOne.ID > 0 && evaluation.ID > 0 {
4247
+				dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
4248
+				dewater_amount = dewater_amount * 1000
4249
+				service.UpdateMobileGetDialysisPrescribeOne(dialysisPrescribeOne.ID, dewater_amount)
4250
+			}
4251
+		}
4252
+	}
4253
+
4229
 	if adminUserInfo.Org.Id == 10721 || adminUserInfo.Org.Id == 10164 {
4254
 	if adminUserInfo.Org.Id == 10721 || adminUserInfo.Org.Id == 10164 {
4230
 
4255
 
4231
 		prescription, _ := service.GetTodayPrescription(id, adminUserInfo.Org.Id, theAssessmentDateTime)
4256
 		prescription, _ := service.GetTodayPrescription(id, adminUserInfo.Org.Id, theAssessmentDateTime)
5706
 				advice.PrescribingNumber = cnt
5731
 				advice.PrescribingNumber = cnt
5707
 				advice.PrescribingNumberUnit = item.Unit
5732
 				advice.PrescribingNumberUnit = item.Unit
5708
 				advice.AdviceDoctor = item.Doctor
5733
 				advice.AdviceDoctor = item.Doctor
5734
+				advice.Remark = item.Remark
5709
 				if item.Type == 3 {
5735
 				if item.Type == 3 {
5710
 					advice.AdviceName = item.GoodInfo.GoodName
5736
 					advice.AdviceName = item.GoodInfo.GoodName
5711
 					advice.PrescribingNumberUnit = item.GoodInfo.PackingUnit
5737
 					advice.PrescribingNumberUnit = item.GoodInfo.PackingUnit

+ 145 - 10
controllers/patient_api_controller.go View File

162
 
162
 
163
 	beego.Router("/api/patient/getpatientlapeso", &DialysisApiController{}, "Get:GetPatientLapseList")
163
 	beego.Router("/api/patient/getpatientlapeso", &DialysisApiController{}, "Get:GetPatientLapseList")
164
 
164
 
165
+	beego.Router("/api/patient/adddeathsummary", &DialysisApiController{}, "Post:AddDeathSummary")
166
+
167
+	beego.Router("/api/patient/getpatientdeathsummary", &DialysisApiController{}, "Get:GetPatientDeathSummary")
168
+
169
+	beego.Router("/api/patient/deletepatientdeathsummary", &DialysisApiController{}, "Get:DeletePatientDeathSummary")
170
+
165
 }
171
 }
166
 func (c *PatientApiController) GetExportList() {
172
 func (c *PatientApiController) GetExportList() {
167
 	startTime := c.GetString("start_time")
173
 	startTime := c.GetString("start_time")
297
 
303
 
298
 	adminUserInfo := c.GetAdminUserInfo()
304
 	adminUserInfo := c.GetAdminUserInfo()
299
 
305
 
300
-	patients, total, _ := service.GetAllPatientList(adminUserInfo.CurrentOrgId)
306
+	if adminUserInfo.CurrentOrgId != 10702 {
307
+		patients, total, _ := service.GetAllPatientList(adminUserInfo.CurrentOrgId)
308
+		c.ServeSuccessJSON(map[string]interface{}{
309
+			"patients":    patients,
310
+			"patientsOne": patients,
311
+			"total":       total,
312
+		})
313
+		return
314
+	} else {
315
+		patients, total, _ := service.GetAllPatientListOne(adminUserInfo.CurrentOrgId)
316
+		patientsOne, total, _ := service.GetAllPatientList(adminUserInfo.CurrentOrgId)
317
+		c.ServeSuccessJSON(map[string]interface{}{
318
+			"patients":    patients,
319
+			"patientsOne": patientsOne,
320
+			"total":       total,
321
+		})
322
+		return
323
+	}
301
 
324
 
302
-	c.ServeSuccessJSON(map[string]interface{}{
303
-		"patients": patients,
304
-		"total":    total,
305
-	})
306
-	return
307
 }
325
 }
308
 
326
 
309
 // GenerateDialysisNo 生成透析号
327
 // GenerateDialysisNo 生成透析号
7626
 
7644
 
7627
 	end_time_one := dataBody["end_time_one"].(string)
7645
 	end_time_one := dataBody["end_time_one"].(string)
7628
 
7646
 
7647
+	is_check := int64(dataBody["is_check"].(float64))
7648
+
7629
 	timeLayout := "2006-01-02"
7649
 	timeLayout := "2006-01-02"
7630
 	loc, _ := time.LoadLocation("Local")
7650
 	loc, _ := time.LoadLocation("Local")
7631
 	var recordDate int64
7651
 	var recordDate int64
7711
 
7731
 
7712
 		service.UpdatePatientLapsetoByPatientId(patient_id, recordDate, lapse_reason)
7732
 		service.UpdatePatientLapsetoByPatientId(patient_id, recordDate, lapse_reason)
7713
 
7733
 
7714
-		service.UpdateScheduleByDeathTime(patient_id, recordDate)
7734
+		if is_check == 2 {
7735
+			service.UpdateScheduleByDeathTime(patient_id, recordDate)
7736
+			service.UpdateScheduleItemByPatientId(patient_id)
7737
+		}
7715
 
7738
 
7716
-		service.UpdateScheduleItemByPatientId(patient_id)
7717
 	}
7739
 	}
7718
 
7740
 
7719
 	//病人转出
7741
 	//病人转出
7721
 
7743
 
7722
 		service.UpdatePatientLapsetoByPatientIdOne(patient_id, recordDate, lapse_reason)
7744
 		service.UpdatePatientLapsetoByPatientIdOne(patient_id, recordDate, lapse_reason)
7723
 
7745
 
7724
-		service.UpdateScheduleByDeathTime(patient_id, recordDate)
7746
+		if is_check == 2 {
7747
+			service.UpdateScheduleByDeathTime(patient_id, recordDate)
7748
+			service.UpdateScheduleItemByPatientId(patient_id)
7749
+		}
7725
 
7750
 
7726
-		service.UpdateScheduleItemByPatientId(patient_id)
7727
 	}
7751
 	}
7728
 
7752
 
7729
 	if lapse_type == 11 {
7753
 	if lapse_type == 11 {
8024
 	//
8048
 	//
8025
 	//}
8049
 	//}
8026
 }
8050
 }
8051
+
8052
+func (c *DialysisApiController) AddDeathSummary() {
8053
+
8054
+	dataBody := make(map[string]interface{}, 0)
8055
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
8056
+	fmt.Println(err)
8057
+
8058
+	id := int64(dataBody["id"].(float64))
8059
+
8060
+	patient_id := int64(dataBody["patient_id"].(float64))
8061
+
8062
+	record_date := dataBody["record_date"].(string)
8063
+
8064
+	last_record_date := dataBody["last_record_date"].(string)
8065
+
8066
+	reason_one := dataBody["reason_one"].(string)
8067
+
8068
+	reason_two := dataBody["reason_two"].(string)
8069
+
8070
+	reason_three := dataBody["reason_three"].(string)
8071
+
8072
+	reason_four := dataBody["reason_four"].(string)
8073
+
8074
+	death_way := dataBody["death_way"].(string)
8075
+
8076
+	replace_way := dataBody["replace_way"].(string)
8077
+
8078
+	replace_reason := dataBody["replace_reason"].(string)
8079
+
8080
+	transplant := dataBody["transplant"].(string)
8081
+
8082
+	remark := dataBody["remark"].(string)
8083
+
8084
+	timeLayout := "2006-01-02"
8085
+	loc, _ := time.LoadLocation("Local")
8086
+	var recordDate int64
8087
+	if len(record_date) > 0 {
8088
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
8089
+		if err != nil {
8090
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
8091
+			return
8092
+		}
8093
+		recordDate = theTime.Unix()
8094
+	}
8095
+
8096
+	var lastRecordDate int64
8097
+	if len(last_record_date) > 0 {
8098
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", last_record_date+" 00:00:00", loc)
8099
+		if err != nil {
8100
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
8101
+			return
8102
+		}
8103
+		lastRecordDate = theTime.Unix()
8104
+	}
8105
+
8106
+	orgId := c.GetAdminUserInfo().CurrentOrgId
8107
+
8108
+	admin_user_id := c.GetAdminUserInfo().AdminUser.Id
8109
+
8110
+	deathSummary := models.XtDeathSummary{
8111
+		ID:             id,
8112
+		PatientId:      patient_id,
8113
+		UserOrgId:      orgId,
8114
+		RecordDate:     recordDate,
8115
+		ReasonOne:      reason_one,
8116
+		ReasonTwo:      reason_two,
8117
+		ReasonThree:    reason_three,
8118
+		ReasonFour:     reason_four,
8119
+		DeathWay:       death_way,
8120
+		ReplaceWay:     replace_way,
8121
+		ReplaceReason:  replace_reason,
8122
+		Transplant:     transplant,
8123
+		Ctime:          time.Now().Unix(),
8124
+		Remark:         remark,
8125
+		Mtime:          time.Now().Unix(),
8126
+		Status:         1,
8127
+		AdminUserId:    admin_user_id,
8128
+		UpdateCreater:  admin_user_id,
8129
+		LastRecordDate: lastRecordDate,
8130
+	}
8131
+
8132
+	service.CreateDeathSummary(deathSummary)
8133
+
8134
+	c.ServeSuccessJSON(map[string]interface{}{
8135
+		"deathSummary": deathSummary,
8136
+	})
8137
+}
8138
+
8139
+func (c *DialysisApiController) GetPatientDeathSummary() {
8140
+
8141
+	patient_id, _ := c.GetInt64("patient_id")
8142
+
8143
+	orgId := c.GetAdminUserInfo().CurrentOrgId
8144
+
8145
+	deathSummary, _ := service.GetPatientDeathSummary(patient_id, orgId)
8146
+
8147
+	c.ServeSuccessJSON(map[string]interface{}{
8148
+		"deathSummary": deathSummary,
8149
+	})
8150
+}
8151
+
8152
+func (c *DialysisApiController) DeletePatientDeathSummary() {
8153
+
8154
+	id, _ := c.GetInt64("id")
8155
+
8156
+	service.DeletePatientDeathSummary(id)
8157
+
8158
+	c.ServeSuccessJSON(map[string]interface{}{
8159
+		"msg": "删除成功",
8160
+	})
8161
+}

+ 26 - 46
controllers/patient_dataconfig_api_controller.go View File

198
 	guominyaowu_desc := this.GetString("guominyaowu_desc")
198
 	guominyaowu_desc := this.GetString("guominyaowu_desc")
199
 	doctor_id, _ := this.GetInt64("doctor_id")
199
 	doctor_id, _ := this.GetInt64("doctor_id")
200
 
200
 
201
-	//if patientID <= 0 || len(content) == 0 {
202
-	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
203
-	//	return
204
-	//}
201
+	timeLayout := "2006-01-02"
202
+	loc, _ := time.LoadLocation("Local")
203
+	var recordDate int64
204
+	if len(record_time_str) > 0 {
205
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time_str+" 00:00:00", loc)
206
+		if err != nil {
207
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
208
+			return
209
+		}
210
+		recordDate = theTime.Unix()
211
+	}
205
 
212
 
206
 	if len(record_time_str) == 0 {
213
 	if len(record_time_str) == 0 {
207
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
214
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
208
 		return
215
 		return
209
 	}
216
 	}
210
-	record_date := strings.Split(record_time_str, " ")
211
-
212
-	checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
213
-	checkDate_two, _ := utils.ParseTimeStringToTime("2006-01-02", record_date[0])
214
 
217
 
215
 	adminUserInfo := this.GetAdminUserInfo()
218
 	adminUserInfo := this.GetAdminUserInfo()
216
-	//patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
217
-	//if getPatientErr != nil {
218
-	//	this.ErrorLog("获取患者信息失败:%v", getPatientErr)
219
-	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
220
-	//	return
221
-	//} else if patient == nil {
222
-	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
223
-	//	return
224
-	//}
225
 
219
 
226
 	now := time.Now().Unix()
220
 	now := time.Now().Unix()
227
 	record := models.XtPatientSickHistory{
221
 	record := models.XtPatientSickHistory{
228
 		OrgId:                   adminUserInfo.CurrentOrgId,
222
 		OrgId:                   adminUserInfo.CurrentOrgId,
229
 		PatientId:               patientID,
223
 		PatientId:               patientID,
230
 		Recorder:                adminUserInfo.AdminUser.Id,
224
 		Recorder:                adminUserInfo.AdminUser.Id,
231
-		RecordTime:              checkDate.Unix(),
225
+		RecordTime:              recordDate,
232
 		Content:                 content,
226
 		Content:                 content,
233
 		Status:                  1,
227
 		Status:                  1,
234
 		Title:                   title,
228
 		Title:                   title,
239
 		Ctime:                   now,
233
 		Ctime:                   now,
240
 		Mtime:                   now,
234
 		Mtime:                   now,
241
 		DoctorId:                doctor_id,
235
 		DoctorId:                doctor_id,
242
-		RecordDate:              checkDate_two.Unix(),
236
+		RecordDate:              recordDate,
243
 	}
237
 	}
244
 
238
 
245
 	createErr := service.CreatePatientSickHistory(&record)
239
 	createErr := service.CreatePatientSickHistory(&record)
304
 	guominyaowu_desc := this.GetString("guominyaowu_desc")
298
 	guominyaowu_desc := this.GetString("guominyaowu_desc")
305
 	doctor_id, _ := this.GetInt64("doctor_id")
299
 	doctor_id, _ := this.GetInt64("doctor_id")
306
 
300
 
307
-	if patientID <= 0 || len(content) == 0 || id == 0 || len(record_time_str) == 0 {
308
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
309
-		return
310
-	}
311
-	//timeLayout := "2006-01-02"
312
-	//loc, _ := time.LoadLocation("Local")
313
-	checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
314
-
315
 	adminUserInfo := this.GetAdminUserInfo()
301
 	adminUserInfo := this.GetAdminUserInfo()
316
-	//patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
317
-	//if getPatientErr != nil {
318
-	//	this.ErrorLog("获取患者信息失败:%v", getPatientErr)
319
-	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
320
-	//	return
321
-	//} else if patient == nil {
322
-	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
323
-	//	return
324
-	//}
302
+
303
+	timeLayout := "2006-01-02"
304
+	loc, _ := time.LoadLocation("Local")
305
+	var recordDate int64
306
+	if len(record_time_str) > 0 {
307
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_time_str+" 00:00:00", loc)
308
+		if err != nil {
309
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
310
+			return
311
+		}
312
+		recordDate = theTime.Unix()
313
+	}
325
 
314
 
326
 	now := time.Now().Unix()
315
 	now := time.Now().Unix()
327
 
316
 
335
 		Ctime:                   now,
324
 		Ctime:                   now,
336
 		Mtime:                   now,
325
 		Mtime:                   now,
337
 		Title:                   title,
326
 		Title:                   title,
338
-		RecordTime:              checkDate.Unix(),
327
+		RecordTime:              recordDate,
339
 		IsShenyizhiHistory:      is_shenyizhishi,
328
 		IsShenyizhiHistory:      is_shenyizhishi,
340
 		IsFumoDialysisHistory:   is_fumotouxishi,
329
 		IsFumoDialysisHistory:   is_fumotouxishi,
341
 		HypersusceptibilityDesc: guominyaowu_desc,
330
 		HypersusceptibilityDesc: guominyaowu_desc,
866
 	}
855
 	}
867
 
856
 
868
 	adminUserInfo := this.GetAdminUserInfo()
857
 	adminUserInfo := this.GetAdminUserInfo()
869
-	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
870
-	if getPatientErr != nil {
871
-		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
872
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
873
-		return
874
-	} else if patient == nil {
875
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
876
-		return
877
-	}
878
 
858
 
879
 	recordIDStrs := strings.Split(idsStr, ",")
859
 	recordIDStrs := strings.Split(idsStr, ",")
880
 	recordIDs := make([]int64, 0, len(recordIDStrs))
860
 	recordIDs := make([]int64, 0, len(recordIDStrs))

+ 27 - 0
models/patient_models.go View File

2803
 
2803
 
2804
 	return "xt_patient_laspse_record"
2804
 	return "xt_patient_laspse_record"
2805
 }
2805
 }
2806
+
2807
+type XtDeathSummary struct {
2808
+	ID             int64  `gorm:"column:id" json:"id" form:"id"`
2809
+	PatientId      int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
2810
+	UserOrgId      int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2811
+	RecordDate     int64  `gorm:"column:record_date" json:"record_date" form:"record_date"`
2812
+	ReasonOne      string `gorm:"column:reason_one" json:"reason_one" form:"reason_one"`
2813
+	ReasonTwo      string `gorm:"column:reason_two" json:"reason_two" form:"reason_two"`
2814
+	ReasonThree    string `gorm:"column:reason_three" json:"reason_three" form:"reason_three"`
2815
+	ReasonFour     string `gorm:"column:reason_four" json:"reason_four" form:"reason_four"`
2816
+	DeathWay       string `gorm:"column:death_way" json:"death_way" form:"death_way"`
2817
+	ReplaceWay     string `gorm:"column:replace_way" json:"replace_way" form:"replace_way"`
2818
+	ReplaceReason  string `gorm:"column:replace_reason" json:"replace_reason" form:"replace_reason"`
2819
+	Transplant     string `gorm:"column:transplant" json:"transplant" form:"transplant"`
2820
+	Ctime          int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
2821
+	Remark         string `gorm:"column:remark" json:"remark" form:"remark"`
2822
+	Mtime          int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
2823
+	Status         int64  `gorm:"column:status" json:"status" form:"status"`
2824
+	AdminUserId    int64  `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
2825
+	UpdateCreater  int64  `gorm:"column:update_creater" json:"update_creater" form:"update_creater"`
2826
+	LastRecordDate int64  `gorm:"column:last_record_date" json:"last_record_date" form:"last_record_date"`
2827
+}
2828
+
2829
+func (XtDeathSummary) TableName() string {
2830
+
2831
+	return "xt_death_summary"
2832
+}

+ 8 - 0
service/dialysis_service.go View File

2726
 	err := XTWriteDB().Model(&models.MonitoringRecord{}).Where("id = ? and status=1", id).Updates(map[string]interface{}{"displacement_quantity": displacement_quantity}).Error
2726
 	err := XTWriteDB().Model(&models.MonitoringRecord{}).Where("id = ? and status=1", id).Updates(map[string]interface{}{"displacement_quantity": displacement_quantity}).Error
2727
 	return err
2727
 	return err
2728
 }
2728
 }
2729
+
2730
+func StopLongAdvice(id int64, stop_time int64) (models.DoctorAdvice, error) {
2731
+
2732
+	advice := models.DoctorAdvice{}
2733
+	err := XTWriteDB().Model(&advice).Where("id=? and status=1", id).Updates(map[string]interface{}{"stop_time": stop_time, "stop_state": 1, "updated_time": time.Now().Unix()}).Error
2734
+
2735
+	return advice, err
2736
+}

+ 33 - 0
service/patient_service.go View File

110
 	return
110
 	return
111
 }
111
 }
112
 
112
 
113
+func GetAllPatientListOne(orgID int64) (patients []*models.Patients, total int64, err error) {
114
+
115
+	db := readDb.Table("xt_patients as p").Where("p.user_org_id=? and p.status=1 and p.lapseto =1", orgID)
116
+
117
+	err = db.Select(" p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time,p.age,p.id_card_no").Count(&total).Find(&patients).Error
118
+	return
119
+}
120
+
113
 func GetAllPatientListTwenty(orgID int64) (patients []*models.Patients, total int64, err error) {
121
 func GetAllPatientListTwenty(orgID int64) (patients []*models.Patients, total int64, err error) {
114
 
122
 
115
 	db := readDb.Table("xt_patients as p").Where("p.user_org_id=? and p.status=1 and p.lapseto = 1", orgID)
123
 	db := readDb.Table("xt_patients as p").Where("p.user_org_id=? and p.status=1 and p.lapseto = 1", orgID)
4359
 
4367
 
4360
 	return prescription, err
4368
 	return prescription, err
4361
 }
4369
 }
4370
+
4371
+func CreateDeathSummary(summary models.XtDeathSummary) error {
4372
+
4373
+	err := XTWriteDB().Save(&summary).Error
4374
+
4375
+	return err
4376
+}
4377
+
4378
+func GetPatientDeathSummary(patient_id int64, user_org_id int64) (models.XtDeathSummary, error) {
4379
+
4380
+	deathSummary := models.XtDeathSummary{}
4381
+
4382
+	err := XTReadDB().Where("patient_id = ? and user_org_id = ? and status=1", patient_id, user_org_id).Find(&deathSummary).Error
4383
+
4384
+	return deathSummary, err
4385
+}
4386
+
4387
+func DeletePatientDeathSummary(id int64) error {
4388
+
4389
+	summary := models.XtDeathSummary{}
4390
+
4391
+	err := XTWriteDB().Model(&summary).Where("id = ? and status=1", id).Updates(map[string]interface{}{"status": 0}).Error
4392
+
4393
+	return err
4394
+}