Browse Source

库存流水展示

XMLWAN 2 years ago
parent
commit
735248a301

+ 238 - 0
controllers/dialysis_api_controller.go View File

333
 	sodium_curve := c.GetString("sodium_curve")
333
 	sodium_curve := c.GetString("sodium_curve")
334
 	dialysis_fluid_flow := c.GetString("dialysis_fluid_flow")
334
 	dialysis_fluid_flow := c.GetString("dialysis_fluid_flow")
335
 	sodium_bicarbonate_flow := c.GetString("sodium_bicarbonate_flow")
335
 	sodium_bicarbonate_flow := c.GetString("sodium_bicarbonate_flow")
336
+	prescription_water, _ := c.GetFloat("prescription_water")
337
+	dialysis_strainer := c.GetString("dialysis_strainer")
336
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
338
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
337
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
339
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
338
 
340
 
448
 		SodiumCurve:                sodium_curve,
450
 		SodiumCurve:                sodium_curve,
449
 		DialysisFluidFlow:          dialysis_fluid_flow,
451
 		DialysisFluidFlow:          dialysis_fluid_flow,
450
 		SodiumBicarbonateFlow:      sodium_bicarbonate_flow,
452
 		SodiumBicarbonateFlow:      sodium_bicarbonate_flow,
453
+		PrescriptionWater:          prescription_water,
454
+		DialysisStrainer:           dialysis_strainer,
451
 	}
455
 	}
452
 
456
 
453
 	//长沙南雅医院,自动生成抗凝剂的临时处方
457
 	//长沙南雅医院,自动生成抗凝剂的临时处方
835
 	sodium_curve := c.GetString("sodium_curve")
839
 	sodium_curve := c.GetString("sodium_curve")
836
 	dialysis_fluid_flow := c.GetString("dialysis_fluid_flow")
840
 	dialysis_fluid_flow := c.GetString("dialysis_fluid_flow")
837
 	sodium_bicarbonate_flow := c.GetString("sodium_bicarbonate_flow")
841
 	sodium_bicarbonate_flow := c.GetString("sodium_bicarbonate_flow")
842
+	prescription_water, _ := c.GetFloat("prescription_water")
843
+	dialysis_strainer := c.GetString("dialysis_strainer")
838
 	var prescription_doctor int64
844
 	var prescription_doctor int64
839
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
845
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
840
 
846
 
970
 		TreatmentRemark:            treatment_remark,
976
 		TreatmentRemark:            treatment_remark,
971
 		DialysisFluidFlow:          dialysis_fluid_flow,
977
 		DialysisFluidFlow:          dialysis_fluid_flow,
972
 		SodiumBicarbonateFlow:      sodium_bicarbonate_flow,
978
 		SodiumBicarbonateFlow:      sodium_bicarbonate_flow,
979
+		PrescriptionWater:          prescription_water,
980
+		DialysisStrainer:           dialysis_strainer,
973
 	}
981
 	}
974
 
982
 
975
 	//查询最近透析准备表里是否存在 透析器 灌流器
983
 	//查询最近透析准备表里是否存在 透析器 灌流器
1148
 		TreatmentRemark:            treatment_remark,
1156
 		TreatmentRemark:            treatment_remark,
1149
 		DialysisFluidFlow:          dialysis_fluid_flow,
1157
 		DialysisFluidFlow:          dialysis_fluid_flow,
1150
 		SodiumBicarbonateFlow:      sodium_bicarbonate_flow,
1158
 		SodiumBicarbonateFlow:      sodium_bicarbonate_flow,
1159
+		PrescriptionWater:          prescribing_number,
1160
+		DialysisStrainer:           dialysis_strainer,
1151
 	}
1161
 	}
1152
 
1162
 
1153
 	//针对河间咸得
1163
 	//针对河间咸得
1959
 		}
1969
 		}
1960
 
1970
 
1961
 		err := service.AddSigleAssessmentBeforeDislysisRecord(&assessmentBeforeDislysis)
1971
 		err := service.AddSigleAssessmentBeforeDislysisRecord(&assessmentBeforeDislysis)
1972
+
1973
+		if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 10469 {
1974
+			fmt.Println("进来--------------------------------------")
1975
+			fmt.Println("evaluation.WeightBefore", weight_before)
1976
+			fmt.Println(" evaluation.DryWeight", dry_weight)
1977
+			var dewater_amount float64
1978
+			dewater_amount = 0
1979
+			if dry_weight > 0 {
1980
+				dewater_amount = weight_before - dry_weight - additional_weight
1981
+
1982
+				dewater_amount = dewater_amount * 1000
1983
+
1984
+				if dewater_amount <= 0 {
1985
+					dewater_amount = 0
1986
+				}
1987
+			} else {
1988
+				dewater_amount = 0
1989
+			}
1990
+
1991
+			// 计算透析处方的相关超滤量
1992
+			schedual, _ := service.MobileGetSchedualDetailSix(adminUserInfo.CurrentOrgId, patient, recordDate.Unix())
1993
+			var lastDialysisPrescribe *models.DialysisPrescription
1994
+			var dialysisSolution *models.DialysisSolution
1995
+			var dialysisPrescribe *models.DialysisPrescription
1996
+			var mode_id int64
1997
+			if schedual != nil {
1998
+				dialysisPrescribe, _ = service.MobileGetDialysisPrescribeByModeIdSix(adminUserInfo.CurrentOrgId, patient, recordDate.Unix(), schedual.ModeId)
1999
+				if dialysisPrescribe == nil {
2000
+					dialysisPrescribe, _ = service.MobileGetDialysisPrescribe(adminUserInfo.CurrentOrgId, patient, recordDate.Unix())
2001
+				}
2002
+				lastDialysisPrescribe, _ = service.MobileGetLastDialysisPrescribeByModeIdSix(adminUserInfo.CurrentOrgId, patient, schedual.ModeId)
2003
+				// 获取透析模版
2004
+				dialysisSolution, _ = service.MobileGetDialysisSolutionByModeIdSix(adminUserInfo.CurrentOrgId, patient, schedual.ModeId)
2005
+				mode_id = schedual.ModeId
2006
+			} else {
2007
+				//lastDialysisPrescribe, _ = service.MobileGetLastDialysisPrescribe(adminUserInfo.Org.Id, id,schedual.ModeId)
2008
+				// 获取透析模版
2009
+				dialysisPrescribe, _ = service.MobileGetDialysisPrescribe(adminUserInfo.CurrentOrgId, patient, recordDate.Unix())
2010
+				dialysisSolution, _ = service.MobileGetDialysisSolution(adminUserInfo.CurrentOrgId, patient)
2011
+
2012
+				if dialysisPrescribe == nil && dialysisSolution != nil {
2013
+					mode_id = dialysisSolution.ModeId
2014
+				}
2015
+
2016
+				if dialysisPrescribe == nil && dialysisSolution == nil {
2017
+					mode_id = 0
2018
+				}
2019
+			}
2020
+
2021
+			// 插入透析处方
2022
+			if dialysisPrescribe == nil && dialysisSolution != nil {
2023
+				var newprescribe models.DialysisPrescription
2024
+				newprescribe.UserOrgId = dialysisSolution.UserOrgId
2025
+				newprescribe.PatientId = dialysisSolution.PatientId
2026
+				newprescribe.Anticoagulant = dialysisSolution.Anticoagulant
2027
+				newprescribe.AnticoagulantShouji = dialysisSolution.AnticoagulantShouji
2028
+				newprescribe.AnticoagulantWeichi = dialysisSolution.AnticoagulantWeichi
2029
+				newprescribe.AnticoagulantZongliang = dialysisSolution.AnticoagulantZongliang
2030
+				newprescribe.AnticoagulantGaimingcheng = dialysisSolution.AnticoagulantGaimingcheng
2031
+				newprescribe.AnticoagulantGaijiliang = dialysisSolution.AnticoagulantGaijiliang
2032
+				newprescribe.ModeId = dialysisSolution.ModeId
2033
+				newprescribe.DialysisDuration = dialysisSolution.DialysisDuration
2034
+				newprescribe.ReplacementWay = dialysisSolution.ReplacementWay
2035
+				newprescribe.HemodialysisMachine = dialysisSolution.HemodialysisMachine
2036
+				newprescribe.BloodFilter = dialysisSolution.BloodFilter
2037
+				newprescribe.PerfusionApparatus = dialysisSolution.PerfusionApparatus
2038
+				newprescribe.BloodFlowVolume = dialysisSolution.BloodFlowVolume
2039
+				newprescribe.DisplaceLiqui = dialysisSolution.DisplaceLiqui
2040
+				newprescribe.Glucose = dialysisSolution.Glucose
2041
+				newprescribe.DialysateFlow = dialysisSolution.DialysateFlow
2042
+				newprescribe.Kalium = dialysisSolution.Kalium
2043
+				newprescribe.Sodium = dialysisSolution.Sodium
2044
+				newprescribe.Calcium = dialysisSolution.Calcium
2045
+				newprescribe.Bicarbonate = dialysisSolution.Bicarbonate
2046
+				newprescribe.DialysateTemperature = dialysisSolution.DialysateTemperature
2047
+				newprescribe.Conductivity = dialysisSolution.Conductivity
2048
+				newprescribe.BodyFluid = dialysisSolution.BodyFluid
2049
+				newprescribe.SpecialMedicine = dialysisSolution.SpecialMedicine
2050
+				newprescribe.SpecialMedicineOther = dialysisSolution.SpecialMedicineOther
2051
+				newprescribe.DisplaceLiquiPart = dialysisSolution.DisplaceLiquiPart
2052
+				newprescribe.DisplaceLiquiValue = dialysisSolution.DisplaceLiquiValue
2053
+				newprescribe.BloodAccess = dialysisSolution.BloodAccess
2054
+				newprescribe.Ultrafiltration = dialysisSolution.Ultrafiltration
2055
+				newprescribe.DialysisDurationHour = dialysisSolution.DialysisDurationHour
2056
+				newprescribe.DialysisDurationMinute = dialysisSolution.DialysisDurationMinute
2057
+				newprescribe.TargetUltrafiltration = dialysisSolution.TargetUltrafiltration
2058
+				newprescribe.DialysateFormulation = dialysisSolution.DialysateFormulation
2059
+				newprescribe.Dialyzer = dialysisSolution.Dialyzer
2060
+				newprescribe.ReplacementTotal = dialysisSolution.ReplacementTotal
2061
+				newprescribe.DialyzerPerfusionApparatus = dialysisSolution.DialyzerPerfusionApparatus
2062
+				newprescribe.BodyFluidOther = dialysisSolution.BodyFluidOther
2063
+				newprescribe.TargetKtv = dialysisSolution.TargetKtv
2064
+
2065
+				newprescribe.CreatedTime = time.Now().Unix()
2066
+				newprescribe.UpdatedTime = time.Now().Unix()
2067
+				newprescribe.RecordDate = recordDate.Unix()
2068
+				newprescribe.DewaterAmount = dewater_amount
2069
+				newprescribe.TargetUltrafiltration = dewater_amount
2070
+				newprescribe.Status = 1
2071
+
2072
+				err := service.AddSigleRecord(&newprescribe)
2073
+				if err != nil {
2074
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
2075
+				}
2076
+			}
2077
+
2078
+			if dialysisPrescribe == nil && dialysisSolution == nil {
2079
+				if lastDialysisPrescribe != nil {
2080
+					var newprescribe models.DialysisPrescription
2081
+					newprescribe.UserOrgId = lastDialysisPrescribe.UserOrgId
2082
+					newprescribe.PatientId = lastDialysisPrescribe.PatientId
2083
+					newprescribe.Anticoagulant = lastDialysisPrescribe.Anticoagulant
2084
+					newprescribe.AnticoagulantShouji = lastDialysisPrescribe.AnticoagulantShouji
2085
+					newprescribe.AnticoagulantWeichi = lastDialysisPrescribe.AnticoagulantWeichi
2086
+					newprescribe.AnticoagulantZongliang = lastDialysisPrescribe.AnticoagulantZongliang
2087
+					newprescribe.AnticoagulantGaimingcheng = lastDialysisPrescribe.AnticoagulantGaimingcheng
2088
+					newprescribe.AnticoagulantGaijiliang = lastDialysisPrescribe.AnticoagulantGaijiliang
2089
+					newprescribe.ModeId = lastDialysisPrescribe.ModeId
2090
+					newprescribe.DialysisDuration = lastDialysisPrescribe.DialysisDuration
2091
+					newprescribe.ReplacementWay = lastDialysisPrescribe.ReplacementWay
2092
+					newprescribe.HemodialysisMachine = lastDialysisPrescribe.HemodialysisMachine
2093
+					newprescribe.BloodFilter = lastDialysisPrescribe.BloodFilter
2094
+					newprescribe.PerfusionApparatus = lastDialysisPrescribe.PerfusionApparatus
2095
+					newprescribe.BloodFlowVolume = lastDialysisPrescribe.BloodFlowVolume
2096
+					newprescribe.DisplaceLiqui = lastDialysisPrescribe.DisplaceLiqui
2097
+					newprescribe.Glucose = lastDialysisPrescribe.Glucose
2098
+					newprescribe.DialysateFlow = lastDialysisPrescribe.DialysateFlow
2099
+					newprescribe.Kalium = lastDialysisPrescribe.Kalium
2100
+					newprescribe.Sodium = lastDialysisPrescribe.Sodium
2101
+					newprescribe.Calcium = lastDialysisPrescribe.Calcium
2102
+					newprescribe.Bicarbonate = lastDialysisPrescribe.Bicarbonate
2103
+					newprescribe.DialysateTemperature = lastDialysisPrescribe.DialysateTemperature
2104
+					newprescribe.Conductivity = lastDialysisPrescribe.Conductivity
2105
+					newprescribe.BodyFluid = lastDialysisPrescribe.BodyFluid
2106
+					newprescribe.SpecialMedicine = lastDialysisPrescribe.SpecialMedicine
2107
+					newprescribe.SpecialMedicineOther = lastDialysisPrescribe.SpecialMedicineOther
2108
+					newprescribe.DisplaceLiquiPart = lastDialysisPrescribe.DisplaceLiquiPart
2109
+					newprescribe.DisplaceLiquiValue = lastDialysisPrescribe.DisplaceLiquiValue
2110
+					newprescribe.BloodAccess = lastDialysisPrescribe.BloodAccess
2111
+					newprescribe.Ultrafiltration = lastDialysisPrescribe.Ultrafiltration
2112
+					newprescribe.DialysisDurationHour = lastDialysisPrescribe.DialysisDurationHour
2113
+					newprescribe.DialysisDurationMinute = lastDialysisPrescribe.DialysisDurationMinute
2114
+					newprescribe.DialysateFormulation = lastDialysisPrescribe.DialysateFormulation
2115
+					newprescribe.Dialyzer = lastDialysisPrescribe.Dialyzer
2116
+					newprescribe.ReplacementTotal = lastDialysisPrescribe.ReplacementTotal
2117
+					newprescribe.DialyzerPerfusionApparatus = lastDialysisPrescribe.DialyzerPerfusionApparatus
2118
+					newprescribe.BodyFluidOther = lastDialysisPrescribe.BodyFluidOther
2119
+					newprescribe.TargetKtv = lastDialysisPrescribe.TargetKtv
2120
+					newprescribe.CreatedTime = time.Now().Unix()
2121
+					newprescribe.UpdatedTime = time.Now().Unix()
2122
+					newprescribe.RecordDate = recordDate.Unix()
2123
+					newprescribe.DewaterAmount = dewater_amount
2124
+					newprescribe.TargetUltrafiltration = dewater_amount
2125
+					newprescribe.Status = 1
2126
+					newprescribe.Creater = adminUserInfo.AdminUser.Id
2127
+					newprescribe.PrescriptionDoctor = adminUserInfo.AdminUser.Id
2128
+
2129
+					err := service.AddSigleRecord(&newprescribe)
2130
+					key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
2131
+					redis := service.RedisClient()
2132
+					defer redis.Close()
2133
+					//清空key 值
2134
+					redis.Set(key, "", time.Second)
2135
+
2136
+					keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":prescriptions_list_all"
2137
+					redis.Set(keyOne, "", time.Second)
2138
+					keyThree := "scheduals_" + recordDateStr + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
2139
+					redis.Set(keyThree, "", time.Second)
2140
+					if err != nil {
2141
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
2142
+					}
2143
+				} else {
2144
+					var newprescribe models.DialysisPrescription
2145
+					newprescribe.UserOrgId = adminUserInfo.CurrentOrgId
2146
+					newprescribe.PatientId = patient
2147
+					newprescribe.ModeId = mode_id
2148
+					newprescribe.CreatedTime = time.Now().Unix()
2149
+					newprescribe.UpdatedTime = time.Now().Unix()
2150
+					newprescribe.RecordDate = recordDate.Unix()
2151
+					newprescribe.DewaterAmount = dewater_amount
2152
+					newprescribe.TargetUltrafiltration = dewater_amount
2153
+					newprescribe.Status = 1
2154
+					newprescribe.Creater = adminUserInfo.AdminUser.Id
2155
+					newprescribe.PrescriptionDoctor = adminUserInfo.AdminUser.Id
2156
+					newprescribe.Modifier = adminUserInfo.AdminUser.Id
2157
+
2158
+					err := service.AddSigleRecord(&newprescribe)
2159
+					key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
2160
+					redis := service.RedisClient()
2161
+					defer redis.Close()
2162
+					//清空key 值
2163
+					redis.Set(key, "", time.Second)
2164
+
2165
+					keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":prescriptions_list_all"
2166
+					redis.Set(keyOne, "", time.Second)
2167
+					keyThree := "scheduals_" + recordDateStr + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
2168
+					redis.Set(keyThree, "", time.Second)
2169
+					if err != nil {
2170
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
2171
+					}
2172
+				}
2173
+			}
2174
+
2175
+		}
2176
+
1962
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_before_dislysis"
2177
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_before_dislysis"
1963
 		redis := service.RedisClient()
2178
 		redis := service.RedisClient()
1964
 
2179
 
1971
 		keyTwo := "scheduals_" + recordDateStr + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
2186
 		keyTwo := "scheduals_" + recordDateStr + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
1972
 		redis.Set(keyTwo, "", time.Second)
2187
 		redis.Set(keyTwo, "", time.Second)
1973
 		defer redis.Close()
2188
 		defer redis.Close()
2189
+
1974
 		if err == nil {
2190
 		if err == nil {
1975
 			c.ServeSuccessJSON(map[string]interface{}{
2191
 			c.ServeSuccessJSON(map[string]interface{}{
1976
 				"assessmentBeforeDislysis": &assessmentBeforeDislysis,
2192
 				"assessmentBeforeDislysis": &assessmentBeforeDislysis,
2164
 				newprescribe.Status = 1
2380
 				newprescribe.Status = 1
2165
 
2381
 
2166
 				err := service.AddSigleRecord(&newprescribe)
2382
 				err := service.AddSigleRecord(&newprescribe)
2383
+
2384
+				key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
2385
+				redis := service.RedisClient()
2386
+				defer redis.Close()
2387
+				//清空key 值
2388
+				redis.Set(key, "", time.Second)
2389
+
2390
+				keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":prescriptions_list_all"
2391
+				redis.Set(keyOne, "", time.Second)
2392
+				keyThree := "scheduals_" + recordDateStr + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
2393
+				redis.Set(keyThree, "", time.Second)
2167
 				if err != nil {
2394
 				if err != nil {
2168
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
2395
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
2169
 				}
2396
 				}
2180
 				newprescribe.Status = 1
2407
 				newprescribe.Status = 1
2181
 
2408
 
2182
 				err := service.AddSigleRecord(&newprescribe)
2409
 				err := service.AddSigleRecord(&newprescribe)
2410
+				key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
2411
+				redis := service.RedisClient()
2412
+				defer redis.Close()
2413
+				//清空key 值
2414
+				redis.Set(key, "", time.Second)
2415
+
2416
+				keyOne := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":prescriptions_list_all"
2417
+				redis.Set(keyOne, "", time.Second)
2418
+				keyThree := "scheduals_" + recordDateStr + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
2419
+				redis.Set(keyThree, "", time.Second)
2183
 				if err != nil {
2420
 				if err != nil {
2184
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
2421
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
2185
 				}
2422
 				}
2197
 		defer redis.Close()
2434
 		defer redis.Close()
2198
 		keyTwo := "scheduals_" + recordDateStr + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
2435
 		keyTwo := "scheduals_" + recordDateStr + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
2199
 		redis.Set(keyTwo, "", time.Second)
2436
 		redis.Set(keyTwo, "", time.Second)
2437
+
2200
 		if err == nil {
2438
 		if err == nil {
2201
 			c.ServeSuccessJSON(map[string]interface{}{
2439
 			c.ServeSuccessJSON(map[string]interface{}{
2202
 				"assessmentBeforeDislysis": &assessmentBeforeDislysis,
2440
 				"assessmentBeforeDislysis": &assessmentBeforeDislysis,

+ 10 - 8
controllers/doctors_api_controller.go View File

1463
 
1463
 
1464
 func (c *DoctorsApiController) CreateFirstDisease() {
1464
 func (c *DoctorsApiController) CreateFirstDisease() {
1465
 
1465
 
1466
-	timeLayout := "2006-01-02"
1467
-	loc, _ := time.LoadLocation("Local")
1466
+	//timeLayout := "2006-01-02"
1467
+	//loc, _ := time.LoadLocation("Local")
1468
 	dataBody := make(map[string]interface{}, 0)
1468
 	dataBody := make(map[string]interface{}, 0)
1469
 	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
1469
 	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
1470
 	fmt.Print("err", err)
1470
 	fmt.Print("err", err)
1471
 
1471
 
1472
 	doctor := int64(dataBody["doctor"].(float64))
1472
 	doctor := int64(dataBody["doctor"].(float64))
1473
 	record_date := dataBody["record_date"].(string)
1473
 	record_date := dataBody["record_date"].(string)
1474
-	recordDates, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
1474
+
1475
+	recordDates, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", record_date)
1475
 	recordtime := recordDates.Unix()
1476
 	recordtime := recordDates.Unix()
1477
+
1476
 	patient_id := int64(dataBody["patient_id"].(float64))
1478
 	patient_id := int64(dataBody["patient_id"].(float64))
1477
 	title := dataBody["title"].(string)
1479
 	title := dataBody["title"].(string)
1478
 	main_content := dataBody["main_content"].(string)
1480
 	main_content := dataBody["main_content"].(string)
1501
 	}
1503
 	}
1502
 
1504
 
1503
 	error := service.CreatePatientFirstDisease(firstdisease)
1505
 	error := service.CreatePatientFirstDisease(firstdisease)
1504
-	fmt.Println("err-------", error)
1506
+
1505
 	if error == nil {
1507
 	if error == nil {
1506
 		c.ServeSuccessJSON(map[string]interface{}{
1508
 		c.ServeSuccessJSON(map[string]interface{}{
1507
 			"firstDisease": firstdisease,
1509
 			"firstDisease": firstdisease,
1521
 	startime := dischargeTimes.Unix()
1523
 	startime := dischargeTimes.Unix()
1522
 
1524
 
1523
 	end_time := c.GetString("end_time")
1525
 	end_time := c.GetString("end_time")
1524
-	endTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
1526
+	endTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
1525
 	endtime := endTimes.Unix()
1527
 	endtime := endTimes.Unix()
1526
 	list, err := service.GetPatientDiseaseList(orgId, patient_id, startime, endtime)
1528
 	list, err := service.GetPatientDiseaseList(orgId, patient_id, startime, endtime)
1527
 	if err == nil {
1529
 	if err == nil {
1546
 
1548
 
1547
 func (c *DoctorsApiController) UpdateFirstDisease() {
1549
 func (c *DoctorsApiController) UpdateFirstDisease() {
1548
 
1550
 
1549
-	timeLayout := "2006-01-02"
1550
-	loc, _ := time.LoadLocation("Local")
1551
+	//timeLayout := "2006-01-02"
1552
+	//loc, _ := time.LoadLocation("Local")
1551
 	dataBody := make(map[string]interface{}, 0)
1553
 	dataBody := make(map[string]interface{}, 0)
1552
 	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
1554
 	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
1553
 	fmt.Print("err", err)
1555
 	fmt.Print("err", err)
1554
 	id := int64(dataBody["id"].(float64))
1556
 	id := int64(dataBody["id"].(float64))
1555
 	doctor := int64(dataBody["doctor"].(float64))
1557
 	doctor := int64(dataBody["doctor"].(float64))
1556
 	record_date := dataBody["record_date"].(string)
1558
 	record_date := dataBody["record_date"].(string)
1557
-	recordDates, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
1559
+	recordDates, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", record_date)
1558
 	recordtime := recordDates.Unix()
1560
 	recordtime := recordDates.Unix()
1559
 	patient_id := int64(dataBody["patient_id"].(float64))
1561
 	patient_id := int64(dataBody["patient_id"].(float64))
1560
 	title := dataBody["title"].(string)
1562
 	title := dataBody["title"].(string)

+ 18 - 5
controllers/his_api_controller.go View File

2872
 						count, _ := strconv.ParseInt(item.Count, 10, 64)
2872
 						count, _ := strconv.ParseInt(item.Count, 10, 64)
2873
 						total_count += count
2873
 						total_count += count
2874
 
2874
 
2875
-						goodList, _ := service.GetSumGoodList(c.GetAdminUserInfo().CurrentOrgId, houseConfig.StorehouseOutInfo, item.ProjectId)
2876
-						var flush_count int64
2877
-						for _, it := range goodList {
2878
-							flush_count += it.StockCount
2879
-						}
2880
 						if info.ID > 0 {
2875
 						if info.ID > 0 {
2881
 							if info.Count >= total_count {
2876
 							if info.Count >= total_count {
2882
 
2877
 
2883
 								//回退库存
2878
 								//回退库存
2884
 								service.UpDateWarehouseInfoByStockDelete(info.WarehouseInfotId, total_count, info.PatientId, info.SysRecordTime, item.ProjectId)
2879
 								service.UpDateWarehouseInfoByStockDelete(info.WarehouseInfotId, total_count, info.PatientId, info.SysRecordTime, item.ProjectId)
2880
+								goodList, _ := service.GetSumGoodList(c.GetAdminUserInfo().CurrentOrgId, houseConfig.StorehouseOutInfo, item.ProjectId)
2881
+								var flush_count int64
2882
+								for _, it := range goodList {
2883
+									flush_count += it.StockCount
2884
+								}
2885
 								cancelStockInfo := models.CancelStockInfo{
2885
 								cancelStockInfo := models.CancelStockInfo{
2886
 									GoodId:          item.ProjectId,
2886
 									GoodId:          item.ProjectId,
2887
 									CancelStockId:   cancel.ID,
2887
 									CancelStockId:   cancel.ID,
2956
 							if info.Count < total_count {
2956
 							if info.Count < total_count {
2957
 								//回退库存
2957
 								//回退库存
2958
 								service.UpDateWarehouseInfoByStockDelete(info.WarehouseInfotId, info.Count, info.PatientId, info.SysRecordTime, item.ProjectId)
2958
 								service.UpDateWarehouseInfoByStockDelete(info.WarehouseInfotId, info.Count, info.PatientId, info.SysRecordTime, item.ProjectId)
2959
+								goodList, _ := service.GetSumGoodList(c.GetAdminUserInfo().CurrentOrgId, houseConfig.StorehouseOutInfo, item.ProjectId)
2960
+								var flush_count int64
2961
+								for _, it := range goodList {
2962
+									flush_count += it.StockCount
2963
+								}
2959
 								cancelStockInfo := models.CancelStockInfo{
2964
 								cancelStockInfo := models.CancelStockInfo{
2960
 									GoodId:          item.ProjectId,
2965
 									GoodId:          item.ProjectId,
2961
 									CancelStockId:   cancel.ID,
2966
 									CancelStockId:   cancel.ID,
3027
 								service.UpdateSumCount(c.GetAdminUserInfo().CurrentOrgId, houseConfig.StorehouseOutInfo, item.ProjectId, info.Count)
3032
 								service.UpdateSumCount(c.GetAdminUserInfo().CurrentOrgId, houseConfig.StorehouseOutInfo, item.ProjectId, info.Count)
3028
 							}
3033
 							}
3029
 
3034
 
3035
+							goodList, _ := service.GetSumGoodList(c.GetAdminUserInfo().CurrentOrgId, houseConfig.StorehouseOutInfo, item.ProjectId)
3036
+							var flush_count int64
3037
+							for _, it := range goodList {
3038
+								flush_count += it.StockCount
3039
+							}
3040
+
3030
 							//查询已出库数量
3041
 							//查询已出库数量
3031
 							dialysisInfo, _ := service.GetGoodDialysisOutInfoSix(c.GetAdminUserInfo().CurrentOrgId, info.PatientId, info.SysRecordTime, item.ProjectId)
3042
 							dialysisInfo, _ := service.GetGoodDialysisOutInfoSix(c.GetAdminUserInfo().CurrentOrgId, info.PatientId, info.SysRecordTime, item.ProjectId)
3032
 
3043
 
3697
 					//查询已出库数量
3708
 					//查询已出库数量
3698
 					dialysisInfo, _ := service.GetGoodDialysisOutInfoSix(adminInfo.CurrentOrgId, info.PatientId, info.SysRecordTime, project.ProjectId)
3709
 					dialysisInfo, _ := service.GetGoodDialysisOutInfoSix(adminInfo.CurrentOrgId, info.PatientId, info.SysRecordTime, project.ProjectId)
3699
 
3710
 
3711
+					fmt.Println("aiwohonguo --------------------", prescribingNumber)
3712
+					fmt.Println("aiwohonguo --------------------", dialysisInfo.Count)
3700
 					if prescribingNumber < dialysisInfo.Count {
3713
 					if prescribingNumber < dialysisInfo.Count {
3701
 						//改变数量
3714
 						//改变数量
3702
 						service.UpdateAutoGood(adminInfo.CurrentOrgId, info.PatientId, info.SysRecordTime, project.ProjectId, id, prescribingNumber)
3715
 						service.UpdateAutoGood(adminInfo.CurrentOrgId, info.PatientId, info.SysRecordTime, project.ProjectId, id, prescribingNumber)

+ 10 - 0
controllers/mobile_api_controllers/dialysis_api_controller.go View File

1464
 	treatment_remark := c.GetString("treatment_remark")
1464
 	treatment_remark := c.GetString("treatment_remark")
1465
 	dialysis_fluid_flow := c.GetString("dialysis_fluid_flow")
1465
 	dialysis_fluid_flow := c.GetString("dialysis_fluid_flow")
1466
 	sodium_bicarbonate_flow := c.GetString("sodium_bicarbonate_flow")
1466
 	sodium_bicarbonate_flow := c.GetString("sodium_bicarbonate_flow")
1467
+	prescription_water, _ := c.GetFloat("prescription_water")
1468
+	dialysis_strainer := c.GetString("dialysis_strainer")
1467
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1469
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1468
 
1470
 
1469
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
1471
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
1596
 		PrescriptionSodium:         prescription_sodium,
1598
 		PrescriptionSodium:         prescription_sodium,
1597
 		DialysisFluidFlow:          dialysis_fluid_flow,
1599
 		DialysisFluidFlow:          dialysis_fluid_flow,
1598
 		SodiumBicarbonateFlow:      sodium_bicarbonate_flow,
1600
 		SodiumBicarbonateFlow:      sodium_bicarbonate_flow,
1601
+		PrescriptionWater:          prescription_water,
1602
+		DialysisStrainer:           dialysis_strainer,
1599
 	}
1603
 	}
1600
 
1604
 
1601
 	//查询最近透析准备表里是否存在 透析器 灌流器
1605
 	//查询最近透析准备表里是否存在 透析器 灌流器
3015
 	dialysis_remark := c.GetString("dialysis_remark")
3019
 	dialysis_remark := c.GetString("dialysis_remark")
3016
 	dialysis_fluid_flow := c.GetString("dialysis_fluid_flow")
3020
 	dialysis_fluid_flow := c.GetString("dialysis_fluid_flow")
3017
 	sodium_bicarbonate_flow := c.GetString("sodium_bicarbonate_flow")
3021
 	sodium_bicarbonate_flow := c.GetString("sodium_bicarbonate_flow")
3022
+	prescription_water, _ := c.GetFloat("prescription_water")
3023
+	dialysis_strainer := c.GetString("dialysis_strainer")
3018
 	if mode_id > 0 {
3024
 	if mode_id > 0 {
3019
 
3025
 
3020
 		var str string
3026
 		var str string
3145
 		TreatmentRemark:            treatment_remark,
3151
 		TreatmentRemark:            treatment_remark,
3146
 		DialysisFluidFlow:          dialysis_fluid_flow,
3152
 		DialysisFluidFlow:          dialysis_fluid_flow,
3147
 		SodiumBicarbonateFlow:      sodium_bicarbonate_flow,
3153
 		SodiumBicarbonateFlow:      sodium_bicarbonate_flow,
3154
+		PrescriptionWater:          prescription_water,
3155
+		DialysisStrainer:           dialysis_strainer,
3148
 	}
3156
 	}
3149
 
3157
 
3150
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
3158
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
3251
 		TreatmentRemark:            treatment_remark,
3259
 		TreatmentRemark:            treatment_remark,
3252
 		SodiumBicarbonateFlow:      sodium_bicarbonate_flow,
3260
 		SodiumBicarbonateFlow:      sodium_bicarbonate_flow,
3253
 		DialysisFluidFlow:          dialysis_fluid_flow,
3261
 		DialysisFluidFlow:          dialysis_fluid_flow,
3262
+		PrescriptionWater:          prescription_water,
3263
+		DialysisStrainer:           dialysis_strainer,
3254
 	}
3264
 	}
3255
 
3265
 
3256
 	//针对河间咸的
3266
 	//针对河间咸的

+ 1 - 1
controllers/mobile_api_controllers/patient_api_controller.go View File

1679
 	if evaluation.DryWeight > 0 {
1679
 	if evaluation.DryWeight > 0 {
1680
 		dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
1680
 		dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
1681
 
1681
 
1682
-		if template.TemplateId == 17 || template.TemplateId == 22 || template.TemplateId == 21 || template.TemplateId == 26 || template.TemplateId == 34 || template.TemplateId == 32 {
1682
+		if template.TemplateId == 17 || template.TemplateId == 22 || template.TemplateId == 21 || template.TemplateId == 26 || template.TemplateId == 34 || template.TemplateId == 32 || adminUserInfo.Org.Id == 10469 || adminUserInfo.Org.Id == 3877 {
1683
 			dewater_amount = dewater_amount * 1000
1683
 			dewater_amount = dewater_amount * 1000
1684
 
1684
 
1685
 		}
1685
 		}

+ 7 - 4
controllers/print_data_api_controller.go View File

37
 	idStrs := strings.Split(schIDStr, ",")
37
 	idStrs := strings.Split(schIDStr, ",")
38
 	adminUserInfo := this.GetAdminUserInfo()
38
 	adminUserInfo := this.GetAdminUserInfo()
39
 
39
 
40
-	if this.GetAdminUserInfo().CurrentOrgId == 10016 || this.GetAdminUserInfo().CurrentOrgId == 9882 || this.GetAdminUserInfo().CurrentOrgId == 10138 || this.GetAdminUserInfo().CurrentOrgId == 10278 || this.GetAdminUserInfo().CurrentOrgId == 9841 || this.GetAdminUserInfo().CurrentOrgId == 9845 || this.GetAdminUserInfo().CurrentOrgId == 10081 || this.GetAdminUserInfo().CurrentOrgId == 10215 {
40
+	if this.GetAdminUserInfo().CurrentOrgId == 10016 || this.GetAdminUserInfo().CurrentOrgId == 9882 || this.GetAdminUserInfo().CurrentOrgId == 10138 || this.GetAdminUserInfo().CurrentOrgId == 10278 || this.GetAdminUserInfo().CurrentOrgId == 9841 || this.GetAdminUserInfo().CurrentOrgId == 9845 || this.GetAdminUserInfo().CurrentOrgId == 10081 || this.GetAdminUserInfo().CurrentOrgId == 10215 || this.GetAdminUserInfo().CurrentOrgId == 10121 || this.GetAdminUserInfo().CurrentOrgId == 10234 {
41
 		schedules, getScheduleErr := service.GetSchedulesSeven(adminUserInfo.CurrentOrgId, idStrs)
41
 		schedules, getScheduleErr := service.GetSchedulesSeven(adminUserInfo.CurrentOrgId, idStrs)
42
 		for _, item := range schedules {
42
 		for _, item := range schedules {
43
 
43
 
136
 		})
136
 		})
137
 	}
137
 	}
138
 
138
 
139
-	if this.GetAdminUserInfo().CurrentOrgId != 10016 && this.GetAdminUserInfo().CurrentOrgId != 9882 && this.GetAdminUserInfo().CurrentOrgId != 10138 && this.GetAdminUserInfo().CurrentOrgId != 10278 && this.GetAdminUserInfo().CurrentOrgId != 9841 && this.GetAdminUserInfo().CurrentOrgId != 9845 && this.GetAdminUserInfo().CurrentOrgId != 10081 && this.GetAdminUserInfo().CurrentOrgId != 10215 {
139
+	if this.GetAdminUserInfo().CurrentOrgId != 10016 && this.GetAdminUserInfo().CurrentOrgId != 9882 && this.GetAdminUserInfo().CurrentOrgId != 10138 && this.GetAdminUserInfo().CurrentOrgId != 10278 && this.GetAdminUserInfo().CurrentOrgId != 9841 && this.GetAdminUserInfo().CurrentOrgId != 9845 && this.GetAdminUserInfo().CurrentOrgId != 10081 && this.GetAdminUserInfo().CurrentOrgId != 10215 && this.GetAdminUserInfo().CurrentOrgId != 10121 && this.GetAdminUserInfo().CurrentOrgId != 10234 {
140
 		schedules, getScheduleErr := service.GetSchedules(adminUserInfo.CurrentOrgId, idStrs)
140
 		schedules, getScheduleErr := service.GetSchedules(adminUserInfo.CurrentOrgId, idStrs)
141
 		for _, item := range schedules {
141
 		for _, item := range schedules {
142
 			list, _ := service.GetDialysisOrderCountSeven(item.PatientID, item.ScheduleDate)
142
 			list, _ := service.GetDialysisOrderCountSeven(item.PatientID, item.ScheduleDate)
257
 
257
 
258
 	//patient, _ := service.FindPatientWithDeviceById(adminUserInfo.CurrentOrgId, patient_id)
258
 	//patient, _ := service.FindPatientWithDeviceById(adminUserInfo.CurrentOrgId, patient_id)
259
 	patient, _ := service.GetPatientDetail(adminUserInfo.CurrentOrgId, patient_id)
259
 	patient, _ := service.GetPatientDetail(adminUserInfo.CurrentOrgId, patient_id)
260
+
261
+	adminUser, _ := service.GetAllAdminUsers(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
260
 	if err != nil {
262
 	if err != nil {
261
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
263
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
262
 		return
264
 		return
263
 	} else {
265
 	} else {
264
 		this.ServeSuccessJSON(map[string]interface{}{
266
 		this.ServeSuccessJSON(map[string]interface{}{
265
-			"record":  record,
266
-			"patient": patient,
267
+			"record":    record,
268
+			"patient":   patient,
269
+			"adminUser": adminUser,
267
 		})
270
 		})
268
 	}
271
 	}
269
 }
272
 }

+ 1 - 1
controllers/schedule_api_controller.go View File

3870
 		for _, item := range list {
3870
 		for _, item := range list {
3871
 			order, _ := service.GetLastDialysisOrder(orgId, item.PatientId, targetDay.Unix())
3871
 			order, _ := service.GetLastDialysisOrder(orgId, item.PatientId, targetDay.Unix())
3872
 			item.XtDialysisOrderSix = order
3872
 			item.XtDialysisOrderSix = order
3873
-			if orgId == 9671 || orgId == 9675 || orgId == 10340 {
3873
+			if orgId == 10340 {
3874
 
3874
 
3875
 				solution, _ := service.GetLastDialysisSolution(orgId, item.PatientId, item.ModeId, item.ScheduleDate)
3875
 				solution, _ := service.GetLastDialysisSolution(orgId, item.PatientId, item.ModeId, item.ScheduleDate)
3876
 				item.DialysisPrescription = solution
3876
 				item.DialysisPrescription = solution

+ 4 - 0
models/patient_models.go View File

364
 	SodiumCurve                string        `gorm:"column:sodium_curve" json:"sodium_curve" form:"sodium_curve"`
364
 	SodiumCurve                string        `gorm:"column:sodium_curve" json:"sodium_curve" form:"sodium_curve"`
365
 	DialysisFluidFlow          string        `gorm:"column:dialysis_fluid_flow" json:"dialysis_fluid_flow" form:"dialysis_fluid_flow"`
365
 	DialysisFluidFlow          string        `gorm:"column:dialysis_fluid_flow" json:"dialysis_fluid_flow" form:"dialysis_fluid_flow"`
366
 	SodiumBicarbonateFlow      string        `gorm:"column:sodium_bicarbonate_flow" json:"sodium_bicarbonate_flow" form:"sodium_bicarbonate_flow"`
366
 	SodiumBicarbonateFlow      string        `gorm:"column:sodium_bicarbonate_flow" json:"sodium_bicarbonate_flow" form:"sodium_bicarbonate_flow"`
367
+	PrescriptionWater          float64       `gorm:"column:prescription_water" json:"prescription_water" form:"prescription_water"`
368
+	DialysisStrainer           string        `gorm:"column:dialysis_strainer" json:"dialysis_strainer" form:"dialysis_strainer"`
367
 }
369
 }
368
 
370
 
369
 func (DialysisPrescription) TableName() string {
371
 func (DialysisPrescription) TableName() string {
578
 	SodiumCurve                string  `gorm:"column:sodium_curve" json:"sodium_curve" form:"sodium_curve"`
580
 	SodiumCurve                string  `gorm:"column:sodium_curve" json:"sodium_curve" form:"sodium_curve"`
579
 	DialysisFluidFlow          string  `gorm:"column:dialysis_fluid_flow" json:"dialysis_fluid_flow" form:"dialysis_fluid_flow"`
581
 	DialysisFluidFlow          string  `gorm:"column:dialysis_fluid_flow" json:"dialysis_fluid_flow" form:"dialysis_fluid_flow"`
580
 	SodiumBicarbonateFlow      string  `gorm:"column:sodium_bicarbonate_flow" json:"sodium_bicarbonate_flow" form:"sodium_bicarbonate_flow"`
582
 	SodiumBicarbonateFlow      string  `gorm:"column:sodium_bicarbonate_flow" json:"sodium_bicarbonate_flow" form:"sodium_bicarbonate_flow"`
583
+	PrescriptionWater          float64 `gorm:"column:prescription_water" json:"prescription_water" form:"prescription_water"`
584
+	DialysisStrainer           string  `gorm:"column:dialysis_strainer" json:"dialysis_strainer" form:"dialysis_strainer"`
581
 }
585
 }
582
 
586
 
583
 func (DialysisSolution) TableName() string {
587
 func (DialysisSolution) TableName() string {

+ 3 - 3
service/stock_service.go View File

3392
 }
3392
 }
3393
 
3393
 
3394
 func GetStockType(orgid int64) (goodstype []*models.GoodsTypeOne, err error) {
3394
 func GetStockType(orgid int64) (goodstype []*models.GoodsTypeOne, err error) {
3395
-	err = XTReadDB().Where("org_id = ? and status = 1 and (stock_attribute = 2 or stock_attribute = 3)", orgid).
3395
+	err = XTReadDB().Where("org_id = ? and status = 1 and (stock_attribute = 2 or stock_attribute = 3 or stock_attribute = 4)", orgid).
3396
 		Preload("GoodInfo", "org_id = ? and status = 1", orgid).Find(&goodstype).Error
3396
 		Preload("GoodInfo", "org_id = ? and status = 1", orgid).Find(&goodstype).Error
3397
 	return goodstype, err
3397
 	return goodstype, err
3398
 }
3398
 }
3878
 	err = XTWriteDB().Model(models.BloodAutomaticReduceDetail{}).Where("org_id = ? and patient_id = ? and record_time = ? and status =1 and good_id = ?", orgid, patient_id, recordtime, goodid).UpdateColumn("count", gorm.Expr("count - ?", count)).Error
3878
 	err = XTWriteDB().Model(models.BloodAutomaticReduceDetail{}).Where("org_id = ? and patient_id = ? and record_time = ? and status =1 and good_id = ?", orgid, patient_id, recordtime, goodid).UpdateColumn("count", gorm.Expr("count - ?", count)).Error
3879
 	err = XTWriteDB().Model(models.WarehouseOutInfo{}).Where("org_id = ? and patient_id = ? and sys_record_time = ? and good_id = ? and status = 1", orgid, patient_id, recordtime, goodid).UpdateColumn("count", gorm.Expr("count - ?", count)).Error
3879
 	err = XTWriteDB().Model(models.WarehouseOutInfo{}).Where("org_id = ? and patient_id = ? and sys_record_time = ? and good_id = ? and status = 1", orgid, patient_id, recordtime, goodid).UpdateColumn("count", gorm.Expr("count - ?", count)).Error
3880
 	//err = XTWriteDB().Model(models.WarehouseOutInfo{}).Where("org_id = ? and patient_id = ? and sys_record_time = ? and good_id = ? and status = 1", orgid, patient_id, recordtime, goodid).UpdateColumn("over_count", gorm.Expr("over_count + ?", count)).Error
3880
 	//err = XTWriteDB().Model(models.WarehouseOutInfo{}).Where("org_id = ? and patient_id = ? and sys_record_time = ? and good_id = ? and status = 1", orgid, patient_id, recordtime, goodid).UpdateColumn("over_count", gorm.Expr("over_count + ?", count)).Error
3881
-	err = XTWriteDB().Model(&models.DialysisBeforePrepare{}).Where("org_id = ? and patient_id = ? and sys_record_time = ? and good_id = ? and status = 1", orgid, patient_id, recordtime, goodid).UpdateColumn("count", gorm.Expr("count - ?", count)).Error
3882
-	err = XTWriteDB().Model(&models.VmStockFlow{}).Where("org_id = ? and patient_id = ? and sys_record_time = ? and good_id = ? and status = 1 and project_id = ?", orgid, patient_id, recordtime, goodid, project_id).UpdateColumn("count", gorm.Expr("count - ?", count)).Error
3881
+	err = XTWriteDB().Model(&models.DialysisBeforePrepare{}).Where("user_org_id = ? and patient_id = ? and record_date = ? and good_id = ? and status = 1", orgid, patient_id, recordtime, goodid).UpdateColumn("count", gorm.Expr("count - ?", count)).Error
3882
+	//err = XTWriteDB().Model(&models.VmStockFlow{}).Where("user_org_id = ? and patient_id = ? and system_time = ? and good_id = ? and status = 1 and project_id = ?", orgid, patient_id, recordtime, goodid, project_id).UpdateColumn("count", gorm.Expr("count - ?", count)).Error
3883
 	return err
3883
 	return err
3884
 }
3884
 }
3885
 
3885