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

+ 5 - 1
controllers/dialysis_api_controller.go View File

@@ -2839,7 +2839,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
2839 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 2843
 			var dewater_amount float64
2844 2844
 			dewater_amount = 0
2845 2845
 			if dry_weight > 0 {
@@ -2940,6 +2940,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
2940 2940
 				newprescribe.TargetUltrafiltration = dewater_amount
2941 2941
 				newprescribe.PrescriptionWater = dewater_amount
2942 2942
 				newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
2943
+				newprescribe.Amylaceum = dialysisSolution.Amylaceum
2943 2944
 				newprescribe.Status = 1
2944 2945
 
2945 2946
 				if adminUserInfo.CurrentOrgId == 10579 {
@@ -3013,6 +3014,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
3013 3014
 					newprescribe.DialysisStrainer = lastDialysisPrescribe.DialysisStrainer
3014 3015
 					newprescribe.DialysisIrrigation = lastDialysisPrescribe.DialysisIrrigation
3015 3016
 					newprescribe.DialysisDialyszers = lastDialysisPrescribe.DialysisDialyszers
3017
+					newprescribe.Amylaceum = lastDialysisPrescribe.Amylaceum
3016 3018
 					newprescribe.CreatedTime = time.Now().Unix()
3017 3019
 					newprescribe.UpdatedTime = time.Now().Unix()
3018 3020
 					newprescribe.RecordDate = recordDate.Unix()
@@ -3301,6 +3303,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
3301 3303
 			newprescribe.TargetUltrafiltration = dewater_amount
3302 3304
 			newprescribe.PrescriptionWater = dewater_amount
3303 3305
 			newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
3306
+			newprescribe.Amylaceum = dialysisSolution.Amylaceum
3304 3307
 			newprescribe.Status = 1
3305 3308
 			if adminUserInfo.CurrentOrgId == 10579 {
3306 3309
 				newprescribe.Modifier = 0
@@ -3379,6 +3382,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
3379 3382
 				newprescribe.DialysisStrainer = lastDialysisPrescribe.DialysisStrainer
3380 3383
 				newprescribe.DialysisIrrigation = lastDialysisPrescribe.DialysisIrrigation
3381 3384
 				newprescribe.DialysisDialyszers = lastDialysisPrescribe.DialysisDialyszers
3385
+				newprescribe.Amylaceum = lastDialysisPrescribe.Amylaceum
3382 3386
 				newprescribe.Status = 1
3383 3387
 				if adminUserInfo.CurrentOrgId == 10579 {
3384 3388
 					newprescribe.Modifier = 0

+ 29 - 3
controllers/doctor_schedule_api_controller.go View File

@@ -430,12 +430,37 @@ func (this *DoctorScheduleApiController) CopyStaffSchedule() {
430 430
 	adminUserInfo := this.GetAdminUserInfo()
431 431
 	orgId := adminUserInfo.CurrentOrgId
432 432
 	start_time, _ := this.GetInt64("start_time")
433
-	fmt.Println("start_time", start_time)
433
+
434 434
 	end_time, _ := this.GetInt64("end_time")
435
-	fmt.Println("end_time", end_time)
435
+
436 436
 	copy_startime, _ := this.GetInt64("copy_startime")
437
-	fmt.Println("copy_startime", copy_startime)
437
+
438 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 464
 	schedule, err := service.GetStaffScheduleListTwo(orgId, start_time, end_time)
440 465
 	//查询选中日期的排班是否存在
441 466
 	_, errcode := service.GetNextWeekSchedule(orgId, copy_startime, copy_endtime)
@@ -477,6 +502,7 @@ func (this *DoctorScheduleApiController) CopyStaffSchedule() {
477 502
 				Status:       1,
478 503
 				Ctime:        time.Now().Unix(),
479 504
 				ScheduleDate: item.ScheduleDate,
505
+				Remark:       item.Remark,
480 506
 			}
481 507
 			service.AddSchedule(&staffSchedule)
482 508
 		}

+ 2 - 3
controllers/his_api_controller.go View File

@@ -3390,7 +3390,7 @@ func (c *HisApiController) CreateHisPrescription() {
3390 3390
 	var adviceList []models.HisDoctorAdviceInfo
3391 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 3394
 		if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
3395 3395
 			prescriptions, _ := dataBody["prescriptions"].([]interface{})
3396 3396
 
@@ -7068,6 +7068,7 @@ func (c *HisApiController) DeletePrescription() {
7068 7068
 									ExpireDate:              it.ExpiryDate,
7069 7069
 									StorehouseId:            houseConfig.StorehouseOutInfo,
7070 7070
 									OverCount:               flush_count_one,
7071
+									OperateTime:             time.Now().Unix(),
7071 7072
 								}
7072 7073
 								service.CreateStockFlowOne(flow)
7073 7074
 
@@ -7701,8 +7702,6 @@ func (c *HisApiController) DeleteProject() {
7701 7702
 					//查询已出库数量
7702 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 7705
 					if prescribingNumber < dialysisInfo.Count {
7707 7706
 						//改变数量
7708 7707
 						service.UpdateAutoGood(adminInfo.CurrentOrgId, info.PatientId, info.SysRecordTime, project.ProjectId, id, prescribingNumber)

+ 59 - 0
controllers/inspection_api_controller.go View File

@@ -42,6 +42,10 @@ func InspectionApiRegistRouters() {
42 42
 
43 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 50
 func (c *InspectionApiController) SetInspectionRemind() {
47 51
 	remind_cycle, _ := c.GetInt64("remind_cycle", 0)
@@ -1140,3 +1144,58 @@ func (c *InspectionApiController) EditPatientNewInspection() {
1140 1144
 
1141 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,7 +319,7 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
319 319
 
320 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 323
 		if adminUserInfo.Org.Id != 10447 {
324 324
 			dewater_amount = dewater_amount * 1000
325 325
 		}
@@ -437,6 +437,7 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
437 437
 			newprescribe.Chaptalization = dialysisSolution.Chaptalization
438 438
 			newprescribe.PrescribingNumber = 1
439 439
 			newprescribe.BloodAccessPartId = dialysisSolution.BloodAccessPartId
440
+			newprescribe.Amylaceum = dialysisSolution.Amylaceum
440 441
 			newprescribe.Status = 1
441 442
 			if adminUserInfo.Org.Id != 10013 && adminUserInfo.Org.Id != 10014 && adminUserInfo.Org.Id != 10016 {
442 443
 				newprescribe.Remark = dialysisSolution.Remark
@@ -587,6 +588,7 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
587 588
 				newprescribe.BodyFluidOther = lastDialysisPrescribe.BodyFluidOther
588 589
 				newprescribe.TargetKtv = lastDialysisPrescribe.TargetKtv
589 590
 				newprescribe.BloodAccessPartId = lastDialysisPrescribe.BloodAccessPartId
591
+				newprescribe.Amylaceum = lastDialysisPrescribe.Amylaceum
590 592
 				newprescribe.CreatedTime = time.Now().Unix()
591 593
 				newprescribe.UpdatedTime = time.Now().Unix()
592 594
 				newprescribe.RecordDate = theAssessmentDateTime
@@ -713,6 +715,7 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
713 715
 				newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
714 716
 				newprescribe.BloodAccessPartId = lastDialysisPrescribe.BloodAccessPartId
715 717
 				newprescribe.Status = 1
718
+				newprescribe.Amylaceum = lastDialysisPrescribe.Amylaceum
716 719
 				newprescribe.PrescribingNumber = 1
717 720
 
718 721
 				if adminUserInfo.Org.Id == 10340 {
@@ -954,6 +957,9 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
954 957
 				if adminUserInfo.Org.Id == 10721 {
955 958
 					evaluation.Temperature = 36.5
956 959
 				}
960
+				if adminUserInfo.Org.Id == 10702 {
961
+					evaluation.PulseFrequency = 0
962
+				}
957 963
 			}
958 964
 		} else {
959 965
 			evaluation.UpdatedTime = time.Now().Unix()
@@ -974,6 +980,14 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
974 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 991
 		err := service.UpadatePredialysisEvaluation(&evaluation)
978 992
 
979 993
 		//记录日志

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

@@ -3011,7 +3011,7 @@ func (c *DialysisAPIController) Finish() {
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 3015
 		evaluation, _ := service.MobileGetPredialysisEvaluationOne(adminUserInfo.Org.Id, id, recordDate.Unix())
3016 3016
 		if evaluation.SystolicBloodPressure == 0 {
3017 3017
 			evaluation.SystolicBloodPressure = fmonitorRecords.SystolicBloodPressure
@@ -3937,6 +3937,14 @@ func (this *DialysisAPIController) StartDialysis() {
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 3948
 			if adminUserInfo.Org.Id == 10694 || adminUserInfo.Org.Id == 10697 {
3941 3949
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
3942 3950
 				ultrafiltration_rate = ultrafiltration_rate
@@ -3972,6 +3980,21 @@ func (this *DialysisAPIController) StartDialysis() {
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,7 +5099,7 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
5076 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 5103
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60)
5081 5104
 				record.UltrafiltrationRate = ultrafiltration_rate
5082 5105
 			}
@@ -5153,6 +5176,13 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
5153 5176
 			if adminInfo.Org.Id == 10597 || adminInfo.Org.Id == 10599 || adminInfo.Org.Id == 10679 {
5154 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 5186
 			//if template.TemplateId == 47 {
5157 5187
 			//	ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 60 / float64(totalMin))
5158 5188
 			//	record.UltrafiltrationRate = ultrafiltration_rate
@@ -5226,7 +5256,16 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
5226 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 5269
 		if ultrafiltration_rate > 0 {
5231 5270
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5232 5271
 			record.UltrafiltrationVolume = ultrafiltration_volume / 1000
@@ -5240,7 +5279,6 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
5240 5279
 		totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
5241 5280
 		replacement_rate = math.Floor(prescription.ReplacementTotal*1000/float64(totalMin)*60) / 1000
5242 5281
 
5243
-		fmt.Println("replacement_rate--------------------------", replacement_rate)
5244 5282
 		record.ReplacementRate = replacement_rate
5245 5283
 
5246 5284
 		fmt.Println(math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600))
@@ -5249,6 +5287,27 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
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 5311
 	lastMonitorRecordList, _ := service.GetLastMonitorRecordList(patientID, monitorDate, adminInfo.Org.Id)
5253 5312
 
5254 5313
 	this.ServeSuccessJSON(map[string]interface{}{
@@ -12393,3 +12452,29 @@ func (c *DialysisAPIController) SaveLongAdviceTemplate() {
12393 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,4 +231,6 @@ func MobileAPIControllersRegisterRouters() {
231 231
 	beego.Router("/m/api/updateeditdrugorder", &DialysisAPIController{}, "Post:UpdateEditDrugOrder")
232 232
 
233 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,7 +1375,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1375 1375
 
1376 1376
 							if medical.IsUse != 1 {
1377 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 1379
 										service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
1380 1380
 										advice.ExecutionTime = 0
1381 1381
 										advice.ExecutionState = 2
@@ -1391,7 +1391,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1391 1391
 
1392 1392
 								}
1393 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 1395
 										service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
1396 1396
 										advice.ExecutionTime = 0
1397 1397
 										advice.ExecutionState = 2
@@ -1418,7 +1418,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1418 1418
 											//查询今日是否出库
1419 1419
 											drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1420 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 1422
 													service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1423 1423
 												}
1424 1424
 
@@ -1428,7 +1428,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1428 1428
 										if pharmacyConfig.IsOpen != 1 {
1429 1429
 											drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1430 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 1432
 													service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1433 1433
 												}
1434 1434
 
@@ -1455,7 +1455,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1455 1455
 									if pharmacyConfig.IsOpen == 1 && medical.IsPharmacy == 0 {
1456 1456
 										drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1457 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 1459
 												service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1460 1460
 											}
1461 1461
 
@@ -1479,7 +1479,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1479 1479
 										service.CreateDrugError(drugError)
1480 1480
 										drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1481 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 1483
 												service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1484 1484
 											}
1485 1485
 
@@ -1558,7 +1558,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1558 1558
 							}
1559 1559
 							if medical.IsUse != 1 {
1560 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 1562
 										service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
1563 1563
 										advice.ExecutionTime = 0
1564 1564
 										advice.ExecutionState = 2
@@ -1572,7 +1572,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1572 1572
 									return
1573 1573
 								}
1574 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 1576
 										service.UpdateDoctorAdviceByExcecute(advice.ID, advice.UserOrgId)
1577 1577
 										advice.ExecutionTime = 0
1578 1578
 										advice.ExecutionState = 2
@@ -1591,7 +1591,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1591 1591
 									//查询今日是否出库
1592 1592
 									drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1593 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 1595
 											service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1596 1596
 										}
1597 1597
 
@@ -1601,7 +1601,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1601 1601
 									//查询今日是否出库
1602 1602
 									drugOutInfo, _ := service.GetAdviceIsOut(item.ID, item.UserOrgId, item.PatientId, item.AdviceDate, item.DrugId)
1603 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 1605
 											service.DrugsDelivery(item.UserOrgId, item.ExecutionStaff, &item)
1606 1606
 										}
1607 1607
 
@@ -3494,6 +3494,10 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
3494 3494
 
3495 3495
 		}
3496 3496
 
3497
+		if adminUserInfo.Org.Id == 10727 {
3498
+			dewater_amount = dewater_amount * 1000
3499
+		}
3500
+
3497 3501
 		if dewater_amount <= 0 {
3498 3502
 			dewater_amount = 0
3499 3503
 		}
@@ -4226,6 +4230,27 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
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 4254
 	if adminUserInfo.Org.Id == 10721 || adminUserInfo.Org.Id == 10164 {
4230 4255
 
4231 4256
 		prescription, _ := service.GetTodayPrescription(id, adminUserInfo.Org.Id, theAssessmentDateTime)
@@ -5706,6 +5731,7 @@ func (c *PatientApiController) GetPrintDialysisOrder() {
5706 5731
 				advice.PrescribingNumber = cnt
5707 5732
 				advice.PrescribingNumberUnit = item.Unit
5708 5733
 				advice.AdviceDoctor = item.Doctor
5734
+				advice.Remark = item.Remark
5709 5735
 				if item.Type == 3 {
5710 5736
 					advice.AdviceName = item.GoodInfo.GoodName
5711 5737
 					advice.PrescribingNumberUnit = item.GoodInfo.PackingUnit

+ 145 - 10
controllers/patient_api_controller.go View File

@@ -162,6 +162,12 @@ func PatientApiRegistRouters() {
162 162
 
163 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 172
 func (c *PatientApiController) GetExportList() {
167 173
 	startTime := c.GetString("start_time")
@@ -297,13 +303,25 @@ func (c *PatientApiController) GetPatientsAllList() {
297 303
 
298 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 327
 // GenerateDialysisNo 生成透析号
@@ -7626,6 +7644,8 @@ func (c *PatientApiController) SavePatientLapse() {
7626 7644
 
7627 7645
 	end_time_one := dataBody["end_time_one"].(string)
7628 7646
 
7647
+	is_check := int64(dataBody["is_check"].(float64))
7648
+
7629 7649
 	timeLayout := "2006-01-02"
7630 7650
 	loc, _ := time.LoadLocation("Local")
7631 7651
 	var recordDate int64
@@ -7711,9 +7731,11 @@ func (c *PatientApiController) SavePatientLapse() {
7711 7731
 
7712 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,9 +7743,11 @@ func (c *PatientApiController) SavePatientLapse() {
7721 7743
 
7722 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 7753
 	if lapse_type == 11 {
@@ -8024,3 +8048,114 @@ func (c *DialysisApiController) GetPatientLapseList() {
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,37 +198,31 @@ func (this *PatientDataConfigAPIController) CreateSickHistory() {
198 198
 	guominyaowu_desc := this.GetString("guominyaowu_desc")
199 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 213
 	if len(record_time_str) == 0 {
207 214
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
208 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 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 220
 	now := time.Now().Unix()
227 221
 	record := models.XtPatientSickHistory{
228 222
 		OrgId:                   adminUserInfo.CurrentOrgId,
229 223
 		PatientId:               patientID,
230 224
 		Recorder:                adminUserInfo.AdminUser.Id,
231
-		RecordTime:              checkDate.Unix(),
225
+		RecordTime:              recordDate,
232 226
 		Content:                 content,
233 227
 		Status:                  1,
234 228
 		Title:                   title,
@@ -239,7 +233,7 @@ func (this *PatientDataConfigAPIController) CreateSickHistory() {
239 233
 		Ctime:                   now,
240 234
 		Mtime:                   now,
241 235
 		DoctorId:                doctor_id,
242
-		RecordDate:              checkDate_two.Unix(),
236
+		RecordDate:              recordDate,
243 237
 	}
244 238
 
245 239
 	createErr := service.CreatePatientSickHistory(&record)
@@ -304,24 +298,19 @@ func (this *PatientDataConfigAPIController) ModifySickHistory() {
304 298
 	guominyaowu_desc := this.GetString("guominyaowu_desc")
305 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 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 315
 	now := time.Now().Unix()
327 316
 
@@ -335,7 +324,7 @@ func (this *PatientDataConfigAPIController) ModifySickHistory() {
335 324
 		Ctime:                   now,
336 325
 		Mtime:                   now,
337 326
 		Title:                   title,
338
-		RecordTime:              checkDate.Unix(),
327
+		RecordTime:              recordDate,
339 328
 		IsShenyizhiHistory:      is_shenyizhishi,
340 329
 		IsFumoDialysisHistory:   is_fumotouxishi,
341 330
 		HypersusceptibilityDesc: guominyaowu_desc,
@@ -866,15 +855,6 @@ func (this *PatientDataConfigAPIController) DeleteCourse() {
866 855
 	}
867 856
 
868 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 859
 	recordIDStrs := strings.Split(idsStr, ",")
880 860
 	recordIDs := make([]int64, 0, len(recordIDStrs))

+ 27 - 0
models/patient_models.go View File

@@ -2803,3 +2803,30 @@ func (XtPatientLaspseRecord) TableName() string {
2803 2803
 
2804 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,3 +2726,11 @@ func ModifyPatientDisplacementQuantity(id int64, displacement_quantity float64)
2726 2726
 	err := XTWriteDB().Model(&models.MonitoringRecord{}).Where("id = ? and status=1", id).Updates(map[string]interface{}{"displacement_quantity": displacement_quantity}).Error
2727 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,6 +110,14 @@ func GetAllPatientList(orgID int64) (patients []*models.Patients, total int64, e
110 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 121
 func GetAllPatientListTwenty(orgID int64) (patients []*models.Patients, total int64, err error) {
114 122
 
115 123
 	db := readDb.Table("xt_patients as p").Where("p.user_org_id=? and p.status=1 and p.lapseto = 1", orgID)
@@ -4359,3 +4367,28 @@ func GetDialysisPrescribeOneList(patient_id int64, record_date int64, user_org_i
4359 4367
 
4360 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
+}