28169 hace 1 año
padre
commit
63ea329f85

+ 6 - 6
controllers/base_api_controller.go Ver fichero

@@ -81,7 +81,7 @@ func (this *BaseAuthAPIController) Prepare() {
81 81
 		userAdmin.ModifyTime = 1530786071
82 82
 		var subscibe models.ServeSubscibe
83 83
 		subscibe.ID = 11
84
-		subscibe.OrgId = 10579 //机构id 10344
84
+		subscibe.OrgId = 10612 //机构id 10344
85 85
 		subscibe.PeriodStart = 1547447814
86 86
 		subscibe.PeriodEnd = 1550039814
87 87
 		subscibe.State = 1
@@ -91,8 +91,8 @@ func (this *BaseAuthAPIController) Prepare() {
91 91
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
92 92
 		subscibes[4] = &subscibe
93 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 96
 		adminUserInfo.AdminUser = &userAdmin
97 97
 		adminUserInfo.Subscibes = subscibes
98 98
 		this.SetSession("admin_user_info", &adminUserInfo)
@@ -326,7 +326,7 @@ func (this *BaseServeAPIController) Prepare() {
326 326
 		userAdmin.ModifyTime = 1530786071
327 327
 		var subscibe models.ServeSubscibe
328 328
 		subscibe.ID = 11
329
-		subscibe.OrgId = 10579 //机构id小英10344或4
329
+		subscibe.OrgId = 10612 //机构id小英10344或4
330 330
 		subscibe.PeriodStart = 1538035409
331 331
 		subscibe.PeriodEnd = 1569571409
332 332
 		subscibe.State = 1
@@ -336,8 +336,8 @@ func (this *BaseServeAPIController) Prepare() {
336 336
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
337 337
 		subscibes[4] = &subscibe
338 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 341
 		adminUserInfo.AdminUser = &userAdmin
342 342
 		adminUserInfo.Subscibes = subscibes
343 343
 		this.SetSession("admin_user_info", &adminUserInfo)

+ 6 - 0
controllers/dialysis_api_controller.go Ver fichero

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

+ 10 - 1
controllers/dialysis_record_api_controller.go Ver fichero

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

+ 2 - 47
controllers/his_api_controller.go Ver fichero

@@ -1845,16 +1845,11 @@ func (c *HisApiController) CreateHisPrescription() {
1845 1845
 								//查询该药品是否存在开药记录
1846 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 1849
 								if advicelist.ID == 0 {
1854 1850
 									all_count, _ := strconv.ParseFloat(totals, 64)
1855 1851
 									if prescribingNumberUnit == drug.MinUnit {
1856
-										fmt.Println("prescribing_number", prescribing_number)
1857
-										fmt.Println("all_count", all_count)
1852
+
1858 1853
 										if drug.IsUse != 1 {
1859 1854
 											if drug.IsProject == 0 || drug.IsProject == 2 {
1860 1855
 												if all_count == 0 {
@@ -2312,7 +2307,7 @@ func (c *HisApiController) CreateHisPrescription() {
2312 2307
 															var sum_in_count int64
2313 2308
 															warehouseInfo, _ := service.FindLastDrugWarehousingInfoByID(drug_id, storeConfig.DrugStorehouseOut)
2314 2309
 															sum_in_count = warehouseInfo.StockMaxNumber*drug.MinNumber + warehouseInfo.StockMinNumber
2315
-															fmt.Println("sum_in_count", sum_in_count)
2310
+
2316 2311
 															//如果修改的数量大于有库存的第一个批次
2317 2312
 															if number_count > sum_in_count {
2318 2313
 																c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(warehouseInfo.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(warehouseInfo.StockMinNumber, 10) + drug.MinUnit)
@@ -10798,25 +10793,12 @@ func (c *HisApiController) GetHisMonthChargePatientInfo() {
10798 10793
 	case_history, _ := service.GetHisPatientCaseHistoryInfo(admin.CurrentOrgId, patient_id, recordDateTime)
10799 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 10796
 	lastPatientPrescriptionInfo, _ := service.FindLastPatientPrescriptionInfoTwo(admin.CurrentOrgId, patient_id, recordDateTime, p_type)
10804 10797
 
10805 10798
 	doctors, _ := service.GetHisAdminUserDoctors(admin.CurrentOrgId)
10806 10799
 	//获取所有科室信息
10807 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 10802
 	c.ServeSuccessJSON(map[string]interface{}{
10821 10803
 		"his_info":            his_patient_info,
10822 10804
 		"xt_info":             xt_patient_info,
@@ -10828,37 +10810,10 @@ func (c *HisApiController) GetHisMonthChargePatientInfo() {
10828 10810
 		"doctors":             doctors,
10829 10811
 		"department":          department,
10830 10812
 		"settle_total":        settle_total,
10831
-		"dia_arr":             dia_arr,
10832 10813
 	})
10833 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 10817
 func (c *HisApiController) GetHisMonthPatientInfo() {
10863 10818
 	patient_id, _ := c.GetInt64("patient_id")
10864 10819
 	his_patient_id, _ := c.GetInt64("his_patient_id")

+ 14 - 4
controllers/mobile_api_controllers/dialysis_api_controller.go Ver fichero

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

+ 1 - 1
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go Ver fichero

@@ -510,7 +510,7 @@ func (this *StaffScheduleApiController) DeleteSchedule() {
510 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 514
 			advice, _ := service.GetDoctorAdviceListTwenty(schedule.PatientId, schedule.ScheduleDate, org_id)
515 515
 			if len(advice) > 0 {
516 516
 				service.UpdateAdviceObj(schedule.PatientId, schedule.ScheduleDate, org_id)

+ 2 - 2
controllers/pharmacy_controller.go Ver fichero

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

+ 1 - 1
controllers/schedule_api_controller.go Ver fichero

@@ -1969,7 +1969,7 @@ func (c *ScheduleApiController) DeleteSchedule() {
1969 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 1973
 		advice, _ := service.GetDoctorAdviceListTwenty(schedule.PatientId, schedule.ScheduleDate, adminINfo.CurrentOrgId)
1974 1974
 		if len(advice) > 0 {
1975 1975
 			service.UpdateAdviceObj(schedule.PatientId, schedule.ScheduleDate, adminINfo.CurrentOrgId)

+ 1 - 1
controllers/self_drug_api_congtroller.go Ver fichero

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

+ 2 - 2
controllers/sign_api_controller.go Ver fichero

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

+ 5 - 17
controllers/stock_in_api_controller.go Ver fichero

@@ -7962,45 +7962,33 @@ func (this *StockManagerApiController) GetStockFlowOrderList() {
7962 7962
 	good_id, _ := this.GetInt64("good_id")
7963 7963
 	orgId := this.GetAdminUserInfo().CurrentOrgId
7964 7964
 	list, _ := service.GetStockFlowOrderList(good_id, orgId)
7965
-	fmt.Println("listowowowow", list)
7966 7965
 	for index, _ := range list {
7967
-		fmt.Println("index", index)
7968 7966
 		if list[index].ConsumableType == 3 || list[index].ConsumableType == 2 || list[index].ConsumableType == 11 || list[index].ConsumableType == 12 || list[index].ConsumableType == 15 {
7969 7967
 			var count int64
7968
+
7970 7969
 			if index == 0 {
7971 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 7971
 				service.UpdateOverCount(list[index+1].ID, count)
7976 7972
 			}
7977 7973
 
7978 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 7977
 				service.UpdateOverCount(list[index].ID, count)
7984 7978
 			}
7985 7979
 
7986 7980
 		}
7987 7981
 		if list[index].ConsumableType == 7 || list[index].ConsumableType == 4 || list[index].ConsumableType == 1 || list[index].ConsumableType == 10 || list[index].ConsumableType == 13 {
7988
-
7989 7982
 			if index == 0 {
7990 7983
 				var count int64
7991 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 7985
 				service.UpdateOverCount(list[index+1].ID, count)
7996 7986
 			}
7997 7987
 
7998 7988
 			if index >= 1 {
7999 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 7992
 				service.UpdateOverCount(list[index].ID, count)
8005 7993
 			}
8006 7994
 

+ 3 - 0
models/dialysis.go Ver fichero

@@ -656,6 +656,7 @@ type AssessmentAfterDislysis struct {
656 656
 	PipCoagulation                  string  `gorm:"column:pip_coagulation" json:"pip_coagulation" form:"pip_coagulation"`
657 657
 	AccumulatedBloodVolume          string  `gorm:"column:accumulated_blood_volume" json:"accumulated_blood_volume" form:"accumulated_blood_volume"`
658 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 662
 func (AssessmentAfterDislysis) TableName() string {
@@ -865,6 +866,8 @@ type DialysisOrder struct {
865 866
 	OrderRemark                string        `gorm:"column:order_remark" json:"order_remark" form:"order_remark"`
866 867
 	DialysisTotal              int64         `gorm:"column:dialysis_total" json:"dialysis_total" form:"dialysis_total"`
867 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 873
 func (DialysisOrder) TableName() string {

+ 2 - 0
models/patient_models.go Ver fichero

@@ -381,6 +381,7 @@ type DialysisPrescription struct {
381 381
 	WashingTime                string        `gorm:"column:washing_time" json:"washing_time" form:"washing_time"`
382 382
 	BloodAccessPartId          string        `gorm:"column:blood_access_part_id" json:"blood_access_part_id" form:"blood_access_part_id"`
383 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 387
 func (DialysisPrescription) TableName() string {
@@ -620,6 +621,7 @@ type DialysisSolution struct {
620 621
 	WashingTime                string  `gorm:"column:washing_time" json:"washing_time" form:"washing_time"`
621 622
 	BloodAccessPartId          string  `gorm:"column:blood_access_part_id" json:"blood_access_part_id" form:"blood_access_part_id"`
622 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 627
 func (DialysisSolution) TableName() string {

+ 2 - 2
service/dialysis_service.go Ver fichero

@@ -559,8 +559,8 @@ func CreateDialysisRecord(id int64, orgId int64, record *models.DialysisOrder) e
559 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 564
 	return err
565 565
 
566 566
 }

+ 2 - 2
service/mobile_dialysis_service.go Ver fichero

@@ -2241,7 +2241,7 @@ func BatchUpdateMonitors(monitors []*models.MonitoringRecord) error {
2241 2241
 func ModifyStartDialysisOrder(order *models.DialysisOrder) error {
2242 2242
 	tx := writeDb.Begin()
2243 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 2245
 	if err != nil {
2246 2246
 		tx.Rollback()
2247 2247
 		return err
@@ -2253,7 +2253,7 @@ func ModifyStartDialysisOrder(order *models.DialysisOrder) error {
2253 2253
 func ModifyFinishDialysisOrder(order *models.DialysisOrder) error {
2254 2254
 	tx := writeDb.Begin()
2255 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 2257
 	if err != nil {
2258 2258
 		tx.Rollback()
2259 2259
 		return err

+ 36 - 13
service/new_warehouse_service.go Ver fichero

@@ -1287,6 +1287,18 @@ func BloodDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *
1287 1287
 // 药品自动出库 递归方式
1288 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 1302
 	drugError := models.XtDrugError{
1291 1303
 		UserOrgId:             orgID,
1292 1304
 		DrugId:                advice.DrugId,
@@ -1320,10 +1332,6 @@ func BloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseou
1320 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 1335
 	if unit == drup.MaxUnit {
1328 1336
 		deliver_number_one = countone * drup.MinNumber
1329 1337
 
@@ -1407,6 +1415,9 @@ func BloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseou
1407 1415
 
1408 1416
 	}
1409 1417
 
1418
+	fmt.Println("药品名称", drup.DrugName)
1419
+	fmt.Println("库存数量我哦我我", stock_number)
1420
+	fmt.Println("出库数量", deliver_number)
1410 1421
 	// 当库存数量大于或等于出库数量的话,则正常出库该批次
1411 1422
 	if stock_number >= deliver_number {
1412 1423
 
@@ -1449,10 +1460,8 @@ func BloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseou
1449 1460
 
1450 1461
 		warehouse.Mtime = time.Now().Unix()
1451 1462
 
1452
-		//fmt.Println("stockmin", warehouse.StockMinNumber)
1453
-		//fmt.Println("minnubmerr", minNumber)
1454 1463
 		if warehouse.StockMinNumber < minNumber {
1455
-			//fmt.Println("金4")
1464
+
1456 1465
 			warehouse.StockMaxNumber = warehouse.StockMaxNumber - 1
1457 1466
 			if warehouse.MaxUnit != warehouse.MinUnit {
1458 1467
 				warehouse.StockMinNumber = warehouse.StockMinNumber + drup.MinNumber - minNumber
@@ -1461,7 +1470,7 @@ func BloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseou
1461 1470
 				warehouse.StockMaxNumber = warehouse.StockMaxNumber - 1
1462 1471
 			}
1463 1472
 		} else {
1464
-			//fmt.Println("金5")
1473
+
1465 1474
 			if minNumber > 0 {
1466 1475
 				if (warehouse.StockMinNumber - minNumber) >= 0 {
1467 1476
 					warehouse.StockMinNumber = warehouse.StockMinNumber - minNumber
@@ -1470,7 +1479,7 @@ func BloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseou
1470 1479
 			}
1471 1480
 
1472 1481
 			if minNumber == 0 && maxNumber != 1 && warehouse.StockMaxNumber <= 0 {
1473
-				//fmt.Println("6")
1482
+
1474 1483
 				if warehouse.StockMinNumber > 0 {
1475 1484
 					if warehouse.StockMinNumber-deliver_number >= 0 {
1476 1485
 						warehouse.StockMinNumber = warehouse.StockMinNumber - deliver_number
@@ -1484,7 +1493,7 @@ func BloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseou
1484 1493
 
1485 1494
 		if maxNumber == 1 && minNumber == 0 && drup.MaxUnit != drup.MinUnit && warehouse.MaxUnit != warehouse.MinUnit {
1486 1495
 			if (warehouse.StockMinNumber - deliver_number) >= 0 {
1487
-				//fmt.Println("金7")
1496
+
1488 1497
 				warehouse.StockMinNumber = warehouse.StockMinNumber - deliver_number
1489 1498
 			}
1490 1499
 
@@ -2060,8 +2069,8 @@ func BloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseou
2060 2069
 			OverCount:               sum_count,
2061 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 2074
 		if errCode == gorm.ErrRecordNotFound {
2066 2075
 			errOne := AddSigleDrugWarehouseOutInfo(warehouseOutInfo)
2067 2076
 			if errOne != nil {
@@ -2084,7 +2093,7 @@ func BloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseou
2084 2093
 		}
2085 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 2097
 			var his_count int64
2089 2098
 			if lastDrugOutInfo.CountUnit == drup.MaxUnit {
2090 2099
 				his_count = lastDrugOutInfo.Count * drup.MinNumber
@@ -2455,6 +2464,20 @@ func GetSigleDrugWarehouseOutInfo(patient_id int64, advice_date int64, orgid int
2455 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 2481
 func GetSigleDrugWarehouseOutInfoOne(patient_id int64, advice_date int64, orgid int64) (models.XtDrugWarehouseOutInfo, error) {
2459 2482
 
2460 2483
 	info := models.XtDrugWarehouseOutInfo{}

+ 1 - 0
service/pharmacy_service.go Ver fichero

@@ -798,6 +798,7 @@ func DispensingMedicineOne(orgid, patient_id, stime, etime, creater int64) (err
798 798
 	//发药
799 799
 	if len(adviceList) > 0 {
800 800
 		for _, item := range adviceList {
801
+
801 802
 			//扣减库存
802 803
 			err = HisDrugsDelivery(orgid, creater, item)
803 804
 			if err != nil {

+ 9 - 0
service/secondary_service.go Ver fichero

@@ -1161,3 +1161,12 @@ func UpdateOverCount(id int64, count int64) (err error) {
1161 1161
 	err = XTWriteDB().Model(models.VmStockFlow{}).Where("id = ? and status=1", id).Updates(map[string]interface{}{"over_count": count}).Error
1162 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 Ver fichero

@@ -2364,7 +2364,7 @@ func FindeEndStokInventoryProfit(good_id int64, orgid int64, startime int64, end
2364 2364
 	if startime > 0 {
2365 2365
 		db = db.Where("ctime >=?", startime)
2366 2366
 	}
2367
-	if endtime < 0 {
2367
+	if endtime > 0 {
2368 2368
 		db = db.Where("ctime <=?", endtime)
2369 2369
 	}
2370 2370
 	if storehouse_id > 0 {
@@ -2386,7 +2386,7 @@ func FindeEndStokInventoryProfitTwenty(good_id int64, orgid int64, startime int6
2386 2386
 	if startime > 0 {
2387 2387
 		db = db.Where("ctime >=?", startime)
2388 2388
 	}
2389
-	if endtime < 0 {
2389
+	if endtime > 0 {
2390 2390
 		db = db.Where("ctime <=?", endtime)
2391 2391
 	}
2392 2392
 
@@ -2405,7 +2405,7 @@ func FindeEndStockInventoryLosses(good_id int64, orgid int64, startime int64, en
2405 2405
 	if startime > 0 {
2406 2406
 		db = db.Where("ctime >=?", startime)
2407 2407
 	}
2408
-	if endtime < 0 {
2408
+	if endtime > 0 {
2409 2409
 		db = db.Where("ctime <=?", endtime)
2410 2410
 	}
2411 2411
 	if storehouse_id > 0 {
@@ -2426,7 +2426,7 @@ func FindeEndStockInventoryLossesTwenty(good_id int64, orgid int64, startime int
2426 2426
 	if startime > 0 {
2427 2427
 		db = db.Where("ctime >=?", startime)
2428 2428
 	}
2429
-	if endtime < 0 {
2429
+	if endtime > 0 {
2430 2430
 		db = db.Where("ctime <=?", endtime)
2431 2431
 	}
2432 2432
 

+ 2 - 2
service/sign_service.go Ver fichero

@@ -2065,13 +2065,13 @@ func UpdatePatientNew(id int64, firstleterr string) error {
2065 2065
 
2066 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 2069
 	return list, err
2070 2070
 }
2071 2071
 
2072 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 2075
 	return err
2076 2076
 }
2077 2077
 

+ 15 - 16
service/warhouse_service.go Ver fichero

@@ -621,22 +621,21 @@ func HisDrugsDelivery(orgID int64, creater int64, advice *models.HisDoctorAdvice
621 621
 
622 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 640
 		} else {
642 641
 			return errors.New("药品信息不存在")