Browse Source

库存流水展示

XMLWAN 2 years ago
parent
commit
735248a301

+ 238 - 0
controllers/dialysis_api_controller.go View File

@@ -333,6 +333,8 @@ func (c *DialysisApiController) PostPrescription() {
333 333
 	sodium_curve := c.GetString("sodium_curve")
334 334
 	dialysis_fluid_flow := c.GetString("dialysis_fluid_flow")
335 335
 	sodium_bicarbonate_flow := c.GetString("sodium_bicarbonate_flow")
336
+	prescription_water, _ := c.GetFloat("prescription_water")
337
+	dialysis_strainer := c.GetString("dialysis_strainer")
336 338
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
337 339
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
338 340
 
@@ -448,6 +450,8 @@ func (c *DialysisApiController) PostPrescription() {
448 450
 		SodiumCurve:                sodium_curve,
449 451
 		DialysisFluidFlow:          dialysis_fluid_flow,
450 452
 		SodiumBicarbonateFlow:      sodium_bicarbonate_flow,
453
+		PrescriptionWater:          prescription_water,
454
+		DialysisStrainer:           dialysis_strainer,
451 455
 	}
452 456
 
453 457
 	//长沙南雅医院,自动生成抗凝剂的临时处方
@@ -835,6 +839,8 @@ func (c *DialysisApiController) PostSoulution() {
835 839
 	sodium_curve := c.GetString("sodium_curve")
836 840
 	dialysis_fluid_flow := c.GetString("dialysis_fluid_flow")
837 841
 	sodium_bicarbonate_flow := c.GetString("sodium_bicarbonate_flow")
842
+	prescription_water, _ := c.GetFloat("prescription_water")
843
+	dialysis_strainer := c.GetString("dialysis_strainer")
838 844
 	var prescription_doctor int64
839 845
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
840 846
 
@@ -970,6 +976,8 @@ func (c *DialysisApiController) PostSoulution() {
970 976
 		TreatmentRemark:            treatment_remark,
971 977
 		DialysisFluidFlow:          dialysis_fluid_flow,
972 978
 		SodiumBicarbonateFlow:      sodium_bicarbonate_flow,
979
+		PrescriptionWater:          prescription_water,
980
+		DialysisStrainer:           dialysis_strainer,
973 981
 	}
974 982
 
975 983
 	//查询最近透析准备表里是否存在 透析器 灌流器
@@ -1148,6 +1156,8 @@ func (c *DialysisApiController) PostSoulution() {
1148 1156
 		TreatmentRemark:            treatment_remark,
1149 1157
 		DialysisFluidFlow:          dialysis_fluid_flow,
1150 1158
 		SodiumBicarbonateFlow:      sodium_bicarbonate_flow,
1159
+		PrescriptionWater:          prescribing_number,
1160
+		DialysisStrainer:           dialysis_strainer,
1151 1161
 	}
1152 1162
 
1153 1163
 	//针对河间咸得
@@ -1959,6 +1969,211 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
1959 1969
 		}
1960 1970
 
1961 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 2177
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":assessment_before_dislysis"
1963 2178
 		redis := service.RedisClient()
1964 2179
 
@@ -1971,6 +2186,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
1971 2186
 		keyTwo := "scheduals_" + recordDateStr + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
1972 2187
 		redis.Set(keyTwo, "", time.Second)
1973 2188
 		defer redis.Close()
2189
+
1974 2190
 		if err == nil {
1975 2191
 			c.ServeSuccessJSON(map[string]interface{}{
1976 2192
 				"assessmentBeforeDislysis": &assessmentBeforeDislysis,
@@ -2164,6 +2380,17 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
2164 2380
 				newprescribe.Status = 1
2165 2381
 
2166 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 2394
 				if err != nil {
2168 2395
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
2169 2396
 				}
@@ -2180,6 +2407,16 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
2180 2407
 				newprescribe.Status = 1
2181 2408
 
2182 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 2420
 				if err != nil {
2184 2421
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
2185 2422
 				}
@@ -2197,6 +2434,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
2197 2434
 		defer redis.Close()
2198 2435
 		keyTwo := "scheduals_" + recordDateStr + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
2199 2436
 		redis.Set(keyTwo, "", time.Second)
2437
+
2200 2438
 		if err == nil {
2201 2439
 			c.ServeSuccessJSON(map[string]interface{}{
2202 2440
 				"assessmentBeforeDislysis": &assessmentBeforeDislysis,

+ 10 - 8
controllers/doctors_api_controller.go View File

@@ -1463,16 +1463,18 @@ func (c *DoctorsApiController) GetScheduleAdvicesList() {
1463 1463
 
1464 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 1468
 	dataBody := make(map[string]interface{}, 0)
1469 1469
 	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
1470 1470
 	fmt.Print("err", err)
1471 1471
 
1472 1472
 	doctor := int64(dataBody["doctor"].(float64))
1473 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 1476
 	recordtime := recordDates.Unix()
1477
+
1476 1478
 	patient_id := int64(dataBody["patient_id"].(float64))
1477 1479
 	title := dataBody["title"].(string)
1478 1480
 	main_content := dataBody["main_content"].(string)
@@ -1501,7 +1503,7 @@ func (c *DoctorsApiController) CreateFirstDisease() {
1501 1503
 	}
1502 1504
 
1503 1505
 	error := service.CreatePatientFirstDisease(firstdisease)
1504
-	fmt.Println("err-------", error)
1506
+
1505 1507
 	if error == nil {
1506 1508
 		c.ServeSuccessJSON(map[string]interface{}{
1507 1509
 			"firstDisease": firstdisease,
@@ -1521,7 +1523,7 @@ func (c *DoctorsApiController) GetFirstDiseaseList() {
1521 1523
 	startime := dischargeTimes.Unix()
1522 1524
 
1523 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 1527
 	endtime := endTimes.Unix()
1526 1528
 	list, err := service.GetPatientDiseaseList(orgId, patient_id, startime, endtime)
1527 1529
 	if err == nil {
@@ -1546,15 +1548,15 @@ func (c *DoctorsApiController) GetFirstDetailById() {
1546 1548
 
1547 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 1553
 	dataBody := make(map[string]interface{}, 0)
1552 1554
 	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
1553 1555
 	fmt.Print("err", err)
1554 1556
 	id := int64(dataBody["id"].(float64))
1555 1557
 	doctor := int64(dataBody["doctor"].(float64))
1556 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 1560
 	recordtime := recordDates.Unix()
1559 1561
 	patient_id := int64(dataBody["patient_id"].(float64))
1560 1562
 	title := dataBody["title"].(string)

+ 18 - 5
controllers/his_api_controller.go View File

@@ -2872,16 +2872,16 @@ func (c *HisApiController) DeletePrescription() {
2872 2872
 						count, _ := strconv.ParseInt(item.Count, 10, 64)
2873 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 2875
 						if info.ID > 0 {
2881 2876
 							if info.Count >= total_count {
2882 2877
 
2883 2878
 								//回退库存
2884 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 2885
 								cancelStockInfo := models.CancelStockInfo{
2886 2886
 									GoodId:          item.ProjectId,
2887 2887
 									CancelStockId:   cancel.ID,
@@ -2956,6 +2956,11 @@ func (c *HisApiController) DeletePrescription() {
2956 2956
 							if info.Count < total_count {
2957 2957
 								//回退库存
2958 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 2964
 								cancelStockInfo := models.CancelStockInfo{
2960 2965
 									GoodId:          item.ProjectId,
2961 2966
 									CancelStockId:   cancel.ID,
@@ -3027,6 +3032,12 @@ func (c *HisApiController) DeletePrescription() {
3027 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 3042
 							dialysisInfo, _ := service.GetGoodDialysisOutInfoSix(c.GetAdminUserInfo().CurrentOrgId, info.PatientId, info.SysRecordTime, item.ProjectId)
3032 3043
 
@@ -3697,6 +3708,8 @@ func (c *HisApiController) DeleteProject() {
3697 3708
 					//查询已出库数量
3698 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 3713
 					if prescribingNumber < dialysisInfo.Count {
3701 3714
 						//改变数量
3702 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,6 +1464,8 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1464 1464
 	treatment_remark := c.GetString("treatment_remark")
1465 1465
 	dialysis_fluid_flow := c.GetString("dialysis_fluid_flow")
1466 1466
 	sodium_bicarbonate_flow := c.GetString("sodium_bicarbonate_flow")
1467
+	prescription_water, _ := c.GetFloat("prescription_water")
1468
+	dialysis_strainer := c.GetString("dialysis_strainer")
1467 1469
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1468 1470
 
1469 1471
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
@@ -1596,6 +1598,8 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1596 1598
 		PrescriptionSodium:         prescription_sodium,
1597 1599
 		DialysisFluidFlow:          dialysis_fluid_flow,
1598 1600
 		SodiumBicarbonateFlow:      sodium_bicarbonate_flow,
1601
+		PrescriptionWater:          prescription_water,
1602
+		DialysisStrainer:           dialysis_strainer,
1599 1603
 	}
1600 1604
 
1601 1605
 	//查询最近透析准备表里是否存在 透析器 灌流器
@@ -3015,6 +3019,8 @@ func (c *DialysisAPIController) PostSolution() {
3015 3019
 	dialysis_remark := c.GetString("dialysis_remark")
3016 3020
 	dialysis_fluid_flow := c.GetString("dialysis_fluid_flow")
3017 3021
 	sodium_bicarbonate_flow := c.GetString("sodium_bicarbonate_flow")
3022
+	prescription_water, _ := c.GetFloat("prescription_water")
3023
+	dialysis_strainer := c.GetString("dialysis_strainer")
3018 3024
 	if mode_id > 0 {
3019 3025
 
3020 3026
 		var str string
@@ -3145,6 +3151,8 @@ func (c *DialysisAPIController) PostSolution() {
3145 3151
 		TreatmentRemark:            treatment_remark,
3146 3152
 		DialysisFluidFlow:          dialysis_fluid_flow,
3147 3153
 		SodiumBicarbonateFlow:      sodium_bicarbonate_flow,
3154
+		PrescriptionWater:          prescription_water,
3155
+		DialysisStrainer:           dialysis_strainer,
3148 3156
 	}
3149 3157
 
3150 3158
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
@@ -3251,6 +3259,8 @@ func (c *DialysisAPIController) PostSolution() {
3251 3259
 		TreatmentRemark:            treatment_remark,
3252 3260
 		SodiumBicarbonateFlow:      sodium_bicarbonate_flow,
3253 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,7 +1679,7 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
1679 1679
 	if evaluation.DryWeight > 0 {
1680 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 1683
 			dewater_amount = dewater_amount * 1000
1684 1684
 
1685 1685
 		}

+ 7 - 4
controllers/print_data_api_controller.go View File

@@ -37,7 +37,7 @@ func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
37 37
 	idStrs := strings.Split(schIDStr, ",")
38 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 41
 		schedules, getScheduleErr := service.GetSchedulesSeven(adminUserInfo.CurrentOrgId, idStrs)
42 42
 		for _, item := range schedules {
43 43
 
@@ -136,7 +136,7 @@ func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
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 140
 		schedules, getScheduleErr := service.GetSchedules(adminUserInfo.CurrentOrgId, idStrs)
141 141
 		for _, item := range schedules {
142 142
 			list, _ := service.GetDialysisOrderCountSeven(item.PatientID, item.ScheduleDate)
@@ -257,13 +257,16 @@ func (this *PrintDataAPIController) CourseRecordPrintData() {
257 257
 
258 258
 	//patient, _ := service.FindPatientWithDeviceById(adminUserInfo.CurrentOrgId, patient_id)
259 259
 	patient, _ := service.GetPatientDetail(adminUserInfo.CurrentOrgId, patient_id)
260
+
261
+	adminUser, _ := service.GetAllAdminUsers(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
260 262
 	if err != nil {
261 263
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
262 264
 		return
263 265
 	} else {
264 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,7 +3870,7 @@ func (this *ScheduleApiController) GetBloodScheduleList() {
3870 3870
 		for _, item := range list {
3871 3871
 			order, _ := service.GetLastDialysisOrder(orgId, item.PatientId, targetDay.Unix())
3872 3872
 			item.XtDialysisOrderSix = order
3873
-			if orgId == 9671 || orgId == 9675 || orgId == 10340 {
3873
+			if orgId == 10340 {
3874 3874
 
3875 3875
 				solution, _ := service.GetLastDialysisSolution(orgId, item.PatientId, item.ModeId, item.ScheduleDate)
3876 3876
 				item.DialysisPrescription = solution

+ 4 - 0
models/patient_models.go View File

@@ -364,6 +364,8 @@ type DialysisPrescription struct {
364 364
 	SodiumCurve                string        `gorm:"column:sodium_curve" json:"sodium_curve" form:"sodium_curve"`
365 365
 	DialysisFluidFlow          string        `gorm:"column:dialysis_fluid_flow" json:"dialysis_fluid_flow" form:"dialysis_fluid_flow"`
366 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 371
 func (DialysisPrescription) TableName() string {
@@ -578,6 +580,8 @@ type DialysisSolution struct {
578 580
 	SodiumCurve                string  `gorm:"column:sodium_curve" json:"sodium_curve" form:"sodium_curve"`
579 581
 	DialysisFluidFlow          string  `gorm:"column:dialysis_fluid_flow" json:"dialysis_fluid_flow" form:"dialysis_fluid_flow"`
580 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 587
 func (DialysisSolution) TableName() string {

+ 3 - 3
service/stock_service.go View File

@@ -3392,7 +3392,7 @@ func PostSearchStock(keyword string, orgid int64) (goods []*models.GoodsType, er
3392 3392
 }
3393 3393
 
3394 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 3396
 		Preload("GoodInfo", "org_id = ? and status = 1", orgid).Find(&goodstype).Error
3397 3397
 	return goodstype, err
3398 3398
 }
@@ -3878,8 +3878,8 @@ func UpdateAutoGood(orgid int64, patient_id int64, recordtime int64, goodid int6
3878 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 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 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 3883
 	return err
3884 3884
 }
3885 3885