Pārlūkot izejas kodu

11月8日库存管理

XMLWAN 2 gadus atpakaļ
vecāks
revīzija
74282a1a2d

+ 105 - 107
controllers/dialysis_record_api_controller.go Parādīt failu

@@ -1347,119 +1347,117 @@ func (this *DialysisRecordAPIController) FinishDialysis() {
1347 1347
 
1348 1348
 	err := service.UpdateAssessmentAfterDislysisRecord(&tempassessmentAfterDislysis)
1349 1349
 
1350
-	if adminUserInfo.CurrentOrgId == 10101 || adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 9675 || adminUserInfo.CurrentOrgId == 10215 || adminUserInfo.CurrentOrgId == 10233 || adminUserInfo.CurrentOrgId == 10223 || adminUserInfo.CurrentOrgId == 10243 || adminUserInfo.CurrentOrgId == 10340 {
1351
-
1352
-		//evaluation, _ := service.MobileGetPredialysisEvaluationOne(adminUserInfo.CurrentOrgId, patientID, recordDate.Unix())
1353
-		//if evaluation.SystolicBloodPressure == 0 {
1354
-		//	evaluation.SystolicBloodPressure = fmonitorRecords.SystolicBloodPressure
1355
-		//
1356
-		//	pre := models.PredialysisEvaluation{
1357
-		//		SystolicBloodPressure: evaluation.SystolicBloodPressure,
1358
-		//	}
1359
-		//	fmt.Println("prew", pre)
1360
-		//	getNurseErr := service.UpdatePredialysisEvaluation(&pre, evaluation.ID)
1361
-		//	key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_before_dislysis"
1362
-		//	keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_befores_list_all"
1363
-		//
1364
-		//	redis := service.RedisClient()
1365
-		//	redis.Set(key, "", time.Second)
1366
-		//	redis.Set(keyOne, "", time.Second)
1367
-		//	defer redis.Close()
1368
-		//	fmt.Println(getNurseErr)
1369
-		//}
1370
-		//if evaluation.DiastolicBloodPressure == 0 {
1371
-		//	evaluation.DiastolicBloodPressure = fmonitorRecords.DiastolicBloodPressure
1372
-		//	pres := models.PredialysisEvaluation{
1373
-		//		DiastolicBloodPressure: evaluation.DiastolicBloodPressure,
1374
-		//	}
1375
-		//	getNurseErr := service.UpdatePredialysisEvaluationTwo(&pres, evaluation.ID)
1376
-		//	key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_before_dislysis"
1377
-		//
1378
-		//	redis := service.RedisClient()
1379
-		//	redis.Set(key, "", time.Second)
1380
-		//
1381
-		//	keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_befores_list_all"
1382
-		//	redis.Set(keyOne, "", time.Second)
1383
-		//	defer redis.Close()
1384
-		//	fmt.Println(getNurseErr)
1385
-		//}
1386
-		//if evaluation.PulseFrequency == 0 {
1387
-		//	evaluation.PulseFrequency = fmonitorRecords.PulseFrequency
1388
-		//	press := models.PredialysisEvaluation{
1389
-		//		PulseFrequency: evaluation.PulseFrequency,
1390
-		//	}
1391
-		//	getNurseErr := service.UpdatePredialysisEvaluationThree(&press, evaluation.ID)
1392
-		//	key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_before_dislysis"
1393
-		//
1394
-		//	redis := service.RedisClient()
1395
-		//	redis.Set(key, "", time.Second)
1396
-		//	keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_befores_list_all"
1397
-		//	redis.Set(keyOne, "", time.Second)
1398
-		//	defer redis.Close()
1399
-		//	fmt.Println(getNurseErr)
1400
-		//}
1401
-		//
1402
-		//if evaluation.Temperature == 0 {
1403
-		//	evaluation.Temperature = fmonitorRecords.Temperature
1404
-		//	press := models.PredialysisEvaluation{
1405
-		//		Temperature: evaluation.Temperature,
1406
-		//	}
1407
-		//	getNurseErr := service.UpdatePredialysisEvaluationFour(&press, evaluation.ID)
1408
-		//	key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_before_dislysis"
1409
-		//
1410
-		//	redis := service.RedisClient()
1411
-		//	redis.Set(key, "", time.Second)
1412
-		//	keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_befores_list_all"
1413
-		//	redis.Set(keyOne, "", time.Second)
1414
-		//	defer redis.Close()
1415
-		//	fmt.Println(getNurseErr)
1416
-		//}
1417
-		//
1418
-		if err != nil {
1419
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1420
-			return
1421
-		}
1350
+	//evaluation, _ := service.MobileGetPredialysisEvaluationOne(adminUserInfo.CurrentOrgId, patientID, recordDate.Unix())
1351
+	//if evaluation.SystolicBloodPressure == 0 {
1352
+	//	evaluation.SystolicBloodPressure = fmonitorRecords.SystolicBloodPressure
1353
+	//
1354
+	//	pre := models.PredialysisEvaluation{
1355
+	//		SystolicBloodPressure: evaluation.SystolicBloodPressure,
1356
+	//	}
1357
+	//	fmt.Println("prew", pre)
1358
+	//	getNurseErr := service.UpdatePredialysisEvaluation(&pre, evaluation.ID)
1359
+	//	key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_before_dislysis"
1360
+	//	keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_befores_list_all"
1361
+	//
1362
+	//	redis := service.RedisClient()
1363
+	//	redis.Set(key, "", time.Second)
1364
+	//	redis.Set(keyOne, "", time.Second)
1365
+	//	defer redis.Close()
1366
+	//	fmt.Println(getNurseErr)
1367
+	//}
1368
+	//if evaluation.DiastolicBloodPressure == 0 {
1369
+	//	evaluation.DiastolicBloodPressure = fmonitorRecords.DiastolicBloodPressure
1370
+	//	pres := models.PredialysisEvaluation{
1371
+	//		DiastolicBloodPressure: evaluation.DiastolicBloodPressure,
1372
+	//	}
1373
+	//	getNurseErr := service.UpdatePredialysisEvaluationTwo(&pres, evaluation.ID)
1374
+	//	key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_before_dislysis"
1375
+	//
1376
+	//	redis := service.RedisClient()
1377
+	//	redis.Set(key, "", time.Second)
1378
+	//
1379
+	//	keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_befores_list_all"
1380
+	//	redis.Set(keyOne, "", time.Second)
1381
+	//	defer redis.Close()
1382
+	//	fmt.Println(getNurseErr)
1383
+	//}
1384
+	//if evaluation.PulseFrequency == 0 {
1385
+	//	evaluation.PulseFrequency = fmonitorRecords.PulseFrequency
1386
+	//	press := models.PredialysisEvaluation{
1387
+	//		PulseFrequency: evaluation.PulseFrequency,
1388
+	//	}
1389
+	//	getNurseErr := service.UpdatePredialysisEvaluationThree(&press, evaluation.ID)
1390
+	//	key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_before_dislysis"
1391
+	//
1392
+	//	redis := service.RedisClient()
1393
+	//	redis.Set(key, "", time.Second)
1394
+	//	keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_befores_list_all"
1395
+	//	redis.Set(keyOne, "", time.Second)
1396
+	//	defer redis.Close()
1397
+	//	fmt.Println(getNurseErr)
1398
+	//}
1399
+	//
1400
+	//if evaluation.Temperature == 0 {
1401
+	//	evaluation.Temperature = fmonitorRecords.Temperature
1402
+	//	press := models.PredialysisEvaluation{
1403
+	//		Temperature: evaluation.Temperature,
1404
+	//	}
1405
+	//	getNurseErr := service.UpdatePredialysisEvaluationFour(&press, evaluation.ID)
1406
+	//	key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_before_dislysis"
1407
+	//
1408
+	//	redis := service.RedisClient()
1409
+	//	redis.Set(key, "", time.Second)
1410
+	//	keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_befores_list_all"
1411
+	//	redis.Set(keyOne, "", time.Second)
1412
+	//	defer redis.Close()
1413
+	//	fmt.Println(getNurseErr)
1414
+	//}
1415
+	//
1416
+	if err != nil {
1417
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1418
+		return
1419
+	}
1422 1420
 
1423
-		go func() {
1424
-			ssoDomain := beego.AppConfig.String("call_domain")
1425
-			api := ssoDomain + "/index/downpatient"
1426
-			values := make(url.Values)
1427
-			values.Set("org_id", strconv.FormatInt(adminUserInfo.CurrentOrgId, 10))
1428
-			values.Set("admin_user_id", strconv.FormatInt(nurseID, 10))
1429
-			values.Set("patient_id", strconv.FormatInt(patientID, 10))
1430
-			http.PostForm(api, values)
1431
-		}()
1421
+	go func() {
1422
+		ssoDomain := beego.AppConfig.String("call_domain")
1423
+		api := ssoDomain + "/index/downpatient"
1424
+		values := make(url.Values)
1425
+		values.Set("org_id", strconv.FormatInt(adminUserInfo.CurrentOrgId, 10))
1426
+		values.Set("admin_user_id", strconv.FormatInt(nurseID, 10))
1427
+		values.Set("patient_id", strconv.FormatInt(patientID, 10))
1428
+		http.PostForm(api, values)
1429
+	}()
1432 1430
 
1433
-		//执行下机
1434
-		updateErr := service.ModifyDialysisRecord(dialysisRecord.ID, nurseID, endDate.Unix(), adminUserInfo.AdminUser.Id, puncture_point_haematoma, internal_fistula, catheter, cruor)
1435
-		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":dialysis_order"
1436
-		redis := service.RedisClient()
1437
-		defer redis.Close()
1438
-		//清空key 值
1439
-		redis.Set(key, "", time.Second)
1431
+	//执行下机
1432
+	updateErr := service.ModifyDialysisRecord(dialysisRecord.ID, nurseID, endDate.Unix(), adminUserInfo.AdminUser.Id, puncture_point_haematoma, internal_fistula, catheter, cruor)
1433
+	key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":dialysis_order"
1434
+	redis := service.RedisClient()
1435
+	defer redis.Close()
1436
+	//清空key 值
1437
+	redis.Set(key, "", time.Second)
1440 1438
 
1441
-		keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":dialysis_orders_list_all"
1442
-		redis.Set(keyOne, "", time.Second)
1439
+	keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":dialysis_orders_list_all"
1440
+	redis.Set(keyOne, "", time.Second)
1443 1441
 
1444
-		if updateErr != nil {
1445
-			this.ErrorLog("下机失败:%v", updateErr)
1446
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1447
-			return
1448
-		} else {
1449
-			dialysisRecord.Stage = 2
1450
-			dialysisRecord.FinishNurse = nurseID
1451
-			dialysisRecord.FinishCreator = adminUserInfo.AdminUser.Id
1452
-			dialysisRecord.FinishModifier = adminUserInfo.AdminUser.Id
1453
-			dialysisRecord.EndTime = endDate.Unix()
1454
-			// 结束时候透析次数加1
1455
-			service.UpdateSolutionByPatientId(patientID)
1442
+	if updateErr != nil {
1443
+		this.ErrorLog("下机失败:%v", updateErr)
1444
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1445
+		return
1446
+	} else {
1447
+		dialysisRecord.Stage = 2
1448
+		dialysisRecord.FinishNurse = nurseID
1449
+		dialysisRecord.FinishCreator = adminUserInfo.AdminUser.Id
1450
+		dialysisRecord.FinishModifier = adminUserInfo.AdminUser.Id
1451
+		dialysisRecord.EndTime = endDate.Unix()
1452
+		// 结束时候透析次数加1
1453
+		service.UpdateSolutionByPatientId(patientID)
1456 1454
 
1457
-			this.ServeSuccessJSON(map[string]interface{}{
1458
-				"dialysis_order":          dialysisRecord,
1459
-				"assessmentAfterDislysis": tempassessmentAfterDislysis,
1460
-			})
1461
-		}
1455
+		this.ServeSuccessJSON(map[string]interface{}{
1456
+			"dialysis_order":          dialysisRecord,
1457
+			"assessmentAfterDislysis": tempassessmentAfterDislysis,
1458
+		})
1462 1459
 	}
1460
+
1463 1461
 }
1464 1462
 
1465 1463
 func (this *DialysisRecordAPIController) ModifyStartDialysis() {

+ 19 - 15
controllers/mobile_api_controllers/patient_api_controller.go Parādīt failu

@@ -1160,23 +1160,27 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1160 1160
 					}
1161 1161
 					if prescribing_number_total <= total {
1162 1162
 						if medical.IsUse == 2 {
1163
-							service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1164
-							//查询默认仓库
1165
-							houseConfig, _ := service.GetAllStoreHouseConfig(medical.OrgId)
1166
-							//查询默认仓库剩余多少库存
1167
-							list, _ := service.GetDrugSumCountByStorehouseId(houseConfig.DrugStorehouseOut, medical.OrgId, medical.ID)
1168
-							var sum_count int64
1169
-							var sum_in_count int64
1170
-							for _, it := range list {
1171
-								baseDrug, _ := service.GetBaseDrugMedical(medical.ID)
1172
-								if it.MaxUnit == baseDrug.MaxUnit {
1173
-									it.StockMaxNumber = it.StockMaxNumber * baseDrug.MinNumber
1174
-									it.WarehousingCount = it.WarehousingCount * baseDrug.MinNumber
1163
+							config, _ := service.GetDrugOpenConfig(adminInfo.Org.Id)
1164
+							if config.IsOpen != 1 {
1165
+								service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1166
+								//查询默认仓库
1167
+								houseConfig, _ := service.GetAllStoreHouseConfig(medical.OrgId)
1168
+								//查询默认仓库剩余多少库存
1169
+								list, _ := service.GetDrugSumCountByStorehouseId(houseConfig.DrugStorehouseOut, medical.OrgId, medical.ID)
1170
+								var sum_count int64
1171
+								var sum_in_count int64
1172
+								for _, it := range list {
1173
+									baseDrug, _ := service.GetBaseDrugMedical(medical.ID)
1174
+									if it.MaxUnit == baseDrug.MaxUnit {
1175
+										it.StockMaxNumber = it.StockMaxNumber * baseDrug.MinNumber
1176
+										it.WarehousingCount = it.WarehousingCount * baseDrug.MinNumber
1177
+									}
1178
+									sum_count += it.StockMaxNumber + it.StockMinNumber
1179
+									sum_in_count += it.WarehousingCount
1175 1180
 								}
1176
-								sum_count += it.StockMaxNumber + it.StockMinNumber
1177
-								sum_in_count += it.WarehousingCount
1181
+								service.UpdateMedicalSumCount(medical.ID, sum_count, sum_in_count, medical.OrgId)
1178 1182
 							}
1179
-							service.UpdateMedicalSumCount(medical.ID, sum_count, sum_in_count, medical.OrgId)
1183
+
1180 1184
 						}
1181 1185
 					}
1182 1186
 				}

+ 25 - 22
controllers/patient_api_controller.go Parādīt failu

@@ -2124,30 +2124,33 @@ func (c *PatientApiController) ExecDoctorAdvice() {
2124 2124
 				}
2125 2125
 				if prescribing_number_total <= total {
2126 2126
 					if medical.IsUse == 2 {
2127
-						service.HisDrugsDelivery(adminUserInfo.CurrentOrgId, item.ExecutionStaff, item)
2128
-
2129
-						//查询默认仓库
2130
-						houseConfig, _ := service.GetAllStoreHouseConfig(item.UserOrgId)
2131
-						//查询默认仓库剩余多少库存
2132
-						list, _ := service.GetDrugSumCountByStorehouseId(houseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
2133
-						var sum_count int64
2134
-						var sum_in_count int64
2135
-						for _, it := range list {
2136
-							baseDrug, _ := service.GetBaseDrugMedical(it.DrugId)
2137
-							if it.MaxUnit == baseDrug.MaxUnit {
2138
-								it.StockMaxNumber = it.StockMaxNumber * baseDrug.MinNumber
2139
-								it.WarehousingCount = it.WarehousingCount * baseDrug.MinNumber
2127
+						config, _ := service.GetDrugOpenConfig(adminUserInfo.CurrentOrgId)
2128
+						if config.IsOpen != 1 {
2129
+							service.HisDrugsDelivery(adminUserInfo.CurrentOrgId, item.ExecutionStaff, item)
2130
+
2131
+							//查询默认仓库
2132
+							houseConfig, _ := service.GetAllStoreHouseConfig(item.UserOrgId)
2133
+							//查询默认仓库剩余多少库存
2134
+							list, _ := service.GetDrugSumCountByStorehouseId(houseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
2135
+							var sum_count int64
2136
+							var sum_in_count int64
2137
+							for _, it := range list {
2138
+								baseDrug, _ := service.GetBaseDrugMedical(it.DrugId)
2139
+								if it.MaxUnit == baseDrug.MaxUnit {
2140
+									it.StockMaxNumber = it.StockMaxNumber * baseDrug.MinNumber
2141
+									it.WarehousingCount = it.WarehousingCount * baseDrug.MinNumber
2142
+								}
2143
+								sum_count += it.StockMaxNumber + it.StockMinNumber
2144
+								sum_in_count += it.WarehousingCount
2140 2145
 							}
2141
-							sum_count += it.StockMaxNumber + it.StockMinNumber
2142
-							sum_in_count += it.WarehousingCount
2146
+							service.UpdateMedicalSumCount(item.DrugId, sum_count, sum_in_count, item.UserOrgId)
2147
+							break
2148
+							c.ServeSuccessJSON(map[string]interface{}{
2149
+								"msg":    "1",
2150
+								"advice": advice,
2151
+							})
2152
+							return
2143 2153
 						}
2144
-						service.UpdateMedicalSumCount(item.DrugId, sum_count, sum_in_count, item.UserOrgId)
2145
-						break
2146
-						c.ServeSuccessJSON(map[string]interface{}{
2147
-							"msg":    "1",
2148
-							"advice": advice,
2149
-						})
2150
-						return
2151 2154
 					}
2152 2155
 
2153 2156
 					if medical.IsUse == 1 {