瀏覽代碼

Merge branch '20201014_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20201014_xt_api_new_branch

XMLWAN 3 年之前
父節點
當前提交
9968bbc58d

+ 69 - 0
controllers/gobal_config_api_controller.go 查看文件

67
 	beego.Router("/api/xtconfig/get", &GobalConfigApiController{}, "get:GetXTHisConfig")
67
 	beego.Router("/api/xtconfig/get", &GobalConfigApiController{}, "get:GetXTHisConfig")
68
 	beego.Router("/api/xtconfig/isopen", &GobalConfigApiController{}, "post:PostXTHisConfig")
68
 	beego.Router("/api/xtconfig/isopen", &GobalConfigApiController{}, "post:PostXTHisConfig")
69
 
69
 
70
+	beego.Router("/api/hisstockpriceconfig/get", &GobalConfigApiController{}, "get:GetHisStockPriceConfig")
71
+	beego.Router("/api/hisstockpriceconfig/isopen", &GobalConfigApiController{}, "post:PostHisStockPriceConfig")
72
+
73
+	beego.Router("/api/xtconfig/get", &GobalConfigApiController{}, "get:GetXTHisConfig")
74
+	beego.Router("/api/xtconfig/isopen", &GobalConfigApiController{}, "post:PostXTHisConfig")
75
+
70
 	beego.Router("/api/xtconfigproject/isopen", &GobalConfigApiController{}, "post:PostXTHisProjectConfig")
76
 	beego.Router("/api/xtconfigproject/isopen", &GobalConfigApiController{}, "post:PostXTHisProjectConfig")
71
 
77
 
72
 	beego.Router("/api/isopen/init", &GobalConfigApiController{}, "get:GetAllIsOpenConfig")
78
 	beego.Router("/api/isopen/init", &GobalConfigApiController{}, "get:GetAllIsOpenConfig")
1405
 	return
1411
 	return
1406
 }
1412
 }
1407
 
1413
 
1414
+func (c *GobalConfigApiController) PostHisStockPriceConfig() {
1415
+	is_open, _ := c.GetBool("is_open", false)
1416
+	adminUserInfo := c.GetAdminUserInfo()
1417
+	org_id := adminUserInfo.CurrentOrgId
1418
+	isOpen := 0
1419
+
1420
+	if is_open {
1421
+		isOpen = 1
1422
+	} else {
1423
+		isOpen = 2
1424
+	}
1425
+
1426
+	config := models.HisStockPriceConfig{
1427
+		UserOrgId: org_id,
1428
+		IsOpen:    int64(isOpen),
1429
+		Status:    1,
1430
+		Ctime:     time.Now().Unix(),
1431
+		Mtime:     time.Now().Unix(),
1432
+	}
1433
+
1434
+	errs, configs := service.FindHisStockPriceRecordByOrgId(org_id)
1435
+
1436
+	if errs == gorm.ErrRecordNotFound {
1437
+		err := service.CreateHisStockPriceRecord(&config)
1438
+		if err != nil {
1439
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
1440
+			return
1441
+		}
1442
+
1443
+	} else if errs == nil {
1444
+		modifyConfig := models.HisStockPriceConfig{
1445
+			ID:        configs.ID,
1446
+			UserOrgId: org_id,
1447
+			Status:    1,
1448
+			Ctime:     time.Now().Unix(),
1449
+			Mtime:     time.Now().Unix(),
1450
+			IsOpen:    int64(isOpen),
1451
+		}
1452
+
1453
+		err := service.UpdateHisStockPriceRecord(&modifyConfig)
1454
+		if err != nil {
1455
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
1456
+			return
1457
+		}
1458
+
1459
+	}
1460
+
1461
+	c.ServeSuccessJSON(map[string]interface{}{
1462
+		"is_open": is_open,
1463
+	})
1464
+
1465
+	return
1466
+}
1467
+
1408
 func (c *GobalConfigApiController) PostXTHisProjectConfig() {
1468
 func (c *GobalConfigApiController) PostXTHisProjectConfig() {
1409
 	is_open, _ := c.GetBool("is_open", false)
1469
 	is_open, _ := c.GetBool("is_open", false)
1410
 	adminUserInfo := c.GetAdminUserInfo()
1470
 	adminUserInfo := c.GetAdminUserInfo()
1470
 	})
1530
 	})
1471
 }
1531
 }
1472
 
1532
 
1533
+func (c *GobalConfigApiController) GetHisStockPriceConfig() {
1534
+	adminUserInfo := c.GetAdminUserInfo()
1535
+	_, config := service.FindHisStockPriceRecordByOrgId(adminUserInfo.CurrentOrgId)
1536
+
1537
+	c.ServeSuccessJSON(map[string]interface{}{
1538
+		"config": config,
1539
+	})
1540
+}
1541
+
1473
 func (c *GobalConfigApiController) GetAllIsOpenConfig() {
1542
 func (c *GobalConfigApiController) GetAllIsOpenConfig() {
1474
 	adminUserInfo := c.GetAdminUserInfo()
1543
 	adminUserInfo := c.GetAdminUserInfo()
1475
 	_, config := service.FindXTHisRecordByOrgId(adminUserInfo.CurrentOrgId)
1544
 	_, config := service.FindXTHisRecordByOrgId(adminUserInfo.CurrentOrgId)

+ 96 - 53
controllers/his_api_controller.go 查看文件

559
 	return
559
 	return
560
 
560
 
561
 }
561
 }
562
+
562
 func (c *HisApiController) GetHisPrescriptionConfig() {
563
 func (c *HisApiController) GetHisPrescriptionConfig() {
563
 	adminInfo := c.GetAdminUserInfo()
564
 	adminInfo := c.GetAdminUserInfo()
564
 	//获取医嘱模版
565
 	//获取医嘱模版
565
 	advices, _ := service.FindAllHisAdviceTemplate(adminInfo.CurrentOrgId)
566
 	advices, _ := service.FindAllHisAdviceTemplate(adminInfo.CurrentOrgId)
566
 	//获取所有基础药
567
 	//获取所有基础药
567
 	drugs, _ := service.GetAllDrugLibList(adminInfo.CurrentOrgId)
568
 	drugs, _ := service.GetAllDrugLibList(adminInfo.CurrentOrgId)
569
+
570
+	_, config := service.FindHisStockPriceRecordByOrgId(adminInfo.CurrentOrgId)
571
+	if config.ID > 0 && config.IsOpen == 1 {
572
+		for _, item := range drugs {
573
+			var index = 0
574
+			for _, subItem := range item.OtherDrugWarehouseInfo {
575
+				if index == 0 {
576
+					if subItem.StockMaxNumber*item.MinNumber+subItem.StockMinNumber > 0 {
577
+						index = index + 1
578
+						item.MinPrice = subItem.Price
579
+					}
580
+				}
581
+			}
582
+		}
583
+	}
584
+
568
 	drugways, _, _ := service.GetDrugWayDics(adminInfo.CurrentOrgId)
585
 	drugways, _, _ := service.GetDrugWayDics(adminInfo.CurrentOrgId)
569
 	efs, _, _ := service.GetExecutionFrequencyDics(adminInfo.CurrentOrgId)
586
 	efs, _, _ := service.GetExecutionFrequencyDics(adminInfo.CurrentOrgId)
570
 	doctors, _ := service.GetHisAdminUserDoctors(adminInfo.CurrentOrgId)
587
 	doctors, _ := service.GetHisAdminUserDoctors(adminInfo.CurrentOrgId)
943
 							s.PatientId = patient_id
960
 							s.PatientId = patient_id
944
 							s.HisPatientId = his_patient_id
961
 							s.HisPatientId = his_patient_id
945
 							s.StartTime = pTime
962
 							s.StartTime = pTime
963
+
946
 							errcode := c.setAdviceWithJSON(&s, advice.(map[string]interface{}))
964
 							errcode := c.setAdviceWithJSON(&s, advice.(map[string]interface{}))
947
 							if errcode > 0 {
965
 							if errcode > 0 {
948
 								c.ServeFailJSONWithSGJErrorCode(errcode)
966
 								c.ServeFailJSONWithSGJErrorCode(errcode)
1045
 							if p.Type == 3 { //处理透前准备耗材数量数据
1063
 							if p.Type == 3 { //处理透前准备耗材数量数据
1046
 								consumables, _ := service.FindHisConsumablesByID(adminInfo.CurrentOrgId, patient_id, recordDateTime, p.ProjectId)
1064
 								consumables, _ := service.FindHisConsumablesByID(adminInfo.CurrentOrgId, patient_id, recordDateTime, p.ProjectId)
1047
 								if consumables.ID > 0 {
1065
 								if consumables.ID > 0 {
1048
-									consumables.Count = int64(p.Count)
1066
+									cnt, _ := strconv.ParseInt(p.Count, 10, 64)
1067
+									consumables.Count = cnt
1049
 									service.UpdateConsumables(&consumables)
1068
 									service.UpdateConsumables(&consumables)
1050
 								}
1069
 								}
1051
 							}
1070
 							}
1359
 	if err == nil {
1378
 	if err == nil {
1360
 		if len(projects) > 0 {
1379
 		if len(projects) > 0 {
1361
 			for _, item := range projects {
1380
 			for _, item := range projects {
1381
+				service.DeletePrintInfo(item.ID) //删除打印信息
1362
 				if stockConfig.IsOpen == 1 {
1382
 				if stockConfig.IsOpen == 1 {
1363
 					if item.Type == 3 {
1383
 					if item.Type == 3 {
1364
 						good, _ := service.FindGoodInfoByIdTwo(item.ProjectId)
1384
 						good, _ := service.FindGoodInfoByIdTwo(item.ProjectId)
1365
-						f_count, _ := strconv.ParseFloat(strconv.FormatInt(int64(item.Count), 10), 64)
1385
+						//cnt, _ := strconv.ParseInt(item.Count, 10, 64)
1386
+						f_count, _ := strconv.ParseFloat(item.Count, 64)
1366
 						good.Total = good.Total + f_count
1387
 						good.Total = good.Total + f_count
1367
 						service.UpdateGoodInfo(&good)
1388
 						service.UpdateGoodInfo(&good)
1368
 					}
1389
 					}
1447
 	}
1468
 	}
1448
 	err := service.DelelteProject(id, c.GetAdminUserInfo().CurrentOrgId)
1469
 	err := service.DelelteProject(id, c.GetAdminUserInfo().CurrentOrgId)
1449
 	if err == nil {
1470
 	if err == nil {
1471
+		service.DeletePrintInfo(id)
1450
 		label, _ := service.GetProjectById(adminInfo.CurrentOrgId, id, project.RecordDate, project.PatientId)
1472
 		label, _ := service.GetProjectById(adminInfo.CurrentOrgId, id, project.RecordDate, project.PatientId)
1451
 		label.Status = 0
1473
 		label.Status = 0
1452
 		service.CreateHisLabelRecord(&label)
1474
 		service.CreateHisLabelRecord(&label)
1454
 		if stockConfig.IsOpen == 1 {
1476
 		if stockConfig.IsOpen == 1 {
1455
 			if project.Type == 3 {
1477
 			if project.Type == 3 {
1456
 				good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
1478
 				good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
1457
-				f_count, _ := strconv.ParseFloat(strconv.FormatInt(int64(project.Count), 10), 64)
1479
+
1480
+				f_count, _ := strconv.ParseFloat(project.Count, 64)
1458
 				good.Total = good.Total + f_count
1481
 				good.Total = good.Total + f_count
1459
 				service.UpdateGoodInfo(&good)
1482
 				service.UpdateGoodInfo(&good)
1460
 			}
1483
 			}
1952
 
1975
 
1953
 	if json["total"] != nil && reflect.TypeOf(json["total"]).String() == "string" {
1976
 	if json["total"] != nil && reflect.TypeOf(json["total"]).String() == "string" {
1954
 		total, _ := json["total"].(string)
1977
 		total, _ := json["total"].(string)
1955
-		totals, _ := strconv.ParseInt(total, 10, 64)
1956
-		project.Count = totals
1978
+		project.Count = total
1957
 	}
1979
 	}
1958
 
1980
 
1959
 	if json["medical_code"] != nil && reflect.TypeOf(json["medical_code"]).String() == "string" {
1981
 	if json["medical_code"] != nil && reflect.TypeOf(json["medical_code"]).String() == "string" {
2099
 	//	advice.WeekDay = week_day
2121
 	//	advice.WeekDay = week_day
2100
 	//}
2122
 	//}
2101
 
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
+
2102
 	if json["prescribing_number_unit"] != nil && reflect.TypeOf(json["prescribing_number_unit"]).String() == "string" {
2159
 	if json["prescribing_number_unit"] != nil && reflect.TypeOf(json["prescribing_number_unit"]).String() == "string" {
2103
 		prescribingNumberUnit, _ := json["prescribing_number_unit"].(string)
2160
 		prescribingNumberUnit, _ := json["prescribing_number_unit"].(string)
2104
 		advice.PrescribingNumberUnit = prescribingNumberUnit
2161
 		advice.PrescribingNumberUnit = prescribingNumberUnit
2111
 			hisAdvice, err := service.GetHisDoctorAdvicesById(advice.ID)
2168
 			hisAdvice, err := service.GetHisDoctorAdvicesById(advice.ID)
2112
 			if err == nil {
2169
 			if err == nil {
2113
 				if hisAdvice.ID > 0 {
2170
 				if hisAdvice.ID > 0 {
2171
+
2114
 					advice.ExecutionTime = hisAdvice.ExecutionTime
2172
 					advice.ExecutionTime = hisAdvice.ExecutionTime
2115
 					advice.ExecutionStaff = hisAdvice.ExecutionStaff
2173
 					advice.ExecutionStaff = hisAdvice.ExecutionStaff
2116
 					advice.ExecutionState = hisAdvice.ExecutionState
2174
 					advice.ExecutionState = hisAdvice.ExecutionState
2119
 					advice.CheckState = hisAdvice.CheckState
2177
 					advice.CheckState = hisAdvice.CheckState
2120
 					advice.StartTime = hisAdvice.StartTime
2178
 					advice.StartTime = hisAdvice.StartTime
2121
 					advice.HospApprFlag = hisAdvice.HospApprFlag
2179
 					advice.HospApprFlag = hisAdvice.HospApprFlag
2180
+
2181
+					if hisAdvice.SingleDose != advice.SingleDose || hisAdvice.DeliveryWay != advice.DeliveryWay || hisAdvice.ExecutionFrequency != advice.ExecutionFrequency || hisAdvice.Day != advice.Day || hisAdvice.PrescribingNumber != advice.PrescribingNumber || hisAdvice.Price != advice.Price || hisAdvice.Remark != advice.Remark {
2182
+						advice.ExecutionTime = 0
2183
+						advice.ExecutionStaff = 0
2184
+						advice.ExecutionState = 2
2185
+						advice.CheckTime = 0
2186
+						advice.Checker = 0
2187
+						advice.CheckState = 2
2188
+					}
2189
+
2122
 					//advice.Groupno = hisAdvice.Groupno
2190
 					//advice.Groupno = hisAdvice.Groupno
2123
 
2191
 
2124
 				}
2192
 				}
2246
 	//	advice.StartTime = start_time
2314
 	//	advice.StartTime = start_time
2247
 	//}
2315
 	//}
2248
 
2316
 
2249
-	if json["min_unit"] != nil && reflect.TypeOf(json["min_unit"]).String() == "string" {
2250
-		drugSpecUnit, _ := json["min_unit"].(string)
2251
-		advice.DrugSpecUnit = drugSpecUnit
2252
-	}
2253
-	if json["single_dose"] != nil && reflect.TypeOf(json["single_dose"]).String() == "string" {
2254
-		singleDose, _ := strconv.ParseFloat(json["single_dose"].(string), 64)
2255
-		advice.SingleDose = singleDose
2256
-	}
2257
-	if json["single_dose_unit"] != nil && reflect.TypeOf(json["single_dose_unit"]).String() == "string" {
2258
-		singleDoseUnit, _ := json["single_dose_unit"].(string)
2259
-		advice.SingleDoseUnit = singleDoseUnit
2260
-	}
2261
-
2262
-	if json["delivery_way"] != nil && reflect.TypeOf(json["delivery_way"]).String() == "string" {
2263
-		deliveryWay, _ := json["delivery_way"].(string)
2264
-		advice.DeliveryWay = deliveryWay
2265
-	}
2266
-	if json["execution_frequency"] != nil && reflect.TypeOf(json["execution_frequency"]).String() == "string" {
2267
-		executionFrequency, _ := json["execution_frequency"].(string)
2268
-		advice.ExecutionFrequency = executionFrequency
2269
-	}
2270
-
2271
-	if json["retail_price"] != nil || reflect.TypeOf(json["retail_price"]).String() == "string" {
2272
-		price, _ := strconv.ParseFloat(json["retail_price"].(string), 64)
2273
-		advice.Price = price
2274
-	}
2275
-	if json["medical_insurance_number"] != nil || reflect.TypeOf(json["medical_insurance_number"]).String() == "string" {
2276
-		med_list_codg, _ := json["medical_insurance_number"].(string)
2277
-		advice.MedListCodg = med_list_codg
2278
-	}
2279
-	if json["day"] != nil || reflect.TypeOf(json["day"]).String() == "float64" {
2280
-		day := int64(json["day"].(float64))
2281
-		advice.Day = day
2282
-	}
2283
 	return 0
2317
 	return 0
2284
 }
2318
 }
2285
 
2319
 
2326
 
2360
 
2327
 	if json["total"] != nil && reflect.TypeOf(json["total"]).String() == "string" {
2361
 	if json["total"] != nil && reflect.TypeOf(json["total"]).String() == "string" {
2328
 		total, _ := json["total"].(string)
2362
 		total, _ := json["total"].(string)
2329
-		totals, _ := strconv.ParseInt(total, 10, 64)
2330
-		project.Count = totals
2363
+		//totals, _ := strconv.ParseInt(total, 10, 64)
2364
+		project.Count = total
2331
 	}
2365
 	}
2332
 
2366
 
2333
 	if json["medical_code"] != nil && reflect.TypeOf(json["medical_code"]).String() == "string" {
2367
 	if json["medical_code"] != nil && reflect.TypeOf(json["medical_code"]).String() == "string" {
2383
 		if stockConfig.IsOpen == 1 {
2417
 		if stockConfig.IsOpen == 1 {
2384
 			if project.Type == 3 {
2418
 			if project.Type == 3 {
2385
 				good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
2419
 				good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
2386
-				f_count, _ := strconv.ParseFloat(strconv.FormatInt(int64(project.Count), 10), 64)
2420
+				f_count, _ := strconv.ParseFloat(project.Count, 64)
2387
 				good.Total = good.Total - f_count
2421
 				good.Total = good.Total - f_count
2388
 				service.UpdateGoodInfo(&good)
2422
 				service.UpdateGoodInfo(&good)
2389
 			}
2423
 			}
2396
 			if project.Type == 3 {
2430
 			if project.Type == 3 {
2397
 				good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
2431
 				good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
2398
 				if project.Count < temp_project.Count {
2432
 				if project.Count < temp_project.Count {
2399
-					other_count := temp_project.Count - project.Count
2433
+					f_count_one, _ := strconv.ParseFloat(project.Count, 64)
2434
+					f_count_two, _ := strconv.ParseFloat(temp_project.Count, 64)
2435
+
2436
+					other_count := f_count_two - f_count_one
2400
 					other_count_two, _ := strconv.ParseFloat(strconv.FormatInt(int64(other_count), 10), 64)
2437
 					other_count_two, _ := strconv.ParseFloat(strconv.FormatInt(int64(other_count), 10), 64)
2401
 					good.Total = good.Total + other_count_two
2438
 					good.Total = good.Total + other_count_two
2402
 					service.UpdateGoodInfo(&good)
2439
 					service.UpdateGoodInfo(&good)
2403
 				} else if project.Count > temp_project.Count {
2440
 				} else if project.Count > temp_project.Count {
2404
-					other_count := project.Count - temp_project.Count
2441
+					f_count_one, _ := strconv.ParseFloat(project.Count, 64)
2442
+					f_count_two, _ := strconv.ParseFloat(temp_project.Count, 64)
2443
+
2444
+					other_count := f_count_one - f_count_two
2405
 					other_count_two, _ := strconv.ParseFloat(strconv.FormatInt(int64(other_count), 10), 64)
2445
 					other_count_two, _ := strconv.ParseFloat(strconv.FormatInt(int64(other_count), 10), 64)
2406
 					good.Total = good.Total - other_count_two
2446
 					good.Total = good.Total - other_count_two
2407
 					service.UpdateGoodInfo(&good)
2447
 					service.UpdateGoodInfo(&good)
2557
 
2597
 
2558
 	if json["total"] != nil && reflect.TypeOf(json["total"]).String() == "string" {
2598
 	if json["total"] != nil && reflect.TypeOf(json["total"]).String() == "string" {
2559
 		total, _ := json["total"].(string)
2599
 		total, _ := json["total"].(string)
2560
-		totals, _ := strconv.ParseInt(total, 10, 64)
2561
-		project.Count = totals
2600
+		//totals, _ := strconv.ParseInt(total, 10, 64)
2601
+		project.Count = total
2562
 	}
2602
 	}
2563
 
2603
 
2564
 	if json["medical_code"] != nil && reflect.TypeOf(json["medical_code"]).String() == "string" {
2604
 	if json["medical_code"] != nil && reflect.TypeOf(json["medical_code"]).String() == "string" {
3260
 			}
3300
 			}
3261
 			if item.Type == 2 { //项目
3301
 			if item.Type == 2 { //项目
3262
 				for _, subItem := range item.HisPrescriptionProject {
3302
 				for _, subItem := range item.HisPrescriptionProject {
3263
-					total = total + (subItem.Price * float64(subItem.Count))
3303
+					cnt, _ := strconv.ParseFloat(subItem.Count, 64)
3304
+					total = total + (subItem.Price * cnt)
3264
 				}
3305
 				}
3265
 			}
3306
 			}
3266
 
3307
 
3330
 			}
3371
 			}
3331
 			if item.Type == 2 { //项目
3372
 			if item.Type == 2 { //项目
3332
 				for _, subItem := range item.HisPrescriptionProject {
3373
 				for _, subItem := range item.HisPrescriptionProject {
3374
+					cnt, _ := strconv.ParseFloat(subItem.Count, 64)
3333
 					cus := &Custom{
3375
 					cus := &Custom{
3334
 						AdviceId:         0,
3376
 						AdviceId:         0,
3335
 						ProjectId:        subItem.ID,
3377
 						ProjectId:        subItem.ID,
3336
-						DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*float64(subItem.Count)),
3337
-						Cut:              fmt.Sprintf("%.4f", float64(subItem.Count)),
3378
+						DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*cnt),
3379
+						Cut:              fmt.Sprintf("%.4f", cnt),
3338
 						FeedetlSn:        subItem.FeedetlSn,
3380
 						FeedetlSn:        subItem.FeedetlSn,
3339
 						Price:            fmt.Sprintf("%.4f", float64(subItem.Price)),
3381
 						Price:            fmt.Sprintf("%.4f", float64(subItem.Price)),
3340
 						MedListCodg:      subItem.MedListCodg,
3382
 						MedListCodg:      subItem.MedListCodg,
5097
 		}
5139
 		}
5098
 		if item.Type == 2 { //项目
5140
 		if item.Type == 2 { //项目
5099
 			for _, subItem := range item.HisPrescriptionProject {
5141
 			for _, subItem := range item.HisPrescriptionProject {
5100
-				total = total + (subItem.Price * float64(subItem.Count))
5142
+				cnt, _ := strconv.ParseFloat(subItem.Count, 64)
5143
+				total = total + (subItem.Price * cnt)
5101
 			}
5144
 			}
5102
 		}
5145
 		}
5103
 
5146
 
5155
 
5198
 
5156
 		if item.Type == 2 { //项目
5199
 		if item.Type == 2 { //项目
5157
 			for _, subItem := range item.HisPrescriptionProject {
5200
 			for _, subItem := range item.HisPrescriptionProject {
5158
-
5201
+				cnt, _ := strconv.ParseFloat(subItem.Count, 64)
5159
 				cus := &Custom{
5202
 				cus := &Custom{
5160
 					AdviceId:         0,
5203
 					AdviceId:         0,
5161
 					ProjectId:        subItem.ID,
5204
 					ProjectId:        subItem.ID,
5162
-					DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)),
5163
-					Cut:              fmt.Sprintf("%.2f", float64(subItem.Count)),
5205
+					DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*cnt),
5206
+					Cut:              fmt.Sprintf("%.2f", cnt),
5164
 					FeedetlSn:        subItem.FeedetlSn,
5207
 					FeedetlSn:        subItem.FeedetlSn,
5165
 					Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
5208
 					Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
5166
 					MedListCodg:      subItem.MedListCodg,
5209
 					MedListCodg:      subItem.MedListCodg,

+ 2 - 2
controllers/his_config_api_controller.go 查看文件

413
 
413
 
414
 	if json["total"] != nil && reflect.TypeOf(json["total"]).String() == "string" {
414
 	if json["total"] != nil && reflect.TypeOf(json["total"]).String() == "string" {
415
 		total, _ := json["total"].(string)
415
 		total, _ := json["total"].(string)
416
-		totals, _ := strconv.ParseInt(total, 10, 64)
417
-		project.Count = totals
416
+		//totals, _ := strconv.ParseInt(total, 10, 64)
417
+		project.Count = total
418
 	}
418
 	}
419
 
419
 
420
 	if json["medical_code"] != nil && reflect.TypeOf(json["medical_code"]).String() == "string" {
420
 	if json["medical_code"] != nil && reflect.TypeOf(json["medical_code"]).String() == "string" {

+ 7 - 3
controllers/his_hospital_api_controller.go 查看文件

468
 		}
468
 		}
469
 		if item.Type == 2 { //项目
469
 		if item.Type == 2 { //项目
470
 			for _, subItem := range item.HisPrescriptionProject {
470
 			for _, subItem := range item.HisPrescriptionProject {
471
-				total = total + (subItem.Price * float64(subItem.Count))
471
+				cut, _ := strconv.ParseFloat(subItem.Count, 64)
472
+				total = total + (subItem.Price * cut)
472
 			}
473
 			}
473
 		}
474
 		}
474
 
475
 
532
 			}
533
 			}
533
 		}
534
 		}
534
 		if item.Type == 2 { //项目
535
 		if item.Type == 2 { //项目
536
+
535
 			for _, subItem := range item.HisPrescriptionProject {
537
 			for _, subItem := range item.HisPrescriptionProject {
538
+				cut, _ := strconv.ParseFloat(subItem.Count, 64)
539
+
536
 				cus := &Custom{
540
 				cus := &Custom{
537
 					AdviceId:         0,
541
 					AdviceId:         0,
538
 					ProjectId:        subItem.ID,
542
 					ProjectId:        subItem.ID,
539
-					DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)),
540
-					Cut:              fmt.Sprintf("%.2f", float64(subItem.Count)),
543
+					DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*cut),
544
+					Cut:              fmt.Sprintf("%.2f", cut),
541
 					FeedetlSn:        subItem.FeedetlSn,
545
 					FeedetlSn:        subItem.FeedetlSn,
542
 					Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
546
 					Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
543
 					MedListCodg:      subItem.MedListCodg,
547
 					MedListCodg:      subItem.MedListCodg,

+ 9 - 2
controllers/his_project_api_controller.go 查看文件

809
 }
809
 }
810
 
810
 
811
 func (this *HisProjectApiController) GetHisProject() {
811
 func (this *HisProjectApiController) GetHisProject() {
812
-
813
 	adminUserInfo := this.GetAdminUserInfo()
812
 	adminUserInfo := this.GetAdminUserInfo()
814
 	orgId := adminUserInfo.CurrentOrgId
813
 	orgId := adminUserInfo.CurrentOrgId
815
 	project, err := service.GetHisProject(orgId)
814
 	project, err := service.GetHisProject(orgId)
816
 	good_info, err := service.GetGoodInfoMation(orgId)
815
 	good_info, err := service.GetGoodInfoMation(orgId)
817
-
816
+	_, config := service.FindHisStockPriceRecordByOrgId(orgId)
817
+	if config.ID > 0 && config.IsOpen == 1 {
818
+		//处理耗材不同批号价格问题
819
+		for _, item := range good_info {
820
+			if len(item.GoodSotckInfo) > 0 {
821
+				item.PackingPrice = item.GoodSotckInfo[0].Price
822
+			}
823
+		}
824
+	}
818
 	if err != nil {
825
 	if err != nil {
819
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
826
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
820
 		return
827
 		return

+ 2 - 1
controllers/mobile_api_controllers/patient_api_controller.go 查看文件

2682
 	projects, _ := service.FindAllHisProjectById(adminUserInfo.Org.Id, patientInfo.ID, xttime)
2682
 	projects, _ := service.FindAllHisProjectById(adminUserInfo.Org.Id, patientInfo.ID, xttime)
2683
 	if config.IsOpen == 1 && project_config.IsOpen == 1 && len(projects) > 0 {
2683
 	if config.IsOpen == 1 && project_config.IsOpen == 1 && len(projects) > 0 {
2684
 		for _, item := range projects {
2684
 		for _, item := range projects {
2685
+			cnt, _ := strconv.ParseFloat(item.Count, 64)
2685
 			var advice models.HisDoctorAdviceInfo
2686
 			var advice models.HisDoctorAdviceInfo
2686
 			advice.ID = item.ID
2687
 			advice.ID = item.ID
2687
 			advice.Checker = item.Checker
2688
 			advice.Checker = item.Checker
2689
 			advice.CheckState = item.CheckState
2690
 			advice.CheckState = item.CheckState
2690
 			advice.ExecutionState = item.ExecutionState
2691
 			advice.ExecutionState = item.ExecutionState
2691
 			advice.ExecutionStaff = item.ExecutionStaff
2692
 			advice.ExecutionStaff = item.ExecutionStaff
2692
-			advice.PrescribingNumber = float64(item.Count)
2693
+			advice.PrescribingNumber = cnt
2693
 			advice.PrescribingNumberUnit = item.Unit
2694
 			advice.PrescribingNumberUnit = item.Unit
2694
 			advice.AdviceDoctor = item.Doctor
2695
 			advice.AdviceDoctor = item.Doctor
2695
 			if item.Type == 3 {
2696
 			if item.Type == 3 {

+ 19 - 9
controllers/new_mobile_api_controllers/mobile_his_api_controller.go 查看文件

270
 	projects, _ := service.GetHisPrescriptionProjectsByID(prescription_id)
270
 	projects, _ := service.GetHisPrescriptionProjectsByID(prescription_id)
271
 	advices, _ := service.GetHisPrescriptionAdviceByID(prescription_id)
271
 	advices, _ := service.GetHisPrescriptionAdviceByID(prescription_id)
272
 	_, drugStockConfig := service.FindDrugStockAutomaticReduceRecordByOrgId(c.GetMobileAdminUserInfo().Org.Id)
272
 	_, drugStockConfig := service.FindDrugStockAutomaticReduceRecordByOrgId(c.GetMobileAdminUserInfo().Org.Id)
273
-	_, stockConfig := service.FindAutomaticReduceRecordByOrgId(c.GetAdminUserInfo().CurrentOrgId)
273
+	_, stockConfig := service.FindAutomaticReduceRecordByOrgId(c.GetMobileAdminUserInfo().Org.Id)
274
 
274
 
275
 	err := service.DelelteHisPrescription(prescription_id, c.GetMobileAdminUserInfo().Org.Id)
275
 	err := service.DelelteHisPrescription(prescription_id, c.GetMobileAdminUserInfo().Org.Id)
276
 	if err == nil {
276
 	if err == nil {
277
 		if len(projects) > 0 {
277
 		if len(projects) > 0 {
278
 			for _, item := range projects {
278
 			for _, item := range projects {
279
+				service.DeletePrintInfo(item.ID)
280
+
279
 				if item.Type == 3 { //处理透前准备耗材数量数据
281
 				if item.Type == 3 { //处理透前准备耗材数量数据
280
 					consumables, _ := service.FindHisConsumablesByID(item.UserOrgId, item.PatientId, item.RecordDate, item.ProjectId)
282
 					consumables, _ := service.FindHisConsumablesByID(item.UserOrgId, item.PatientId, item.RecordDate, item.ProjectId)
281
 					if consumables.ID > 0 {
283
 					if consumables.ID > 0 {
287
 				if stockConfig.IsOpen == 1 {
289
 				if stockConfig.IsOpen == 1 {
288
 					if item.Type == 3 {
290
 					if item.Type == 3 {
289
 						good, _ := service.FindGoodInfoByIdTwo(item.ProjectId)
291
 						good, _ := service.FindGoodInfoByIdTwo(item.ProjectId)
290
-						f_count, _ := strconv.ParseFloat(strconv.FormatInt(int64(item.Count), 10), 64)
292
+						f_count, _ := strconv.ParseFloat(item.Count, 64)
291
 						good.Total = good.Total + f_count
293
 						good.Total = good.Total + f_count
292
 						service.UpdateGoodInfo(&good)
294
 						service.UpdateGoodInfo(&good)
293
 					}
295
 					}
361
 
363
 
362
 	err := service.DelelteProject(id, c.GetMobileAdminUserInfo().Org.Id)
364
 	err := service.DelelteProject(id, c.GetMobileAdminUserInfo().Org.Id)
363
 	if err == nil {
365
 	if err == nil {
366
+		service.DeletePrintInfo(id)
364
 		if stockConfig.IsOpen == 1 {
367
 		if stockConfig.IsOpen == 1 {
365
 			if project.Type == 3 {
368
 			if project.Type == 3 {
366
 				good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
369
 				good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
367
-				f_count, _ := strconv.ParseFloat(strconv.FormatInt(int64(project.Count), 10), 64)
370
+				f_count, _ := strconv.ParseFloat(project.Count, 64)
368
 				good.Total = good.Total + f_count
371
 				good.Total = good.Total + f_count
369
 				service.UpdateGoodInfo(&good)
372
 				service.UpdateGoodInfo(&good)
370
 			}
373
 			}
762
 							if p.Type == 3 { //处理透前准备耗材数量数据
765
 							if p.Type == 3 { //处理透前准备耗材数量数据
763
 								consumables, _ := service.FindHisConsumablesByID(adminInfo.Org.Id, patient_id, recordDateTime, p.ProjectId)
766
 								consumables, _ := service.FindHisConsumablesByID(adminInfo.Org.Id, patient_id, recordDateTime, p.ProjectId)
764
 								if consumables.ID > 0 {
767
 								if consumables.ID > 0 {
765
-									consumables.Count = int64(p.Count)
768
+									cnt, _ := strconv.ParseInt(p.Count, 10, 64)
769
+									consumables.Count = cnt
766
 									service.UpdateConsumables(&consumables)
770
 									service.UpdateConsumables(&consumables)
767
 								}
771
 								}
768
 							}
772
 							}
1086
 
1090
 
1087
 	if json["total"] != nil && reflect.TypeOf(json["total"]).String() == "string" {
1091
 	if json["total"] != nil && reflect.TypeOf(json["total"]).String() == "string" {
1088
 		total, _ := json["total"].(string)
1092
 		total, _ := json["total"].(string)
1089
-		totals, _ := strconv.ParseInt(total, 10, 64)
1090
-		project.Count = totals
1093
+		//totals, _ := strconv.ParseInt(total, 10, 64)
1094
+		project.Count = total
1091
 	}
1095
 	}
1092
 
1096
 
1093
 	if json["medical_code"] != nil && reflect.TypeOf(json["medical_code"]).String() == "string" {
1097
 	if json["medical_code"] != nil && reflect.TypeOf(json["medical_code"]).String() == "string" {
1127
 		if stockConfig.IsOpen == 1 {
1131
 		if stockConfig.IsOpen == 1 {
1128
 			if project.Type == 3 {
1132
 			if project.Type == 3 {
1129
 				good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
1133
 				good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
1130
-				f_count, _ := strconv.ParseFloat(strconv.FormatInt(int64(project.Count), 10), 64)
1134
+				f_count, _ := strconv.ParseFloat(project.Count, 64)
1131
 				good.Total = good.Total - f_count
1135
 				good.Total = good.Total - f_count
1132
 				service.UpdateGoodInfo(&good)
1136
 				service.UpdateGoodInfo(&good)
1133
 			}
1137
 			}
1140
 			if project.Type == 3 {
1144
 			if project.Type == 3 {
1141
 				good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
1145
 				good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
1142
 				if project.Count < temp_project.Count {
1146
 				if project.Count < temp_project.Count {
1143
-					other_count := temp_project.Count - project.Count
1147
+					f_count_one, _ := strconv.ParseFloat(project.Count, 64)
1148
+					f_count_two, _ := strconv.ParseFloat(temp_project.Count, 64)
1149
+
1150
+					other_count := f_count_two - f_count_one
1144
 					other_count_two, _ := strconv.ParseFloat(strconv.FormatInt(int64(other_count), 10), 64)
1151
 					other_count_two, _ := strconv.ParseFloat(strconv.FormatInt(int64(other_count), 10), 64)
1145
 					good.Total = good.Total + other_count_two
1152
 					good.Total = good.Total + other_count_two
1146
 					service.UpdateGoodInfo(&good)
1153
 					service.UpdateGoodInfo(&good)
1147
 				} else if project.Count > temp_project.Count {
1154
 				} else if project.Count > temp_project.Count {
1148
-					other_count := project.Count - temp_project.Count
1155
+					f_count_one, _ := strconv.ParseFloat(project.Count, 64)
1156
+					f_count_two, _ := strconv.ParseFloat(temp_project.Count, 64)
1157
+
1158
+					other_count := f_count_one - f_count_two
1149
 					other_count_two, _ := strconv.ParseFloat(strconv.FormatInt(int64(other_count), 10), 64)
1159
 					other_count_two, _ := strconv.ParseFloat(strconv.FormatInt(int64(other_count), 10), 64)
1150
 					good.Total = good.Total - other_count_two
1160
 					good.Total = good.Total - other_count_two
1151
 					service.UpdateGoodInfo(&good)
1161
 					service.UpdateGoodInfo(&good)

+ 23 - 31
controllers/public_api_controller.go 查看文件

69
 
69
 
70
 	beego.Router("/handle10215", &PublicApiController{}, "get:Handle10215")
70
 	beego.Router("/handle10215", &PublicApiController{}, "get:Handle10215")
71
 
71
 
72
-	//beego.Router("/handelOrder", &PublicApiController{}, "get:HandleOrder")
72
+	beego.Router("/handelOrder", &PublicApiController{}, "get:HandleOrder")
73
 
73
 
74
 }
74
 }
75
 
75
 
1700
 
1700
 
1701
 }
1701
 }
1702
 
1702
 
1703
-//func (c *PublicApiController)HandleOrder(){
1704
-//	//orders, _ := service.GetAllHisOrder()
1705
-//
1706
-//
1707
-//	order, _ := service.GetLastHisOrder()
1708
-//
1709
-//	fpNumber, _ := strconv.Atoi(order.FaPiaoNumber)
1710
-//
1711
-//
1712
-//	//fmt.Println(fpNumber)
1713
-//
1714
-//	//for index, item := range orders {
1715
-//	//	item.FaPiaoCode ="144072080589"
1716
-//	//	var zero string
1717
-//	//	if 1520 + int64(index) >= 1000{
1718
-//	//		zero = "0000" + strconv.FormatInt(1520 + int64(index),10)
1719
-//	//	}else if 1520 + int64(index) >= 10000{
1720
-//	//		zero = "000" + strconv.FormatInt(1520 + int64(index),10)
1721
-//	//	} else if 1520 + int64(index) >= 100000{
1722
-//	//		zero = "00" +strconv.FormatInt(1520 + int64(index),10)
1723
-//	//	} else if 1520 + int64(index) >= 1000000{
1724
-//	//		zero = "0" +strconv.FormatInt(1520 + int64(index),10)
1725
-//	//	}else {
1726
-//	//		zero = strconv.FormatInt(1520 + int64(index),10)
1727
-//	//	}
1728
-//	//	item.FaPiaoNumber = zero
1729
-//	//	service.SaveOrder(item)
1730
-//	//}
1731
-//}
1703
+func (c *PublicApiController) HandleOrder() {
1704
+	orders, _ := service.GetAllHisOrder()
1705
+
1706
+	for index, item := range orders {
1707
+		item.FaPiaoCode = "144072080589"
1708
+		var zero string
1709
+		if 1520+int64(index) >= 1000 {
1710
+			zero = "0000" + strconv.FormatInt(1520+int64(index), 10)
1711
+		} else if 1520+int64(index) >= 10000 {
1712
+			zero = "000" + strconv.FormatInt(1520+int64(index), 10)
1713
+		} else if 1520+int64(index) >= 100000 {
1714
+			zero = "00" + strconv.FormatInt(1520+int64(index), 10)
1715
+		} else if 1520+int64(index) >= 1000000 {
1716
+			zero = "0" + strconv.FormatInt(1520+int64(index), 10)
1717
+		} else {
1718
+			zero = strconv.FormatInt(1520+int64(index), 10)
1719
+		}
1720
+		item.FaPiaoNumber = zero
1721
+		service.SaveOrder(item)
1722
+	}
1723
+}
1732
 
1724
 
1733
 func Mkdir(dir string) {
1725
 func Mkdir(dir string) {
1734
 	// 创建文件夹
1726
 	// 创建文件夹
1896
 							Mtime:              time.Now().Unix(),
1888
 							Mtime:              time.Now().Unix(),
1897
 							PatientId:          ssubItem.PatientId,
1889
 							PatientId:          ssubItem.PatientId,
1898
 							RecordDate:         ssubItem.AdviceDate,
1890
 							RecordDate:         ssubItem.AdviceDate,
1899
-							Count:              1,
1891
+							Count:              "1",
1900
 							FeedetlSn:          "",
1892
 							FeedetlSn:          "",
1901
 							MedListCodg:        "",
1893
 							MedListCodg:        "",
1902
 							SingleDose:         "1",
1894
 							SingleDose:         "1",

+ 8 - 8
models/his_charge_models.go 查看文件

1
 package models
1
 package models
2
 
2
 
3
 type HisChargePrescriptionProject struct {
3
 type HisChargePrescriptionProject struct {
4
-	ID         int64 `gorm:"column:id" json:"id" form:"id"`
5
-	ProjectId  int64 `gorm:"column:project_id" json:"project_id" form:"project_id"`
6
-	UserOrgId  int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
7
-	Status     int64 `gorm:"column:status" json:"status" form:"status"`
8
-	PatientId  int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
9
-	RecordDate int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
10
-	Count      int64 `gorm:"column:count" json:"count" form:"count"`
11
-	Type       int64 `gorm:"column:type" json:"type" form:"type"`
4
+	ID         int64  `gorm:"column:id" json:"id" form:"id"`
5
+	ProjectId  int64  `gorm:"column:project_id" json:"project_id" form:"project_id"`
6
+	UserOrgId  int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
7
+	Status     int64  `gorm:"column:status" json:"status" form:"status"`
8
+	PatientId  int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
9
+	RecordDate int64  `gorm:"column:record_date" json:"record_date" form:"record_date"`
10
+	Count      string `gorm:"column:count" json:"count" form:"count"`
11
+	Type       int64  `gorm:"column:type" json:"type" form:"type"`
12
 
12
 
13
 	HisChargeProject  HisChargeProject  `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"project"`
13
 	HisChargeProject  HisChargeProject  `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"project"`
14
 	HisChargeGoodInfo HisChargeGoodInfo `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"good_info"`
14
 	HisChargeGoodInfo HisChargeGoodInfo `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"good_info"`

+ 15 - 2
models/his_models.go 查看文件

749
 	HisPatientId       int64      `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
749
 	HisPatientId       int64      `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
750
 	RecordDate         int64      `gorm:"column:record_date" json:"record_date" form:"record_date"`
750
 	RecordDate         int64      `gorm:"column:record_date" json:"record_date" form:"record_date"`
751
 	PrescriptionId     int64      `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
751
 	PrescriptionId     int64      `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
752
-	Count              int64      `gorm:"column:count" json:"count" form:"count"`
752
+	Count              string     `gorm:"column:count" json:"count" form:"count"`
753
 	FeedetlSn          string     `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
753
 	FeedetlSn          string     `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
754
 	MedListCodg        string     `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
754
 	MedListCodg        string     `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
755
 	SingleDose         string     `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
755
 	SingleDose         string     `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
1429
 	PatientId          int64        `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1429
 	PatientId          int64        `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1430
 	HisPatientId       int64        `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
1430
 	HisPatientId       int64        `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
1431
 	RecordDate         int64        `gorm:"column:record_date" json:"record_date" form:"record_date"`
1431
 	RecordDate         int64        `gorm:"column:record_date" json:"record_date" form:"record_date"`
1432
-	Count              int64        `gorm:"column:count" json:"count" form:"count"`
1432
+	Count              string       `gorm:"column:count" json:"count" form:"count"`
1433
 	FeedetlSn          string       `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
1433
 	FeedetlSn          string       `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
1434
 	MedListCodg        string       `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
1434
 	MedListCodg        string       `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
1435
 	SingleDose         string       `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
1435
 	SingleDose         string       `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
1618
 func (VMHisOrderTwo) TableName() string {
1618
 func (VMHisOrderTwo) TableName() string {
1619
 	return "his_order"
1619
 	return "his_order"
1620
 }
1620
 }
1621
+
1622
+type HisStockPriceConfig struct {
1623
+	ID        int64 `gorm:"column:id" json:"id" form:"id"`
1624
+	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1625
+	Ctime     int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
1626
+	Mtime     int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
1627
+	Status    int64 `gorm:"column:status" json:"status" form:"status"`
1628
+	IsOpen    int64 `gorm:"column:is_open" json:"is_open" form:"is_open"`
1629
+}
1630
+
1631
+func (HisStockPriceConfig) TableName() string {
1632
+	return "his_stock_price_config"
1633
+}

+ 5 - 4
models/stock_models.go 查看文件

1116
 }
1116
 }
1117
 
1117
 
1118
 type GoodSotckInfo struct {
1118
 type GoodSotckInfo struct {
1119
-	GoodId            int64  `gorm:"column:good_id" json:"good_id" form:"good_id"`
1120
-	StockCount        int64  `gorm:"column:stock_count" json:"stock_count" form:"stock_count"`
1121
-	GoodName          string `gorm:"column:good_name" json:"good_name"`
1122
-	SpecificationName string `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
1119
+	GoodId            int64   `gorm:"column:good_id" json:"good_id" form:"good_id"`
1120
+	StockCount        int64   `gorm:"column:stock_count" json:"stock_count" form:"stock_count"`
1121
+	GoodName          string  `gorm:"column:good_name" json:"good_name"`
1122
+	SpecificationName string  `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
1123
+	Price             float64 `gorm:"column:price" json:"price" form:"price"`
1123
 }
1124
 }
1124
 
1125
 
1125
 func (GoodSotckInfo) TableName() string {
1126
 func (GoodSotckInfo) TableName() string {

+ 1 - 1
service/dialysis_service.go 查看文件

1179
 
1179
 
1180
 func GetGoodInfoMation(orgid int64) (goodinfo []*models.GoodInfo, err error) {
1180
 func GetGoodInfoMation(orgid int64) (goodinfo []*models.GoodInfo, err error) {
1181
 
1181
 
1182
-	err = XTReadDB().Model(&goodinfo).Where("org_id = ? and status = 1 AND  find_in_set('停用',good_status) = 0", orgid).Preload("GoodSotckInfo", "stock_count >0 and status = 1").Find(&goodinfo).Error
1182
+	err = XTReadDB().Model(&goodinfo).Where("org_id = ? and status = 1 AND  find_in_set('停用',good_status) = 0", orgid).Preload("GoodSotckInfo", "stock_count > 0 and status = 1").Find(&goodinfo).Error
1183
 	return goodinfo, err
1183
 	return goodinfo, err
1184
 }
1184
 }
1185
 
1185
 

+ 3 - 3
service/gdyb_service.go 查看文件

384
 				//var randNum int
384
 				//var randNum int
385
 				//randNum = rand.Intn(10000) + 1000
385
 				//randNum = rand.Intn(10000) + 1000
386
 				if len(subItem.MedListCodg) > 0 {
386
 				if len(subItem.MedListCodg) > 0 {
387
-
387
+					cut, _ := strconv.ParseFloat(subItem.Count, 64)
388
 					cus := &Custom{
388
 					cus := &Custom{
389
-						DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)),
390
-						Cut:              fmt.Sprintf("%.2f", float64(subItem.Count)),
389
+						DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*cut),
390
+						Cut:              fmt.Sprintf("%.2f", cut),
391
 						FeedetlSn:        subItem.FeedetlSn,
391
 						FeedetlSn:        subItem.FeedetlSn,
392
 						Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
392
 						Price:            fmt.Sprintf("%.2f", float64(subItem.Price)),
393
 						MedListCodg:      subItem.MedListCodg,
393
 						MedListCodg:      subItem.MedListCodg,

+ 15 - 0
service/gobal_config_service.go 查看文件

185
 	return
185
 	return
186
 }
186
 }
187
 
187
 
188
+func FindHisStockPriceRecordByOrgId(org_id int64) (err error, config models.HisStockPriceConfig) {
189
+	err = readDb.Model(&models.HisStockPriceConfig{}).Where("status = 1 AND user_org_id = ?", org_id).Find(&config).Error
190
+	return
191
+}
192
+
188
 func UpdateXTHisRecord(config *models.XtHisConfig) (err error) {
193
 func UpdateXTHisRecord(config *models.XtHisConfig) (err error) {
189
 	err = writeDb.Save(config).Error
194
 	err = writeDb.Save(config).Error
190
 	return
195
 	return
195
 	return
200
 	return
196
 }
201
 }
197
 
202
 
203
+func CreateHisStockPriceRecord(config *models.HisStockPriceConfig) (err error) {
204
+	err = writeDb.Model(&models.HisStockPriceConfig{}).Create(config).Error
205
+	return
206
+}
207
+
208
+func UpdateHisStockPriceRecord(config *models.HisStockPriceConfig) (err error) {
209
+	err = writeDb.Save(config).Error
210
+	return
211
+}
212
+
198
 //TODO:项目开关
213
 //TODO:项目开关
199
 func FindXTHisProjectByOrgId(org_id int64) (err error, config models.XtHisProjectConfig) {
214
 func FindXTHisProjectByOrgId(org_id int64) (err error, config models.XtHisProjectConfig) {
200
 	err = readDb.Model(&models.XtHisProjectConfig{}).Where("status = 1 AND user_org_id = ?", org_id).Find(&config).Error
215
 	err = readDb.Model(&models.XtHisProjectConfig{}).Where("status = 1 AND user_org_id = ?", org_id).Find(&config).Error

+ 13 - 8
service/his_service.go 查看文件

588
 }
588
 }
589
 
589
 
590
 type OtherDrugWarehouseInfo struct {
590
 type OtherDrugWarehouseInfo struct {
591
-	ID               int64 `gorm:"column:id" json:"id" form:"id"`
592
-	DrugId           int64 `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
593
-	WarehousingCount int64 `gorm:"column:warehousing_count" json:"warehousing_count" form:"warehousing_count"`
594
-	Status           int64 `gorm:"column:status" json:"status" form:"status"`
595
-	OrgId            int64 `gorm:"column:org_id" json:"org_id" form:"org_id"`
596
-	StockMaxNumber   int64 `gorm:"column:stock_max_number" json:"stock_max_number" form:"stock_max_number"`
597
-	StockMinNumber   int64 `gorm:"column:stock_min_number" json:"stock_min_number" form:"stock_min_number"`
591
+	ID               int64   `gorm:"column:id" json:"id" form:"id"`
592
+	DrugId           int64   `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
593
+	WarehousingCount int64   `gorm:"column:warehousing_count" json:"warehousing_count" form:"warehousing_count"`
594
+	Status           int64   `gorm:"column:status" json:"status" form:"status"`
595
+	OrgId            int64   `gorm:"column:org_id" json:"org_id" form:"org_id"`
596
+	StockMaxNumber   int64   `gorm:"column:stock_max_number" json:"stock_max_number" form:"stock_max_number"`
597
+	StockMinNumber   int64   `gorm:"column:stock_min_number" json:"stock_min_number" form:"stock_min_number"`
598
+	Price            float64 `gorm:"column:price" json:"price" form:"price"`
598
 }
599
 }
599
 
600
 
600
 func (OtherDrugWarehouseInfo) TableName() string {
601
 func (OtherDrugWarehouseInfo) TableName() string {
1515
 	HisPatientId       int64        `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
1516
 	HisPatientId       int64        `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
1516
 	RecordDate         int64        `gorm:"column:record_date" json:"record_date" form:"record_date"`
1517
 	RecordDate         int64        `gorm:"column:record_date" json:"record_date" form:"record_date"`
1517
 	PrescriptionId     int64        `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
1518
 	PrescriptionId     int64        `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
1518
-	Count              int64        `gorm:"column:count" json:"count" form:"count"`
1519
+	Count              string       `gorm:"column:count" json:"count" form:"count"`
1519
 	FeedetlSn          string       `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
1520
 	FeedetlSn          string       `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
1520
 	MedListCodg        string       `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
1521
 	MedListCodg        string       `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
1521
 	SingleDose         string       `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
1522
 	SingleDose         string       `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
2209
 	return
2210
 	return
2210
 }
2211
 }
2211
 
2212
 
2213
+func DeletePrintInfo(id int64) {
2214
+	writeDb.Model(&models.HisLabelPrintInfo{}).Where("p_project_id = ?", id).Updates(map[string]interface{}{"status": 0})
2215
+}
2216
+
2212
 func CreateHisLabelRecord(label *models.HisLabelPrintInfo) error {
2217
 func CreateHisLabelRecord(label *models.HisLabelPrintInfo) error {
2213
 	err := writeDb.Save(&label).Error
2218
 	err := writeDb.Save(&label).Error
2214
 	return err
2219
 	return err