xmg123 3 天前
父节点
当前提交
8c5725d24c

二进制
XT_New.exe 查看文件


+ 10 - 10
controllers/base_api_controller.go 查看文件

@@ -72,10 +72,10 @@ func (this *BaseAuthAPIController) Prepare() {
72 72
 	this.BaseAPIController.Prepare()
73 73
 	if this.GetAdminUserInfo() == nil {
74 74
 		var userAdmin models.AdminUser
75
-		userAdmin.Id = 2301
75
+		userAdmin.Id = 5318
76 76
 		userAdmin.Mobile = "13318599895"
77 77
 
78
-		userAdmin.Id = 2301 //4,809
78
+		userAdmin.Id = 5318 //4,809
79 79
 		userAdmin.Mobile = "12222222222"
80 80
 		userAdmin.IsSuperAdmin = true
81 81
 		userAdmin.Status = 1
@@ -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 = 9779 //机构id
86
+		subscibe.OrgId = 10777 //机构id
87 87
 		subscibe.PeriodStart = 1547447814
88 88
 		subscibe.PeriodEnd = 1550039814
89 89
 		subscibe.State = 1
@@ -93,8 +93,8 @@ 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 = 9779  //机构id小英9675或4
97
-		adminUserInfo.CurrentAppId = 17634 //4
96
+		adminUserInfo.CurrentOrgId = 10777 //机构id小英9675或4
97
+		adminUserInfo.CurrentAppId = 11811 //4
98 98
 		adminUserInfo.AdminUser = &userAdmin
99 99
 		adminUserInfo.Subscibes = subscibes
100 100
 		this.SetSession("admin_user_info", &adminUserInfo)
@@ -318,10 +318,10 @@ func (this *BaseServeAPIController) Prepare() {
318 318
 	this.BaseAPIController.Prepare()
319 319
 	if this.GetAdminUserInfo() == nil {
320 320
 		var userAdmin models.AdminUser
321
-		userAdmin.Id = 2301
321
+		userAdmin.Id = 5318
322 322
 		userAdmin.Mobile = "13318599895"
323 323
 
324
-		userAdmin.Id = 2301 //4,809
324
+		userAdmin.Id = 5318 //4,809
325 325
 		userAdmin.Mobile = "12222222222"
326 326
 		userAdmin.IsSuperAdmin = false
327 327
 		userAdmin.Status = 1
@@ -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 = 9779 //机构id小英9675或4
332
+		subscibe.OrgId = 10777 //机构id小英9675或4
333 333
 		subscibe.PeriodStart = 1538035409
334 334
 		subscibe.PeriodEnd = 1569571409
335 335
 		subscibe.State = 1
@@ -339,8 +339,8 @@ 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 = 9779  //机构id小英9675或4
343
-		adminUserInfo.CurrentAppId = 17634 //4
342
+		adminUserInfo.CurrentOrgId = 10777 //机构id小英9675或4
343
+		adminUserInfo.CurrentAppId = 11811 //4
344 344
 		adminUserInfo.AdminUser = &userAdmin
345 345
 		adminUserInfo.Subscibes = subscibes
346 346
 		this.SetSession("admin_user_info", &adminUserInfo)

+ 7 - 3
controllers/data_api_controller.go 查看文件

@@ -87,14 +87,17 @@ func (c *DataApiController) CreateConfig() {
87 87
 	// 验证关键字段的值是否重复
88 88
 
89 89
 	thisConfig, _ := service.FindConfigByTitle(dataconfig.Module, dataconfig.FieldName, adminUserInfo.CurrentOrgId)
90
-	fmt.Println("99999", thisConfig)
90
+
91 91
 	if thisConfig.ID > 0 {
92 92
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeFieldExist)
93 93
 		return
94 94
 	}
95 95
 
96
-	fieldValue := service.GetChildValue(dataconfig.Module, dataconfig.ParentId, adminUserInfo.CurrentOrgId)
97
-	dataconfig.Value = fieldValue + 1
96
+	//fieldValue := service.GetChildValue(dataconfig.Module, dataconfig.ParentId, adminUserInfo.CurrentOrgId)
97
+
98
+	dataconfiList, _ := service.FindConfigByTitleOne(dataconfig.Module, adminUserInfo.CurrentOrgId)
99
+
100
+	dataconfig.Value = len(dataconfiList) + 200
98 101
 
99 102
 	dataBody := make(map[string]interface{}, 0)
100 103
 	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
@@ -130,6 +133,7 @@ func (c *DataApiController) CreateConfig() {
130 133
 		resultConfig.CreateUserId = dataconfig.CreateUserId
131 134
 		resultConfig.Title = dataconfig.Title
132 135
 		resultConfig.Content = dataconfig.Content
136
+
133 137
 	}
134 138
 
135 139
 	c.ServeSuccessJSON(map[string]interface{}{

+ 85 - 5
controllers/dialysis_api_controller.go 查看文件

@@ -153,6 +153,8 @@ func DialysisApiRegistRouters() {
153 153
 
154 154
 	beego.Router("/api/schedule/getpatientbefor", &DialysisApiController{}, "Get:GetPatientBefor")
155 155
 
156
+	beego.Router("/api/schedule/getbednumberlist", &DialysisApiController{}, "Get:GetNewBedNumberList")
157
+
156 158
 }
157 159
 
158 160
 func (c *DialysisApiController) GetQueueCall() {
@@ -3025,13 +3027,13 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
3025 3027
 			service.CreateDialysisFinish(finish)
3026 3028
 		}
3027 3029
 
3028
-		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 == 10164 || adminUserInfo.CurrentOrgId == 10727 || adminUserInfo.CurrentOrgId == 10751 || adminUserInfo.CurrentOrgId == 10752 || adminUserInfo.CurrentOrgId == 10480 || adminUserInfo.CurrentOrgId == 10293 || adminUserInfo.CurrentOrgId == 9478 || adminUserInfo.CurrentOrgId == 10766 || adminUserInfo.CurrentOrgId == 10768 {
3030
+		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 == 10777 || adminUserInfo.CurrentOrgId == 10727 || adminUserInfo.CurrentOrgId == 10726 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10727 || adminUserInfo.CurrentOrgId == 10751 || adminUserInfo.CurrentOrgId == 10752 || adminUserInfo.CurrentOrgId == 10480 || adminUserInfo.CurrentOrgId == 10293 || adminUserInfo.CurrentOrgId == 9478 || adminUserInfo.CurrentOrgId == 10766 || adminUserInfo.CurrentOrgId == 10768 {
3029 3031
 			var dewater_amount float64
3030 3032
 			dewater_amount = 0
3031 3033
 			if dry_weight > 0 {
3032 3034
 				dewater_amount = weight_before - dry_weight - additional_weight
3033 3035
 
3034
-				if 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 != 10480 && adminUserInfo.CurrentOrgId != 10293 && adminUserInfo.CurrentOrgId != 9478 && adminUserInfo.CurrentOrgId != 10744 && adminUserInfo.CurrentOrgId != 10766 {
3036
+				if 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 != 10480 && adminUserInfo.CurrentOrgId != 10293 && adminUserInfo.CurrentOrgId != 9478 && adminUserInfo.CurrentOrgId != 10744 && adminUserInfo.CurrentOrgId != 10766 && adminUserInfo.CurrentOrgId != 10777 {
3035 3037
 					dewater_amount = dewater_amount * 1000
3036 3038
 				}
3037 3039
 
@@ -3401,8 +3403,8 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
3401 3403
 		dewater_amount = 0
3402 3404
 		if evaluation.DryWeight > 0 {
3403 3405
 			dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
3404
-			if templateInfo.TemplateId == 17 || templateInfo.TemplateId == 22 || templateInfo.TemplateId == 21 || templateInfo.TemplateId == 34 || adminUserInfo.CurrentOrgId == 10551 || adminUserInfo.CurrentOrgId == 10751 || adminUserInfo.CurrentOrgId == 10757 || adminUserInfo.CurrentOrgId == 9478 {
3405
-				if adminUserInfo.CurrentOrgId != 10551 && adminUserInfo.CurrentOrgId != 10751 && adminUserInfo.CurrentOrgId != 9478 {
3406
+			if templateInfo.TemplateId == 17 || templateInfo.TemplateId == 22 || templateInfo.TemplateId == 21 || templateInfo.TemplateId == 34 || adminUserInfo.CurrentOrgId == 10551 || adminUserInfo.CurrentOrgId == 10751 || adminUserInfo.CurrentOrgId == 10757 || adminUserInfo.CurrentOrgId == 9478 || adminUserInfo.CurrentOrgId == 10777 {
3407
+				if adminUserInfo.CurrentOrgId != 10551 && adminUserInfo.CurrentOrgId != 10751 && adminUserInfo.CurrentOrgId != 9478 && adminUserInfo.CurrentOrgId != 10777 {
3406 3408
 					dewater_amount = dewater_amount * 1000
3407 3409
 				}
3408 3410
 
@@ -3497,6 +3499,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
3497 3499
 			newprescribe.PrescriptionWater = dewater_amount
3498 3500
 			newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
3499 3501
 			newprescribe.Amylaceum = dialysisSolution.Amylaceum
3502
+
3500 3503
 			newprescribe.Status = 1
3501 3504
 			if adminUserInfo.CurrentOrgId == 10579 {
3502 3505
 				newprescribe.Modifier = 0
@@ -3679,7 +3682,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
3679 3682
 		}
3680 3683
 
3681 3684
 		//针对孝昌康桥超滤率计算问题
3682
-		if adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10635 || adminUserInfo.CurrentOrgId == 10723 || adminUserInfo.CurrentOrgId == 10721 || adminUserInfo.CurrentOrgId == 10726 || adminUserInfo.CurrentOrgId == 10742 || adminUserInfo.CurrentOrgId == 10751 || adminUserInfo.CurrentOrgId == 10752 || adminUserInfo.CurrentOrgId == 10697 || adminUserInfo.CurrentOrgId == 9478 || adminUserInfo.CurrentOrgId == 10766 || adminUserInfo.CurrentOrgId == 10768 {
3685
+		if adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10635 || adminUserInfo.CurrentOrgId == 10723 || adminUserInfo.CurrentOrgId == 10721 || adminUserInfo.CurrentOrgId == 10742 || adminUserInfo.CurrentOrgId == 10751 || adminUserInfo.CurrentOrgId == 10752 || adminUserInfo.CurrentOrgId == 10697 || adminUserInfo.CurrentOrgId == 9478 || adminUserInfo.CurrentOrgId == 10766 || adminUserInfo.CurrentOrgId == 10768 || adminUserInfo.CurrentOrgId == 10777 {
3683 3686
 			if assessmentBeforeDislysis.ID == 0 {
3684 3687
 				dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.CurrentOrgId, patient, recordDate.Unix())
3685 3688
 				if dialysisPrescribeOne.ID > 0 && assessmentBeforeDislysis.ID > 0 {
@@ -3866,6 +3869,30 @@ func (c *DialysisApiController) PostTreatmentSummary() {
3866 3869
 			}
3867 3870
 		}
3868 3871
 		err := service.AddSigleSummaryRecord(&treatmentSummary)
3872
+
3873
+		if adminUserInfo.CurrentOrgId == 10777 {
3874
+			//查询该该账号是不是医生
3875
+			userAdminName := service.GetUserAdminNameType(adminUserInfo.AdminUser.Id, adminUserInfo.CurrentOrgId)
3876
+
3877
+			if userAdminName != 3 {
3878
+
3879
+				record := models.PatientDiseaseCourse{
3880
+					OrgID:      adminUserInfo.CurrentOrgId,
3881
+					PatientID:  patient,
3882
+					Recorder:   adminUserInfo.AdminUser.Id,
3883
+					RecordTime: time.Now().Unix(),
3884
+					Content:    specialRecord,
3885
+					Status:     1,
3886
+					CreateTime: time.Now().Unix(),
3887
+					ModifyTime: time.Now().Unix(),
3888
+					Title:      "日常病程",
3889
+					RecordDate: recordDate.Unix(),
3890
+				}
3891
+
3892
+				service.CreatePatientCourseOfDisease(&record)
3893
+			}
3894
+
3895
+		}
3869 3896
 		finish := models.XtDialysisFinish{
3870 3897
 			IsFinish:   1,
3871 3898
 			UserOrgId:  adminUserInfo.CurrentOrgId,
@@ -3940,8 +3967,30 @@ func (c *DialysisApiController) PostTreatmentSummary() {
3940 3967
 		treatmentSummary.UpdatedTime = time.Now().Unix()
3941 3968
 		treatmentSummary.Modifier = adminUserInfo.AdminUser.Id
3942 3969
 		treatmentSummary.ID = tempTreatmentSummary.ID
3970
+
3943 3971
 		err := service.UpdateSummeRecord(&treatmentSummary)
3944 3972
 
3973
+		if adminUserInfo.CurrentOrgId == 10777 {
3974
+			//查询该该账号是不是医生
3975
+			userAdminName := service.GetUserAdminNameType(adminUserInfo.AdminUser.Id, adminUserInfo.CurrentOrgId)
3976
+			if userAdminName != 3 {
3977
+
3978
+				record := models.PatientDiseaseCourse{
3979
+					OrgID:      adminUserInfo.CurrentOrgId,
3980
+					PatientID:  patient,
3981
+					Recorder:   adminUserInfo.AdminUser.Id,
3982
+					RecordTime: time.Now().Unix(),
3983
+					Content:    specialRecord,
3984
+					Status:     1,
3985
+					CreateTime: time.Now().Unix(),
3986
+					ModifyTime: time.Now().Unix(),
3987
+					Title:      "日常病程",
3988
+					RecordDate: recordDate.Unix(),
3989
+				}
3990
+				service.ModifyPatientCoursesOne(&record)
3991
+			}
3992
+		}
3993
+
3945 3994
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":treatment_summary"
3946 3995
 		keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":treatment_summarys_list_all"
3947 3996
 		keyThree := "scheduals_" + recordDateStr + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
@@ -8612,8 +8661,39 @@ func (this *DialysisApiController) GetPatientBefor() {
8612 8661
 
8613 8662
 	prescription, _ := service.GetDialysisPrescribeOneList(patient_id, startdateunix, user_org_id)
8614 8663
 
8664
+	access, _ := service.GetNewPatientVascularAccess(patient_id)
8665
+
8615 8666
 	this.ServeSuccessJSON(map[string]interface{}{
8616 8667
 		"patientBefor": patientBefor,
8617 8668
 		"prescription": prescription,
8669
+		"access":       access,
8670
+	})
8671
+}
8672
+
8673
+func (c *DialysisApiController) GetNewBedNumberList() {
8674
+
8675
+	patient_id, _ := c.GetInt64("patient_id")
8676
+
8677
+	fmt.Println("patient_id----------------", patient_id)
8678
+
8679
+	record_date := c.GetString("record_date")
8680
+
8681
+	orgId := c.GetAdminUserInfo().CurrentOrgId
8682
+
8683
+	recordDateStr, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", record_date)
8684
+	fmt.Println("parseDateErr------------------", parseDateErr)
8685
+	if parseDateErr != nil {
8686
+		c.ErrorLog("日期(%v)解析错误:%v", recordDateStr, parseDateErr)
8687
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
8688
+		return
8689
+	}
8690
+
8691
+	schedule, _ := service.GetNewPatientSchedule(patient_id, recordDateStr.Unix(), orgId)
8692
+
8693
+	number, _ := service.GetNewBedNumber(schedule.BedId)
8694
+
8695
+	c.ServeSuccessJSON(map[string]interface{}{
8696
+		"number": number,
8618 8697
 	})
8698
+
8619 8699
 }

+ 12 - 9
controllers/his_api_controller.go 查看文件

@@ -2261,7 +2261,7 @@ func (c *HisApiController) CreateHisPrescription() {
2261 2261
 			for _, item := range prescriptions {
2262 2262
 				items := item.(map[string]interface{})
2263 2263
 
2264
-				if adminInfo.CurrentOrgId == 9478 {
2264
+				if adminInfo.CurrentOrgId == 9478 || adminInfo.CurrentOrgId == 10768 {
2265 2265
 					if items["advices"] != nil && reflect.TypeOf(items["advices"]).String() == "[]interface {}" {
2266 2266
 						advices := items["advices"].([]interface{})
2267 2267
 						if len(advices) > 0 {
@@ -2364,7 +2364,7 @@ func (c *HisApiController) CreateHisPrescription() {
2364 2364
 		return
2365 2365
 	}
2366 2366
 
2367
-	if adminInfo.CurrentOrgId == 9478 {
2367
+	if adminInfo.CurrentOrgId == 9478 || adminInfo.CurrentOrgId == 10768 {
2368 2368
 		//不是保存处方出库
2369 2369
 		drugOutConfig, _ := service.GetDrugOpenConfigOne(adminInfo.CurrentOrgId)
2370 2370
 
@@ -11115,7 +11115,7 @@ func (c *HisApiController) GetUploadInfo() {
11115 11115
 
11116 11116
 		tm := time.Unix(time.Now().Unix(), 0)
11117 11117
 
11118
-		allTotal := fmt.Sprintf("%.4f", total)
11118
+		allTotal := fmt.Sprintf("%.2f", total)
11119 11119
 		totals, _ := strconv.ParseFloat(allTotal, 64)
11120 11120
 		order := &models.HisOrder{
11121 11121
 			UserOrgId:             adminUser.CurrentOrgId,
@@ -11174,7 +11174,7 @@ func (c *HisApiController) GetUploadInfo() {
11174 11174
 						cus := &Custom{
11175 11175
 							AdviceId:         subItem.ID,
11176 11176
 							ProjectId:        0,
11177
-							DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*subItem.PrescribingNumber),
11177
+							DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*subItem.PrescribingNumber),
11178 11178
 							Cut:              fmt.Sprintf("%.4f", subItem.PrescribingNumber),
11179 11179
 							FeedetlSn:        subItem.FeedetlSn,
11180 11180
 							Price:            fmt.Sprintf("%.4f", subItem.Price),
@@ -11194,7 +11194,7 @@ func (c *HisApiController) GetUploadInfo() {
11194 11194
 						cus := &Custom{
11195 11195
 							AdviceId:         0,
11196 11196
 							ProjectId:        subItem.ID,
11197
-							DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*cnt),
11197
+							DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*cnt),
11198 11198
 							Cut:              fmt.Sprintf("%.4f", cnt),
11199 11199
 							FeedetlSn:        subItem.FeedetlSn,
11200 11200
 							Price:            fmt.Sprintf("%.4f", float64(subItem.Price)),
@@ -11209,7 +11209,7 @@ func (c *HisApiController) GetUploadInfo() {
11209 11209
 							cus := &Custom{
11210 11210
 								AdviceId:         0,
11211 11211
 								ProjectId:        subItem.ID,
11212
-								DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*cnt),
11212
+								DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*cnt),
11213 11213
 								Cut:              fmt.Sprintf("%.4f", cnt),
11214 11214
 								FeedetlSn:        subItem.FeedetlSn,
11215 11215
 								Price:            fmt.Sprintf("%.4f", float64(subItem.Price)),
@@ -11230,7 +11230,7 @@ func (c *HisApiController) GetUploadInfo() {
11230 11230
 					ItemId:           item.ID,
11231 11231
 					AdviceId:         0,
11232 11232
 					ProjectId:        0,
11233
-					DetItemFeeSumamt: fmt.Sprintf("%.4f", item.Price),
11233
+					DetItemFeeSumamt: fmt.Sprintf("%.2f", item.Price),
11234 11234
 					Cut:              fmt.Sprintf("%.4f", float64(item.Count)),
11235 11235
 					FeedetlSn:        item.FeedetlSn,
11236 11236
 					Price:            fmt.Sprintf("%.4f", float64(item.Price)),
@@ -11259,6 +11259,9 @@ func (c *HisApiController) GetUploadInfo() {
11259 11259
 				if item.CostType == 3 {
11260 11260
 					med_chrgitm_type = "04"
11261 11261
 				}
11262
+				if (adminUser.CurrentOrgId == 9478 && item.CostType == 12) || (adminUser.CurrentOrgId == 9478 && item.CostType == 16) || (adminUser.CurrentOrgId == 9478 && item.CostType == 3) {
11263
+					med_chrgitm_type = "04"
11264
+				}
11262 11265
 				if item.CostType == 8 {
11263 11266
 					med_chrgitm_type = "03"
11264 11267
 				}
@@ -11269,9 +11272,8 @@ func (c *HisApiController) GetUploadInfo() {
11269 11272
 			} else if item.Type == 3 {
11270 11273
 				advice_id = 0
11271 11274
 				item_id = item.ItemId
11272
-				project_id = 0
11275
+				project_id = item.ProjectId
11273 11276
 				med_chrgitm_type = "08"
11274
-
11275 11277
 			}
11276 11278
 			detItemFeeSumamt, _ := strconv.ParseFloat(item.DetItemFeeSumamt, 32)
11277 11279
 			cut, _ := strconv.ParseFloat(item.Cut, 32)
@@ -11297,6 +11299,7 @@ func (c *HisApiController) GetUploadInfo() {
11297 11299
 			}
11298 11300
 			service.CreateOrderInfoTX(info, tx)
11299 11301
 		}
11302
+
11300 11303
 		his.Diagnosis = diagnosis_id
11301 11304
 		his.SickType = sick_type
11302 11305
 		his.RegisterType = reg_type

+ 138 - 18
controllers/mobile_api_controllers/dialysis_api_controller.go 查看文件

@@ -413,6 +413,7 @@ func (this *DialysisAPIController) DialysisRecord() {
413 413
 
414 414
 	// 先走redis,没有走数据库
415 415
 	schedual, _ := service.MobileGetSchedualDetailOne(adminInfo.Org.Id, patientID, date.Unix())
416
+
416 417
 	go func() {
417 418
 		patient, _ = service.FindPatientByIdWithDiseases(adminInfo.Org.Id, patientID)
418 419
 
@@ -658,6 +659,10 @@ func (this *DialysisAPIController) DialysisRecord() {
658 659
 
659 660
 	firstMonitor, _ := service.GetFirstMonitorOne(patientID, date.Unix(), adminInfo.Org.Id)
660 661
 
662
+	access, _ := service.GetNewPatientVascularAccess(patientID)
663
+
664
+	numberList, _ := service.GetNewBedNumber(schedual.BedId)
665
+
661 666
 	returnData := map[string]interface{}{
662 667
 		"patient":                        patient,
663 668
 		"schedual":                       schedual,
@@ -697,6 +702,8 @@ func (this *DialysisAPIController) DialysisRecord() {
697 702
 		"dryWeightList":                  dryWeightList,
698 703
 		"firstMonitor":                   firstMonitor,
699 704
 		"lastMonitor":                    lastMonitor,
705
+		"access":                         access,
706
+		"numberList":                     numberList,
700 707
 	}
701 708
 
702 709
 	this.ServeSuccessJSON(returnData)
@@ -729,9 +736,9 @@ func (c *DialysisAPIController) PostAtreatmentInfo() {
729 736
 	deboardNurseId, _ := c.GetInt64("deboardNurse", 0)
730 737
 	treatDoctor, _ := c.GetInt64("treatDoctor", 0)
731 738
 	nursingRecord := c.GetString("nursing_record")
732
-	fmt.Println("护理记录", nursingRecord)
739
+
733 740
 	specialRecord := c.GetString("special_record")
734
-	fmt.Println("特殊记录", specialRecord)
741
+
735 742
 	adminUserInfo := c.GetMobileAdminUserInfo()
736 743
 
737 744
 	changeMedicalNurseId = adminUserInfo.AdminUser.Id
@@ -805,6 +812,31 @@ func (c *DialysisAPIController) PostAtreatmentInfo() {
805 812
 	if treatmentSummary.ID == 0 { //新增
806 813
 		summary.Creater = adminUserInfo.AdminUser.Id
807 814
 		service.AddSigleSummaryRecord(&summary)
815
+
816
+		if adminUserInfo.Org.Id == 10777 {
817
+			//查询该该账号是不是医生
818
+			userAdminName := service.GetUserAdminNameType(adminUserInfo.AdminUser.Id, adminUserInfo.Org.Id)
819
+
820
+			if userAdminName != 3 {
821
+
822
+				record := models.PatientDiseaseCourse{
823
+					OrgID:      adminUserInfo.Org.Id,
824
+					PatientID:  id,
825
+					Recorder:   adminUserInfo.AdminUser.Id,
826
+					RecordTime: time.Now().Unix(),
827
+					Content:    specialRecord,
828
+					Status:     1,
829
+					CreateTime: time.Now().Unix(),
830
+					ModifyTime: time.Now().Unix(),
831
+					Title:      "日常病程",
832
+					RecordDate: recordDate.Unix(),
833
+				}
834
+
835
+				service.CreatePatientCourseOfDisease(&record)
836
+			}
837
+
838
+		}
839
+
808 840
 		finish := models.XtDialysisFinish{
809 841
 			IsFinish:   1,
810 842
 			UserOrgId:  adminUserInfo.Org.Id,
@@ -841,6 +873,28 @@ func (c *DialysisAPIController) PostAtreatmentInfo() {
841 873
 		summary.Modifier = adminUserInfo.AdminUser.Id
842 874
 		summary.ID = treatmentSummary.ID
843 875
 		service.UpdateSummeRecord(&summary)
876
+
877
+		if adminUserInfo.Org.Id == 10777 {
878
+			//查询该该账号是不是医生
879
+			userAdminName := service.GetUserAdminNameType(adminUserInfo.AdminUser.Id, adminUserInfo.Org.Id)
880
+			if userAdminName != 3 {
881
+
882
+				record := models.PatientDiseaseCourse{
883
+					OrgID:      adminUserInfo.Org.Id,
884
+					PatientID:  id,
885
+					Recorder:   adminUserInfo.AdminUser.Id,
886
+					RecordTime: time.Now().Unix(),
887
+					Content:    specialRecord,
888
+					Status:     1,
889
+					CreateTime: time.Now().Unix(),
890
+					ModifyTime: time.Now().Unix(),
891
+					Title:      "日常病程",
892
+					RecordDate: recordDate.Unix(),
893
+				}
894
+				service.ModifyPatientCoursesOne(&record)
895
+			}
896
+		}
897
+
844 898
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":treatment_summary"
845 899
 		redis := service.RedisClient()
846 900
 		//清空key 值
@@ -2977,7 +3031,6 @@ func (c *DialysisAPIController) Finish() {
2977 3031
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2978 3032
 		return
2979 3033
 	}
2980
-	fmt.Println(endmonitorRecords.UltrafiltrationVolume)
2981 3034
 
2982 3035
 	assessmentAfterDislysis, getAADErr := service.MobileGetAssessmentAfterDislysisOne(adminUserInfo.Org.Id, id, recordDate.Unix())
2983 3036
 	if getAADErr != nil {
@@ -3439,6 +3492,10 @@ func (c *DialysisAPIController) Finish() {
3439 3492
 		tempassessmentAfterDislysis.SystolicBloodPressure = 0
3440 3493
 	}
3441 3494
 
3495
+	if adminUserInfo.Org.Id == 10777 {
3496
+		tempassessmentAfterDislysis.ActualUltrafiltration = endmonitorRecords.UltrafiltrationVolume / 1000
3497
+	}
3498
+
3442 3499
 	tempassessmentAfterDislysis.RecordTime = dialysisOrder.EndTime
3443 3500
 
3444 3501
 	err := service.UpdateAssessmentAfterDislysisRecord(&tempassessmentAfterDislysis)
@@ -4400,6 +4457,11 @@ func (this *DialysisAPIController) StartDialysis() {
4400 4457
 				ultrafiltration_rate = ultrafiltration_rate / 1000
4401 4458
 			}
4402 4459
 
4460
+			if adminUserInfo.Org.Id == 10777 {
4461
+				ultrafiltration_rate = math.Floor(prescription.PrescriptionWater * 1000 / float64(totalMin) * 60 * 1000)
4462
+				ultrafiltration_rate = ultrafiltration_rate / 1000
4463
+			}
4464
+
4403 4465
 			if adminUserInfo.Org.Id == 10721 || adminUserInfo.Org.Id == 10757 {
4404 4466
 				if prescription.ModeId == 2 {
4405 4467
 					totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
@@ -4483,6 +4545,27 @@ func (this *DialysisAPIController) StartDialysis() {
4483 4545
 				}
4484 4546
 			}
4485 4547
 
4548
+			//标注
4549
+			if adminUserInfo.Org.Id == 10777 {
4550
+				if prescription.ID > 0 {
4551
+
4552
+					if prescription.ModeId == 2 || prescription.ModeId == 5 || prescription.ModeId == 12 {
4553
+						totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
4554
+						if totalMin == 0 {
4555
+							totalMin = 240
4556
+						}
4557
+						if prescription.DisplaceLiquiValue == 0 {
4558
+							prescription.DisplaceLiquiValue = 15
4559
+						}
4560
+
4561
+						//乘10 除10是为了保留一位小数
4562
+						replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*10) / 10
4563
+
4564
+						fmt.Println("replacement_rate------------------", replacement_rate)
4565
+					}
4566
+
4567
+				}
4568
+			}
4486 4569
 		}
4487 4570
 	}
4488 4571
 
@@ -4524,6 +4607,25 @@ func (this *DialysisAPIController) StartDialysis() {
4524 4607
 		}
4525 4608
 	}
4526 4609
 
4610
+	if adminUserInfo.Org.Id == 10777 {
4611
+		if prescription.ID == 0 {
4612
+
4613
+			if prescription.ModeId == 2 || prescription.ModeId == 5 || prescription.ModeId == 12 {
4614
+				totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
4615
+				if totalMin == 0 {
4616
+					totalMin = 240
4617
+				}
4618
+				if prescription.DisplaceLiquiValue == 0 {
4619
+					prescription.DisplaceLiquiValue = 15
4620
+				}
4621
+
4622
+				//乘10 除10是为了保留一位小数
4623
+				replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*10) / 10
4624
+			}
4625
+
4626
+		}
4627
+	}
4628
+
4527 4629
 	record := models.MonitoringRecord{
4528 4630
 		UserOrgId:       adminUserInfo.Org.Id,
4529 4631
 		PatientId:       patientID,
@@ -4652,6 +4754,15 @@ func (this *DialysisAPIController) StartDialysis() {
4652 4754
 			record.PulseFrequency = befor.PulseFrequency
4653 4755
 		}
4654 4756
 
4757
+		if adminUserInfo.Org.Id == 10777 {
4758
+			befor, _ := service.GetAssessmentBeforThrity(adminUserInfo.Org.Id, patientID, recordDate.Unix())
4759
+			dialysisPrescription, _ := service.GetDialysisPrescription(patientID, adminUserInfo.Org.Id, recordDate.Unix())
4760
+			record.BreathingRate = befor.BreathingRate
4761
+			record.BloodFlowVolume = dialysisPrescription.BloodFlowVolume
4762
+			record.Temperature = befor.Temperature
4763
+			record.PulseFrequency = befor.PulseFrequency
4764
+		}
4765
+
4655 4766
 		if adminUserInfo.Org.Id != 10683 {
4656 4767
 			err = service.CreateMonitor(&record)
4657 4768
 		}
@@ -5835,6 +5946,11 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
5835 5946
 				record.UltrafiltrationRate = ultrafiltration_rate / 1000
5836 5947
 			}
5837 5948
 
5949
+			if adminInfo.Org.Id == 10777 {
5950
+				ultrafiltration_rate = math.Floor(prescription.PrescriptionWater * 1000 / float64(totalMin) * 60 * 1000)
5951
+				record.UltrafiltrationRate = ultrafiltration_rate / 1000
5952
+			}
5953
+
5838 5954
 			if adminInfo.Org.Id == 10597 || adminInfo.Org.Id == 10599 || adminInfo.Org.Id == 10679 {
5839 5955
 				record.UltrafiltrationRate = 0
5840 5956
 			}
@@ -5926,7 +6042,7 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
5926 6042
 	}
5927 6043
 
5928 6044
 	//长沙南雅
5929
-	if adminInfo.Org.Id == 10395 || adminInfo.Org.Id == 10138 || adminInfo.Org.Id == 10278 || adminInfo.Org.Id == 10432 || adminInfo.Org.Id == 10441 || adminInfo.Org.Id == 10445 || adminInfo.Org.Id == 10469 || adminInfo.Org.Id == 10375 || adminInfo.Org.Id == 10610 || adminInfo.Org.Id == 10537 || adminInfo.Org.Id == 10667 || adminInfo.Org.Id == 9478 || adminInfo.Org.Id == 10766 {
6045
+	if adminInfo.Org.Id == 10395 || adminInfo.Org.Id == 10138 || adminInfo.Org.Id == 10278 || adminInfo.Org.Id == 10432 || adminInfo.Org.Id == 10441 || adminInfo.Org.Id == 10445 || adminInfo.Org.Id == 10469 || adminInfo.Org.Id == 10375 || adminInfo.Org.Id == 10610 || adminInfo.Org.Id == 10537 || adminInfo.Org.Id == 10667 || adminInfo.Org.Id == 9478 || adminInfo.Org.Id == 10766 || adminInfo.Org.Id == 10777 {
5930 6046
 
5931 6047
 		if ultrafiltration_rate > 0 {
5932 6048
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
@@ -5975,7 +6091,7 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
5975 6091
 		record.UltrafiltrationVolume = 0
5976 6092
 	}
5977 6093
 
5978
-	if adminInfo.Org.Id == 10721 || adminInfo.Org.Id == 10164 || adminInfo.Org.Id == 10731 || adminInfo.Org.Id == 10752 || adminInfo.Org.Id == 10757 || adminInfo.Org.Id == 10766 {
6094
+	if adminInfo.Org.Id == 10721 || adminInfo.Org.Id == 10164 || adminInfo.Org.Id == 10731 || adminInfo.Org.Id == 10752 || adminInfo.Org.Id == 10757 || adminInfo.Org.Id == 10766 || adminInfo.Org.Id == 10777 {
5979 6095
 		if ultrafiltration_rate > 0 {
5980 6096
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5981 6097
 			record.UltrafiltrationVolume = ultrafiltration_volume / 1000
@@ -6063,7 +6179,8 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
6063 6179
 
6064 6180
 	}
6065 6181
 
6066
-	if adminInfo.Org.Id == 10740 || adminInfo.Org.Id == 10742 || adminInfo.Org.Id == 10745 || adminInfo.Org.Id == 9478 || adminInfo.Org.Id == 10766 {
6182
+	//标注
6183
+	if adminInfo.Org.Id == 10740 || adminInfo.Org.Id == 10742 || adminInfo.Org.Id == 10745 || adminInfo.Org.Id == 9478 || adminInfo.Org.Id == 10766 || adminInfo.Org.Id == 10777 {
6067 6184
 
6068 6185
 		var replacement_rate float64
6069 6186
 		var displacement_quantity float64
@@ -6072,6 +6189,7 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
6072 6189
 
6073 6190
 		record.ReplacementRate = replacement_rate
6074 6191
 		displacement_quantity = math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime)/3600) * replacement_rate
6192
+
6075 6193
 		record.DisplacementQuantity = displacement_quantity
6076 6194
 	}
6077 6195
 
@@ -6106,20 +6224,22 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
6106 6224
 		record.UltrafiltrationVolume = ultrafiltration_volume / 1000
6107 6225
 	}
6108 6226
 
6109
-	if adminInfo.Org.Id == 9478 {
6110
-		totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
6111
-		if totalMin == 0 {
6112
-			totalMin = 240
6113
-		}
6114
-		if prescription.DisplaceLiquiValue == 0 {
6115
-			prescription.DisplaceLiquiValue = 15
6227
+	if adminInfo.Org.Id == 9478 || adminInfo.Org.Id == 10777 {
6228
+		if prescription.ModeId == 2 || prescription.ModeId == 5 || prescription.ModeId == 12 {
6229
+			totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
6230
+			if totalMin == 0 {
6231
+				totalMin = 240
6232
+			}
6233
+			if prescription.DisplaceLiquiValue == 0 {
6234
+				prescription.DisplaceLiquiValue = 15
6235
+			}
6236
+			var replacement_rate float64
6237
+			//乘10 除10是为了保留一位小数
6238
+			replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*10) / 10
6239
+
6240
+			record.ReplacementRate = replacement_rate
6116 6241
 		}
6117
-		var replacement_rate float64
6118
-		//乘10 除10是为了保留一位小数
6119
-		replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*10) / 10
6120 6242
 
6121
-		fmt.Println("hahahahahhaahahah", replacement_rate)
6122
-		record.ReplacementRate = replacement_rate
6123 6243
 	}
6124 6244
 
6125 6245
 	lastMonitorRecordList, _ := service.GetLastMonitorRecordList(patientID, monitorDate, adminInfo.Org.Id)

+ 3 - 3
controllers/mobile_api_controllers/patient_api_controller.go 查看文件

@@ -3878,9 +3878,9 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
3878 3878
 	if evaluation.DryWeight > 0 {
3879 3879
 		dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
3880 3880
 
3881
-		if template.TemplateId == 17 || template.TemplateId == 22 || template.TemplateId == 21 || template.TemplateId == 26 || template.TemplateId == 34 || template.TemplateId == 32 || adminUserInfo.Org.Id == 10469 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 10551 || adminUserInfo.Org.Id == 10579 || adminUserInfo.Org.Id == 10580 || adminUserInfo.Org.Id == 10585 || adminUserInfo.Org.Id == 10635 || adminUserInfo.Org.Id == 10727 || adminUserInfo.Org.Id == 10751 || adminUserInfo.Org.Id == 10752 || adminUserInfo.Org.Id == 10757 || adminUserInfo.Org.Id == 9478 || adminUserInfo.Org.Id == 10766 || adminUserInfo.Org.Id == 10768 {
3881
+		if template.TemplateId == 17 || template.TemplateId == 22 || template.TemplateId == 21 || template.TemplateId == 26 || template.TemplateId == 34 || template.TemplateId == 32 || adminUserInfo.Org.Id == 10469 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 10551 || adminUserInfo.Org.Id == 10579 || adminUserInfo.Org.Id == 10580 || adminUserInfo.Org.Id == 10585 || adminUserInfo.Org.Id == 10635 || adminUserInfo.Org.Id == 10727 || adminUserInfo.Org.Id == 10751 || adminUserInfo.Org.Id == 10752 || adminUserInfo.Org.Id == 10757 || adminUserInfo.Org.Id == 9478 || adminUserInfo.Org.Id == 10766 || adminUserInfo.Org.Id == 10768 || adminUserInfo.Org.Id == 10777 {
3882 3882
 
3883
-			if adminUserInfo.Org.Id != 10551 && adminUserInfo.Org.Id != 10579 && adminUserInfo.Org.Id != 10580 && adminUserInfo.Org.Id != 10585 && adminUserInfo.Org.Id != 10752 && adminUserInfo.Org.Id != 9478 && adminUserInfo.Org.Id != 10766 {
3883
+			if adminUserInfo.Org.Id != 10551 && adminUserInfo.Org.Id != 10579 && adminUserInfo.Org.Id != 10580 && adminUserInfo.Org.Id != 10585 && adminUserInfo.Org.Id != 10752 && adminUserInfo.Org.Id != 9478 && adminUserInfo.Org.Id != 10766 && adminUserInfo.Org.Id != 10777 {
3884 3884
 				dewater_amount = dewater_amount * 1000
3885 3885
 			}
3886 3886
 
@@ -4714,7 +4714,7 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
4714 4714
 		}
4715 4715
 	}
4716 4716
 
4717
-	if adminUserInfo.Org.Id == 10597 || adminUserInfo.Org.Id == 10742 || adminUserInfo.Org.Id == 10768 {
4717
+	if adminUserInfo.Org.Id == 10597 || adminUserInfo.Org.Id == 10742 || adminUserInfo.Org.Id == 10768 || adminUserInfo.Org.Id == 10777 {
4718 4718
 
4719 4719
 		if evaluation.ID > 0 {
4720 4720
 

+ 16 - 0
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go 查看文件

@@ -741,6 +741,14 @@ func (this *StaffScheduleApiController) DeleteSchedule() {
741 741
 				service.UpdateProjectObj(schedule.PatientId, schedule.ScheduleDate, org_id)
742 742
 			}
743 743
 		}
744
+
745
+		if org_id == 10633 {
746
+
747
+			prescription, _ := service.GetDialysisPrescription(schedule.PatientId, org_id, schedule.ScheduleDate)
748
+			if prescription.ID > 0 {
749
+				service.DeleteDialysisPrescription(prescription.ID)
750
+			}
751
+		}
744 752
 		redis := service.RedisClient()
745 753
 		//处方
746 754
 		keyOne := strconv.FormatInt(org_id, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":prescriptions_list_all"
@@ -890,7 +898,15 @@ func (this *StaffScheduleApiController) UpdateBloodScheduleMode() {
890 898
 	}
891 899
 	service.UpdatedScheduleMode(schedule, id)
892 900
 
901
+	scheduleObj, _ := service.GetScheduleId(id)
902
+
893 903
 	orgId := this.GetMobileAdminUserInfo().Org.Id
904
+
905
+	prescription, _ := service.GetDialysisPrescription(scheduleObj.PatientId, orgId, schedule.ScheduleDate)
906
+	if prescription.ID > 0 {
907
+		service.UpdateDialysisPrescriptionModeId(prescription.ID, mode_id)
908
+	}
909
+
894 910
 	//记录日志
895 911
 	byterequest, _ := json.Marshal(schedule)
896 912
 	scheduleLog := models.XtScheduleLog{

+ 3 - 1
controllers/patient_api_controller.go 查看文件

@@ -8484,6 +8484,8 @@ func (this *PatientApiController) CreateNewCourseOfDiaseaseRecord() {
8484 8484
 	content := dataBody["content"].(string)
8485 8485
 	admin_user_id := int64(dataBody["admin_user_id"].(float64))
8486 8486
 
8487
+	title := dataBody["title"].(string)
8488
+
8487 8489
 	orgId := this.GetAdminUserInfo().CurrentOrgId
8488 8490
 
8489 8491
 	patientCourse := models.PatientDiseaseCourse{
@@ -8496,7 +8498,7 @@ func (this *PatientApiController) CreateNewCourseOfDiaseaseRecord() {
8496 8498
 		Status:     1,
8497 8499
 		CreateTime: time.Now().Unix(),
8498 8500
 		ModifyTime: time.Now().Unix(),
8499
-		Title:      "",
8501
+		Title:      title,
8500 8502
 	}
8501 8503
 
8502 8504
 	service.CreateNewCourseOfDiaseaseRecord(patientCourse)

+ 64 - 4
controllers/pharmacy_controller.go 查看文件

@@ -1,6 +1,7 @@
1 1
 package controllers
2 2
 
3 3
 import (
4
+	"encoding/json"
4 5
 	"fmt"
5 6
 	"math"
6 7
 	"strconv"
@@ -46,7 +47,7 @@ func PharmacyApiRegistRouters() {
46 47
 
47 48
 	beego.Router("/api/pharmacy/updatedruginventorywarehouseinfo", &PharmacyController{}, "Get:UpdateDrugInventoryWarehouseInfo")
48 49
 
49
-	beego.Router("/api/pharmacy/changedrugcode", &PharmacyController{}, "Get:ChangeDrugCode")
50
+	beego.Router("/api/pharmacy/changedrugcode", &PharmacyController{}, "Post:ChangeDrugCode")
50 51
 
51 52
 	beego.Router("/api/pharmacy/changeZeroFlag", &PharmacyController{}, "Get:ChangeZeroFlag")
52 53
 
@@ -1441,23 +1442,64 @@ func (this *PharmacyController) UpdateDrugInventoryWarehouseInfo() {
1441 1442
 
1442 1443
 func (this *PharmacyController) ChangeDrugCode() {
1443 1444
 
1444
-	id, _ := this.GetInt64("id")
1445 1445
 	orgId := this.GetAdminUserInfo().CurrentOrgId
1446
-	data_source, _ := this.GetInt64("data_source")
1447
-	drug_code := this.GetString("drug_code")
1446
+	dataBody := make(map[string]interface{}, 0)
1447
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
1448
+	fmt.Println("err", err)
1449
+	id := int64(dataBody["id"].(float64))
1450
+
1451
+	data_source := int64(dataBody["data_source"].(float64))
1452
+
1453
+	drug_code := dataBody["drug_code"].(string)
1454
+
1455
+	//if dataBody["codeinfo"] != nil && reflect.TypeOf(dataBody["codeinfo"]).String() == "[]interface {}" {
1456
+	//	prescriptions, _ := dataBody["codeinfo"].([]interface{})
1457
+	//	if len(prescriptions) > 0 {
1458
+	//		for _, item := range prescriptions {
1459
+	//			var name string
1460
+	//			if item.(map[string]interface{})["name"] != nil || reflect.TypeOf(item.(map[string]interface{})["name"]).String() == "string" {
1461
+	//				name = item.(map[string]interface{})["name"].(string)
1462
+	//			}
1463
+	//			var count int64
1464
+	//			if item.(map[string]interface{})["count"] != nil || reflect.TypeOf(item.(map[string]interface{})["count"]).String() == "float64" {
1465
+	//				count = int64(item.(map[string]interface{})["count"].(float64))
1466
+	//			}
1467
+	//
1468
+	//			fmt.Println("name=====", name)
1469
+	//			fmt.Println("count====", count)
1470
+	//
1471
+	//			//hisPrescriptionProject, _ := service.GetHisPrescriptionByProject(id)
1472
+	//
1473
+	//			//查询这个耗材的已经扫码过的数据
1474
+	//			//service.GetWarehouseOoutInfo(name)
1475
+	//
1476
+	//		}
1477
+	//	}
1478
+	//}
1448 1479
 
1449 1480
 	str := strings.Replace(drug_code, " ", "", -1)
1450 1481
 	// 去除换行符
1451 1482
 	str = strings.Replace(str, "\n", "", -1)
1483
+
1452 1484
 	if data_source == 1 {
1453 1485
 		service.ChangeHisDrugCode(id, str, orgId)
1454 1486
 
1455 1487
 	}
1488
+
1456 1489
 	if data_source == 2 {
1457 1490
 		service.ChangeAdivceDrugCode(id, str, orgId)
1458 1491
 	}
1459 1492
 
1493
+	//耗材
1460 1494
 	if data_source == 3 {
1495
+
1496
+		if orgId == 10164 {
1497
+
1498
+			//fmt.Println("roleIds", role_ids)
1499
+			//for _, item := range role_ids {
1500
+			//	fmt.Println("item------", item)
1501
+			//}
1502
+		}
1461 1503
 		service.ChangeHisProjectCode(id, str, orgId)
1462 1504
 	}
1463 1505
 
@@ -1466,6 +1508,24 @@ func (this *PharmacyController) ChangeDrugCode() {
1466 1508
 	})
1467 1509
 }
1468 1510
 
1511
+func CountOccurrences(roleIds []int64) []map[int64]int {
1512
+	// 创建一个map来记录每个值的出现次数
1513
+	countMap := make(map[int64]int)
1514
+
1515
+	// 遍历数组,统计每个值的出现次数
1516
+	for _, id := range roleIds {
1517
+		countMap[id]++
1518
+	}
1519
+
1520
+	// 将统计结果转换为数组对象
1521
+	var result []map[int64]int
1522
+	for id, count := range countMap {
1523
+		result = append(result, map[int64]int{id: count})
1524
+	}
1525
+
1526
+	return result
1527
+}
1528
+
1469 1529
 func (this *PharmacyController) ChangeZeroFlag() {
1470 1530
 	id, _ := this.GetInt64("id")
1471 1531
 	orgId := this.GetAdminUserInfo().CurrentOrgId

+ 8 - 0
controllers/schedule_api_controller.go 查看文件

@@ -2257,6 +2257,14 @@ func (c *ScheduleApiController) DeleteSchedule() {
2257 2257
 		}
2258 2258
 	}
2259 2259
 
2260
+	if adminINfo.CurrentOrgId == 10633 {
2261
+
2262
+		prescription, _ := service.GetDialysisPrescription(schedule.PatientId, adminINfo.CurrentOrgId, schedule.ScheduleDate)
2263
+		if prescription.ID > 0 {
2264
+			service.DeleteDialysisPrescription(prescription.ID)
2265
+		}
2266
+	}
2267
+
2260 2268
 	redis := service.RedisClient()
2261 2269
 
2262 2270
 	//处方

+ 38 - 0
controllers/self_drug_api_congtroller.go 查看文件

@@ -205,6 +205,8 @@ func SelfDrugRouters() {
205 205
 
206 206
 	beego.Router("/api/patient/changegoodwarehouseinfo", &SelfDrugApiController{}, "Post:ChangeGoodWarehouseInfo")
207 207
 
208
+	beego.Router("/api/good/getrepatgoodlist", &SelfDrugApiController{}, "Post:GetReatGoodList")
209
+
208 210
 }
209 211
 
210 212
 func (this *SelfDrugApiController) GetCurrentPatient() {
@@ -6934,3 +6936,39 @@ func (this *SelfDrugApiController) ChangeGoodWarehouseInfo() {
6934 6936
 	})
6935 6937
 
6936 6938
 }
6939
+
6940
+func (this *SelfDrugApiController) GetReatGoodList() {
6941
+
6942
+	orgId := this.GetAdminUserInfo().CurrentOrgId
6943
+	dataBody := make(map[string]interface{}, 0)
6944
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
6945
+	if err != nil {
6946
+		utils.ErrorLog(err.Error())
6947
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
6948
+		return
6949
+	}
6950
+
6951
+	good_str := dataBody["good_str"].(string)
6952
+
6953
+	good_id := int64(dataBody["good_id"].(float64))
6954
+
6955
+	var ids []string
6956
+	if len(good_str) > 0 {
6957
+		ids = strings.Split(good_str, ",")
6958
+	}
6959
+
6960
+	if len(ids) > 0 {
6961
+		for _, item := range ids {
6962
+			goodcodeinfo, _ := service.GetReatGoodList(item, good_id, orgId)
6963
+			if goodcodeinfo.ID > 0 {
6964
+				this.ServeDynamicFailJsonSend("追溯码:" + item + "已经重复入库")
6965
+				return
6966
+			}
6967
+		}
6968
+	}
6969
+
6970
+	this.ServeSuccessJSON(map[string]interface{}{
6971
+		"msg": "ok",
6972
+	})
6973
+
6974
+}

+ 44 - 19
controllers/stock_in_api_controller.go 查看文件

@@ -424,6 +424,8 @@ func (c *StockManagerApiController) CreateWarehouse() {
424 424
 				register_number, _ := items["register_number"].(string)
425 425
 
426 426
 				good_code, _ := items["good_code"].(string)
427
+
428
+				split_of_number := int64(items["split_of_number"].(float64))
427 429
 				//入库单表格
428 430
 				warehouseInfo := &models.WarehousingInfo{
429 431
 					ID:               id,
@@ -451,6 +453,7 @@ func (c *StockManagerApiController) CreateWarehouse() {
451 453
 					IsCheck:          2,
452 454
 					RegisterNumber:   register_number,
453 455
 					GoodCode:         good_code,
456
+					SplitOfNumber:    split_of_number,
454 457
 				}
455 458
 				warehousingInfo = append(warehousingInfo, warehouseInfo)
456 459
 
@@ -537,7 +540,7 @@ func (c *StockManagerApiController) GetWarehouseList() {
537 540
 		}
538 541
 	}
539 542
 	warehouseList, total, err := service.FindAllWarehousingList(adminUserInfo.CurrentOrgId, page, limit, startTime, endTime, types, keywords, ids, storehouse_id, check_type)
540
-	fmt.Println("ottal--------", total)
543
+
541 544
 	houselist, _ := service.GetAllStoreHouseList(adminUserInfo.CurrentOrgId)
542 545
 	if err == nil {
543 546
 		c.ServeSuccessJSON(map[string]interface{}{
@@ -722,6 +725,8 @@ func (c *StockManagerApiController) EditWarehouse() {
722 725
 				}
723 726
 				id := int64(items["id"].(float64))
724 727
 
728
+				split_of_number := int64(items["split_of_number"].(float64))
729
+
725 730
 				if id == 0 {
726 731
 					warehouseInfo := &models.WarehousingInfo{
727 732
 						WarehousingOrder: warehouse.WarehousingOrder,
@@ -748,6 +753,7 @@ func (c *StockManagerApiController) EditWarehouse() {
748 753
 						IsCheck:          2,
749 754
 						RegisterNumber:   register_number,
750 755
 						GoodCode:         good_code,
756
+						SplitOfNumber:    split_of_number,
751 757
 					}
752 758
 					warehousingInfo = append(warehousingInfo, warehouseInfo)
753 759
 
@@ -777,6 +783,7 @@ func (c *StockManagerApiController) EditWarehouse() {
777 783
 						StorehouseId:     storehouse_id,
778 784
 						RegisterNumber:   register_number,
779 785
 						GoodCode:         good_code,
786
+						SplitOfNumber:    split_of_number,
780 787
 					}
781 788
 					upDateWarehousingInfo = append(upDateWarehousingInfo, warehouseInfo)
782 789
 
@@ -7497,6 +7504,8 @@ func (this *StockManagerApiController) CheckWarehouseInfo() {
7497 7504
 	//更改审核状态
7498 7505
 	err := service.UpdateNewCheckWarehouseInfo(warehousing_info_id, checker, tx)
7499 7506
 	var is_success = 2
7507
+	var total_one int64
7508
+	var total_two int64
7500 7509
 	if err == nil {
7501 7510
 		list, _ := service.GetNewWarehouseInfoList(warehousing_info_id, orgId, tx)
7502 7511
 
@@ -7619,23 +7628,37 @@ func (this *StockManagerApiController) CheckWarehouseInfo() {
7619 7628
 			goodcodelist := strings.Split(item.GoodCode, ",")
7620 7629
 
7621 7630
 			if len(goodcodelist) > 0 {
7622
-				goodInfo, _ := service.GetNewGoodByIdIsStop(item.GoodId, item.OrgId, tx)
7631
+				//goodInfo, _ := service.GetNewGoodByIdIsStop(item.GoodId, item.OrgId, tx)
7623 7632
 				for _, it := range goodcodelist {
7624
-					if it != "" {
7625
-						codeInfo := models.XtGoodCodeInfo{
7626
-							GoodId:          item.GoodId,
7627
-							BatchNumber:     item.Number,
7628
-							GoodCode:        it,
7629
-							WarehouseInfoId: item.ID,
7630
-							IsUserCount:     0,
7631
-							IsOutStatus:     2,
7632
-							Status:          1,
7633
-							UserOrgId:       item.OrgId,
7634
-							Ctime:           time.Now().Unix(),
7635
-							Mtime:           time.Now().Unix(),
7636
-							SplitOfNumber:   goodInfo.SplitOfNumber,
7633
+
7634
+					//查询改追溯码是否已经入库过
7635
+					goodCodeInfo, _ := service.GetGoodCodeIsUsered(item.GoodId, item.OrgId, it)
7636
+
7637
+					if goodCodeInfo.ID == 0 {
7638
+
7639
+						if it != "" {
7640
+							codeInfo := models.XtGoodCodeInfo{
7641
+								GoodId:          item.GoodId,
7642
+								BatchNumber:     item.Number,
7643
+								GoodCode:        it,
7644
+								WarehouseInfoId: item.ID,
7645
+								IsUserCount:     0,
7646
+								IsOutStatus:     2,
7647
+								Status:          1,
7648
+								UserOrgId:       item.OrgId,
7649
+								Ctime:           time.Now().Unix(),
7650
+								Mtime:           time.Now().Unix(),
7651
+								SplitOfNumber:   item.SplitOfNumber,
7652
+							}
7653
+							service.CreateCodeInfo(codeInfo, tx)
7654
+							total_one = total_one + 1
7637 7655
 						}
7638
-						service.CreateCodeInfo(codeInfo, tx)
7656
+
7657
+					}
7658
+
7659
+					if goodCodeInfo.ID > 0 {
7660
+
7661
+						total_two = total_two + 1
7639 7662
 					}
7640 7663
 
7641 7664
 				}
@@ -7649,7 +7672,9 @@ func (this *StockManagerApiController) CheckWarehouseInfo() {
7649 7672
 
7650 7673
 	if err == nil {
7651 7674
 		this.ServeSuccessJSON(map[string]interface{}{
7652
-			"list": "list",
7675
+			"list":      "list",
7676
+			"total_one": total_one,
7677
+			"totalTwo":  total_two,
7653 7678
 		})
7654 7679
 	}
7655 7680
 	return
@@ -8141,7 +8166,7 @@ func (this *StockManagerApiController) GetGoodPatientName() {
8141 8166
 
8142 8167
 func (this *StockManagerApiController) UpdateBaseDrugListByUserOrgID() {
8143 8168
 
8144
-	//orgId := this.GetAdminUserInfo().CurrentOrgId
8169
+	orgId := this.GetAdminUserInfo().CurrentOrgId
8145 8170
 
8146 8171
 	//list, _ := service.GetAllBaseDrugList(orgId)
8147 8172
 	//
@@ -8217,7 +8242,7 @@ func (this *StockManagerApiController) UpdateBaseDrugListByUserOrgID() {
8217 8242
 	//	service.UpdateDealerManufacturerOne(item.ID, manufacturer.ManufacturerName)
8218 8243
 	//}
8219 8244
 
8220
-	drugList, _ := service.GetAllBaseDrugListTwentyOne(9478)
8245
+	drugList, _ := service.GetAllBaseDrugListTwentyOne(orgId)
8221 8246
 
8222 8247
 	for _, item := range drugList {
8223 8248
 		var drug_spec = item.Dose + item.DoseUnit + "*" + strconv.FormatInt(item.MinNumber, 10) + item.MinUnit + "/" + item.MaxUnit

+ 1 - 0
models/patient_models.go 查看文件

@@ -732,6 +732,7 @@ type PatientDiseaseCourse struct {
732 732
 	CreateTime int64  `gorm:"column:ctime" json:"-" form:"-"`
733 733
 	ModifyTime int64  `gorm:"column:mtime" json:"-" form:"-"`
734 734
 	Title      string `gorm:"column:title" json:"title"`
735
+	RecordDate int64  `gorm:"column:record_date" json:"record_date" form:"record_date"`
735 736
 }
736 737
 
737 738
 func (PatientDiseaseCourse) TableName() string {

+ 2 - 0
models/stock_models.go 查看文件

@@ -180,6 +180,7 @@ type WarehousingInfo struct {
180 180
 	ManafacturerName          string                  `gorm:"column:manafacturer_name" json:"manafacturer_name" form:"manafacturer_name"`
181 181
 	DealerName                string                  `gorm:"column:dealer_name" json:"dealer_name" form:"dealer_name"`
182 182
 	GoodCode                  string                  `gorm:"column:good_code" json:"good_code" form:"good_code"`
183
+	SplitOfNumber             int64                   `gorm:"column:split_of_number" json:"split_of_number" form:"split_of_number"`
183 184
 }
184 185
 
185 186
 func (WarehousingInfo) TableName() string {
@@ -1559,6 +1560,7 @@ type VmWarehousingInfoSix struct {
1559 1560
 	SecondWarehouseInfoId     int64    `gorm:"column:second_warehouse_info_id" json:"second_warehouse_info_id" form:"second_warehouse_info_id"`
1560 1561
 	RegisterNumber            string   `gorm:"column:register_number" json:"register_number" form:"register_number"`
1561 1562
 	GoodCode                  string   `gorm:"column:good_code" json:"good_code" form:"good_code"`
1563
+	SplitOfNumber             int64    `gorm:"column:split_of_number" json:"split_of_number" form:"split_of_number"`
1562 1564
 }
1563 1565
 
1564 1566
 func (VmWarehousingInfoSix) TableName() string {

+ 18 - 0
service/auto_create_week_disinfection.go 查看文件

@@ -231,6 +231,24 @@ func GetDialysisPrescription(patientid int64, orgID int64, timenow int64) (model
231 231
 	return prescription, err
232 232
 }
233 233
 
234
+func UpdateDialysisPrescriptionModeId(id int64, mode_id int64) error {
235
+
236
+	prescription := models.DialysisPrescription{}
237
+
238
+	err := XTWriteDB().Model(&prescription).Where("id = ? and status=1", id).Updates(map[string]interface{}{"mode_id": mode_id}).Error
239
+
240
+	return err
241
+}
242
+
243
+func DeleteDialysisPrescription(id int64) error {
244
+
245
+	prescription := models.XtDialysisPrescription{}
246
+
247
+	err := XTWriteDB().Model(&prescription).Where("id= ? and status=1", id).Updates(map[string]interface{}{"status": 0}).Error
248
+
249
+	return err
250
+}
251
+
234 252
 func GetAssessmentAfterDissData(patientid int64, orgID int64, timenow int64) (models.XtAssessmentAfterDislysis, error) {
235 253
 	dislysis := models.XtAssessmentAfterDislysis{}
236 254
 	err := XTReadDB().Where("patient_id = ? AND user_org_id = ? AND assessment_date = ?", patientid, orgID, timenow).Find(&dislysis).Error

+ 5 - 0
service/data.go 查看文件

@@ -233,6 +233,11 @@ func FindConfigByTitle(module string, title string, org_id int64) (dataconfig mo
233 233
 	return
234 234
 }
235 235
 
236
+func FindConfigByTitleOne(module string, org_id int64) (dataconfig []*models.Dataconfig, err error) {
237
+	err = readDb.Model(&models.Dataconfig{}).Where("module=? and org_id in (0,?) and status = 1", module, org_id).Find(&dataconfig).Error
238
+	return
239
+}
240
+
236 241
 func FindConfigByName(module string, name string, parent_id int64, org_id int64) (dataconfig models.Dataconfig, err error) {
237 242
 	err = readDb.Model(&models.Dataconfig{}).Where("module=? and name=? and parent_id=? and org_id in (0,?) and status = 1", module, name, parent_id, org_id).First(&dataconfig).Error
238 243
 	return

+ 0 - 3
service/dialysis_solution_service.go 查看文件

@@ -222,9 +222,6 @@ func GetDialysisGoodTotalCount(orgID int64, schedule_type int64, partition_id []
222 222
 	if schedule_type > 0 {
223 223
 		db = db.Where("schedule_type = ?", schedule_type)
224 224
 	}
225
-	//if partition_id > 0 {
226
-	//	db = db.Where("partition_id = ?", partition_id)
227
-	//}
228 225
 
229 226
 	if len(partition_id) > 0 {
230 227
 		db = db.Where("partition_id in(?)", partition_id)

+ 9 - 0
service/doctor_schedule_service.go 查看文件

@@ -739,6 +739,15 @@ func UpdatedScheduleMode(schedule models.XtSchedule, id int64) error {
739 739
 	return err
740 740
 }
741 741
 
742
+func GetScheduleId(id int64) (models.Schedule, error) {
743
+
744
+	schedule := models.Schedule{}
745
+
746
+	err := XTReadDB().Where("id=? an status=1", id).Find(&schedule).Error
747
+
748
+	return schedule, err
749
+}
750
+
742 751
 func UpdatedSchedule(schedule models.XtSchedule, patient_id int64, schedule_date int64, schedule_type int64, bed_id int64) error {
743 752
 
744 753
 	xtSchedule := models.XtSchedule{}

+ 9 - 0
service/his_service.go 查看文件

@@ -3181,6 +3181,15 @@ func CreateCodeInfo(info models.XtGoodCodeInfo, tx *gorm.DB) error {
3181 3181
 	return err
3182 3182
 }
3183 3183
 
3184
+func GetGoodCodeIsUsered(good_id int64, user_org_id int64, good_code string) (models.XtGoodCodeInfo, error) {
3185
+
3186
+	codeInfo := models.XtGoodCodeInfo{}
3187
+
3188
+	err := XTReadDB().Where("good_id=? and user_org_id = ? and good_code = ? and status=1", good_id, user_org_id, good_code).Find(&codeInfo).Error
3189
+
3190
+	return codeInfo, err
3191
+}
3192
+
3184 3193
 func CreateDrugCodeInfo(info models.XtDrugCodeInfo, tx *gorm.DB) error {
3185 3194
 
3186 3195
 	err := tx.Create(&info).Error

+ 9 - 1
service/manage_center_service.go 查看文件

@@ -331,7 +331,7 @@ func GetBaseDrugLibList(org_id int64, keyword string, page int64, limit int64, i
331 331
 	}
332 332
 	offset := (page - 1) * limit
333 333
 
334
-	err = db.Count(&total).Offset(offset).Limit(limit).Order("ctime desc").Find(&list).Error
334
+	err = db.Count(&total).Offset(offset).Limit(limit).Order("id desc").Find(&list).Error
335 335
 	return
336 336
 }
337 337
 
@@ -1171,3 +1171,11 @@ func ModifyGoodCodeWarehouseInfo(id int64, good_code string) (models.XtWarehouse
1171 1171
 
1172 1172
 	return info, err
1173 1173
 }
1174
+
1175
+func GetReatGoodList(good_code string, good_id int64, user_org_id int64) (models.XtGoodCodeInfo, error) {
1176
+
1177
+	codeInfo := models.XtGoodCodeInfo{}
1178
+	err = XTReadDB().Where("good_id = ? and good_code = ? and status=1 and user_org_id = ?", good_id, good_code, user_org_id).Find(&codeInfo).Error
1179
+
1180
+	return codeInfo, err
1181
+}

+ 1 - 1
service/manage_service.go 查看文件

@@ -1684,7 +1684,7 @@ func GetNewAirDisinfectList(limit int64, page int64, start_time int64, end_time
1684 1684
 	if len(storey) > 0 {
1685 1685
 		db = db.Where("storey =?", storey)
1686 1686
 	}
1687
-	err = db.Count(&total).Offset(offset).Limit(limit).Find(&list).Error
1687
+	err = db.Count(&total).Offset(offset).Limit(limit).Order("record_date asc").Find(&list).Error
1688 1688
 	return list, total, err
1689 1689
 }
1690 1690
 

+ 8 - 0
service/new_warehouse_service.go 查看文件

@@ -4781,6 +4781,10 @@ func HisStoryBloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, war
4781 4781
 			UpdateNewSingleDrugAutoReduceRecordInfo(autoMaticReduceDetail.ID, deliver_number, tx)
4782 4782
 		}
4783 4783
 
4784
+		if orgID == 9478 {
4785
+			ModifyDrugPriceList(advice.DrugId, warehouse.RetailPrice, drup.MinNumber, tx)
4786
+		}
4787
+
4784 4788
 		return nil
4785 4789
 
4786 4790
 	} else {
@@ -4952,6 +4956,10 @@ func HisStoryBloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, war
4952 4956
 		advice.PrescribingNumberUnit = drup.MinUnit
4953 4957
 
4954 4958
 		HisStoryBloodHisDrugDeliverInfo(orgID, overPlusNumber, warehouseout, drup, advice, hisprescribingNumber, unit, tx)
4959
+
4960
+		if orgID == 9478 {
4961
+			ModifyDrugPriceList(advice.DrugId, warehouse.RetailPrice, drup.MinNumber, tx)
4962
+		}
4955 4963
 	}
4956 4964
 
4957 4965
 	return

+ 5 - 0
service/patient_dataconfig_service.go 查看文件

@@ -119,6 +119,11 @@ func ModifyPatientCourses(record *models.PatientDiseaseCourse) error {
119 119
 	return err
120 120
 }
121 121
 
122
+func ModifyPatientCoursesOne(record *models.PatientDiseaseCourse) error {
123
+	err := writeDb.Model(&models.PatientDiseaseCourse{}).Where("org_id = ? and patient_id = ? and status = 1 and record_date = ?", record.OrgID, record.PatientID, record.RecordDate).Updates(map[string]interface{}{"content": record.Content, "record_time": record.RecordTime, "mtime": time.Now().Unix(), "title": record.Title}).Error
124
+	return err
125
+}
126
+
122 127
 func ModifyPatientSickHistory(record *models.XtPatientSickHistory) error {
123 128
 	err := writeDb.Save(record).Error
124 129
 	//err := writeDb.Model(&models.XtPatientSickHistory{}).Where("org_id = ? and patient_id = ? and status = 1 and id = ?", record.OrgId, record.PatientId, record.ID).Updates(map[string]interface{}{"content": record.Content, "record_time": record.RecordTime, "mtime": time.Now().Unix(), "title": record.Title}).Error

+ 28 - 1
service/patient_service.go 查看文件

@@ -4428,6 +4428,15 @@ func GetDialysisPrescribeOneList(patient_id int64, record_date int64, user_org_i
4428 4428
 	return prescription, err
4429 4429
 }
4430 4430
 
4431
+func GetNewPatientVascularAccess(patient_id int64) (models.XtPatientVascularAccess, error) {
4432
+
4433
+	access := models.XtPatientVascularAccess{}
4434
+
4435
+	err = XTReadDB().Where("patient_id = ? and user_status = 1", patient_id).Last(&access).Error
4436
+
4437
+	return access, err
4438
+}
4439
+
4431 4440
 func CreateDeathSummary(summary models.XtDeathSummary) error {
4432 4441
 
4433 4442
 	err := XTWriteDB().Save(&summary).Error
@@ -4510,7 +4519,7 @@ func CreateNewCourseOfDiaseaseRecord(course models.PatientDiseaseCourse) error {
4510 4519
 
4511 4520
 func GetPatientCoureseOfDiseasesList(patient_id int64, org_id int64) (list []*models.PatientDiseaseCourse, err error) {
4512 4521
 
4513
-	err = XTReadDB().Where("patient_id = ? and org_id = ? and status=1", patient_id, org_id).Find(&list).Error
4522
+	err = XTReadDB().Where("patient_id = ? and org_id = ? and status=1", patient_id, org_id).Order("record_time desc").Find(&list).Error
4514 4523
 
4515 4524
 	return list, err
4516 4525
 
@@ -5627,3 +5636,21 @@ func GetPatientCountFlowByIdList(patient_id int64, orgId int64, mode_id int64, i
5627 5636
 
5628 5637
 	return flow, err
5629 5638
 }
5639
+
5640
+func GetNewPatientSchedule(patient_id int64, schedule_date int64, user_org_id int64) (models.XtSchedule, error) {
5641
+
5642
+	schedule := models.XtSchedule{}
5643
+
5644
+	err := XTReadDB().Where("patient_id = ? and schedule_date=? and user_org_id = ? and status=1", patient_id, schedule_date, user_org_id).Find(&schedule).Error
5645
+
5646
+	return schedule, err
5647
+}
5648
+
5649
+func GetNewBedNumber(id int64) (models.DeviceNumber, error) {
5650
+
5651
+	number := models.DeviceNumber{}
5652
+
5653
+	err = XTReadDB().Where("id=?", id).Find(&number).Error
5654
+
5655
+	return number, err
5656
+}

+ 16 - 0
service/pharmacy_service.go 查看文件

@@ -1599,6 +1599,13 @@ func GetUserAdminName(id, orgID int64) string {
1599 1599
 	return tmp.UserName
1600 1600
 }
1601 1601
 
1602
+// 获取领药人姓名(
1603
+func GetUserAdminNameType(id, orgID int64) int64 {
1604
+	var tmp models.XTSgjUserAdminRole
1605
+	XTReadDB().Model(&models.XTSgjUserAdminRole{}).Where("admin_user_id = ? and org_id = ?", id, orgID).Find(&tmp)
1606
+	return tmp.UserType
1607
+}
1608
+
1602 1609
 // 根据id查询是否已发药,true已发药,false未发药gai
1603 1610
 func GiveTheMedicine(id int64) bool {
1604 1611
 	var xue models.PharmacyDoctorAdvice
@@ -3044,3 +3051,12 @@ func GetWaitPharmacyHISGoodsPatient(zone_id int64, sch_type int64, record_date i
3044 3051
 	err = db.Where("xt_patients.user_org_id = ?", org_id).Group("xt_patients.id").Find(&patient).Error
3045 3052
 	return
3046 3053
 }
3054
+
3055
+func GetHisPrescriptionByProject(id int64) (models.HisPrescriptionProject, error) {
3056
+
3057
+	prescriptionProject := models.HisPrescriptionProject{}
3058
+
3059
+	err := XTReadDB().Where("id=? and status=1", id).Find(&prescriptionProject).Error
3060
+
3061
+	return prescriptionProject, err
3062
+}

+ 1 - 0
service/print_data_service/schedule_dialysis/print_schedule_dialysis_models.go 查看文件

@@ -231,6 +231,7 @@ type PrescriptionVM struct {
231 231
 	DisplaceSpeed              string  `gorm:"column:displace_speed" json:"displace_speed" form:"displace_speed"`
232 232
 	DialysisStrainer           string  `gorm:"column:dialysis_strainer" json:"dialysis_strainer" form:"dialysis_strainer"`
233 233
 	PrescriptionWater          float64 `gorm:"column:prescription_water" json:"prescription_water" form:"prescription_water"`
234
+	BloodAccessPartId          string  `gorm:"column:blood_access_part_id" json:"blood_access_part_id" form:"blood_access_part_id"`
234 235
 }
235 236
 
236 237
 func (PrescriptionVM) TableName() string {

+ 34 - 9
service/stock_service.go 查看文件

@@ -3,6 +3,7 @@ package service
3 3
 import (
4 4
 	"errors"
5 5
 	"fmt"
6
+	"math"
6 7
 	"strconv"
7 8
 	"strings"
8 9
 	"time"
@@ -359,7 +360,7 @@ func FindGoodInfoList(orgId int64, page int64, limit int64, keyword string, is_u
359 360
 		}
360 361
 	}
361 362
 
362
-	err = db.Count(&total).Offset(offset).Limit(limit).Order("ctime desc").Find(&list).Error
363
+	err = db.Count(&total).Offset(offset).Limit(limit).Order("id desc").Find(&list).Error
363 364
 	return
364 365
 }
365 366
 
@@ -576,11 +577,11 @@ func CreateNewWarehousingInfo(warehousingInfo []*models.WarehousingInfo, tx *gor
576 577
 	if len(warehousingInfo) > 0 {
577 578
 
578 579
 		if len(warehousingInfo) > 0 {
579
-			thisSQL := "INSERT INTO xt_warehouse_info (warehousing_id, good_id, good_type_id, number, product_date,expiry_date,warehousing_count,price,total_price,dealer,manufacturer,remark,ctime,mtime,status,org_id,warehousing_order,type,stock_count,license_number,packing_price,storehouse_id,good_code) VALUES "
580
+			thisSQL := "INSERT INTO xt_warehouse_info (warehousing_id, good_id, good_type_id, number, product_date,expiry_date,warehousing_count,price,total_price,dealer,manufacturer,remark,ctime,mtime,status,org_id,warehousing_order,type,stock_count,license_number,packing_price,storehouse_id,good_code,split_of_number) VALUES "
580 581
 			insertParams := make([]string, 0)
581 582
 			insertData := make([]interface{}, 0)
582 583
 			for _, info := range warehousingInfo {
583
-				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
584
+				insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
584 585
 				insertData = append(insertData, info.WarehousingId)
585 586
 				insertData = append(insertData, info.GoodId)
586 587
 				insertData = append(insertData, info.GoodTypeId)
@@ -604,6 +605,7 @@ func CreateNewWarehousingInfo(warehousingInfo []*models.WarehousingInfo, tx *gor
604 605
 				insertData = append(insertData, info.PackingPrice)
605 606
 				insertData = append(insertData, info.StorehouseId)
606 607
 				insertData = append(insertData, info.GoodCode)
608
+				insertData = append(insertData, info.SplitOfNumber)
607 609
 			}
608 610
 			thisSQL += strings.Join(insertParams, ", ")
609 611
 			err = tx.Exec(thisSQL, insertData...).Error
@@ -1211,7 +1213,7 @@ func FindAllWarehousingList(orgId int64, page int64, limit int64, startTime int6
1211 1213
 	if check_type > 0 {
1212 1214
 		db = db.Where("xt_warehouse.is_check = ?", check_type)
1213 1215
 	}
1214
-	err = db.Count(&total).Offset(offset).Limit(limit).Order("xt_warehouse.warehousing_time desc").Find(&list).Error
1216
+	err = db.Count(&total).Offset(offset).Limit(limit).Order("xt_warehouse.warehousing_time desc,xt_warehouse.id desc").Find(&list).Error
1215 1217
 	return
1216 1218
 }
1217 1219
 
@@ -1460,7 +1462,7 @@ func FindAllDrugWarehousingListOne(orgId int64, page int64, limit int64, startTi
1460 1462
 	}
1461 1463
 	db = db.Count(&total)
1462 1464
 	offset := (page - 1) * limit
1463
-	err = db.Offset(offset).Limit(limit).Order("xt_drug_warehouse.warehousing_time desc").Find(&list).Error
1465
+	err = db.Offset(offset).Limit(limit).Order("xt_drug_warehouse.warehousing_time desc,xt_drug_warehouse.id desc").Find(&list).Error
1464 1466
 	return
1465 1467
 }
1466 1468
 
@@ -4099,6 +4101,19 @@ func UpdateNewSingleDrugAutoReduceRecordInfo(id int64, count int64, tx *gorm.DB)
4099 4101
 	return err
4100 4102
 }
4101 4103
 
4104
+func ModifyDrugPriceList(drug_id int64, retail_price float64, min_number int64, tx *gorm.DB) error {
4105
+
4106
+	result := float64(min_number) * retail_price
4107
+	//保留两位小数的方法1:使用math.Round
4108
+	rounded := math.Round(result*100) / 100
4109
+	err = tx.Model(models.Drug{}).Where("id = ? and status=1", drug_id).Updates(map[string]interface{}{"min_price": retail_price, "retail_price": rounded}).Error
4110
+	if err != nil {
4111
+		tx.Rollback()
4112
+		return err
4113
+	}
4114
+	return err
4115
+}
4116
+
4102 4117
 func AddNewSigleDrugAutoReduceRecordInfo(detail *models.DrugAutomaticReduceDetail, tx *gorm.DB) error {
4103 4118
 
4104 4119
 	err := tx.Create(&detail).Error
@@ -4665,7 +4680,12 @@ func GetSearchDrugListSix(keywords string, orgid int64, storehouse_id int64) (dr
4665 4680
 
4666 4681
 	if len(keywords) > 0 {
4667 4682
 		likekey := "%" + keywords + "%"
4668
-		err = db.Where("(drug_name LIKE ?)", likekey).Preload("LastDrugWarehouseInfo", "org_id=? and status = 1 and (stock_max_number > 0 or stock_min_number>0) and storehouse_id = ?", orgid, storehouse_id).Preload("DrugWarehouseInfo", func(db *gorm.DB) *gorm.DB {
4683
+		// 转义特殊字符(如 % _ \)
4684
+		//escapedKeywords := strings.ReplaceAll(keywords, "%", "\\%")
4685
+		//escapedKeywords = strings.ReplaceAll(escapedKeywords, "_", "\\_")
4686
+		//escapedKeywords = strings.ReplaceAll(escapedKeywords, "\\", "\\\\")
4687
+		//likekey := "%" + escapedKeywords + "%"
4688
+		err = db.Where("(drug_name LIKE ? ESCAPE '\\\\')", likekey).Preload("LastDrugWarehouseInfo", "org_id=? and status = 1 and (stock_max_number > 0 or stock_min_number>0) and storehouse_id = ?", orgid, storehouse_id).Preload("DrugWarehouseInfo", func(db *gorm.DB) *gorm.DB {
4669 4689
 			return XTReadDB().Where("org_id=? and status = 1 and warehousing_count <> 0 and storehouse_id = ?", orgid, storehouse_id).Group("id")
4670 4690
 		}).Find(&drug).Error
4671 4691
 	} else {
@@ -4697,7 +4717,12 @@ func GetSearchGoodListSix(keywords string, orgid int64, storehouse_id int64) (go
4697 4717
 	db := XTReadDB().Model(&good).Where("org_id =? and status = 1  AND find_in_set('停用',good_status) = 0", orgid)
4698 4718
 	if len(keywords) > 0 {
4699 4719
 		likekey := "%" + keywords + "%"
4700
-		err = db.Where("(good_name Like ?)", likekey).Preload("LaStWarehousingInfo", "org_id=? and status = 1 and stock_count <> 0 and storehouse_id =?", orgid, storehouse_id).Preload("StWarehousingInfo", func(db *gorm.DB) *gorm.DB {
4720
+		// 转义特殊字符(如 % _ \)
4721
+		//escapedKeywords := strings.ReplaceAll(keywords, "%", "\\%")
4722
+		//escapedKeywords = strings.ReplaceAll(escapedKeywords, "_", "\\_")
4723
+		//escapedKeywords = strings.ReplaceAll(escapedKeywords, "\\", "\\\\")
4724
+		//likekey := "%" + escapedKeywords + "%"
4725
+		err = db.Where("(good_name Like ?) ", likekey).Preload("LaStWarehousingInfo", "org_id=? and status = 1 and stock_count <> 0 and storehouse_id =?", orgid, storehouse_id).Preload("StWarehousingInfo", func(db *gorm.DB) *gorm.DB {
4701 4726
 			return XTReadDB().Where("org_id=? and status = 1 and warehousing_count <> 0 and storehouse_id =?", orgid, storehouse_id)
4702 4727
 		}).Find(&good).Error
4703 4728
 	} else {
@@ -7453,7 +7478,7 @@ func UpdateWarehouseInfoByGoodIdOne(info *models.WarehousingInfo, id int64) erro
7453 7478
 
7454 7479
 func UpdateNewWarehouseInfoByGoodIdOne(info *models.WarehousingInfo, id int64, tx *gorm.DB) error {
7455 7480
 
7456
-	err := tx.Model(&info).Where("id =? and status = 1", id).Updates(map[string]interface{}{"warehousing_count": info.WarehousingCount, "stock_count": info.StockCount, "price": info.Price, "number": info.Number, "product_date": info.ProductDate, "expiry_date": info.ExpiryDate, "license_number": info.LicenseNumber, "manufacturer": info.Manufacturer, "dealer": info.Dealer, "remark": info.Remark, "packing_price": info.PackingPrice, "storehouse_id": info.StorehouseId, "register_number": info.RegisterNumber, "good_id": info.GoodId, "good_code": info.GoodCode}).Error
7481
+	err := tx.Model(&info).Where("id =? and status = 1", id).Updates(map[string]interface{}{"warehousing_count": info.WarehousingCount, "stock_count": info.StockCount, "price": info.Price, "number": info.Number, "product_date": info.ProductDate, "expiry_date": info.ExpiryDate, "license_number": info.LicenseNumber, "manufacturer": info.Manufacturer, "dealer": info.Dealer, "remark": info.Remark, "packing_price": info.PackingPrice, "storehouse_id": info.StorehouseId, "register_number": info.RegisterNumber, "good_id": info.GoodId, "good_code": info.GoodCode, "split_of_number": info.SplitOfNumber}).Error
7457 7482
 	if err != nil {
7458 7483
 		tx.Rollback()
7459 7484
 		return err
@@ -8732,7 +8757,7 @@ func UpdateWarehouseDetail(info *models.WarehousingInfo, id int64) error {
8732 8757
 
8733 8758
 func UpdateNewWarehouseDetail(info *models.WarehousingInfo, id int64, tx *gorm.DB) error {
8734 8759
 
8735
-	err := tx.Model(&models.WarehousingInfo{}).Where("id = ? and status = 1", id).Update(map[string]interface{}{"good_id": info.GoodId, "good_type_id": info.GoodTypeId, "number": info.Number, "product_date": info.ProductDate, "expiry_date": info.ExpiryDate, "warehousing_count": info.WarehousingCount, "warehousing_unit": info.WarehousingUnit, "price": info.Price, "total_price": info.TotalPrice, "dealer": info.Dealer, "manufacturer": info.Manufacturer, "remark": info.Remark, "license_number": info.LicenseNumber, "packing_price": info.PackingPrice, "register_number": info.RegisterNumber, "storehouse_id": info.StorehouseId, "good_code": info.GoodCode}).Error
8760
+	err := tx.Model(&models.WarehousingInfo{}).Where("id = ? and status = 1", id).Update(map[string]interface{}{"good_id": info.GoodId, "good_type_id": info.GoodTypeId, "number": info.Number, "product_date": info.ProductDate, "expiry_date": info.ExpiryDate, "warehousing_count": info.WarehousingCount, "warehousing_unit": info.WarehousingUnit, "price": info.Price, "total_price": info.TotalPrice, "dealer": info.Dealer, "manufacturer": info.Manufacturer, "remark": info.Remark, "license_number": info.LicenseNumber, "packing_price": info.PackingPrice, "register_number": info.RegisterNumber, "storehouse_id": info.StorehouseId, "good_code": info.GoodCode, "split_of_number": info.SplitOfNumber}).Error
8736 8761
 	if err != nil {
8737 8762
 		tx.Rollback()
8738 8763
 		return err

+ 15 - 0
service/warhouse_service.go 查看文件

@@ -8837,6 +8837,8 @@ func ConsumableNewHisPrescriptionDelivery(orgID int64, patient_id int64, record_
8837 8837
 
8838 8838
 		CreatedDialysisPrepare(autoMatic, tx)
8839 8839
 
8840
+		ModifyGoodPakingPrice(goods.GoodId, warehouse.PackingPrice, tx)
8841
+
8840 8842
 		return nil
8841 8843
 	} else {
8842 8844
 		// 出库完成后,要将该批次库存清零
@@ -8965,6 +8967,7 @@ func ConsumableNewHisPrescriptionDelivery(orgID int64, patient_id int64, record_
8965 8967
 	}
8966 8968
 	CreatedDialysisPrepare(autoMatic, tx)
8967 8969
 	dialyPrepareOne.Count = deliver_number - stock_number
8970
+	ModifyGoodPakingPrice(goods.GoodId, warehouse.PackingPrice, tx)
8968 8971
 	ConsumableNewHisPrescriptionDelivery(orgID, patient_id, record_time, dialyPrepareOne, warehouseOut, creator, tx)
8969 8972
 
8970 8973
 	return nil
@@ -8981,6 +8984,18 @@ func CreatedDialysisPrepare(prepare *models.AutomaticReduceDetail, tx *gorm.DB)
8981 8984
 	return err
8982 8985
 }
8983 8986
 
8987
+func ModifyGoodPakingPrice(good_id int64, packing_price float64, tx *gorm.DB) error {
8988
+
8989
+	err = tx.Model(&models.GoodInfo{}).Where("id = ? and status=1", good_id).Updates(map[string]interface{}{"packing_price": packing_price}).Error
8990
+
8991
+	if err != nil {
8992
+		tx.Rollback()
8993
+		return err
8994
+	}
8995
+
8996
+	return err
8997
+}
8998
+
8984 8999
 func NewHisGoodCancelInfo(orgID int64, creater int64, project *models.HisPrescriptionProject, cha_count int64, good models.GoodInformationThirty, tx *gorm.DB) (err error) {
8985 9000
 
8986 9001
 	storeConfig, _ := GetNewAllStoreHouseConfig(orgID, tx)