Browse Source

医保对接

csx 3 years ago
parent
commit
6103453c41
1 changed files with 35 additions and 38 deletions
  1. 35 38
      controllers/his_api_controller.go

+ 35 - 38
controllers/his_api_controller.go View File

@@ -2121,6 +2121,41 @@ func (c *HisApiController) setAdviceWithJSON(advice *models.HisDoctorAdviceInfo,
2121 2121
 	//	advice.WeekDay = week_day
2122 2122
 	//}
2123 2123
 
2124
+	if json["min_unit"] != nil && reflect.TypeOf(json["min_unit"]).String() == "string" {
2125
+		drugSpecUnit, _ := json["min_unit"].(string)
2126
+		advice.DrugSpecUnit = drugSpecUnit
2127
+	}
2128
+	if json["single_dose"] != nil && reflect.TypeOf(json["single_dose"]).String() == "string" {
2129
+		singleDose, _ := strconv.ParseFloat(json["single_dose"].(string), 64)
2130
+		advice.SingleDose = singleDose
2131
+	}
2132
+	if json["single_dose_unit"] != nil && reflect.TypeOf(json["single_dose_unit"]).String() == "string" {
2133
+		singleDoseUnit, _ := json["single_dose_unit"].(string)
2134
+		advice.SingleDoseUnit = singleDoseUnit
2135
+	}
2136
+
2137
+	if json["delivery_way"] != nil && reflect.TypeOf(json["delivery_way"]).String() == "string" {
2138
+		deliveryWay, _ := json["delivery_way"].(string)
2139
+		advice.DeliveryWay = deliveryWay
2140
+	}
2141
+	if json["execution_frequency"] != nil && reflect.TypeOf(json["execution_frequency"]).String() == "string" {
2142
+		executionFrequency, _ := json["execution_frequency"].(string)
2143
+		advice.ExecutionFrequency = executionFrequency
2144
+	}
2145
+
2146
+	if json["retail_price"] != nil || reflect.TypeOf(json["retail_price"]).String() == "string" {
2147
+		price, _ := strconv.ParseFloat(json["retail_price"].(string), 64)
2148
+		advice.Price = price
2149
+	}
2150
+	if json["medical_insurance_number"] != nil || reflect.TypeOf(json["medical_insurance_number"]).String() == "string" {
2151
+		med_list_codg, _ := json["medical_insurance_number"].(string)
2152
+		advice.MedListCodg = med_list_codg
2153
+	}
2154
+	if json["day"] != nil || reflect.TypeOf(json["day"]).String() == "float64" {
2155
+		day := int64(json["day"].(float64))
2156
+		advice.Day = day
2157
+	}
2158
+
2124 2159
 	if json["prescribing_number_unit"] != nil && reflect.TypeOf(json["prescribing_number_unit"]).String() == "string" {
2125 2160
 		prescribingNumberUnit, _ := json["prescribing_number_unit"].(string)
2126 2161
 		advice.PrescribingNumberUnit = prescribingNumberUnit
@@ -2133,10 +2168,6 @@ func (c *HisApiController) setAdviceWithJSON(advice *models.HisDoctorAdviceInfo,
2133 2168
 			hisAdvice, err := service.GetHisDoctorAdvicesById(advice.ID)
2134 2169
 			if err == nil {
2135 2170
 				if hisAdvice.ID > 0 {
2136
-					if json["single_dose"] != nil && reflect.TypeOf(json["single_dose"]).String() == "string" {
2137
-						singleDose, _ := strconv.ParseFloat(json["single_dose"].(string), 64)
2138
-						advice.SingleDose = singleDose
2139
-					}
2140 2171
 
2141 2172
 					advice.ExecutionTime = hisAdvice.ExecutionTime
2142 2173
 					advice.ExecutionStaff = hisAdvice.ExecutionStaff
@@ -2283,40 +2314,6 @@ func (c *HisApiController) setAdviceWithJSON(advice *models.HisDoctorAdviceInfo,
2283 2314
 	//	advice.StartTime = start_time
2284 2315
 	//}
2285 2316
 
2286
-	if json["min_unit"] != nil && reflect.TypeOf(json["min_unit"]).String() == "string" {
2287
-		drugSpecUnit, _ := json["min_unit"].(string)
2288
-		advice.DrugSpecUnit = drugSpecUnit
2289
-	}
2290
-	if json["single_dose"] != nil && reflect.TypeOf(json["single_dose"]).String() == "string" {
2291
-		singleDose, _ := strconv.ParseFloat(json["single_dose"].(string), 64)
2292
-		advice.SingleDose = singleDose
2293
-	}
2294
-	if json["single_dose_unit"] != nil && reflect.TypeOf(json["single_dose_unit"]).String() == "string" {
2295
-		singleDoseUnit, _ := json["single_dose_unit"].(string)
2296
-		advice.SingleDoseUnit = singleDoseUnit
2297
-	}
2298
-
2299
-	if json["delivery_way"] != nil && reflect.TypeOf(json["delivery_way"]).String() == "string" {
2300
-		deliveryWay, _ := json["delivery_way"].(string)
2301
-		advice.DeliveryWay = deliveryWay
2302
-	}
2303
-	if json["execution_frequency"] != nil && reflect.TypeOf(json["execution_frequency"]).String() == "string" {
2304
-		executionFrequency, _ := json["execution_frequency"].(string)
2305
-		advice.ExecutionFrequency = executionFrequency
2306
-	}
2307
-
2308
-	if json["retail_price"] != nil || reflect.TypeOf(json["retail_price"]).String() == "string" {
2309
-		price, _ := strconv.ParseFloat(json["retail_price"].(string), 64)
2310
-		advice.Price = price
2311
-	}
2312
-	if json["medical_insurance_number"] != nil || reflect.TypeOf(json["medical_insurance_number"]).String() == "string" {
2313
-		med_list_codg, _ := json["medical_insurance_number"].(string)
2314
-		advice.MedListCodg = med_list_codg
2315
-	}
2316
-	if json["day"] != nil || reflect.TypeOf(json["day"]).String() == "float64" {
2317
-		day := int64(json["day"].(float64))
2318
-		advice.Day = day
2319
-	}
2320 2317
 	return 0
2321 2318
 }
2322 2319