28169 1 år sedan
förälder
incheckning
63ea329f85

+ 6 - 6
controllers/base_api_controller.go Visa fil

81
 		userAdmin.ModifyTime = 1530786071
81
 		userAdmin.ModifyTime = 1530786071
82
 		var subscibe models.ServeSubscibe
82
 		var subscibe models.ServeSubscibe
83
 		subscibe.ID = 11
83
 		subscibe.ID = 11
84
-		subscibe.OrgId = 10579 //机构id 10344
84
+		subscibe.OrgId = 10612 //机构id 10344
85
 		subscibe.PeriodStart = 1547447814
85
 		subscibe.PeriodStart = 1547447814
86
 		subscibe.PeriodEnd = 1550039814
86
 		subscibe.PeriodEnd = 1550039814
87
 		subscibe.State = 1
87
 		subscibe.State = 1
91
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
91
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
92
 		subscibes[4] = &subscibe
92
 		subscibes[4] = &subscibe
93
 		var adminUserInfo service.AdminUserInfo
93
 		var adminUserInfo service.AdminUserInfo
94
-		adminUserInfo.CurrentOrgId = 10579 //机构id小英9675或4
95
-		adminUserInfo.CurrentAppId = 16919 //4
94
+		adminUserInfo.CurrentOrgId = 10612 //机构id小英9675或4
95
+		adminUserInfo.CurrentAppId = 17282 //4
96
 		adminUserInfo.AdminUser = &userAdmin
96
 		adminUserInfo.AdminUser = &userAdmin
97
 		adminUserInfo.Subscibes = subscibes
97
 		adminUserInfo.Subscibes = subscibes
98
 		this.SetSession("admin_user_info", &adminUserInfo)
98
 		this.SetSession("admin_user_info", &adminUserInfo)
326
 		userAdmin.ModifyTime = 1530786071
326
 		userAdmin.ModifyTime = 1530786071
327
 		var subscibe models.ServeSubscibe
327
 		var subscibe models.ServeSubscibe
328
 		subscibe.ID = 11
328
 		subscibe.ID = 11
329
-		subscibe.OrgId = 10579 //机构id小英10344或4
329
+		subscibe.OrgId = 10612 //机构id小英10344或4
330
 		subscibe.PeriodStart = 1538035409
330
 		subscibe.PeriodStart = 1538035409
331
 		subscibe.PeriodEnd = 1569571409
331
 		subscibe.PeriodEnd = 1569571409
332
 		subscibe.State = 1
332
 		subscibe.State = 1
336
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
336
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
337
 		subscibes[4] = &subscibe
337
 		subscibes[4] = &subscibe
338
 		var adminUserInfo service.AdminUserInfo
338
 		var adminUserInfo service.AdminUserInfo
339
-		adminUserInfo.CurrentOrgId = 10579 //机构id小英9675或4
340
-		adminUserInfo.CurrentAppId = 16919 //4
339
+		adminUserInfo.CurrentOrgId = 10612 //机构id小英9675或4
340
+		adminUserInfo.CurrentAppId = 17282 //4
341
 		adminUserInfo.AdminUser = &userAdmin
341
 		adminUserInfo.AdminUser = &userAdmin
342
 		adminUserInfo.Subscibes = subscibes
342
 		adminUserInfo.Subscibes = subscibes
343
 		this.SetSession("admin_user_info", &adminUserInfo)
343
 		this.SetSession("admin_user_info", &adminUserInfo)

+ 6 - 0
controllers/dialysis_api_controller.go Visa fil

370
 	warsh_count := c.GetString("warsh_count")
370
 	warsh_count := c.GetString("warsh_count")
371
 	blood_access_part_id := c.GetString("blood_access_part_id")
371
 	blood_access_part_id := c.GetString("blood_access_part_id")
372
 	anticoagulant_weichi_hour := c.GetString("anticoagulant_weichi_hour")
372
 	anticoagulant_weichi_hour := c.GetString("anticoagulant_weichi_hour")
373
+	dialyzate := c.GetString("dialyzate")
373
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
374
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
374
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
375
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
375
 
376
 
492
 		WashingTime:                washing_time,
493
 		WashingTime:                washing_time,
493
 		BloodAccessPartId:          blood_access_part_id,
494
 		BloodAccessPartId:          blood_access_part_id,
494
 		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
495
 		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
496
+		Dialyzate:                  dialyzate,
495
 	}
497
 	}
496
 
498
 
497
 	//长沙南雅医院,自动生成抗凝剂的临时处方
499
 	//长沙南雅医院,自动生成抗凝剂的临时处方
1021
 	washing_time := c.GetString("washing_time")
1023
 	washing_time := c.GetString("washing_time")
1022
 	blood_access_part_id := c.GetString("blood_access_part_id")
1024
 	blood_access_part_id := c.GetString("blood_access_part_id")
1023
 	anticoagulant_weichi_hour := c.GetString("anticoagulant_weichi_hour")
1025
 	anticoagulant_weichi_hour := c.GetString("anticoagulant_weichi_hour")
1026
+	dialyzate := c.GetString("dialyzate")
1024
 	var prescription_doctor int64
1027
 	var prescription_doctor int64
1025
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
1028
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
1026
 
1029
 
1193
 		WashingTime:                washing_time,
1196
 		WashingTime:                washing_time,
1194
 		BloodAccessPartId:          blood_access_part_id,
1197
 		BloodAccessPartId:          blood_access_part_id,
1195
 		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
1198
 		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
1199
+		Dialyzate:                  dialyzate,
1196
 	}
1200
 	}
1197
 
1201
 
1198
 	if prescription.Anticoagulant == 0 {
1202
 	if prescription.Anticoagulant == 0 {
1403
 		WashingTime:                washing_time,
1407
 		WashingTime:                washing_time,
1404
 		BloodAccessPartId:          blood_access_part_id,
1408
 		BloodAccessPartId:          blood_access_part_id,
1405
 		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
1409
 		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
1410
+		Dialyzate:                  dialyzate,
1406
 	}
1411
 	}
1407
 
1412
 
1408
 	if solution.Anticoagulant == 0 {
1413
 	if solution.Anticoagulant == 0 {
2143
 	assessment.PipCoagulation = data.PipCoagulation
2148
 	assessment.PipCoagulation = data.PipCoagulation
2144
 	assessment.AccumulatedBloodVolume = data.AccumulatedBloodVolume
2149
 	assessment.AccumulatedBloodVolume = data.AccumulatedBloodVolume
2145
 	assessment.TransfusionVolume = data.TransfusionVolume
2150
 	assessment.TransfusionVolume = data.TransfusionVolume
2151
+	assessment.Condenser = data.Condenser
2146
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
2152
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
2147
 
2153
 
2148
 	if assessment.ID > 0 {
2154
 	if assessment.ID > 0 {

+ 10 - 1
controllers/dialysis_record_api_controller.go Visa fil

900
 	schedule_remark := this.GetString("schedule_remark")
900
 	schedule_remark := this.GetString("schedule_remark")
901
 	order_remark := this.GetString("order_remark")
901
 	order_remark := this.GetString("order_remark")
902
 	catheter_operation := this.GetString("catheter_operation")
902
 	catheter_operation := this.GetString("catheter_operation")
903
+	blood_flow_volume := this.GetString("blood_flow_volume")
903
 	if patientID <= 0 || len(recordDateStr) == 0 || nurseID <= 0 || bedID <= 0 {
904
 	if patientID <= 0 || len(recordDateStr) == 0 || nurseID <= 0 || bedID <= 0 {
904
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
905
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
905
 		return
906
 		return
1140
 		ScheduleRemark:         schedule_remark,
1141
 		ScheduleRemark:         schedule_remark,
1141
 		OrderRemark:            order_remark,
1142
 		OrderRemark:            order_remark,
1142
 		CatheterOperation:      catheter_operation,
1143
 		CatheterOperation:      catheter_operation,
1144
+		BloodFlowVolume:        blood_flow_volume,
1143
 	}
1145
 	}
1144
 
1146
 
1145
 	createErr := service.MobileCreateDialysisOrder(adminUserInfo.CurrentOrgId, patientID, dialysisRecord)
1147
 	createErr := service.MobileCreateDialysisOrder(adminUserInfo.CurrentOrgId, patientID, dialysisRecord)
1427
 	catheter := this.GetString("catheter")
1429
 	catheter := this.GetString("catheter")
1428
 	cruor := this.GetString("cruor")
1430
 	cruor := this.GetString("cruor")
1429
 	mission := this.GetString("mission")
1431
 	mission := this.GetString("mission")
1432
+	condenser := this.GetString("condenser")
1433
+
1430
 	if patientID <= 0 || len(recordDateStr) == 0 || nurseID <= 0 {
1434
 	if patientID <= 0 || len(recordDateStr) == 0 || nurseID <= 0 {
1431
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1435
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1432
 		return
1436
 		return
1779
 	}
1783
 	}
1780
 
1784
 
1781
 	//执行下机
1785
 	//执行下机
1782
-	updateErr := service.ModifyDialysisRecord(dialysisRecord.ID, nurseID, endDate.Unix(), adminUserInfo.AdminUser.Id, puncture_point_haematoma, internal_fistula, catheter, cruor, mission)
1786
+	updateErr := service.ModifyDialysisRecord(dialysisRecord.ID, nurseID, endDate.Unix(), adminUserInfo.AdminUser.Id, puncture_point_haematoma, internal_fistula, catheter, cruor, mission, condenser)
1783
 	finish := models.XtDialysisFinish{
1787
 	finish := models.XtDialysisFinish{
1784
 		IsFinish:   1,
1788
 		IsFinish:   1,
1785
 		UserOrgId:  adminUserInfo.CurrentOrgId,
1789
 		UserOrgId:  adminUserInfo.CurrentOrgId,
1848
 	schedule_remark := this.GetString("schedule_remark")
1852
 	schedule_remark := this.GetString("schedule_remark")
1849
 	order_remark := this.GetString("order_remark")
1853
 	order_remark := this.GetString("order_remark")
1850
 	catheter_operation := this.GetString("catheter_operation")
1854
 	catheter_operation := this.GetString("catheter_operation")
1855
+	blood_flow_volume := this.GetString("blood_flow_volume")
1856
+
1851
 	if record_id == 0 {
1857
 	if record_id == 0 {
1852
 		this.ErrorLog("id:%v", record_id)
1858
 		this.ErrorLog("id:%v", record_id)
1853
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1859
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2014
 		ScheduleRemark:         schedule_remark,
2020
 		ScheduleRemark:         schedule_remark,
2015
 		OrderRemark:            order_remark,
2021
 		OrderRemark:            order_remark,
2016
 		CatheterOperation:      catheter_operation,
2022
 		CatheterOperation:      catheter_operation,
2023
+		BloodFlowVolume:        blood_flow_volume,
2017
 	}
2024
 	}
2018
 
2025
 
2019
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
2026
 	infor, _ := service.GetDialysisInformationSetting(adminUserInfo.CurrentOrgId)
2121
 	catheter := c.GetString("catheter")
2128
 	catheter := c.GetString("catheter")
2122
 	cruor := c.GetString("cruor")
2129
 	cruor := c.GetString("cruor")
2123
 	mission := c.GetString("mission")
2130
 	mission := c.GetString("mission")
2131
+	condenser := c.GetString("condenser")
2124
 	if record_id <= 0 || nurseID <= 0 {
2132
 	if record_id <= 0 || nurseID <= 0 {
2125
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2133
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2126
 		return
2134
 		return
2168
 		Catheter:                   catheter,
2176
 		Catheter:                   catheter,
2169
 		Cruor:                      cruor,
2177
 		Cruor:                      cruor,
2170
 		Mission:                    mission,
2178
 		Mission:                    mission,
2179
+		Condenser:                  condenser,
2171
 	}
2180
 	}
2172
 
2181
 
2173
 	updateErr := service.ModifyFinishDialysisOrder(dialysisRecord)
2182
 	updateErr := service.ModifyFinishDialysisOrder(dialysisRecord)

+ 2 - 47
controllers/his_api_controller.go Visa fil

1845
 								//查询该药品是否存在开药记录
1845
 								//查询该药品是否存在开药记录
1846
 								advicelist, _ := service.GetHisAdviceListByDrugIdEight(drug_id, patient_id, recordDateTime, adviceId)
1846
 								advicelist, _ := service.GetHisAdviceListByDrugIdEight(drug_id, patient_id, recordDateTime, adviceId)
1847
 
1847
 
1848
-								fmt.Println("wooooooooooooo", advicelist.ID)
1849
-								fmt.Println("prescribingNumberUnit", prescribingNumberUnit)
1850
-								fmt.Println("prescribingNumberUnit", drug.MinUnit)
1851
-								fmt.Println("prescribingNumberUnit", drug.MaxUnit)
1852
 								//新增处方
1848
 								//新增处方
1853
 								if advicelist.ID == 0 {
1849
 								if advicelist.ID == 0 {
1854
 									all_count, _ := strconv.ParseFloat(totals, 64)
1850
 									all_count, _ := strconv.ParseFloat(totals, 64)
1855
 									if prescribingNumberUnit == drug.MinUnit {
1851
 									if prescribingNumberUnit == drug.MinUnit {
1856
-										fmt.Println("prescribing_number", prescribing_number)
1857
-										fmt.Println("all_count", all_count)
1852
+
1858
 										if drug.IsUse != 1 {
1853
 										if drug.IsUse != 1 {
1859
 											if drug.IsProject == 0 || drug.IsProject == 2 {
1854
 											if drug.IsProject == 0 || drug.IsProject == 2 {
1860
 												if all_count == 0 {
1855
 												if all_count == 0 {
2312
 															var sum_in_count int64
2307
 															var sum_in_count int64
2313
 															warehouseInfo, _ := service.FindLastDrugWarehousingInfoByID(drug_id, storeConfig.DrugStorehouseOut)
2308
 															warehouseInfo, _ := service.FindLastDrugWarehousingInfoByID(drug_id, storeConfig.DrugStorehouseOut)
2314
 															sum_in_count = warehouseInfo.StockMaxNumber*drug.MinNumber + warehouseInfo.StockMinNumber
2309
 															sum_in_count = warehouseInfo.StockMaxNumber*drug.MinNumber + warehouseInfo.StockMinNumber
2315
-															fmt.Println("sum_in_count", sum_in_count)
2310
+
2316
 															//如果修改的数量大于有库存的第一个批次
2311
 															//如果修改的数量大于有库存的第一个批次
2317
 															if number_count > sum_in_count {
2312
 															if number_count > sum_in_count {
2318
 																c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(warehouseInfo.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(warehouseInfo.StockMinNumber, 10) + drug.MinUnit)
2313
 																c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(warehouseInfo.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(warehouseInfo.StockMinNumber, 10) + drug.MinUnit)
10798
 	case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
10793
 	case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
10799
 	patientPrescriptionInfo, _ := service.FindPatientPrescriptionInfo(admin.CurrentOrgId, patient_id, recordDateTime, p_type, his_patient_id)
10794
 	patientPrescriptionInfo, _ := service.FindPatientPrescriptionInfo(admin.CurrentOrgId, patient_id, recordDateTime, p_type, his_patient_id)
10800
 
10795
 
10801
-	month_p_info, _ := service.FindPatientPrescriptionInfoTen(admin.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime, p_type)
10802
-
10803
 	lastPatientPrescriptionInfo, _ := service.FindLastPatientPrescriptionInfoTwo(admin.CurrentOrgId, patient_id, recordDateTime, p_type)
10796
 	lastPatientPrescriptionInfo, _ := service.FindLastPatientPrescriptionInfoTwo(admin.CurrentOrgId, patient_id, recordDateTime, p_type)
10804
 
10797
 
10805
 	doctors, _ := service.GetHisAdminUserDoctors(admin.CurrentOrgId)
10798
 	doctors, _ := service.GetHisAdminUserDoctors(admin.CurrentOrgId)
10806
 	//获取所有科室信息
10799
 	//获取所有科室信息
10807
 	department, _ := service.GetAllDepartMent(admin.CurrentOrgId)
10800
 	department, _ := service.GetAllDepartMent(admin.CurrentOrgId)
10808
 
10801
 
10809
-	var dia string
10810
-	for _, item := range month_p_info {
10811
-		if len(dia) == 0 {
10812
-			dia = item.Diagnosis
10813
-		} else {
10814
-			dia = dia + "," + item.Diagnosis
10815
-		}
10816
-	}
10817
-
10818
-	dia_arr := removeDuplicates(strings.Split(dia, ","))
10819
-	dia_arr = removeEmptyStrings(dia_arr)
10820
 	c.ServeSuccessJSON(map[string]interface{}{
10802
 	c.ServeSuccessJSON(map[string]interface{}{
10821
 		"his_info":            his_patient_info,
10803
 		"his_info":            his_patient_info,
10822
 		"xt_info":             xt_patient_info,
10804
 		"xt_info":             xt_patient_info,
10828
 		"doctors":             doctors,
10810
 		"doctors":             doctors,
10829
 		"department":          department,
10811
 		"department":          department,
10830
 		"settle_total":        settle_total,
10812
 		"settle_total":        settle_total,
10831
-		"dia_arr":             dia_arr,
10832
 	})
10813
 	})
10833
 	return
10814
 	return
10834
 }
10815
 }
10835
 
10816
 
10836
-func removeEmptyStrings(input []string) []string {
10837
-	var output []string
10838
-
10839
-	for _, s := range input {
10840
-		if s != "" {
10841
-			output = append(output, s)
10842
-		}
10843
-	}
10844
-
10845
-	return output
10846
-}
10847
-
10848
-func removeDuplicates(input []string) []string {
10849
-	seen := make(map[string]bool)
10850
-	output := []string{}
10851
-
10852
-	for _, s := range input {
10853
-		if _, exists := seen[s]; !exists {
10854
-			seen[s] = true
10855
-			output = append(output, s)
10856
-		}
10857
-	}
10858
-
10859
-	return output
10860
-}
10861
-
10862
 func (c *HisApiController) GetHisMonthPatientInfo() {
10817
 func (c *HisApiController) GetHisMonthPatientInfo() {
10863
 	patient_id, _ := c.GetInt64("patient_id")
10818
 	patient_id, _ := c.GetInt64("patient_id")
10864
 	his_patient_id, _ := c.GetInt64("his_patient_id")
10819
 	his_patient_id, _ := c.GetInt64("his_patient_id")

+ 14 - 4
controllers/mobile_api_controllers/dialysis_api_controller.go Visa fil

1816
 	warsh_count := c.GetString("warsh_count")
1816
 	warsh_count := c.GetString("warsh_count")
1817
 	blood_access_part_id := c.GetString("blood_access_part_id")
1817
 	blood_access_part_id := c.GetString("blood_access_part_id")
1818
 	anticoagulant_weichi_hour := c.GetString("anticoagulant_weichi_hour")
1818
 	anticoagulant_weichi_hour := c.GetString("anticoagulant_weichi_hour")
1819
-
1819
+	dialyzate := c.GetString("dialyzate")
1820
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1820
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1821
 
1821
 
1822
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
1822
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
1981
 		WarshCount:                 warsh_count,
1981
 		WarshCount:                 warsh_count,
1982
 		BloodAccessPartId:          blood_access_part_id,
1982
 		BloodAccessPartId:          blood_access_part_id,
1983
 		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
1983
 		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
1984
+		Dialyzate:                  dialyzate,
1984
 	}
1985
 	}
1985
 
1986
 
1986
 	//查询最近透析准备表里是否存在 透析器 灌流器
1987
 	//查询最近透析准备表里是否存在 透析器 灌流器
2421
 	catheter := c.GetString("catheter")
2422
 	catheter := c.GetString("catheter")
2422
 	cruor := c.GetString("cruor")
2423
 	cruor := c.GetString("cruor")
2423
 	mission := c.GetString("mission")
2424
 	mission := c.GetString("mission")
2425
+	condenser := c.GetString("condenser")
2424
 	if id <= 0 || nurseID <= 0 {
2426
 	if id <= 0 || nurseID <= 0 {
2425
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2427
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2426
 		return
2428
 		return
2830
 	}
2832
 	}
2831
 
2833
 
2832
 	if dialysisOrder.Stage == 1 {
2834
 	if dialysisOrder.Stage == 1 {
2833
-		err := service.ModifyDialysisRecord(dialysisOrder.ID, nurseID, endDate.Unix(), adminUserInfo.AdminUser.Id, puncture_point_haematoma, internal_fistula, catheter, cruor, mission)
2835
+		err := service.ModifyDialysisRecord(dialysisOrder.ID, nurseID, endDate.Unix(), adminUserInfo.AdminUser.Id, puncture_point_haematoma, internal_fistula, catheter, cruor, mission, condenser)
2834
 		finish := models.XtDialysisFinish{
2836
 		finish := models.XtDialysisFinish{
2835
 			IsFinish:   1,
2837
 			IsFinish:   1,
2836
 			UserOrgId:  adminUserInfo.Org.Id,
2838
 			UserOrgId:  adminUserInfo.Org.Id,
2860
 
2862
 
2861
 		//下机完自动消毒,针对长沙南雅
2863
 		//下机完自动消毒,针对长沙南雅
2862
 		if dialysisOrder.Stage == 1 {
2864
 		if dialysisOrder.Stage == 1 {
2863
-			if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9538 || adminUserInfo.Org.Id == 10121 {
2865
+			if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9538 || adminUserInfo.Org.Id == 10121 || adminUserInfo.Org.Id == 10612 {
2864
 				//根据床位号获取设备型号
2866
 				//根据床位号获取设备型号
2865
 				unitType, _ := service.GetUnitType(dialysisOrder.BedID, dialysisOrder.UserOrgId)
2867
 				unitType, _ := service.GetUnitType(dialysisOrder.BedID, dialysisOrder.UserOrgId)
2866
 				//查询使用消毒最后一条消毒记录
2868
 				//查询使用消毒最后一条消毒记录
3059
 	schedule_remark := this.GetString("schedule_remark")
3061
 	schedule_remark := this.GetString("schedule_remark")
3060
 	order_remark := this.GetString("order_remark")
3062
 	order_remark := this.GetString("order_remark")
3061
 	catheter_operation := this.GetString("catheter_operation")
3063
 	catheter_operation := this.GetString("catheter_operation")
3062
-
3064
+	blood_flow_volume := this.GetString("blood_flow_volume")
3063
 	if patientID <= 0 || len(recordDateStr) == 0 || nurseID <= 0 || bedID <= 0 {
3065
 	if patientID <= 0 || len(recordDateStr) == 0 || nurseID <= 0 || bedID <= 0 {
3064
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
3066
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
3065
 		return
3067
 		return
3279
 		ScheduleRemark:         schedule_remark,
3281
 		ScheduleRemark:         schedule_remark,
3280
 		OrderRemark:            order_remark,
3282
 		OrderRemark:            order_remark,
3281
 		CatheterOperation:      catheter_operation,
3283
 		CatheterOperation:      catheter_operation,
3284
+		BloodFlowVolume:        blood_flow_volume,
3282
 	}
3285
 	}
3283
 	//查询该床位是否有人用了
3286
 	//查询该床位是否有人用了
3284
 	_, errorscode := service.GetDialysisOrderByBedId(adminUserInfo.Org.Id, schedulestartTime, bedID, schedual_type)
3287
 	_, errorscode := service.GetDialysisOrderByBedId(adminUserInfo.Org.Id, schedulestartTime, bedID, schedual_type)
3713
 	warsh_count := c.GetString("warsh_count")
3716
 	warsh_count := c.GetString("warsh_count")
3714
 	blood_access_part_id := c.GetString("blood_access_part_id")
3717
 	blood_access_part_id := c.GetString("blood_access_part_id")
3715
 	anticoagulant_weichi_hour := c.GetString("anticoagulant_weichi_hour")
3718
 	anticoagulant_weichi_hour := c.GetString("anticoagulant_weichi_hour")
3719
+	dialyzate := c.GetString("dialyzate")
3716
 	if mode_id > 0 {
3720
 	if mode_id > 0 {
3717
 
3721
 
3718
 		var str string
3722
 		var str string
3875
 		WarshCount:                 warsh_count,
3879
 		WarshCount:                 warsh_count,
3876
 		BloodAccessPartId:          blood_access_part_id,
3880
 		BloodAccessPartId:          blood_access_part_id,
3877
 		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
3881
 		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
3882
+		Dialyzate:                  dialyzate,
3878
 	}
3883
 	}
3879
 
3884
 
3880
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
3885
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
4003
 		WarshCount:                 warsh_count,
4008
 		WarshCount:                 warsh_count,
4004
 		BloodAccessPartId:          blood_access_part_id,
4009
 		BloodAccessPartId:          blood_access_part_id,
4005
 		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
4010
 		AnticoagulantWeichiHour:    anticoagulant_weichi_hour,
4011
+		Dialyzate:                  dialyzate,
4006
 	}
4012
 	}
4007
 
4013
 
4008
 	//针对河间咸的
4014
 	//针对河间咸的
4557
 	order_remark := this.GetString("order_remark")
4563
 	order_remark := this.GetString("order_remark")
4558
 	schedule_remark := this.GetString("schedule_remark")
4564
 	schedule_remark := this.GetString("schedule_remark")
4559
 	catheter_operation := this.GetString("catheter_operation")
4565
 	catheter_operation := this.GetString("catheter_operation")
4566
+	blood_flow_volume := this.GetString("blood_flow_volume")
4560
 	if record_id == 0 {
4567
 	if record_id == 0 {
4561
 		this.ErrorLog("id:%v", record_id)
4568
 		this.ErrorLog("id:%v", record_id)
4562
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4569
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4722
 		OrderRemark:            order_remark,
4729
 		OrderRemark:            order_remark,
4723
 		ScheduleRemark:         schedule_remark,
4730
 		ScheduleRemark:         schedule_remark,
4724
 		CatheterOperation:      catheter_operation,
4731
 		CatheterOperation:      catheter_operation,
4732
+		BloodFlowVolume:        blood_flow_volume,
4725
 	}
4733
 	}
4726
 
4734
 
4727
 	//修改床位号需要重新消毒
4735
 	//修改床位号需要重新消毒
4846
 	catheter := c.GetString("catheter")
4854
 	catheter := c.GetString("catheter")
4847
 	cruor := c.GetString("cruor")
4855
 	cruor := c.GetString("cruor")
4848
 	mission := c.GetString("mission")
4856
 	mission := c.GetString("mission")
4857
+	condenser := c.GetString("condenser")
4849
 	if record_id <= 0 || nurseID <= 0 {
4858
 	if record_id <= 0 || nurseID <= 0 {
4850
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4859
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4851
 		return
4860
 		return
4917
 		Catheter:                   catheter,
4926
 		Catheter:                   catheter,
4918
 		Cruor:                      cruor,
4927
 		Cruor:                      cruor,
4919
 		Mission:                    mission,
4928
 		Mission:                    mission,
4929
+		Condenser:                  condenser,
4920
 	}
4930
 	}
4921
 
4931
 
4922
 	updateErr := service.ModifyFinishDialysisOrder(dialysisRecord)
4932
 	updateErr := service.ModifyFinishDialysisOrder(dialysisRecord)

+ 1 - 1
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go Visa fil

510
 		service.CreateScheduleLog(xtScheduleLog)
510
 		service.CreateScheduleLog(xtScheduleLog)
511
 
511
 
512
 		//针对凤凰医院
512
 		//针对凤凰医院
513
-		if org_id == 10579 || org_id == 10344 {
513
+		if org_id == 10579 || org_id == 10344 || org_id == 10206 {
514
 			advice, _ := service.GetDoctorAdviceListTwenty(schedule.PatientId, schedule.ScheduleDate, org_id)
514
 			advice, _ := service.GetDoctorAdviceListTwenty(schedule.PatientId, schedule.ScheduleDate, org_id)
515
 			if len(advice) > 0 {
515
 			if len(advice) > 0 {
516
 				service.UpdateAdviceObj(schedule.PatientId, schedule.ScheduleDate, org_id)
516
 				service.UpdateAdviceObj(schedule.PatientId, schedule.ScheduleDate, org_id)

+ 2 - 2
controllers/pharmacy_controller.go Visa fil

417
 		}
417
 		}
418
 	}
418
 	}
419
 
419
 
420
-	if orgid != 10480 {
420
+	if orgid != 10480 && orgid != 10188 {
421
 		//发药
421
 		//发药
422
 		err = service.DispensingMedicine(orgid, patient_id, stime, etime, creater)
422
 		err = service.DispensingMedicine(orgid, patient_id, stime, etime, creater)
423
 		if err != nil {
423
 		if err != nil {
432
 		return
432
 		return
433
 	}
433
 	}
434
 
434
 
435
-	if orgid == 10480 {
435
+	if orgid == 10480 || orgid == 10188 {
436
 		//发药逻辑
436
 		//发药逻辑
437
 
437
 
438
 		service.DispensingMedicineOne(orgid, patient_id, stime, etime, creater)
438
 		service.DispensingMedicineOne(orgid, patient_id, stime, etime, creater)

+ 1 - 1
controllers/schedule_api_controller.go Visa fil

1969
 	service.CreateScheduleLog(scheduleLog)
1969
 	service.CreateScheduleLog(scheduleLog)
1970
 
1970
 
1971
 	//针对凤凰医院
1971
 	//针对凤凰医院
1972
-	if adminINfo.CurrentOrgId == 10579 || adminINfo.CurrentOrgId == 10344 {
1972
+	if adminINfo.CurrentOrgId == 10579 || adminINfo.CurrentOrgId == 10344 || adminINfo.CurrentOrgId == 10206 {
1973
 		advice, _ := service.GetDoctorAdviceListTwenty(schedule.PatientId, schedule.ScheduleDate, adminINfo.CurrentOrgId)
1973
 		advice, _ := service.GetDoctorAdviceListTwenty(schedule.PatientId, schedule.ScheduleDate, adminINfo.CurrentOrgId)
1974
 		if len(advice) > 0 {
1974
 		if len(advice) > 0 {
1975
 			service.UpdateAdviceObj(schedule.PatientId, schedule.ScheduleDate, adminINfo.CurrentOrgId)
1975
 			service.UpdateAdviceObj(schedule.PatientId, schedule.ScheduleDate, adminINfo.CurrentOrgId)

+ 1 - 1
controllers/self_drug_api_congtroller.go Visa fil

3917
 
3917
 
3918
 		//获取期末结余
3918
 		//获取期末结余
3919
 		endFlow, _ := service.GetDrugEndFlow(item.ID, orgId, endTime)
3919
 		endFlow, _ := service.GetDrugEndFlow(item.ID, orgId, endTime)
3920
-		fmt.Println("endFlow2222222222222222", endFlow)
3920
+
3921
 		item.DrugEndFlow = endFlow
3921
 		item.DrugEndFlow = endFlow
3922
 		//获取期初结余入库数量
3922
 		//获取期初结余入库数量
3923
 		//startDrugInfo, _ := service.GetDrugWarehouseInfoStart(item.ID, orgId, startTime)
3923
 		//startDrugInfo, _ := service.GetDrugWarehouseInfoStart(item.ID, orgId, startTime)

+ 2 - 2
controllers/sign_api_controller.go Visa fil

665
 
665
 
666
 func (this *SignApiController) UploadPrintOrder() {
666
 func (this *SignApiController) UploadPrintOrder() {
667
 
667
 
668
-	list, _ := service.GetAllPatientNew(10587)
668
+	list, _ := service.GetAllPatientNew(10579)
669
 	for _, item := range list {
669
 	for _, item := range list {
670
 
670
 
671
 		hans := item.Name // 要转换的汉字字符串
671
 		hans := item.Name // 要转换的汉字字符串
692
 		//fmt.Println("First Letter:", firstLetter)
692
 		//fmt.Println("First Letter:", firstLetter)
693
 	}
693
 	}
694
 
694
 
695
-	//baseList, _ := service.GeteAllBaseList(10567)
695
+	//baseList, _ := service.GeteAllBaseList(10587)
696
 	//for _, item := range baseList {
696
 	//for _, item := range baseList {
697
 	//	hans := item.DrugName // 要转换的汉字字符串
697
 	//	hans := item.DrugName // 要转换的汉字字符串
698
 	//	// 创建一个拼音转换器
698
 	//	// 创建一个拼音转换器

+ 5 - 17
controllers/stock_in_api_controller.go Visa fil

7962
 	good_id, _ := this.GetInt64("good_id")
7962
 	good_id, _ := this.GetInt64("good_id")
7963
 	orgId := this.GetAdminUserInfo().CurrentOrgId
7963
 	orgId := this.GetAdminUserInfo().CurrentOrgId
7964
 	list, _ := service.GetStockFlowOrderList(good_id, orgId)
7964
 	list, _ := service.GetStockFlowOrderList(good_id, orgId)
7965
-	fmt.Println("listowowowow", list)
7966
 	for index, _ := range list {
7965
 	for index, _ := range list {
7967
-		fmt.Println("index", index)
7968
 		if list[index].ConsumableType == 3 || list[index].ConsumableType == 2 || list[index].ConsumableType == 11 || list[index].ConsumableType == 12 || list[index].ConsumableType == 15 {
7966
 		if list[index].ConsumableType == 3 || list[index].ConsumableType == 2 || list[index].ConsumableType == 11 || list[index].ConsumableType == 12 || list[index].ConsumableType == 15 {
7969
 			var count int64
7967
 			var count int64
7968
+
7970
 			if index == 0 {
7969
 			if index == 0 {
7971
 				count = list[index].OverCount - list[index].Count
7970
 				count = list[index].OverCount - list[index].Count
7972
-				fmt.Println("id", list[index].ID)
7973
-				fmt.Println("woowowow", list[index].OverCount)
7974
-				fmt.Println("wowoowowowoww", list[index].Count)
7975
 				service.UpdateOverCount(list[index+1].ID, count)
7971
 				service.UpdateOverCount(list[index+1].ID, count)
7976
 			}
7972
 			}
7977
 
7973
 
7978
 			if index >= 1 {
7974
 			if index >= 1 {
7979
-				count = list[index-1].OverCount - list[index].Count
7980
-				fmt.Println("id", list[index].ID)
7981
-				fmt.Println("over_count", list[index-1].OverCount)
7982
-				fmt.Println("wowoowowowoww", list[index].Count)
7975
+				lastStockFlow, _ := service.GetLastOverCount(list[index-1].ID)
7976
+				count = lastStockFlow.OverCount - list[index].Count
7983
 				service.UpdateOverCount(list[index].ID, count)
7977
 				service.UpdateOverCount(list[index].ID, count)
7984
 			}
7978
 			}
7985
 
7979
 
7986
 		}
7980
 		}
7987
 		if list[index].ConsumableType == 7 || list[index].ConsumableType == 4 || list[index].ConsumableType == 1 || list[index].ConsumableType == 10 || list[index].ConsumableType == 13 {
7981
 		if list[index].ConsumableType == 7 || list[index].ConsumableType == 4 || list[index].ConsumableType == 1 || list[index].ConsumableType == 10 || list[index].ConsumableType == 13 {
7988
-
7989
 			if index == 0 {
7982
 			if index == 0 {
7990
 				var count int64
7983
 				var count int64
7991
 				count = list[index].OverCount + list[index].Count
7984
 				count = list[index].OverCount + list[index].Count
7992
-				fmt.Println("id=", list[index].ID)
7993
-				fmt.Println("over_count", list[index].OverCount)
7994
-				fmt.Println("count", list[index].Count)
7995
 				service.UpdateOverCount(list[index+1].ID, count)
7985
 				service.UpdateOverCount(list[index+1].ID, count)
7996
 			}
7986
 			}
7997
 
7987
 
7998
 			if index >= 1 {
7988
 			if index >= 1 {
7999
 				var count int64
7989
 				var count int64
8000
-				count = list[index-1].OverCount + list[index].Count
8001
-				fmt.Println("id=", list[index].ID)
8002
-				fmt.Println("over_count", list[index-1].OverCount)
8003
-				fmt.Println("count", list[index].Count)
7990
+				lastStockFlow, _ := service.GetLastOverCount(list[index-1].ID)
7991
+				count = lastStockFlow.OverCount + list[index].Count
8004
 				service.UpdateOverCount(list[index].ID, count)
7992
 				service.UpdateOverCount(list[index].ID, count)
8005
 			}
7993
 			}
8006
 
7994
 

+ 3 - 0
models/dialysis.go Visa fil

656
 	PipCoagulation                  string  `gorm:"column:pip_coagulation" json:"pip_coagulation" form:"pip_coagulation"`
656
 	PipCoagulation                  string  `gorm:"column:pip_coagulation" json:"pip_coagulation" form:"pip_coagulation"`
657
 	AccumulatedBloodVolume          string  `gorm:"column:accumulated_blood_volume" json:"accumulated_blood_volume" form:"accumulated_blood_volume"`
657
 	AccumulatedBloodVolume          string  `gorm:"column:accumulated_blood_volume" json:"accumulated_blood_volume" form:"accumulated_blood_volume"`
658
 	TransfusionVolume               string  `gorm:"column:transfusion_volume" json:"transfusion_volume" form:"transfusion_volume"`
658
 	TransfusionVolume               string  `gorm:"column:transfusion_volume" json:"transfusion_volume" form:"transfusion_volume"`
659
+	Condenser                       string  `gorm:"column:condenser" json:"condenser" form:"condenser"`
659
 }
660
 }
660
 
661
 
661
 func (AssessmentAfterDislysis) TableName() string {
662
 func (AssessmentAfterDislysis) TableName() string {
865
 	OrderRemark                string        `gorm:"column:order_remark" json:"order_remark" form:"order_remark"`
866
 	OrderRemark                string        `gorm:"column:order_remark" json:"order_remark" form:"order_remark"`
866
 	DialysisTotal              int64         `gorm:"column:dialysis_total" json:"dialysis_total" form:"dialysis_total"`
867
 	DialysisTotal              int64         `gorm:"column:dialysis_total" json:"dialysis_total" form:"dialysis_total"`
867
 	CatheterOperation          string        `gorm:"column:catheter_operation" json:"catheter_operation" form:"catheter_operation"`
868
 	CatheterOperation          string        `gorm:"column:catheter_operation" json:"catheter_operation" form:"catheter_operation"`
869
+	BloodFlowVolume            string        `gorm:"column:blood_flow_volume" json:"blood_flow_volume" form:"blood_flow_volume"`
870
+	Condenser                  string        `gorm:"column:condenser" json:"condenser" form:"condenser"`
868
 }
871
 }
869
 
872
 
870
 func (DialysisOrder) TableName() string {
873
 func (DialysisOrder) TableName() string {

+ 2 - 0
models/patient_models.go Visa fil

381
 	WashingTime                string        `gorm:"column:washing_time" json:"washing_time" form:"washing_time"`
381
 	WashingTime                string        `gorm:"column:washing_time" json:"washing_time" form:"washing_time"`
382
 	BloodAccessPartId          string        `gorm:"column:blood_access_part_id" json:"blood_access_part_id" form:"blood_access_part_id"`
382
 	BloodAccessPartId          string        `gorm:"column:blood_access_part_id" json:"blood_access_part_id" form:"blood_access_part_id"`
383
 	AnticoagulantWeichiHour    string        `gorm:"column:anticoagulant_weichi_hour" json:"anticoagulant_weichi_hour" form:"anticoagulant_weichi_hour"`
383
 	AnticoagulantWeichiHour    string        `gorm:"column:anticoagulant_weichi_hour" json:"anticoagulant_weichi_hour" form:"anticoagulant_weichi_hour"`
384
+	Dialyzate                  string        `gorm:"column:dialyzate" json:"dialyzate" form:"dialyzate"`
384
 }
385
 }
385
 
386
 
386
 func (DialysisPrescription) TableName() string {
387
 func (DialysisPrescription) TableName() string {
620
 	WashingTime                string  `gorm:"column:washing_time" json:"washing_time" form:"washing_time"`
621
 	WashingTime                string  `gorm:"column:washing_time" json:"washing_time" form:"washing_time"`
621
 	BloodAccessPartId          string  `gorm:"column:blood_access_part_id" json:"blood_access_part_id" form:"blood_access_part_id"`
622
 	BloodAccessPartId          string  `gorm:"column:blood_access_part_id" json:"blood_access_part_id" form:"blood_access_part_id"`
622
 	AnticoagulantWeichiHour    string  `gorm:"column:anticoagulant_weichi_hour" json:"anticoagulant_weichi_hour" form:"anticoagulant_weichi_hour"`
623
 	AnticoagulantWeichiHour    string  `gorm:"column:anticoagulant_weichi_hour" json:"anticoagulant_weichi_hour" form:"anticoagulant_weichi_hour"`
624
+	Dialyzate                  string  `gorm:"column:dialyzate" json:"dialyzate" form:"dialyzate"`
623
 }
625
 }
624
 
626
 
625
 func (DialysisSolution) TableName() string {
627
 func (DialysisSolution) TableName() string {

+ 2 - 2
service/dialysis_service.go Visa fil

559
 	return nil
559
 	return nil
560
 }
560
 }
561
 
561
 
562
-func ModifyDialysisRecord(id int64, finishNurse int64, end_time int64, admin_user_id int64, puncture_point_haematoma int64, internal_fistula string, catheter string, cruor string, mission string) error {
563
-	err := writeDb.Model(&models.DialysisOrder{}).Where("id = ? AND status = 1 ", id).Updates(map[string]interface{}{"updated_time": time.Now().Unix(), "stage": 2, "finish_nurse": finishNurse, "end_time": end_time, "finish_creator": admin_user_id, "finish_modifier": admin_user_id, "puncture_point_haematoma": puncture_point_haematoma, "blood_access_internal_fistula": internal_fistula, "catheter": catheter, "cruor": cruor, "mission": mission}).Error
562
+func ModifyDialysisRecord(id int64, finishNurse int64, end_time int64, admin_user_id int64, puncture_point_haematoma int64, internal_fistula string, catheter string, cruor string, mission string, condenser string) error {
563
+	err := writeDb.Model(&models.DialysisOrder{}).Where("id = ? AND status = 1 ", id).Updates(map[string]interface{}{"updated_time": time.Now().Unix(), "stage": 2, "finish_nurse": finishNurse, "end_time": end_time, "finish_creator": admin_user_id, "finish_modifier": admin_user_id, "puncture_point_haematoma": puncture_point_haematoma, "blood_access_internal_fistula": internal_fistula, "catheter": catheter, "cruor": cruor, "mission": mission, "condenser": condenser}).Error
564
 	return err
564
 	return err
565
 
565
 
566
 }
566
 }

+ 2 - 2
service/mobile_dialysis_service.go Visa fil

2241
 func ModifyStartDialysisOrder(order *models.DialysisOrder) error {
2241
 func ModifyStartDialysisOrder(order *models.DialysisOrder) error {
2242
 	tx := writeDb.Begin()
2242
 	tx := writeDb.Begin()
2243
 	updateTime := time.Now().Unix()
2243
 	updateTime := time.Now().Unix()
2244
-	err := tx.Model(&models.DialysisOrder{}).Where("user_org_id = ? AND id = ? AND status = 1 ", order.UserOrgId, order.ID).Updates(map[string]interface{}{"start_nurse": order.StartNurse, "updated_time": updateTime, "bed_id": order.BedID, "puncture_nurse": order.PunctureNurse, "start_time": order.StartTime, "modifier": order.Modifier, "schedual_type": order.SchedualType, "washpipe_nurse": order.WashpipeNurse, "change_nurse": order.ChangeNurse, "difficult_puncture_nurse": order.DifficultPunctureNurse, "new_fistula_nurse": order.NewFistulaNurse, "quality_nurse_id": order.QualityNurseId, "puncture_needle": order.PunctureNeedle, "puncture_way": order.PunctureWay, "dialysis_dialyszers": order.DialysisDialyszers, "dialysis_irrigation": order.DialysisIrrigation, "blood_access_id": order.BloodAccessId, "nuclein_date": order.NucleinDate, "schedule_remark": order.ScheduleRemark, "order_remark": order.OrderRemark, "catheter_operation": order.CatheterOperation}).Error
2244
+	err := tx.Model(&models.DialysisOrder{}).Where("user_org_id = ? AND id = ? AND status = 1 ", order.UserOrgId, order.ID).Updates(map[string]interface{}{"start_nurse": order.StartNurse, "updated_time": updateTime, "bed_id": order.BedID, "puncture_nurse": order.PunctureNurse, "start_time": order.StartTime, "modifier": order.Modifier, "schedual_type": order.SchedualType, "washpipe_nurse": order.WashpipeNurse, "change_nurse": order.ChangeNurse, "difficult_puncture_nurse": order.DifficultPunctureNurse, "new_fistula_nurse": order.NewFistulaNurse, "quality_nurse_id": order.QualityNurseId, "puncture_needle": order.PunctureNeedle, "puncture_way": order.PunctureWay, "dialysis_dialyszers": order.DialysisDialyszers, "dialysis_irrigation": order.DialysisIrrigation, "blood_access_id": order.BloodAccessId, "nuclein_date": order.NucleinDate, "schedule_remark": order.ScheduleRemark, "order_remark": order.OrderRemark, "catheter_operation": order.CatheterOperation, "blood_flow_volume": order.BloodFlowVolume}).Error
2245
 	if err != nil {
2245
 	if err != nil {
2246
 		tx.Rollback()
2246
 		tx.Rollback()
2247
 		return err
2247
 		return err
2253
 func ModifyFinishDialysisOrder(order *models.DialysisOrder) error {
2253
 func ModifyFinishDialysisOrder(order *models.DialysisOrder) error {
2254
 	tx := writeDb.Begin()
2254
 	tx := writeDb.Begin()
2255
 	updateTime := time.Now().Unix()
2255
 	updateTime := time.Now().Unix()
2256
-	err := tx.Model(&models.DialysisOrder{}).Where("user_org_id = ? AND id = ? AND status = 1 ", order.UserOrgId, order.ID).Updates(map[string]interface{}{"finish_nurse": order.FinishNurse, "updated_time": updateTime, "end_time": order.EndTime, "finish_modifier": order.FinishModifier, "puncture_point_haematoma": order.PuncturePointHaematoma, "blood_access_internal_fistula": order.BloodAccessInternalFistula, "catheter": order.Catheter, "cruor": order.Cruor, "mission": order.Mission}).Error
2256
+	err := tx.Model(&models.DialysisOrder{}).Where("user_org_id = ? AND id = ? AND status = 1 ", order.UserOrgId, order.ID).Updates(map[string]interface{}{"finish_nurse": order.FinishNurse, "updated_time": updateTime, "end_time": order.EndTime, "finish_modifier": order.FinishModifier, "puncture_point_haematoma": order.PuncturePointHaematoma, "blood_access_internal_fistula": order.BloodAccessInternalFistula, "catheter": order.Catheter, "cruor": order.Cruor, "mission": order.Mission, "condenser": order.Condenser}).Error
2257
 	if err != nil {
2257
 	if err != nil {
2258
 		tx.Rollback()
2258
 		tx.Rollback()
2259
 		return err
2259
 		return err

+ 36 - 13
service/new_warehouse_service.go Visa fil

1287
 // 药品自动出库 递归方式
1287
 // 药品自动出库 递归方式
1288
 func BloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *models.DrugWarehouseOut, drup *models.BaseDrugLib, advice *models.HisDoctorAdviceInfo, hisprescribingNumber float64, unit string) (err error) {
1288
 func BloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *models.DrugWarehouseOut, drup *models.BaseDrugLib, advice *models.HisDoctorAdviceInfo, hisprescribingNumber float64, unit string) (err error) {
1289
 
1289
 
1290
+	fmt.Println("出库拉22222222222222222222222222222222222222222222222222222222222222222222")
1291
+	fmt.Println("剩余库存2哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦噢噢噢噢", prescribingNumber)
1292
+	//开事务
1293
+	tx := XTWriteDB().Begin()
1294
+	defer func() {
1295
+		if err != nil {
1296
+			utils.ErrorLog("事务失败,原因为: %v", err)
1297
+			tx.Rollback()
1298
+		} else {
1299
+			tx.Commit()
1300
+		}
1301
+	}()
1290
 	drugError := models.XtDrugError{
1302
 	drugError := models.XtDrugError{
1291
 		UserOrgId:             orgID,
1303
 		UserOrgId:             orgID,
1292
 		DrugId:                advice.DrugId,
1304
 		DrugId:                advice.DrugId,
1320
 		deliver_number = count
1332
 		deliver_number = count
1321
 
1333
 
1322
 	}
1334
 	}
1323
-
1324
-	fmt.Println("总数量", countone)
1325
-	fmt.Println("单位1", unit)
1326
-	fmt.Println("单位2", drup.MaxUnit)
1327
 	if unit == drup.MaxUnit {
1335
 	if unit == drup.MaxUnit {
1328
 		deliver_number_one = countone * drup.MinNumber
1336
 		deliver_number_one = countone * drup.MinNumber
1329
 
1337
 
1407
 
1415
 
1408
 	}
1416
 	}
1409
 
1417
 
1418
+	fmt.Println("药品名称", drup.DrugName)
1419
+	fmt.Println("库存数量我哦我我", stock_number)
1420
+	fmt.Println("出库数量", deliver_number)
1410
 	// 当库存数量大于或等于出库数量的话,则正常出库该批次
1421
 	// 当库存数量大于或等于出库数量的话,则正常出库该批次
1411
 	if stock_number >= deliver_number {
1422
 	if stock_number >= deliver_number {
1412
 
1423
 
1449
 
1460
 
1450
 		warehouse.Mtime = time.Now().Unix()
1461
 		warehouse.Mtime = time.Now().Unix()
1451
 
1462
 
1452
-		//fmt.Println("stockmin", warehouse.StockMinNumber)
1453
-		//fmt.Println("minnubmerr", minNumber)
1454
 		if warehouse.StockMinNumber < minNumber {
1463
 		if warehouse.StockMinNumber < minNumber {
1455
-			//fmt.Println("金4")
1464
+
1456
 			warehouse.StockMaxNumber = warehouse.StockMaxNumber - 1
1465
 			warehouse.StockMaxNumber = warehouse.StockMaxNumber - 1
1457
 			if warehouse.MaxUnit != warehouse.MinUnit {
1466
 			if warehouse.MaxUnit != warehouse.MinUnit {
1458
 				warehouse.StockMinNumber = warehouse.StockMinNumber + drup.MinNumber - minNumber
1467
 				warehouse.StockMinNumber = warehouse.StockMinNumber + drup.MinNumber - minNumber
1461
 				warehouse.StockMaxNumber = warehouse.StockMaxNumber - 1
1470
 				warehouse.StockMaxNumber = warehouse.StockMaxNumber - 1
1462
 			}
1471
 			}
1463
 		} else {
1472
 		} else {
1464
-			//fmt.Println("金5")
1473
+
1465
 			if minNumber > 0 {
1474
 			if minNumber > 0 {
1466
 				if (warehouse.StockMinNumber - minNumber) >= 0 {
1475
 				if (warehouse.StockMinNumber - minNumber) >= 0 {
1467
 					warehouse.StockMinNumber = warehouse.StockMinNumber - minNumber
1476
 					warehouse.StockMinNumber = warehouse.StockMinNumber - minNumber
1470
 			}
1479
 			}
1471
 
1480
 
1472
 			if minNumber == 0 && maxNumber != 1 && warehouse.StockMaxNumber <= 0 {
1481
 			if minNumber == 0 && maxNumber != 1 && warehouse.StockMaxNumber <= 0 {
1473
-				//fmt.Println("6")
1482
+
1474
 				if warehouse.StockMinNumber > 0 {
1483
 				if warehouse.StockMinNumber > 0 {
1475
 					if warehouse.StockMinNumber-deliver_number >= 0 {
1484
 					if warehouse.StockMinNumber-deliver_number >= 0 {
1476
 						warehouse.StockMinNumber = warehouse.StockMinNumber - deliver_number
1485
 						warehouse.StockMinNumber = warehouse.StockMinNumber - deliver_number
1484
 
1493
 
1485
 		if maxNumber == 1 && minNumber == 0 && drup.MaxUnit != drup.MinUnit && warehouse.MaxUnit != warehouse.MinUnit {
1494
 		if maxNumber == 1 && minNumber == 0 && drup.MaxUnit != drup.MinUnit && warehouse.MaxUnit != warehouse.MinUnit {
1486
 			if (warehouse.StockMinNumber - deliver_number) >= 0 {
1495
 			if (warehouse.StockMinNumber - deliver_number) >= 0 {
1487
-				//fmt.Println("金7")
1496
+
1488
 				warehouse.StockMinNumber = warehouse.StockMinNumber - deliver_number
1497
 				warehouse.StockMinNumber = warehouse.StockMinNumber - deliver_number
1489
 			}
1498
 			}
1490
 
1499
 
2060
 			OverCount:               sum_count,
2069
 			OverCount:               sum_count,
2061
 			AdviceId:                advice.ID,
2070
 			AdviceId:                advice.ID,
2062
 		}
2071
 		}
2063
-		//查询是否存在出库数据
2064
-		_, errCode := GetSigleDrugWarehouseOutInfo(advice.PatientId, advice.AdviceDate, orgID)
2072
+		//查询该药品是否存在出库数据
2073
+		_, errCode := GetSigleDrugWarehouseOutInfoTwo(advice.PatientId, advice.AdviceDate, orgID, advice.DrugId)
2065
 		if errCode == gorm.ErrRecordNotFound {
2074
 		if errCode == gorm.ErrRecordNotFound {
2066
 			errOne := AddSigleDrugWarehouseOutInfo(warehouseOutInfo)
2075
 			errOne := AddSigleDrugWarehouseOutInfo(warehouseOutInfo)
2067
 			if errOne != nil {
2076
 			if errOne != nil {
2084
 		}
2093
 		}
2085
 		if errCode == nil {
2094
 		if errCode == nil {
2086
 
2095
 
2087
-			lastDrugOutInfo, _ := GetSigleDrugWarehouseOutInfoOne(advice.PatientId, advice.AdviceDate, orgID)
2096
+			lastDrugOutInfo, _ := GetSigleDrugWarehouseOutInfoTwo(advice.PatientId, advice.AdviceDate, orgID, advice.DrugId)
2088
 			var his_count int64
2097
 			var his_count int64
2089
 			if lastDrugOutInfo.CountUnit == drup.MaxUnit {
2098
 			if lastDrugOutInfo.CountUnit == drup.MaxUnit {
2090
 				his_count = lastDrugOutInfo.Count * drup.MinNumber
2099
 				his_count = lastDrugOutInfo.Count * drup.MinNumber
2455
 	return &info, nil
2464
 	return &info, nil
2456
 }
2465
 }
2457
 
2466
 
2467
+func GetSigleDrugWarehouseOutInfoTwo(patient_id int64, advice_date int64, orgid int64, drug_id int64) (*models.XtDrugWarehouseOutInfo, error) {
2468
+
2469
+	info := models.XtDrugWarehouseOutInfo{}
2470
+	var err error
2471
+	err = XTReadDB().Where("patient_id = ? and sys_record_time = ? and org_id = ? and status = 1 and drug_id = ?", patient_id, advice_date, orgid, drug_id).Find(&info).Error
2472
+	if err == gorm.ErrRecordNotFound {
2473
+		return nil, err
2474
+	}
2475
+	if err != nil {
2476
+		return nil, err
2477
+	}
2478
+	return &info, nil
2479
+}
2480
+
2458
 func GetSigleDrugWarehouseOutInfoOne(patient_id int64, advice_date int64, orgid int64) (models.XtDrugWarehouseOutInfo, error) {
2481
 func GetSigleDrugWarehouseOutInfoOne(patient_id int64, advice_date int64, orgid int64) (models.XtDrugWarehouseOutInfo, error) {
2459
 
2482
 
2460
 	info := models.XtDrugWarehouseOutInfo{}
2483
 	info := models.XtDrugWarehouseOutInfo{}

+ 1 - 0
service/pharmacy_service.go Visa fil

798
 	//发药
798
 	//发药
799
 	if len(adviceList) > 0 {
799
 	if len(adviceList) > 0 {
800
 		for _, item := range adviceList {
800
 		for _, item := range adviceList {
801
+
801
 			//扣减库存
802
 			//扣减库存
802
 			err = HisDrugsDelivery(orgid, creater, item)
803
 			err = HisDrugsDelivery(orgid, creater, item)
803
 			if err != nil {
804
 			if err != nil {

+ 9 - 0
service/secondary_service.go Visa fil

1161
 	err = XTWriteDB().Model(models.VmStockFlow{}).Where("id = ? and status=1", id).Updates(map[string]interface{}{"over_count": count}).Error
1161
 	err = XTWriteDB().Model(models.VmStockFlow{}).Where("id = ? and status=1", id).Updates(map[string]interface{}{"over_count": count}).Error
1162
 	return err
1162
 	return err
1163
 }
1163
 }
1164
+
1165
+func GetLastOverCount(id int64) (models.VmStockFlow, error) {
1166
+
1167
+	stockFlow := models.VmStockFlow{}
1168
+
1169
+	err := XTReadDB().Where("id=? and status=1", id).Find(&stockFlow).Error
1170
+
1171
+	return stockFlow, err
1172
+}

+ 4 - 4
service/self_drug_service.go Visa fil

2364
 	if startime > 0 {
2364
 	if startime > 0 {
2365
 		db = db.Where("ctime >=?", startime)
2365
 		db = db.Where("ctime >=?", startime)
2366
 	}
2366
 	}
2367
-	if endtime < 0 {
2367
+	if endtime > 0 {
2368
 		db = db.Where("ctime <=?", endtime)
2368
 		db = db.Where("ctime <=?", endtime)
2369
 	}
2369
 	}
2370
 	if storehouse_id > 0 {
2370
 	if storehouse_id > 0 {
2386
 	if startime > 0 {
2386
 	if startime > 0 {
2387
 		db = db.Where("ctime >=?", startime)
2387
 		db = db.Where("ctime >=?", startime)
2388
 	}
2388
 	}
2389
-	if endtime < 0 {
2389
+	if endtime > 0 {
2390
 		db = db.Where("ctime <=?", endtime)
2390
 		db = db.Where("ctime <=?", endtime)
2391
 	}
2391
 	}
2392
 
2392
 
2405
 	if startime > 0 {
2405
 	if startime > 0 {
2406
 		db = db.Where("ctime >=?", startime)
2406
 		db = db.Where("ctime >=?", startime)
2407
 	}
2407
 	}
2408
-	if endtime < 0 {
2408
+	if endtime > 0 {
2409
 		db = db.Where("ctime <=?", endtime)
2409
 		db = db.Where("ctime <=?", endtime)
2410
 	}
2410
 	}
2411
 	if storehouse_id > 0 {
2411
 	if storehouse_id > 0 {
2426
 	if startime > 0 {
2426
 	if startime > 0 {
2427
 		db = db.Where("ctime >=?", startime)
2427
 		db = db.Where("ctime >=?", startime)
2428
 	}
2428
 	}
2429
-	if endtime < 0 {
2429
+	if endtime > 0 {
2430
 		db = db.Where("ctime <=?", endtime)
2430
 		db = db.Where("ctime <=?", endtime)
2431
 	}
2431
 	}
2432
 
2432
 

+ 2 - 2
service/sign_service.go Visa fil

2065
 
2065
 
2066
 func GeteAllBaseList(user_org_id int64) (list []*models.BaseDrugLib, err error) {
2066
 func GeteAllBaseList(user_org_id int64) (list []*models.BaseDrugLib, err error) {
2067
 
2067
 
2068
-	err = XTWriteDB().Model(&list).Where("user_org_id = ? and status =1", user_org_id).Find(&list).Error
2068
+	err = XTWriteDB().Model(&list).Where("org_id = ? and status =1", user_org_id).Find(&list).Error
2069
 	return list, err
2069
 	return list, err
2070
 }
2070
 }
2071
 
2071
 
2072
 func UpdateBaseList(id int64, firstleterr string) error {
2072
 func UpdateBaseList(id int64, firstleterr string) error {
2073
 
2073
 
2074
-	err := XTWriteDB().Model(&models.BaseDrugLib{}).Where("id = ? and status =1", id, firstleterr).Updates(map[string]interface{}{"first_letter": firstleterr}).Error
2074
+	err := XTWriteDB().Model(&models.BaseDrugLib{}).Where("id = ? and status =1", id).Updates(map[string]interface{}{"first_letter": firstleterr}).Error
2075
 	return err
2075
 	return err
2076
 }
2076
 }
2077
 
2077
 

+ 15 - 16
service/warhouse_service.go Visa fil

621
 
621
 
622
 			BloodHisDrugDeliverInfo(orgID, prescribingNumber, &out, &drup, advice, prescribingNumber, advice.PrescribingNumberUnit)
622
 			BloodHisDrugDeliverInfo(orgID, prescribingNumber, &out, &drup, advice, prescribingNumber, advice.PrescribingNumberUnit)
623
 
623
 
624
-			//查询今日出库的数据
625
-			if orgID == 10188 || orgID == 10217 || orgID == 10344 {
626
-				//查询这个患者今日用过的总数量
627
-				listDrugFlow, _ := GetDrugFlowByWatch(advice.PatientId, advice.DrugId, advice.AdviceDate, advice.UserOrgId)
628
-				fmt.Println("000000000000000000000000000000000000000", listDrugFlow)
629
-				for _, item := range listDrugFlow {
630
-
631
-					outInfor, _ := GetDrugWarehouseOutInfor(item.WarehouseOutDetailId, item.UserOrgId)
632
-					if item.MaxUnit == outInfor.CountUnit {
633
-						if item.Count != outInfor.Count {
634
-							UpdateDrugWarehouseOutInfoById(outInfor.ID, item.Count)
635
-						}
636
-					}
637
-
638
-				}
639
-			}
624
+			////查询今日出库的数据
625
+			//if orgID == 10188 || orgID == 10217 || orgID == 10344 {
626
+			//	//查询这个患者今日用过的总数量
627
+			//	listDrugFlow, _ := GetDrugFlowByWatch(advice.PatientId, advice.DrugId, advice.AdviceDate, advice.UserOrgId)
628
+			//	for _, item := range listDrugFlow {
629
+			//
630
+			//		outInfor, _ := GetDrugWarehouseOutInfor(item.WarehouseOutDetailId, item.UserOrgId)
631
+			//		if item.MaxUnit == outInfor.CountUnit {
632
+			//			if item.Count != outInfor.Count {
633
+			//				UpdateDrugWarehouseOutInfoById(outInfor.ID, item.Count)
634
+			//			}
635
+			//		}
636
+			//
637
+			//	}
638
+			//}
640
 
639
 
641
 		} else {
640
 		} else {
642
 			return errors.New("药品信息不存在")
641
 			return errors.New("药品信息不存在")