Browse Source

耗材参数

XMLWAN 3 years ago
parent
commit
7d5174b9f3

+ 1 - 1
conf/app.conf View File

@@ -1,5 +1,5 @@
1 1
 appname = 血透
2
-httpport = 9531
2
+httpport = 9529
3 3
 runmode = dev
4 4
 
5 5
 #

+ 59 - 61
controllers/base_api_controller.go View File

@@ -2,8 +2,6 @@ package controllers
2 2
 
3 3
 import (
4 4
 	"XT_New/enums"
5
-	"XT_New/models"
6
-
7 5
 	//"XT_New/models"
8 6
 
9 7
 	//"XT_New/models"
@@ -69,36 +67,36 @@ type BaseAuthAPIController struct {
69 67
 func (this *BaseAuthAPIController) Prepare() {
70 68
 	this.BaseAPIController.Prepare()
71 69
 	if this.GetAdminUserInfo() == nil {
72
-		var userAdmin models.AdminUser
73
-		userAdmin.Id = 1448
74
-		userAdmin.Mobile = "13318599895"
75
-
76
-		userAdmin.Id = 597
77
-		userAdmin.Mobile = "19874122664"
78
-		userAdmin.IsSuperAdmin = false
79
-		userAdmin.Status = 1
80
-		userAdmin.CreateTime = 1530786071
81
-		userAdmin.ModifyTime = 1530786071
82
-		var subscibe models.ServeSubscibe
83
-		subscibe.ID = 1
84
-		subscibe.OrgId = 3877
85
-		subscibe.PeriodStart = 1538035409
86
-		subscibe.PeriodEnd = 1569571409
87
-		subscibe.State = 1
88
-		subscibe.Status = 1
89
-		subscibe.CreatedTime = 1538035409
90
-		subscibe.UpdatedTime = 1538035409
91
-		subscibes := make(map[int64]*models.ServeSubscibe, 0)
92
-		subscibes[4] = &subscibe
93
-		var adminUserInfo service.AdminUserInfo
94
-		adminUserInfo.CurrentOrgId = 3877
95
-		adminUserInfo.CurrentAppId = 4
96
-		adminUserInfo.AdminUser = &userAdmin
97
-		adminUserInfo.Subscibes = subscibes
98
-		this.SetSession("admin_user_info", &adminUserInfo)
99
-
100
-		//this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
101
-		//this.StopRun()ba
70
+		//var userAdmin models.AdminUser
71
+		//userAdmin.Id = 1448
72
+		//userAdmin.Mobile = "13318599895"
73
+		//
74
+		//userAdmin.Id = 597
75
+		//userAdmin.Mobile = "19874122664"
76
+		//userAdmin.IsSuperAdmin = false
77
+		//userAdmin.Status = 1
78
+		//userAdmin.CreateTime = 1530786071
79
+		//userAdmin.ModifyTime = 1530786071
80
+		//var subscibe models.ServeSubscibe
81
+		//subscibe.ID = 1
82
+		//subscibe.OrgId = 3877
83
+		//subscibe.PeriodStart = 1538035409
84
+		//subscibe.PeriodEnd = 1569571409
85
+		//subscibe.State = 1
86
+		//subscibe.Status = 1
87
+		//subscibe.CreatedTime = 1538035409
88
+		//subscibe.UpdatedTime = 1538035409
89
+		//subscibes := make(map[int64]*models.ServeSubscibe, 0)
90
+		//subscibes[4] = &subscibe
91
+		//var adminUserInfo service.AdminUserInfo
92
+		//adminUserInfo.CurrentOrgId = 3877
93
+		//adminUserInfo.CurrentAppId = 4
94
+		//adminUserInfo.AdminUser = &userAdmin
95
+		//adminUserInfo.Subscibes = subscibes
96
+		//this.SetSession("admin_user_info", &adminUserInfo)
97
+
98
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
99
+		this.StopRun()
102 100
 
103 101
 	}
104 102
 
@@ -315,35 +313,35 @@ type BaseServeAPIController struct {
315 313
 func (this *BaseServeAPIController) Prepare() {
316 314
 	this.BaseAPIController.Prepare()
317 315
 	if this.GetAdminUserInfo() == nil {
318
-		var userAdmin models.AdminUser
319
-		userAdmin.Id = 1448
320
-		userAdmin.Mobile = "13318599895"
321
-
322
-		userAdmin.Id = 597
323
-		userAdmin.Mobile = "19874122664"
324
-		userAdmin.IsSuperAdmin = false
325
-		userAdmin.Status = 1
326
-		userAdmin.CreateTime = 1530786071
327
-		userAdmin.ModifyTime = 1530786071
328
-		var subscibe models.ServeSubscibe
329
-		subscibe.ID = 1
330
-		subscibe.OrgId = 3877
331
-		subscibe.PeriodStart = 1538035409
332
-		subscibe.PeriodEnd = 1569571409
333
-		subscibe.State = 1
334
-		subscibe.Status = 1
335
-		subscibe.CreatedTime = 1538035409
336
-		subscibe.UpdatedTime = 1538035409
337
-		subscibes := make(map[int64]*models.ServeSubscibe, 0)
338
-		subscibes[4] = &subscibe
339
-		var adminUserInfo service.AdminUserInfo
340
-		adminUserInfo.CurrentOrgId = 3877
341
-		adminUserInfo.CurrentAppId = 4
342
-		adminUserInfo.AdminUser = &userAdmin
343
-		adminUserInfo.Subscibes = subscibes
344
-		this.SetSession("admin_user_info", &adminUserInfo)
345
-		//this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
346
-		//this.StopRun()
316
+		//var userAdmin models.AdminUser
317
+		//userAdmin.Id = 1448
318
+		//userAdmin.Mobile = "13318599895"
319
+		//
320
+		//userAdmin.Id = 597
321
+		//userAdmin.Mobile = "19874122664"
322
+		//userAdmin.IsSuperAdmin = false
323
+		//userAdmin.Status = 1
324
+		//userAdmin.CreateTime = 1530786071
325
+		//userAdmin.ModifyTime = 1530786071
326
+		//var subscibe models.ServeSubscibe
327
+		//subscibe.ID = 1
328
+		//subscibe.OrgId = 3877
329
+		//subscibe.PeriodStart = 1538035409
330
+		//subscibe.PeriodEnd = 1569571409
331
+		//subscibe.State = 1
332
+		//subscibe.Status = 1
333
+		//subscibe.CreatedTime = 1538035409
334
+		//subscibe.UpdatedTime = 1538035409
335
+		//subscibes := make(map[int64]*models.ServeSubscibe, 0)
336
+		//subscibes[4] = &subscibe
337
+		//var adminUserInfo service.AdminUserInfo
338
+		//adminUserInfo.CurrentOrgId = 3877
339
+		//adminUserInfo.CurrentAppId = 4
340
+		//adminUserInfo.AdminUser = &userAdmin
341
+		//adminUserInfo.Subscibes = subscibes
342
+		//this.SetSession("admin_user_info", &adminUserInfo)
343
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
344
+		this.StopRun()
347 345
 	}
348 346
 
349 347
 	//if adminUserInfo.AppRole != nil {

+ 1 - 0
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go View File

@@ -63,6 +63,7 @@ func (this *StaffScheduleApiController) GetMobileNextWeekScheduleLIst() {
63 63
 	orgId := this.GetMobileAdminUserInfo().Org.Id
64 64
 	start_time, _ := this.GetInt64("start_time")
65 65
 	end_time, _ := this.GetInt64("end_time")
66
+
66 67
 	staffList, err := service.GetStaffScheduleList(orgId, start_time, end_time)
67 68
 	if err != nil {
68 69
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")

+ 641 - 0
controllers/self_drug_api_congtroller.go View File

@@ -4,10 +4,12 @@ import (
4 4
 	"XT_New/enums"
5 5
 	"XT_New/models"
6 6
 	"XT_New/service"
7
+	"XT_New/utils"
7 8
 	"encoding/json"
8 9
 	"fmt"
9 10
 	"github.com/astaxie/beego"
10 11
 	"github.com/jinzhu/gorm"
12
+	"reflect"
11 13
 	"strconv"
12 14
 	"strings"
13 15
 	"time"
@@ -52,6 +54,21 @@ func SelfDrugRouters() {
52 54
 	beego.Router("/api/drug/getpatientdetail", &SelfDrugApiController{}, "Get:GetPatientDetail")
53 55
 	//beego.Router("/api/drug/getpatientdetail",&SelfDrugApiController{},"Get:ToPatientDetail")
54 56
 	beego.Router("/api/drug/getselfstockquery", &SelfDrugApiController{}, "Get:GetSelfStockQuery")
57
+	beego.Router("/api/drug/postsearchdrugwarehouselist", &SelfDrugApiController{}, "Get:PostSearchDrugWarehouseList")
58
+	beego.Router("/api/drug/savedrugpriceone", &SelfDrugApiController{}, "Post:SaveDrugPrice")
59
+	beego.Router("/api/drug/drugpricelist", &SelfDrugApiController{}, "Get:GetDrugPriceList")
60
+	beego.Router("/api/drug/savecheckdrugprice", &SelfDrugApiController{}, "Get:SaveCheckDrugPrice")
61
+	beego.Router("/api/drug/savedrugdamageone", &SelfDrugApiController{}, "Post:SaveDrugDamage")
62
+	beego.Router("/api/drug/getdrugdamagelist", &SelfDrugApiController{}, "Get:GetDrugDamageList")
63
+	beego.Router("/api/drug/savedrugdamageprice", &SelfDrugApiController{}, "Get:SaveDrugDamagePrice")
64
+	beego.Router("/api/drug/getdrugmodifyprice", &SelfDrugApiController{}, "Get:GetDrugModifyPrice")
65
+	beego.Router("/api/drug/modifydrugprice", &SelfDrugApiController{}, "Get:ModifyDrugPrice")
66
+	beego.Router("/api/drug/getmodifypriceprint", &SelfDrugApiController{}, "Get:GetModifyPricePrint")
67
+	beego.Router("/api/drug/getdrugdamagedetail", &SelfDrugApiController{}, "Get:GetDrugDamageDetail")
68
+	beego.Router("/api/drug/modifydrugdamage", &SelfDrugApiController{}, "Get:ModifyDrugDamage")
69
+	beego.Router("/api/drug/deletedrugdamage", &SelfDrugApiController{}, "Get:DeleteDrugDamage")
70
+	beego.Router("/api/drug/getdrugdamageprint", &SelfDrugApiController{}, "Get:GetDrugDamagePrint")
71
+	beego.Router("/api/drug/warehouseinfobyid", &SelfDrugApiController{}, "Get:GetWarehoseInfoById")
55 72
 }
56 73
 
57 74
 func (this *SelfDrugApiController) GetCurrentPatient() {
@@ -913,3 +930,627 @@ func (this *SelfDrugApiController) GetSelfStockQuery() {
913 930
 		"stockOutQuery": stockOutQuery,
914 931
 	})
915 932
 }
933
+
934
+func (this *SelfDrugApiController) PostSearchDrugWarehouseList() {
935
+
936
+	keyword := this.GetString("keyword")
937
+	orgId := this.GetAdminUserInfo().CurrentOrgId
938
+	list, err := service.PostSearchDrugWarehouseList(keyword, orgId)
939
+	manufacturerList, err := service.GetAllManufacturerList(orgId)
940
+	dealerList, err := service.GetAllDealerList(orgId)
941
+	if err != nil {
942
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更新设备失败")
943
+		return
944
+	}
945
+	this.ServeSuccessJSON(map[string]interface{}{
946
+		"list":             list,
947
+		"manufacturerList": manufacturerList,
948
+		"dealerList":       dealerList,
949
+	})
950
+}
951
+
952
+func (this *SelfDrugApiController) SaveDrugPrice() {
953
+	fmt.Println("999999999999999999999")
954
+	timeLayout := "2006-01-02"
955
+	loc, _ := time.LoadLocation("Local")
956
+	dataBody := make(map[string]interface{}, 0)
957
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
958
+	fmt.Println(err)
959
+
960
+	tableData, _ := dataBody["tableData"].([]interface{})
961
+	fmt.Println("999939433443", tableData)
962
+	if len(tableData) > 0 {
963
+		for _, item := range tableData {
964
+			items := item.(map[string]interface{})
965
+
966
+			if items["drug_name"] == nil || reflect.TypeOf(items["drug_name"]).String() != "string" {
967
+				utils.ErrorLog("drug_name")
968
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
969
+				return
970
+			}
971
+			drug_name := items["drug_name"].(string)
972
+			fmt.Println("drug_aname23232323232", drug_name)
973
+			if items["drug_name"] == nil || reflect.TypeOf(items["drug_name"]).String() != "string" {
974
+				utils.ErrorLog("drug_name")
975
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
976
+				return
977
+			}
978
+
979
+			if items["retail_price"] == nil || reflect.TypeOf(items["retail_price"]).String() != "string" {
980
+				utils.ErrorLog("retail_price")
981
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
982
+				return
983
+			}
984
+			retail_price, _ := strconv.ParseFloat(items["retail_price"].(string), 64)
985
+
986
+			if items["warehousing_order"] == nil || reflect.TypeOf(items["warehousing_order"]).String() != "string" {
987
+				utils.ErrorLog("warehousing_order")
988
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
989
+				return
990
+			}
991
+			warehousing_order := items["warehousing_order"].(string)
992
+
993
+			if items["number"] == nil || reflect.TypeOf(items["number"]).String() != "string" {
994
+				utils.ErrorLog("number")
995
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
996
+				return
997
+			}
998
+			number := items["number"].(string)
999
+
1000
+			if items["dealer"] == nil || reflect.TypeOf(items["dealer"]).String() != "string" {
1001
+				utils.ErrorLog("dealer")
1002
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1003
+				return
1004
+			}
1005
+			dealer := items["dealer"].(string)
1006
+
1007
+			if items["manufacturer"] == nil || reflect.TypeOf(items["manufacturer"]).String() != "string" {
1008
+				utils.ErrorLog("manufacturer")
1009
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1010
+				return
1011
+			}
1012
+			manufacturer := items["manufacturer"].(string)
1013
+
1014
+			//if items["specification_name"] == nil || reflect.TypeOf(items["specification_name"]).String() != "string" {
1015
+			//  utils.ErrorLog("specification_name")
1016
+			//  this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1017
+			//  return
1018
+			//}
1019
+			//specification_name := items["specification_name"].(string)
1020
+
1021
+			if items["remark"] == nil || reflect.TypeOf(items["remark"]).String() != "string" {
1022
+				utils.ErrorLog("remark")
1023
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1024
+				return
1025
+			}
1026
+			remark := items["remark"].(string)
1027
+
1028
+			if items["warehousing_unit"] == nil || reflect.TypeOf(items["warehousing_unit"]).String() != "string" {
1029
+				utils.ErrorLog("warehousing_unit")
1030
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1031
+				return
1032
+			}
1033
+			warehousing_unit := items["warehousing_unit"].(string)
1034
+
1035
+			if items["last_price"] == nil || reflect.TypeOf(items["last_price"]).String() != "string" {
1036
+				utils.ErrorLog("last_price")
1037
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1038
+				return
1039
+			}
1040
+			last_price, _ := strconv.ParseFloat(items["last_price"].(string), 64)
1041
+
1042
+			if items["count"] == nil || reflect.TypeOf(items["count"]).String() != "float64" {
1043
+				utils.ErrorLog("count")
1044
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1045
+				return
1046
+			}
1047
+			count := int64(items["count"].(float64))
1048
+
1049
+			if items["new_price"] == nil || reflect.TypeOf(items["new_price"]).String() != "string" {
1050
+				utils.ErrorLog("new_price")
1051
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1052
+				return
1053
+			}
1054
+			new_price, _ := strconv.ParseFloat(items["new_price"].(string), 64)
1055
+
1056
+			if items["drug_id"] == nil || reflect.TypeOf(items["drug_id"]).String() != "float64" {
1057
+				utils.ErrorLog("drug_id")
1058
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1059
+				return
1060
+			}
1061
+			drug_id := int64(items["drug_id"].(float64))
1062
+
1063
+			if items["start_time"] == nil || reflect.TypeOf(items["start_time"]).String() != "string" {
1064
+				utils.ErrorLog("start_time")
1065
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1066
+				return
1067
+			}
1068
+			var startTime int64
1069
+			start_time := items["start_time"].(string)
1070
+			if len(start_time) > 0 {
1071
+				theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
1072
+				if err != nil {
1073
+					fmt.Println(err)
1074
+					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1075
+					return
1076
+				}
1077
+				startTime = theTime.Unix()
1078
+			}
1079
+			orgId := this.GetAdminUserInfo().CurrentOrgId
1080
+			Creater := this.GetAdminUserInfo().AdminUser.Id
1081
+
1082
+			drugAdjust := models.XtDrugAdjustPrice{
1083
+				DrugName:          drug_name,
1084
+				SpecificationName: "",
1085
+				WarehousingUnit:   warehousing_unit,
1086
+				Count:             count,
1087
+				LastPrice:         last_price,
1088
+				RetailPrice:       retail_price,
1089
+				NewPrice:          new_price,
1090
+				Manufacturer:      manufacturer,
1091
+				Dealer:            dealer,
1092
+				Remark:            remark,
1093
+				DrugId:            drug_id,
1094
+				UserOrgId:         orgId,
1095
+				Ctime:             time.Now().Unix(),
1096
+				Mtime:             0,
1097
+				Status:            1,
1098
+				WarehousingOrder:  warehousing_order,
1099
+				Number:            number,
1100
+				StartTime:         startTime,
1101
+				Creater:           Creater,
1102
+				Checker:           0,
1103
+				CheckerStatus:     2,
1104
+				CheckerTime:       0,
1105
+			}
1106
+
1107
+			err := service.CreateDrugPrice(drugAdjust)
1108
+			fmt.Println(err)
1109
+		}
1110
+	}
1111
+	returnData := make(map[string]interface{}, 0)
1112
+	returnData["msg"] = "ok"
1113
+	this.ServeSuccessJSON(returnData)
1114
+	return
1115
+}
1116
+
1117
+func (this *SelfDrugApiController) GetDrugPriceList() {
1118
+
1119
+	timeLayout := "2006-01-02"
1120
+	loc, _ := time.LoadLocation("Local")
1121
+	dataBody := make(map[string]interface{}, 0)
1122
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
1123
+	fmt.Println(err)
1124
+	orgId := this.GetAdminUserInfo().CurrentOrgId
1125
+	keyword := this.GetString("keyword")
1126
+
1127
+	start_time := this.GetString("start_time")
1128
+	end_time := this.GetString("end_time")
1129
+	var startTime int64
1130
+	if len(start_time) > 0 {
1131
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
1132
+		if err != nil {
1133
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1134
+			return
1135
+		}
1136
+		startTime = theTime.Unix()
1137
+	}
1138
+	var endTime int64
1139
+	if len(end_time) > 0 {
1140
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
1141
+		if err != nil {
1142
+			utils.ErrorLog(err.Error())
1143
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1144
+			return
1145
+		}
1146
+		endTime = theTime.Unix()
1147
+	}
1148
+	limit, _ := this.GetInt64("limit")
1149
+	page, _ := this.GetInt64("page")
1150
+	list, total, err := service.GetDrugPriceList(startTime, endTime, orgId, keyword, limit, page)
1151
+	doctorList, err := service.GetAllDoctorThree(orgId)
1152
+	if err != nil {
1153
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更新设备失败")
1154
+		return
1155
+	}
1156
+
1157
+	this.ServeSuccessJSON(map[string]interface{}{
1158
+		"total":      total,
1159
+		"list":       list,
1160
+		"doctorList": doctorList,
1161
+	})
1162
+}
1163
+
1164
+func (this *SelfDrugApiController) SaveCheckDrugPrice() {
1165
+	timeLayout := "2006-01-02"
1166
+	loc, _ := time.LoadLocation("Local")
1167
+	dataBody := make(map[string]interface{}, 0)
1168
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
1169
+	fmt.Println(err)
1170
+	idstr := this.GetString("ids")
1171
+	ids := strings.Split(idstr, ",")
1172
+	check_time := this.GetString("check_time")
1173
+	var checkTime int64
1174
+	if len(check_time) > 0 {
1175
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", check_time+" 00:00:00", loc)
1176
+		if err != nil {
1177
+			fmt.Println(err)
1178
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1179
+			return
1180
+		}
1181
+		checkTime = theTime.Unix()
1182
+	}
1183
+	checker, _ := this.GetInt64("checker")
1184
+	adjustPrice := models.XtDrugAdjustPrice{
1185
+		Checker:       checker,
1186
+		CheckerStatus: 1,
1187
+		CheckerTime:   checkTime,
1188
+	}
1189
+	err = service.UpdateDrugAdjuestPrice(ids, adjustPrice)
1190
+	fmt.Println("err", err)
1191
+	this.ServeSuccessJSON(map[string]interface{}{
1192
+		"adjustPrice": adjustPrice,
1193
+	})
1194
+}
1195
+
1196
+func (this *SelfDrugApiController) SaveDrugDamage() {
1197
+	fmt.Println("999999999999999999999")
1198
+	timeLayout := "2006-01-02"
1199
+	loc, _ := time.LoadLocation("Local")
1200
+	dataBody := make(map[string]interface{}, 0)
1201
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
1202
+	fmt.Println(err)
1203
+
1204
+	tableData, _ := dataBody["tableData"].([]interface{})
1205
+	fmt.Println("999939433443", tableData)
1206
+	if len(tableData) > 0 {
1207
+		for _, item := range tableData {
1208
+			items := item.(map[string]interface{})
1209
+			drug_name := items["drug_name"].(string)
1210
+			fmt.Println("durg_nae232333223332232323323223232323", drug_name)
1211
+			if items["drug_name"] == nil || reflect.TypeOf(items["drug_name"]).String() != "string" {
1212
+				utils.ErrorLog("drug_name")
1213
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1214
+				return
1215
+			}
1216
+
1217
+			if items["retail_price"] == nil || reflect.TypeOf(items["retail_price"]).String() != "string" {
1218
+				utils.ErrorLog("retail_price")
1219
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1220
+				return
1221
+			}
1222
+			retail_price, _ := strconv.ParseFloat(items["retail_price"].(string), 64)
1223
+
1224
+			if items["warehousing_order"] == nil || reflect.TypeOf(items["warehousing_order"]).String() != "string" {
1225
+				utils.ErrorLog("warehousing_order")
1226
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1227
+				return
1228
+			}
1229
+			warehousing_order := items["warehousing_order"].(string)
1230
+
1231
+			if items["number"] == nil || reflect.TypeOf(items["number"]).String() != "string" {
1232
+				utils.ErrorLog("number")
1233
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1234
+				return
1235
+			}
1236
+			number := items["number"].(string)
1237
+
1238
+			//if items["dealer"] == nil || reflect.TypeOf(items["dealer"]).String() != "string" {
1239
+			//  utils.ErrorLog("dealer")
1240
+			//  this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1241
+			//  return
1242
+			//}
1243
+			//dealer := items["dealer"].(string)
1244
+
1245
+			if items["manufacturer"] == nil || reflect.TypeOf(items["manufacturer"]).String() != "string" {
1246
+				utils.ErrorLog("manufacturer")
1247
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1248
+				return
1249
+			}
1250
+			manufacturer := items["manufacturer"].(string)
1251
+
1252
+			//if items["specification_name"] == nil || reflect.TypeOf(items["specification_name"]).String() != "string" {
1253
+			//  utils.ErrorLog("specification_name")
1254
+			//  this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1255
+			//  return
1256
+			//}
1257
+			//specification_name := items["specification_name"].(string)
1258
+
1259
+			if items["remark"] == nil || reflect.TypeOf(items["remark"]).String() != "string" {
1260
+				utils.ErrorLog("remark")
1261
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1262
+				return
1263
+			}
1264
+			remark := items["remark"].(string)
1265
+
1266
+			if items["warehousing_unit"] == nil || reflect.TypeOf(items["warehousing_unit"]).String() != "string" {
1267
+				utils.ErrorLog("warehousing_unit")
1268
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1269
+				return
1270
+			}
1271
+			warehousing_unit := items["warehousing_unit"].(string)
1272
+
1273
+			if items["last_price"] == nil || reflect.TypeOf(items["last_price"]).String() != "string" {
1274
+				utils.ErrorLog("last_price")
1275
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1276
+				return
1277
+			}
1278
+			last_price, _ := strconv.ParseFloat(items["last_price"].(string), 64)
1279
+
1280
+			if items["count"] == nil || reflect.TypeOf(items["count"]).String() != "float64" {
1281
+				utils.ErrorLog("count")
1282
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1283
+				return
1284
+			}
1285
+			count := int64(items["count"].(float64))
1286
+
1287
+			if items["new_price"] == nil || reflect.TypeOf(items["new_price"]).String() != "string" {
1288
+				utils.ErrorLog("new_price")
1289
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1290
+				return
1291
+			}
1292
+			new_price, _ := strconv.ParseFloat(items["new_price"].(string), 64)
1293
+
1294
+			if items["drug_id"] == nil || reflect.TypeOf(items["drug_id"]).String() != "float64" {
1295
+				utils.ErrorLog("drug_id")
1296
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1297
+				return
1298
+			}
1299
+			drug_id := int64(items["drug_id"].(float64))
1300
+
1301
+			if items["start_time"] == nil || reflect.TypeOf(items["start_time"]).String() != "string" {
1302
+				utils.ErrorLog("start_time")
1303
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1304
+				return
1305
+			}
1306
+			var startTime int64
1307
+			start_time := items["start_time"].(string)
1308
+			if len(start_time) > 0 {
1309
+				theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
1310
+				if err != nil {
1311
+					fmt.Println(err)
1312
+					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1313
+					return
1314
+				}
1315
+				startTime = theTime.Unix()
1316
+			}
1317
+			orgId := this.GetAdminUserInfo().CurrentOrgId
1318
+			Creater := this.GetAdminUserInfo().AdminUser.Id
1319
+
1320
+			drugDamage := models.XtDrugDamage{
1321
+				DrugName:          drug_name,
1322
+				SpecificationName: "",
1323
+				WarehousingUnit:   warehousing_unit,
1324
+				Count:             count,
1325
+				LastPrice:         last_price,
1326
+				RetailPrice:       retail_price,
1327
+				NewPrice:          new_price,
1328
+				Manufacturer:      manufacturer,
1329
+				Dealer:            "",
1330
+				Remark:            remark,
1331
+				DrugId:            drug_id,
1332
+				UserOrgId:         orgId,
1333
+				Ctime:             time.Now().Unix(),
1334
+				Mtime:             0,
1335
+				Status:            1,
1336
+				WarehousingOrder:  warehousing_order,
1337
+				Number:            number,
1338
+				StartTime:         startTime,
1339
+				Creater:           Creater,
1340
+				Checker:           0,
1341
+				CheckerStatus:     2,
1342
+				CheckerTime:       0,
1343
+			}
1344
+
1345
+			err := service.CreateDrugDamage(drugDamage)
1346
+			fmt.Println(err)
1347
+		}
1348
+	}
1349
+	returnData := make(map[string]interface{}, 0)
1350
+	returnData["msg"] = "ok"
1351
+	this.ServeSuccessJSON(returnData)
1352
+}
1353
+
1354
+func (this *SelfDrugApiController) GetDrugDamageList() {
1355
+
1356
+	timeLayout := "2006-01-02"
1357
+	loc, _ := time.LoadLocation("Local")
1358
+	dataBody := make(map[string]interface{}, 0)
1359
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
1360
+	fmt.Println(err)
1361
+	orgId := this.GetAdminUserInfo().CurrentOrgId
1362
+	keyword := this.GetString("keyword")
1363
+	fmt.Println("keywoer2r2r32rwrwr", keyword)
1364
+	start_time := this.GetString("start_time")
1365
+	end_time := this.GetString("end_time")
1366
+	var startTime int64
1367
+	if len(start_time) > 0 {
1368
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
1369
+		if err != nil {
1370
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1371
+			return
1372
+		}
1373
+		startTime = theTime.Unix()
1374
+	}
1375
+	var endTime int64
1376
+	if len(end_time) > 0 {
1377
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
1378
+		if err != nil {
1379
+			utils.ErrorLog(err.Error())
1380
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1381
+			return
1382
+		}
1383
+		endTime = theTime.Unix()
1384
+	}
1385
+
1386
+	limit, _ := this.GetInt64("limit")
1387
+	page, _ := this.GetInt64("page")
1388
+	list, total, err := service.GetDrugDamageList(startTime, endTime, orgId, keyword, limit, page)
1389
+	doctorList, err := service.GetAllDoctorThree(orgId)
1390
+	if err != nil {
1391
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更新设备失败")
1392
+		return
1393
+	}
1394
+	fmt.Println("list232332", list)
1395
+	fmt.Println("total", total)
1396
+	this.ServeSuccessJSON(map[string]interface{}{
1397
+		"total":      total,
1398
+		"list":       list,
1399
+		"doctorList": doctorList,
1400
+	})
1401
+}
1402
+
1403
+func (this *SelfDrugApiController) SaveDrugDamagePrice() {
1404
+
1405
+	timeLayout := "2006-01-02"
1406
+	loc, _ := time.LoadLocation("Local")
1407
+	dataBody := make(map[string]interface{}, 0)
1408
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
1409
+	fmt.Println(err)
1410
+	idstr := this.GetString("ids")
1411
+	ids := strings.Split(idstr, ",")
1412
+	check_time := this.GetString("check_time")
1413
+	var checkTime int64
1414
+	if len(check_time) > 0 {
1415
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", check_time+" 00:00:00", loc)
1416
+		if err != nil {
1417
+			fmt.Println(err)
1418
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1419
+			return
1420
+		}
1421
+		checkTime = theTime.Unix()
1422
+	}
1423
+	checker, _ := this.GetInt64("checker")
1424
+	damage := models.XtDrugDamage{
1425
+		Checker:       checker,
1426
+		CheckerStatus: 1,
1427
+		CheckerTime:   checkTime,
1428
+	}
1429
+	err = service.UpdateDrugDamage(ids, damage)
1430
+	fmt.Println(err)
1431
+	this.ServeSuccessJSON(map[string]interface{}{
1432
+		"damage": damage,
1433
+	})
1434
+}
1435
+
1436
+func (this *SelfDrugApiController) GetDrugModifyPrice() {
1437
+
1438
+	id, _ := this.GetInt64("id")
1439
+	detail, err := service.GetDrugModifyPrice(id)
1440
+	fmt.Println(err)
1441
+	this.ServeSuccessJSON(map[string]interface{}{
1442
+		"detail": detail,
1443
+	})
1444
+}
1445
+
1446
+func (this *SelfDrugApiController) ModifyDrugPrice() {
1447
+
1448
+	drug_name := this.GetString("drug_name")
1449
+	retailPrice := this.GetString("retail_price")
1450
+	retail_price, _ := strconv.ParseFloat(retailPrice, 64)
1451
+	newPrice := this.GetString("new_price")
1452
+	new_price, _ := strconv.ParseFloat(newPrice, 64)
1453
+	count, _ := this.GetInt64("count")
1454
+	remark := this.GetString("remark")
1455
+	id, _ := this.GetInt64("id")
1456
+	adjustPrice := models.XtDrugAdjustPrice{
1457
+		DrugName:    drug_name,
1458
+		Count:       count,
1459
+		RetailPrice: retail_price,
1460
+		NewPrice:    new_price,
1461
+		Remark:      remark,
1462
+	}
1463
+	err := service.ModifyDrugPrice(id, adjustPrice)
1464
+	fmt.Println(err)
1465
+	this.ServeSuccessJSON(map[string]interface{}{
1466
+		"adjustPrice": adjustPrice,
1467
+	})
1468
+}
1469
+
1470
+func (this *SelfDrugApiController) GetModifyPricePrint() {
1471
+
1472
+	ids := this.GetString("ids")
1473
+	idsSplit := strings.Split(ids, ",")
1474
+	list, err := service.GetModifyPricePrint(idsSplit)
1475
+	fmt.Println(err)
1476
+	this.ServeSuccessJSON(map[string]interface{}{
1477
+		"list": list,
1478
+	})
1479
+}
1480
+
1481
+func (this *SelfDrugApiController) GetDrugDamageDetail() {
1482
+
1483
+	id, _ := this.GetInt64("id")
1484
+	detail, _ := service.GetDrugDamageDetail(id)
1485
+	this.ServeSuccessJSON(map[string]interface{}{
1486
+		"detail": detail,
1487
+	})
1488
+}
1489
+
1490
+func (this *SelfDrugApiController) ModifyDrugDamage() {
1491
+
1492
+	id, _ := this.GetInt64("id")
1493
+	drug_id, _ := this.GetInt64("drug_id")
1494
+	drug_name := this.GetString("drug_name")
1495
+	//drug_origin_place := this.GetString("drug_origin_place")
1496
+	lastPrice := this.GetString("last_price")
1497
+	last_price, _ := strconv.ParseFloat(lastPrice, 64)
1498
+	newPrice := this.GetString("new_price")
1499
+	new_price, _ := strconv.ParseFloat(newPrice, 64)
1500
+	manufacturer := this.GetString("manufacturer")
1501
+	number := this.GetString("number")
1502
+	retailPrice := this.GetString("retail_price")
1503
+	retail_price, _ := strconv.ParseFloat(retailPrice, 64)
1504
+	remark := this.GetString("remark")
1505
+	count, _ := this.GetInt64("count")
1506
+	warehousing_unit := this.GetString("warehousing_unit")
1507
+
1508
+	damage := models.XtDrugDamage{
1509
+		DrugName:          drug_name,
1510
+		SpecificationName: "",
1511
+		WarehousingUnit:   warehousing_unit,
1512
+		Count:             count,
1513
+		LastPrice:         last_price,
1514
+		RetailPrice:       retail_price,
1515
+		NewPrice:          new_price,
1516
+		Manufacturer:      manufacturer,
1517
+		Dealer:            "",
1518
+		Remark:            remark,
1519
+		DrugId:            drug_id,
1520
+		Number:            number,
1521
+	}
1522
+	err := service.ModifyDrugDamage(id, damage)
1523
+	fmt.Println(err)
1524
+	this.ServeSuccessJSON(map[string]interface{}{
1525
+		"damage": damage,
1526
+	})
1527
+}
1528
+
1529
+func (this *SelfDrugApiController) DeleteDrugDamage() {
1530
+
1531
+	id, _ := this.GetInt64("id")
1532
+	err := service.DeleteDrugDamage(id)
1533
+	fmt.Println(err)
1534
+	returnData := make(map[string]interface{}, 0)
1535
+	returnData["msg"] = "ok"
1536
+	this.ServeSuccessJSON(returnData)
1537
+}
1538
+
1539
+func (this *SelfDrugApiController) GetDrugDamagePrint() {
1540
+
1541
+	idsSplit := this.GetString("ids")
1542
+	ids := strings.Split(idsSplit, ",")
1543
+	list, _ := service.GetDrugDamagePrint(ids)
1544
+	this.ServeSuccessJSON(map[string]interface{}{
1545
+		"list": list,
1546
+	})
1547
+}
1548
+
1549
+func (this *SelfDrugApiController) GetWarehoseInfoById() {
1550
+
1551
+	id, _ := this.GetInt64("id")
1552
+	list, _ := service.GetWarehoseInfoById(id)
1553
+	this.ServeSuccessJSON(map[string]interface{}{
1554
+		"list": list,
1555
+	})
1556
+}

+ 444 - 21
controllers/stock_in_api_controller.go View File

@@ -108,6 +108,23 @@ func StockManagerApiRegistRouters() {
108 108
 	beego.Router("/api/stock/savereportstock", &StockManagerApiController{}, "Post:SaveReportStock")
109 109
 	beego.Router("/api/stock/getreportstocklist", &StockManagerApiController{}, "Get:GetReportStockList")
110 110
 	beego.Router("/api/stock/savecheckdamage", &StockManagerApiController{}, "Get:SaveCheckDamage")
111
+	beego.Router("/api/stock/saveinventory", &StockManagerApiController{}, "Post:SaveInventory")
112
+	beego.Router("/api/stock/getinventorylist", &StockManagerApiController{}, "Get:GetInventorylist")
113
+	beego.Router("/api/stock/savecheckinventory", &StockManagerApiController{}, "Get:SaveCheckInventory")
114
+	beego.Router("/api/stock/getmodifypriceDetail", &StockManagerApiController{}, "Get:GetModifyPriceDetail")
115
+	beego.Router("/api/stock/updatestockprice", &StockManagerApiController{}, "Get:UpdateStockPrice")
116
+	beego.Router("/api/stock/deletestockprice", &StockManagerApiController{}, "Get:DeleteStockPrice")
117
+	beego.Router("/api/stock/getstockdamagedetal", &StockManagerApiController{}, "Get:GetStockDamageDetail")
118
+	beego.Router("/api/sotck/modifyprice", &StockManagerApiController{}, "Get:ModifyPrice")
119
+	beego.Router("/api/stock/deletestockdamage", &StockManagerApiController{}, "Get:DeleteDamage")
120
+	beego.Router("/api/stock/getstockdamagebyid", &StockManagerApiController{}, "Get:GetStockDamageById")
121
+	beego.Router("api/sotck/getinventorydetail", &StockManagerApiController{}, "Get:GetInventoryDetail")
122
+	beego.Router("/api/stock/modifyinventory", &StockManagerApiController{}, "Get:ModifyInventory")
123
+	beego.Router("/api/stock/deleteinventory", &StockManagerApiController{}, "Get:DeleteInventory")
124
+	beego.Router("/api/stock/getinventorydetaillist", &StockManagerApiController{}, "Get:GetInventoryDetailList")
125
+	beego.Router("/api/stock/getinventoryprintlist", &StockManagerApiController{}, "Get:GetInventoryPrintList")
126
+	beego.Router("/api/stock/getinventorydetailprintlist", &StockManagerApiController{}, "Get:GetInventoryDetailPrintList")
127
+	beego.Router("/api/drug/deletedrugprice", &StockManagerApiController{}, "Get:DeleteDrugPrice")
111 128
 }
112 129
 
113 130
 func (c *StockManagerApiController) CreateWarehouse() {
@@ -4882,7 +4899,7 @@ func (this *StockManagerApiController) SaveAdjuestPrice() {
4882 4899
 }
4883 4900
 
4884 4901
 func (this *StockManagerApiController) GetAllStockPrice() {
4885
-	fmt.Println("hhhhhhhhhhhhhhhhhhhhhhhhhhhh")
4902
+
4886 4903
 	timeLayout := "2006-01-02"
4887 4904
 	loc, _ := time.LoadLocation("Local")
4888 4905
 	dataBody := make(map[string]interface{}, 0)
@@ -4890,9 +4907,10 @@ func (this *StockManagerApiController) GetAllStockPrice() {
4890 4907
 	fmt.Println(err)
4891 4908
 	orgId := this.GetAdminUserInfo().CurrentOrgId
4892 4909
 	keyword := this.GetString("keyword")
4893
-	fmt.Println("keywoer2r2r32rwrwr", keyword)
4894 4910
 	start_time := this.GetString("start_time")
4895 4911
 	end_time := this.GetString("end_time")
4912
+	limit, _ := this.GetInt64("limit")
4913
+	page, _ := this.GetInt64("page")
4896 4914
 	var startTime int64
4897 4915
 	if len(start_time) > 0 {
4898 4916
 		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
@@ -4912,13 +4930,13 @@ func (this *StockManagerApiController) GetAllStockPrice() {
4912 4930
 		}
4913 4931
 		endTime = theTime.Unix()
4914 4932
 	}
4915
-	fmt.Println("startTime23232233223232323232323", startTime)
4916
-	fmt.Println("endtime 23232232332232323232323232323", endTime)
4917
-	list, _ := service.GetAllStockPrice(orgId, startTime, endTime, keyword)
4933
+
4934
+	list, total, _ := service.GetAllStockPrice(orgId, startTime, endTime, keyword, limit, page)
4918 4935
 	doctor, _ := service.GetAllDoctorThree(orgId)
4919 4936
 	this.ServeSuccessJSON(map[string]interface{}{
4920 4937
 		"list":   list,
4921 4938
 		"doctor": doctor,
4939
+		"total":  total,
4922 4940
 	})
4923 4941
 }
4924 4942
 
@@ -4949,6 +4967,15 @@ func (this *StockManagerApiController) SaveCheckPrice() {
4949 4967
 	}
4950 4968
 	err = service.UpdateAdjustPrice(ids, adjustPrice)
4951 4969
 	fmt.Println(err)
4970
+
4971
+	list, _ := service.GetAdjustCheckPriceList(ids)
4972
+	for _, item := range list {
4973
+		info := models.GoodInfo{
4974
+			PackingPrice: item.NewPrice,
4975
+		}
4976
+		err = service.UpdateAdjustCheckPrice(&info, item.GoodId)
4977
+		fmt.Println(err)
4978
+	}
4952 4979
 	this.ServeSuccessJSON(map[string]interface{}{
4953 4980
 		"adjustPrice": adjustPrice,
4954 4981
 	})
@@ -5064,12 +5091,249 @@ func (this *StockManagerApiController) SaveReportStock() {
5064 5091
 			}
5065 5092
 			count := int64(items["count"].(float64))
5066 5093
 
5067
-			if items["new_price"] == nil || reflect.TypeOf(items["new_price"]).String() != "string" {
5068
-				utils.ErrorLog("new_price")
5094
+			//if items["new_price"] == nil || reflect.TypeOf(items["new_price"]).String() != "string" {
5095
+			//	utils.ErrorLog("new_price")
5096
+			//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5097
+			//	return
5098
+			//}
5099
+			//new_price, _ := strconv.ParseFloat(items["new_price"].(string), 64)
5100
+
5101
+			if items["good_id"] == nil || reflect.TypeOf(items["good_id"]).String() != "float64" {
5102
+				utils.ErrorLog("good_id")
5069 5103
 				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5070 5104
 				return
5071 5105
 			}
5072
-			new_price, _ := strconv.ParseFloat(items["new_price"].(string), 64)
5106
+			good_id := int64(items["good_id"].(float64))
5107
+
5108
+			if items["start_time"] == nil || reflect.TypeOf(items["start_time"]).String() != "string" {
5109
+				utils.ErrorLog("start_time")
5110
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5111
+				return
5112
+			}
5113
+			var startTime int64
5114
+			start_time := items["start_time"].(string)
5115
+			if len(start_time) > 0 {
5116
+				theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
5117
+				if err != nil {
5118
+					fmt.Println(err)
5119
+					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5120
+					return
5121
+				}
5122
+				startTime = theTime.Unix()
5123
+			}
5124
+			orgId := this.GetAdminUserInfo().CurrentOrgId
5125
+			Creater := this.GetAdminUserInfo().AdminUser.Id
5126
+			reportPrice := models.XtStockReportPrice{
5127
+				GoodName:          good_name,
5128
+				SpecificationName: specification_name,
5129
+				WarehousingUnit:   warehousing_unit,
5130
+				Count:             count,
5131
+				BuyPrice:          buy_price,
5132
+				PackingPrice:      packing_price,
5133
+				//NewPrice:          new_price,
5134
+				Manufacturer:     manufacturer,
5135
+				Dealer:           dealer,
5136
+				Remark:           remark,
5137
+				GoodId:           good_id,
5138
+				UserOrgId:        orgId,
5139
+				Ctime:            time.Now().Unix(),
5140
+				Mtime:            0,
5141
+				Status:           1,
5142
+				WarehousingOrder: warehousing_order,
5143
+				LicenseNumber:    license_number,
5144
+				StartTime:        startTime,
5145
+				Creater:          Creater,
5146
+				Checker:          0,
5147
+				CheckerStatus:    2,
5148
+				CheckerTime:      0,
5149
+			}
5150
+			err := service.CreateReportPrice(&reportPrice)
5151
+			fmt.Println(err)
5152
+		}
5153
+	}
5154
+	this.ServeSuccessJSON(map[string]interface{}{
5155
+		"msg": "保存成功!",
5156
+	})
5157
+}
5158
+
5159
+func (this *StockManagerApiController) GetReportStockList() {
5160
+
5161
+	timeLayout := "2006-01-02"
5162
+	loc, _ := time.LoadLocation("Local")
5163
+	start_time := this.GetString("start_time")
5164
+	end_time := this.GetString("end_time")
5165
+	page, _ := this.GetInt64("page")
5166
+	limit, _ := this.GetInt64("limit")
5167
+	var startTime int64
5168
+	if len(start_time) > 0 {
5169
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
5170
+		if err != nil {
5171
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5172
+			return
5173
+		}
5174
+		startTime = theTime.Unix()
5175
+		fmt.Println("开始时间", startTime)
5176
+	}
5177
+	var endTime int64
5178
+	if len(end_time) > 0 {
5179
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
5180
+		if err != nil {
5181
+			utils.ErrorLog(err.Error())
5182
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5183
+			return
5184
+		}
5185
+		endTime = theTime.Unix()
5186
+
5187
+	}
5188
+
5189
+	orgId := this.GetAdminUserInfo().CurrentOrgId
5190
+	keyword := this.GetString("keyword")
5191
+	fmt.Println("startTime", startTime, "endTime", endTime)
5192
+	list, total, _ := service.GetReportStockList(startTime, endTime, orgId, keyword, page, limit)
5193
+	doctorlist, _ := service.GetAllDoctorThree(orgId)
5194
+
5195
+	this.ServeSuccessJSON(map[string]interface{}{
5196
+		"list":       list,
5197
+		"total":      total,
5198
+		"doctorlist": doctorlist,
5199
+	})
5200
+}
5201
+
5202
+func (this *StockManagerApiController) SaveCheckDamage() {
5203
+
5204
+	timeLayout := "2006-01-02"
5205
+	loc, _ := time.LoadLocation("Local")
5206
+	idstr := this.GetString("ids")
5207
+	ids := strings.Split(idstr, ",")
5208
+	check_time := this.GetString("check_time")
5209
+	var checkTime int64
5210
+	if len(check_time) > 0 {
5211
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", check_time+" 00:00:00", loc)
5212
+		if err != nil {
5213
+			fmt.Println(err)
5214
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5215
+			return
5216
+		}
5217
+		checkTime = theTime.Unix()
5218
+	}
5219
+	checker, _ := this.GetInt64("checker")
5220
+	reportprice := models.XtStockReportPrice{
5221
+		Checker:       checker,
5222
+		CheckerStatus: 1,
5223
+		CheckerTime:   checkTime,
5224
+	}
5225
+	err := service.UpdateCheckDamage(ids, reportprice)
5226
+	fmt.Println(err)
5227
+	this.ServeSuccessJSON(map[string]interface{}{
5228
+		"reportPrice": reportprice,
5229
+	})
5230
+}
5231
+
5232
+func (this *StockManagerApiController) SaveInventory() {
5233
+	fmt.Println("hhhhhhhhh232h323223323232")
5234
+	timeLayout := "2006-01-02"
5235
+	loc, _ := time.LoadLocation("Local")
5236
+	dataBody := make(map[string]interface{}, 0)
5237
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
5238
+	if err != nil {
5239
+		utils.ErrorLog(err.Error())
5240
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5241
+		return
5242
+	}
5243
+	tableData, _ := dataBody["tableData"].([]interface{})
5244
+	if len(tableData) > 0 {
5245
+		for _, item := range tableData {
5246
+			items := item.(map[string]interface{})
5247
+
5248
+			if items["good_name"] == nil || reflect.TypeOf(items["good_name"]).String() != "string" {
5249
+				utils.ErrorLog("good_name")
5250
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5251
+				return
5252
+			}
5253
+			good_name := items["good_name"].(string)
5254
+
5255
+			if items["good_name"] == nil || reflect.TypeOf(items["good_name"]).String() != "string" {
5256
+				utils.ErrorLog("good_name")
5257
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5258
+				return
5259
+			}
5260
+
5261
+			if items["packing_price"] == nil || reflect.TypeOf(items["packing_price"]).String() != "string" {
5262
+				utils.ErrorLog("packing_price")
5263
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5264
+				return
5265
+			}
5266
+			packing_price, _ := strconv.ParseFloat(items["packing_price"].(string), 64)
5267
+
5268
+			if items["warehousing_order"] == nil || reflect.TypeOf(items["warehousing_order"]).String() != "string" {
5269
+				utils.ErrorLog("warehousing_order")
5270
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5271
+				return
5272
+			}
5273
+			warehousing_order := items["warehousing_order"].(string)
5274
+
5275
+			if items["license_number"] == nil || reflect.TypeOf(items["license_number"]).String() != "string" {
5276
+				utils.ErrorLog("license_number")
5277
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5278
+				return
5279
+			}
5280
+			license_number := items["license_number"].(string)
5281
+
5282
+			if items["dealer"] == nil || reflect.TypeOf(items["dealer"]).String() != "string" {
5283
+				utils.ErrorLog("dealer")
5284
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5285
+				return
5286
+			}
5287
+			dealer := items["dealer"].(string)
5288
+
5289
+			if items["manufacturer"] == nil || reflect.TypeOf(items["manufacturer"]).String() != "string" {
5290
+				utils.ErrorLog("manufacturer")
5291
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5292
+				return
5293
+			}
5294
+			manufacturer := items["manufacturer"].(string)
5295
+
5296
+			if items["specification_name"] == nil || reflect.TypeOf(items["specification_name"]).String() != "string" {
5297
+				utils.ErrorLog("specification_name")
5298
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5299
+				return
5300
+			}
5301
+			specification_name := items["specification_name"].(string)
5302
+
5303
+			if items["remark"] == nil || reflect.TypeOf(items["remark"]).String() != "string" {
5304
+				utils.ErrorLog("remark")
5305
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5306
+				return
5307
+			}
5308
+			remark := items["remark"].(string)
5309
+
5310
+			if items["warehousing_unit"] == nil || reflect.TypeOf(items["warehousing_unit"]).String() != "string" {
5311
+				utils.ErrorLog("warehousing_unit")
5312
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5313
+				return
5314
+			}
5315
+			warehousing_unit := items["warehousing_unit"].(string)
5316
+
5317
+			if items["buy_price"] == nil || reflect.TypeOf(items["buy_price"]).String() != "string" {
5318
+				utils.ErrorLog("buy_price")
5319
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5320
+				return
5321
+			}
5322
+			buy_price, _ := strconv.ParseFloat(items["buy_price"].(string), 64)
5323
+
5324
+			if items["count"] == nil || reflect.TypeOf(items["count"]).String() != "float64" {
5325
+				utils.ErrorLog("count")
5326
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5327
+				return
5328
+			}
5329
+			count := int64(items["count"].(float64))
5330
+
5331
+			//if items["new_price"] == nil || reflect.TypeOf(items["new_price"]).String() != "string" {
5332
+			//  utils.ErrorLog("new_price")
5333
+			//  this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5334
+			//  return
5335
+			//}
5336
+			//new_price, _ := strconv.ParseFloat(items["new_price"].(string), 64)
5073 5337
 
5074 5338
 			if items["good_id"] == nil || reflect.TypeOf(items["good_id"]).String() != "float64" {
5075 5339
 				utils.ErrorLog("good_id")
@@ -5096,14 +5360,15 @@ func (this *StockManagerApiController) SaveReportStock() {
5096 5360
 			}
5097 5361
 			orgId := this.GetAdminUserInfo().CurrentOrgId
5098 5362
 			Creater := this.GetAdminUserInfo().AdminUser.Id
5099
-			reportPrice := models.XtStockReportPrice{
5363
+
5364
+			inventory := models.XtStockInventory{
5100 5365
 				GoodName:          good_name,
5101 5366
 				SpecificationName: specification_name,
5102 5367
 				WarehousingUnit:   warehousing_unit,
5103 5368
 				Count:             count,
5104 5369
 				BuyPrice:          buy_price,
5105 5370
 				PackingPrice:      packing_price,
5106
-				NewPrice:          new_price,
5371
+				NewPrice:          0,
5107 5372
 				Manufacturer:      manufacturer,
5108 5373
 				Dealer:            dealer,
5109 5374
 				Remark:            remark,
@@ -5120,7 +5385,7 @@ func (this *StockManagerApiController) SaveReportStock() {
5120 5385
 				CheckerStatus:     2,
5121 5386
 				CheckerTime:       0,
5122 5387
 			}
5123
-			err := service.CreateReportPrice(&reportPrice)
5388
+			err = service.CreateInentory(inventory)
5124 5389
 			fmt.Println(err)
5125 5390
 		}
5126 5391
 	}
@@ -5129,7 +5394,7 @@ func (this *StockManagerApiController) SaveReportStock() {
5129 5394
 	})
5130 5395
 }
5131 5396
 
5132
-func (this *StockManagerApiController) GetReportStockList() {
5397
+func (this *StockManagerApiController) GetInventorylist() {
5133 5398
 
5134 5399
 	timeLayout := "2006-01-02"
5135 5400
 	loc, _ := time.LoadLocation("Local")
@@ -5137,6 +5402,8 @@ func (this *StockManagerApiController) GetReportStockList() {
5137 5402
 	end_time := this.GetString("end_time")
5138 5403
 	page, _ := this.GetInt64("page")
5139 5404
 	limit, _ := this.GetInt64("limit")
5405
+	keyword := this.GetString("keyword")
5406
+	inventory_status, _ := this.GetInt64("inventory_status")
5140 5407
 	var startTime int64
5141 5408
 	if len(start_time) > 0 {
5142 5409
 		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
@@ -5160,11 +5427,8 @@ func (this *StockManagerApiController) GetReportStockList() {
5160 5427
 	}
5161 5428
 
5162 5429
 	orgId := this.GetAdminUserInfo().CurrentOrgId
5163
-	keyword := this.GetString("keyword")
5164
-	fmt.Println("startTime", startTime, "endTime", endTime)
5165
-	list, total, _ := service.GetReportStockList(startTime, endTime, orgId, keyword, page, limit)
5430
+	list, total, _ := service.GetInventorylist(startTime, endTime, page, limit, inventory_status, keyword, orgId)
5166 5431
 	doctorlist, _ := service.GetAllDoctorThree(orgId)
5167
-
5168 5432
 	this.ServeSuccessJSON(map[string]interface{}{
5169 5433
 		"list":       list,
5170 5434
 		"total":      total,
@@ -5172,10 +5436,13 @@ func (this *StockManagerApiController) GetReportStockList() {
5172 5436
 	})
5173 5437
 }
5174 5438
 
5175
-func (this *StockManagerApiController) SaveCheckDamage() {
5176
-	fmt.Println("hhhhhhhhhhhhhhhhhhhh")
5439
+func (this *StockManagerApiController) SaveCheckInventory() {
5440
+
5177 5441
 	timeLayout := "2006-01-02"
5178 5442
 	loc, _ := time.LoadLocation("Local")
5443
+	dataBody := make(map[string]interface{}, 0)
5444
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
5445
+	fmt.Println(err)
5179 5446
 	idstr := this.GetString("ids")
5180 5447
 	ids := strings.Split(idstr, ",")
5181 5448
 	check_time := this.GetString("check_time")
@@ -5190,14 +5457,170 @@ func (this *StockManagerApiController) SaveCheckDamage() {
5190 5457
 		checkTime = theTime.Unix()
5191 5458
 	}
5192 5459
 	checker, _ := this.GetInt64("checker")
5193
-	reportprice := models.XtStockReportPrice{
5460
+	inventory := models.XtStockInventory{
5194 5461
 		Checker:       checker,
5195 5462
 		CheckerStatus: 1,
5196 5463
 		CheckerTime:   checkTime,
5197 5464
 	}
5198
-	err := service.UpdateCheckDamage(ids, reportprice)
5465
+	err = service.UpdateCheckInventory(ids, inventory)
5199 5466
 	fmt.Println(err)
5200 5467
 	this.ServeSuccessJSON(map[string]interface{}{
5201
-		"reportPrice": reportprice,
5468
+		"inventory": inventory,
5469
+	})
5470
+}
5471
+
5472
+func (this *StockManagerApiController) GetModifyPriceDetail() {
5473
+
5474
+	id, _ := this.GetInt64("id")
5475
+	detail, _ := service.GetModifyPriceDetail(id)
5476
+	this.ServeSuccessJSON(map[string]interface{}{
5477
+		"detail": detail,
5478
+	})
5479
+}
5480
+
5481
+func (this *StockManagerApiController) UpdateStockPrice() {
5482
+
5483
+	id, _ := this.GetInt64("id")
5484
+	newPrice := this.GetString("new_price")
5485
+	new_price, _ := strconv.ParseFloat(newPrice, 64)
5486
+	adjust := models.XtStockAdjustPrice{
5487
+		NewPrice: new_price,
5488
+	}
5489
+	err := service.UpdateStockPrice(adjust, id)
5490
+	fmt.Println(err)
5491
+	this.ServeSuccessJSON(map[string]interface{}{
5492
+		"adjust": adjust,
5493
+	})
5494
+}
5495
+
5496
+func (this *StockManagerApiController) DeleteStockPrice() {
5497
+
5498
+	id, _ := this.GetInt64("id")
5499
+	err := service.DeleteStockPrice(id)
5500
+	fmt.Println(err)
5501
+	returnData := make(map[string]interface{}, 0)
5502
+	returnData["msg"] = "ok"
5503
+	this.ServeSuccessJSON(returnData)
5504
+	return
5505
+}
5506
+
5507
+func (this *StockManagerApiController) GetStockDamageDetail() {
5508
+
5509
+	id, _ := this.GetInt64("id")
5510
+	detail, err := service.GetStockDamageDetail(id)
5511
+	fmt.Println(err)
5512
+	this.ServeSuccessJSON(map[string]interface{}{
5513
+		"detail": detail,
5514
+	})
5515
+}
5516
+
5517
+func (this *StockManagerApiController) ModifyPrice() {
5518
+
5519
+	count, _ := this.GetInt64("count")
5520
+	id, _ := this.GetInt64("id")
5521
+	adjust := models.XtStockReportPrice{
5522
+		Count: count,
5523
+	}
5524
+	err := service.ModifyPrice(id, adjust)
5525
+	fmt.Println(err)
5526
+	this.ServeSuccessJSON(map[string]interface{}{
5527
+		"adjust": adjust,
5528
+	})
5529
+}
5530
+
5531
+func (this *StockManagerApiController) DeleteDamage() {
5532
+
5533
+	id, _ := this.GetInt64("id")
5534
+	err := service.DeleteDamage(id)
5535
+	fmt.Println(err)
5536
+	returnData := make(map[string]interface{}, 0)
5537
+	returnData["msg"] = "ok"
5538
+	this.ServeSuccessJSON(returnData)
5539
+	return
5540
+}
5541
+
5542
+func (this *StockManagerApiController) GetStockDamageById() {
5543
+	ids := this.GetString("ids")
5544
+
5545
+	splitIds := strings.Split(ids, ",")
5546
+	list, _ := service.GetStockDamageById(splitIds)
5547
+
5548
+	this.ServeSuccessJSON(map[string]interface{}{
5549
+		"list": list,
5550
+	})
5551
+}
5552
+
5553
+func (this *StockManagerApiController) GetInventoryDetail() {
5554
+	id, _ := this.GetInt64("id")
5555
+	detail, _ := service.GetInventoryDetail(id)
5556
+	this.ServeSuccessJSON(map[string]interface{}{
5557
+		"detail": detail,
5202 5558
 	})
5203 5559
 }
5560
+
5561
+func (this *StockManagerApiController) ModifyInventory() {
5562
+	id, _ := this.GetInt64("id")
5563
+	count, _ := this.GetInt64("count")
5564
+	remark := this.GetString("remark")
5565
+	inventory := models.XtStockInventory{
5566
+		Count:  count,
5567
+		Remark: remark,
5568
+	}
5569
+	err := service.ModifyInventory(id, inventory)
5570
+	fmt.Println(err)
5571
+	this.ServeSuccessJSON(map[string]interface{}{
5572
+		"inventory": inventory,
5573
+	})
5574
+}
5575
+
5576
+func (this *StockManagerApiController) DeleteInventory() {
5577
+	id, _ := this.GetInt64("id")
5578
+	err := service.DeleteInventory(id)
5579
+	fmt.Println(err)
5580
+	returnData := make(map[string]interface{}, 0)
5581
+	returnData["msg"] = "ok"
5582
+	this.ServeSuccessJSON(returnData)
5583
+	return
5584
+}
5585
+
5586
+func (this *StockManagerApiController) GetInventoryDetailList() {
5587
+	keyword := this.GetString("keyword")
5588
+	limit, _ := this.GetInt64("limit")
5589
+	page, _ := this.GetInt64("page")
5590
+	orgId := this.GetAdminUserInfo().CurrentOrgId
5591
+	list, total, _ := service.GetInventoryDetailList(keyword, limit, page, orgId)
5592
+	this.ServeSuccessJSON(map[string]interface{}{
5593
+		"list":  list,
5594
+		"total": total,
5595
+	})
5596
+}
5597
+
5598
+func (this *StockManagerApiController) GetInventoryPrintList() {
5599
+
5600
+	ids := this.GetString("ids")
5601
+	splitIds := strings.Split(ids, ",")
5602
+	list, _ := service.GetInventoryPrintList(splitIds)
5603
+	this.ServeSuccessJSON(map[string]interface{}{
5604
+		"list": list,
5605
+	})
5606
+}
5607
+
5608
+func (this *StockManagerApiController) GetInventoryDetailPrintList() {
5609
+	ids := this.GetString("ids")
5610
+	splitIds := strings.Split(ids, ",")
5611
+	list, _ := service.GetInventoryDetailPrintList(splitIds)
5612
+	this.ServeSuccessJSON(map[string]interface{}{
5613
+		"list": list,
5614
+	})
5615
+}
5616
+
5617
+func (this *StockManagerApiController) DeleteDrugPrice() {
5618
+
5619
+	id, _ := this.GetInt64("id")
5620
+	err := service.DeleteDrugPrice(id)
5621
+	fmt.Println(err)
5622
+	returnData := make(map[string]interface{}, 0)
5623
+	returnData["msg"] = "ok"
5624
+	this.ServeSuccessJSON(returnData)
5625
+	return
5626
+}

+ 63 - 0
models/self_drug_models.go View File

@@ -470,6 +470,9 @@ type BloodDrugWarehouseInfo struct {
470 470
 	MinNumber        int64   `json:"min_number"`
471 471
 	Dose             float64 `json:"dose"`
472 472
 	DoseUnit         string  `json:"dose_unit"`
473
+	WarehouseingUnit string  `gorm:"column:warehouseing_unit" json:"warehouseing_unit" form:"warehouseing_unit"`
474
+	LastPrice        float64 `gorm:"column:last_price" json:"last_price" form:"last_price"`
475
+	DrugOriginPlace  string  `gorm:"column:drug_origin_place" json:"drug_origin_place" form:"drug_origin_place"`
473 476
 }
474 477
 
475 478
 type BloodDrugCancelStockInfo struct {
@@ -666,3 +669,63 @@ type VmDrugWarehouseOutInfo struct {
666 669
 	DrugName                string  `json:"drug_name"`
667 670
 	Number                  string  `gorm:"column:number" json:"number" form:"number"`
668 671
 }
672
+
673
+type XtDrugAdjustPrice struct {
674
+	ID                int64   `gorm:"column:id" json:"id" form:"id"`
675
+	DrugName          string  `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
676
+	SpecificationName string  `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
677
+	WarehousingUnit   string  `gorm:"column:warehousing_unit" json:"warehousing_unit" form:"warehousing_unit"`
678
+	Count             int64   `gorm:"column:count" json:"count" form:"count"`
679
+	LastPrice         float64 `gorm:"column:last_price" json:"last_price" form:"last_price"`
680
+	RetailPrice       float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
681
+	NewPrice          float64 `gorm:"column:new_price" json:"new_price" form:"new_price"`
682
+	Manufacturer      string  `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
683
+	Dealer            string  `gorm:"column:dealer" json:"dealer" form:"dealer"`
684
+	Remark            string  `gorm:"column:remark" json:"remark" form:"remark"`
685
+	DrugId            int64   `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
686
+	UserOrgId         int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
687
+	Ctime             int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
688
+	Mtime             int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
689
+	Status            int64   `gorm:"column:status" json:"status" form:"status"`
690
+	WarehousingOrder  string  `gorm:"column:warehousing_order" json:"warehousing_order" form:"warehousing_order"`
691
+	Number            string  `gorm:"column:number" json:"number" form:"number"`
692
+	StartTime         int64   `gorm:"column:start_time" json:"start_time" form:"start_time"`
693
+	Creater           int64   `gorm:"column:creater" json:"creater" form:"creater"`
694
+	Checker           int64   `gorm:"column:checker" json:"checker" form:"checker"`
695
+	CheckerStatus     int64   `gorm:"column:checker_status" json:"checker_status" form:"checker_status"`
696
+	CheckerTime       int64   `gorm:"column:checker_time" json:"checker_time" form:"checker_time"`
697
+}
698
+
699
+func (XtDrugAdjustPrice) TableName() string {
700
+	return "xt_drug_adjust_price"
701
+}
702
+
703
+type XtDrugDamage struct {
704
+	ID                int64   `gorm:"column:id" json:"id" form:"id"`
705
+	DrugName          string  `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
706
+	SpecificationName string  `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
707
+	WarehousingUnit   string  `gorm:"column:warehousing_unit" json:"warehousing_unit" form:"warehousing_unit"`
708
+	Count             int64   `gorm:"column:count" json:"count" form:"count"`
709
+	LastPrice         float64 `gorm:"column:last_price" json:"last_price" form:"last_price"`
710
+	RetailPrice       float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
711
+	NewPrice          float64 `gorm:"column:new_price" json:"new_price" form:"new_price"`
712
+	Manufacturer      string  `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
713
+	Dealer            string  `gorm:"column:dealer" json:"dealer" form:"dealer"`
714
+	Remark            string  `gorm:"column:remark" json:"remark" form:"remark"`
715
+	DrugId            int64   `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
716
+	UserOrgId         int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
717
+	Ctime             int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
718
+	Mtime             int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
719
+	Status            int64   `gorm:"column:status" json:"status" form:"status"`
720
+	WarehousingOrder  string  `gorm:"column:warehousing_order" json:"warehousing_order" form:"warehousing_order"`
721
+	Number            string  `gorm:"column:number" json:"number" form:"number"`
722
+	StartTime         int64   `gorm:"column:start_time" json:"start_time" form:"start_time"`
723
+	Creater           int64   `gorm:"column:creater" json:"creater" form:"creater"`
724
+	Checker           int64   `gorm:"column:checker" json:"checker" form:"checker"`
725
+	CheckerStatus     int64   `gorm:"column:checker_status" json:"checker_status" form:"checker_status"`
726
+	CheckerTime       int64   `gorm:"column:checker_time" json:"checker_time" form:"checker_time"`
727
+}
728
+
729
+func (XtDrugDamage) TableName() string {
730
+	return "xt_drug_damage"
731
+}

+ 58 - 0
models/stock_models.go View File

@@ -946,3 +946,61 @@ type XtStockReportPrice struct {
946 946
 func (XtStockReportPrice) TableName() string {
947 947
 	return "xt_stock_report_price"
948 948
 }
949
+
950
+type XtStockInventory struct {
951
+	ID                int64   `gorm:"column:id" json:"id" form:"id"`
952
+	GoodName          string  `gorm:"column:good_name" json:"good_name" form:"good_name"`
953
+	SpecificationName string  `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
954
+	WarehousingUnit   string  `gorm:"column:warehousing_unit" json:"warehousing_unit" form:"warehousing_unit"`
955
+	Count             int64   `gorm:"column:count" json:"count" form:"count"`
956
+	BuyPrice          float64 `gorm:"column:buy_price" json:"buy_price" form:"buy_price"`
957
+	PackingPrice      float64 `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
958
+	NewPrice          float64 `gorm:"column:new_price" json:"new_price" form:"new_price"`
959
+	Manufacturer      string  `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
960
+	Dealer            string  `gorm:"column:dealer" json:"dealer" form:"dealer"`
961
+	Remark            string  `gorm:"column:remark" json:"remark" form:"remark"`
962
+	GoodId            int64   `gorm:"column:good_id" json:"good_id" form:"good_id"`
963
+	UserOrgId         int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
964
+	Ctime             int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
965
+	Mtime             int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
966
+	Status            int64   `gorm:"column:status" json:"status" form:"status"`
967
+	WarehousingOrder  string  `gorm:"column:warehousing_order" json:"warehousing_order" form:"warehousing_order"`
968
+	LicenseNumber     string  `gorm:"column:license_number" json:"license_number" form:"license_number"`
969
+	StartTime         int64   `gorm:"column:start_time" json:"start_time" form:"start_time"`
970
+	Creater           int64   `gorm:"column:creater" json:"creater" form:"creater"`
971
+	Checker           int64   `gorm:"column:checker" json:"checker" form:"checker"`
972
+	CheckerStatus     int64   `gorm:"column:checker_status" json:"checker_status" form:"checker_status"`
973
+	CheckerTime       int64   `gorm:"column:checker_time" json:"checker_time" form:"checker_time"`
974
+}
975
+
976
+func (XtStockInventory) TableName() string {
977
+	return "xt_stock_inventory"
978
+}
979
+
980
+type VmStockInventory struct {
981
+	ID                int64   `gorm:"column:id" json:"id" form:"id"`
982
+	GoodName          string  `gorm:"column:good_name" json:"good_name" form:"good_name"`
983
+	SpecificationName string  `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
984
+	WarehousingUnit   string  `gorm:"column:warehousing_unit" json:"warehousing_unit" form:"warehousing_unit"`
985
+	Count             int64   `gorm:"column:count" json:"count" form:"count"`
986
+	BuyPrice          float64 `gorm:"column:buy_price" json:"buy_price" form:"buy_price"`
987
+	PackingPrice      float64 `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
988
+	NewPrice          float64 `gorm:"column:new_price" json:"new_price" form:"new_price"`
989
+	Manufacturer      string  `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
990
+	Dealer            string  `gorm:"column:dealer" json:"dealer" form:"dealer"`
991
+	Remark            string  `gorm:"column:remark" json:"remark" form:"remark"`
992
+	GoodId            int64   `gorm:"column:good_id" json:"good_id" form:"good_id"`
993
+	UserOrgId         int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
994
+	Ctime             int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
995
+	Mtime             int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
996
+	Status            int64   `gorm:"column:status" json:"status" form:"status"`
997
+	WarehousingOrder  string  `gorm:"column:warehousing_order" json:"warehousing_order" form:"warehousing_order"`
998
+	LicenseNumber     string  `gorm:"column:license_number" json:"license_number" form:"license_number"`
999
+	StartTime         int64   `gorm:"column:start_time" json:"start_time" form:"start_time"`
1000
+	Creater           int64   `gorm:"column:creater" json:"creater" form:"creater"`
1001
+	Checker           int64   `gorm:"column:checker" json:"checker" form:"checker"`
1002
+	CheckerStatus     int64   `gorm:"column:checker_status" json:"checker_status" form:"checker_status"`
1003
+	CheckerTime       int64   `gorm:"column:checker_time" json:"checker_time" form:"checker_time"`
1004
+	PackingUnit       string  `gorm:"column:packing_unit" json:"packing_unit" form:"packing_unit"`
1005
+	UserName          string  `gorm:"column:user_name" json:"user_name" form:"user_name"`
1006
+}

+ 125 - 0
service/self_drug_service.go View File

@@ -808,3 +808,128 @@ func GetLastDrugWarehouseOutInfo(drugid int64, warehouseOutId int64, orgid int64
808 808
 
809 809
 	return info, err
810 810
 }
811
+
812
+func PostSearchDrugWarehouseList(keyword string, orgid int64) (info []*models.BloodDrugWarehouseInfo, err error) {
813
+	db := XTReadDB().Table("xt_drug_warehouse_info as x").Where("x.status = 1")
814
+	table := XTReadDB().Table("xt_base_drug as t").Where("t.status")
815
+	fmt.Println(table)
816
+	likeKey := "%" + keyword + "%"
817
+	if orgid > 0 {
818
+		db = db.Where("x.org_id = ?", orgid)
819
+	}
820
+	err = db.Select("x.id,x.warehousing_id,x.drug_id,x.number,x.product_date,x.expiry_date,x.warehousing_count,x.price,x.total_price,x.dealer,x.remark,x.warehousing_order,x.warehouseing_unit,x.stock_max_number,x.stock_min_number,x.batch_number,t.drug_origin_place,t.drug_name,t.min_unit,x.manufacturer,t.retail_price,t.max_unit,t.min_number,t.dose,t.dose_unit,t.last_price").Joins("left join xt_base_drug as t on t.id = x.drug_id").Where("t.drug_name like ? and t.org_id = ?", likeKey, orgid).Order("x.ctime desc").Scan(&info).Error
821
+	return info, err
822
+
823
+}
824
+
825
+func CreateDrugPrice(price models.XtDrugAdjustPrice) error {
826
+
827
+	err := XTWriteDB().Create(&price).Error
828
+	return err
829
+}
830
+
831
+func GetDrugPriceList(startime int64, endtime int64, orgId int64, keyword string, limit int64, page int64) (adjust []*models.XtDrugAdjustPrice, total int64, err error) {
832
+	likeKey := "%" + keyword + "%"
833
+	offset := (page - 1) * limit
834
+	db := XTReadDB().Model(&adjust).Where("status = 1")
835
+	if startime > 0 {
836
+		db = db.Where("ctime >=?", startime)
837
+	}
838
+	if endtime > 0 {
839
+		db = db.Where("ctime<=?", endtime)
840
+	}
841
+	if orgId > 0 {
842
+		db = db.Where("user_org_id = ?", orgId)
843
+	}
844
+	if len(keyword) > 0 {
845
+		db = db.Where("warehousing_order like ?", likeKey)
846
+	}
847
+	err = db.Count(&total).Offset(offset).Limit(limit).Find(&adjust).Error
848
+	return adjust, total, err
849
+}
850
+
851
+func UpdateDrugAdjuestPrice(ids []string, info models.XtDrugAdjustPrice) error {
852
+	err := XTWriteDB().Model(&info).Where("id in(?)", ids).Updates(map[string]interface{}{"checker": info.Checker, "checker_status": info.CheckerStatus, "checker_time": info.CheckerTime}).Error
853
+	return err
854
+}
855
+
856
+func CreateDrugDamage(damage models.XtDrugDamage) error {
857
+
858
+	err := XTWriteDB().Create(&damage).Error
859
+	return err
860
+}
861
+
862
+func GetDrugDamageList(startime int64, endtime int64, orgId int64, keyword string, limit int64, page int64) (adjust []*models.XtDrugDamage, total int64, err error) {
863
+	likeKey := "%" + keyword + "%"
864
+	offset := (page - 1) * limit
865
+	db := XTReadDB().Model(&adjust).Where("status = 1")
866
+	if startime > 0 {
867
+		db = db.Where("ctime >=?", startime)
868
+	}
869
+	if endtime > 0 {
870
+		db = db.Where("ctime<=?", endtime)
871
+	}
872
+	if orgId > 0 {
873
+		db = db.Where("user_org_id = ?", orgId)
874
+	}
875
+	if len(keyword) > 0 {
876
+		db = db.Where("warehousing_order like ?", likeKey)
877
+	}
878
+	err = db.Count(&total).Offset(offset).Limit(limit).Find(&adjust).Error
879
+	return adjust, total, err
880
+}
881
+
882
+func UpdateDrugDamage(ids []string, damage models.XtDrugDamage) error {
883
+
884
+	err := XTWriteDB().Model(&damage).Where("id in(?)", ids).Updates(map[string]interface{}{"checker": damage.Checker, "checker_status": damage.CheckerStatus, "checker_time": damage.CheckerTime}).Error
885
+	return err
886
+}
887
+
888
+func GetDrugModifyPrice(id int64) (models.XtDrugAdjustPrice, error) {
889
+	adjuest := models.XtDrugAdjustPrice{}
890
+	err := XTReadDB().Model(&adjuest).Where("id=? and status = 1", id).Find(&adjuest).Error
891
+	return adjuest, err
892
+}
893
+
894
+func ModifyDrugPrice(id int64, adjust models.XtDrugAdjustPrice) error {
895
+
896
+	err := XTWriteDB().Model(&adjust).Where("id=? and status = 1", id).Updates(map[string]interface{}{"drug_name": adjust.DrugName, "retail_price": adjust.RetailPrice, "new_price": adjust.NewPrice, "count": adjust.Count, "remark": adjust.Remark}).Error
897
+	return err
898
+}
899
+
900
+func GetModifyPricePrint(ids []string) (info []*models.XtDrugAdjustPrice, err error) {
901
+
902
+	err = XTReadDB().Model(&info).Where("id in(?) and status = 1", ids).Find(&info).Error
903
+	return info, err
904
+}
905
+
906
+func GetDrugDamageDetail(id int64) (models.XtDrugDamage, error) {
907
+
908
+	damage := models.XtDrugDamage{}
909
+	err := XTReadDB().Model(&damage).Where("id=? and status = 1", id).Find(&damage).Error
910
+	return damage, err
911
+}
912
+
913
+func ModifyDrugDamage(id int64, damage models.XtDrugDamage) error {
914
+
915
+	err := XTWriteDB().Model(&damage).Where("id=? and status = 1", id).Updates(map[string]interface{}{"drug_name": damage.DrugName, "warehousing_unit": damage.WarehousingUnit, "count": damage.Count, "last_price": damage.LastPrice, "retail_price": damage.RetailPrice, "new_price": damage.NewPrice, "manufacturer": damage.Manufacturer, "remark": damage.Remark, "number": damage.Number, "drug_id": damage.DrugId}).Error
916
+	return err
917
+}
918
+
919
+func DeleteDrugDamage(id int64) error {
920
+	damage := models.XtDrugDamage{}
921
+	err := XTWriteDB().Model(&damage).Where("id=? and status = 1").Updates(map[string]interface{}{"status": 0}).Error
922
+	return err
923
+}
924
+
925
+func GetDrugDamagePrint(ids []string) (damage []*models.XtDrugDamage, err error) {
926
+
927
+	err = XTReadDB().Model(&damage).Where("id in(?) and status = 1", ids).Find(&damage).Error
928
+	return damage, err
929
+}
930
+
931
+func GetWarehoseInfoById(id int64) (info []*models.XtDrugWarehouseInfo, err error) {
932
+
933
+	err = XTReadDB().Model(&info).Where("drug_id=? and status = 1", id).Find(&info).Error
934
+	return info, err
935
+}

+ 158 - 4
service/stock_service.go View File

@@ -4304,8 +4304,9 @@ func CreateAdjustPrice(adjustPrice *models.XtStockAdjustPrice) error {
4304 4304
 	return err
4305 4305
 }
4306 4306
 
4307
-func GetAllStockPrice(orgid int64, startime int64, endtime int64, keyword string) (list []*models.VmStockAdjustPrice, err error) {
4307
+func GetAllStockPrice(orgid int64, startime int64, endtime int64, keyword string, limit int64, page int64) (list []*models.VmStockAdjustPrice, total int64, err error) {
4308 4308
 	likeKey := "%" + keyword + "%"
4309
+	offset := (page - 1) * limit
4309 4310
 	db := XTReadDB().Table("xt_stock_adjust_price as x").Where("x.status = 1")
4310 4311
 	table := XTReadDB().Table("xt_good_information as t").Where("t.status = 1")
4311 4312
 	tab := UserReadDB().Table("sgj_user_admin_role as r").Where("r.status = 1")
@@ -4317,13 +4318,13 @@ func GetAllStockPrice(orgid int64, startime int64, endtime int64, keyword string
4317 4318
 		db = db.Where("x.end_time<=?", endtime)
4318 4319
 	}
4319 4320
 	if len(keyword) > 0 {
4320
-		db = db.Where("x.warehousing_order like ?", likeKey)
4321
+		db = db.Where("x.warehousing_order = ? or r.user_name like ?", keyword, likeKey)
4321 4322
 	}
4322 4323
 	if orgid > 0 {
4323 4324
 		db = db.Where("x.user_org_id = ?", orgid)
4324 4325
 	}
4325
-	err = db.Select("x.id,x.good_name,x.specification_name,x.warehousing_unit,x.count,x.buy_price,x.packing_price,x.new_price,x.manufacturer,x.dealer,x.remark,x.good_id,x.warehousing_order,x.license_number,x.start_time,x.creater,x.checker,x.checker_status,x.checker_time,t.packing_unit").Joins("left join sgj_users.sgj_user_admin_role as r on r.id = x.creater").Joins("left join xt_good_information as t on t.id =x.good_id").Scan(&list).Error
4326
-	return list, err
4326
+	err = db.Select("x.id,x.good_name,x.specification_name,x.warehousing_unit,x.count,x.buy_price,x.packing_price,x.new_price,x.manufacturer,x.dealer,x.remark,x.good_id,x.warehousing_order,x.license_number,x.start_time,x.creater,x.checker,x.checker_status,x.checker_time,t.packing_unit").Joins("left join sgj_users.sgj_user_admin_role as r on r.id = x.creater").Joins("left join xt_good_information as t on t.id =x.good_id").Count(&total).Offset(offset).Limit(limit).Scan(&list).Error
4327
+	return list, total, err
4327 4328
 }
4328 4329
 
4329 4330
 func UpdateAdjustPrice(ids []string, info models.XtStockAdjustPrice) error {
@@ -4332,6 +4333,18 @@ func UpdateAdjustPrice(ids []string, info models.XtStockAdjustPrice) error {
4332 4333
 	return err
4333 4334
 }
4334 4335
 
4336
+func UpdateAdjustCheckPrice(info *models.GoodInfo, id int64) error {
4337
+
4338
+	err := XTWriteDB().Model(&info).Where("id = ? and status = 1", id).Updates(map[string]interface{}{"packing_price": info.PackingPrice}).Error
4339
+	return err
4340
+}
4341
+
4342
+func GetAdjustCheckPriceList(ids []string) (info []*models.XtStockAdjustPrice, err error) {
4343
+
4344
+	err = XTReadDB().Where("id in(?)", ids).Find(&info).Error
4345
+	return info, err
4346
+}
4347
+
4335 4348
 func GetAdjustPricebyIdOne(ids []string) (adjust []*models.XtStockAdjustPrice, err error) {
4336 4349
 
4337 4350
 	err = XTReadDB().Where("id in(?) and status = 1", ids).Find(&adjust).Error
@@ -4366,3 +4379,144 @@ func GetReportStockList(startime int64, endtime int64, orgid int64, keyword stri
4366 4379
 	err = db.Select("x.id,x.good_name,x.specification_name,x.warehousing_unit,x.count,x.buy_price,x.packing_price,x.new_price,x.manufacturer,x.dealer,x.remark,x.good_id,x.warehousing_order,x.license_number,x.start_time,x.creater,x.checker,x.checker_status,x.checker_time,t.packing_unit,r.user_name").Joins("left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = x.creater").Joins("left join xt_good_information as t on t.id =x.good_id").Count(&total).Offset(offset).Limit(limit).Scan(&adjust).Error
4367 4380
 	return adjust, total, err
4368 4381
 }
4382
+
4383
+func UpdateCheckDamage(ids []string, reportPrice models.XtStockReportPrice) error {
4384
+
4385
+	err := XTWriteDB().Model(&reportPrice).Where("id in(?) and status = 1", ids).Updates(map[string]interface{}{"checker": reportPrice.Checker, "checker_time": reportPrice.CheckerTime, "checker_status": reportPrice.CheckerStatus}).Error
4386
+	return err
4387
+}
4388
+
4389
+func CreateInentory(inventory models.XtStockInventory) error {
4390
+
4391
+	err = XTWriteDB().Create(&inventory).Error
4392
+	return err
4393
+}
4394
+
4395
+func GetInventorylist(startime int64, endtime int64, page int64, limit int64, inventory_status int64, keyword string, orgid int64) (adjust []*models.VmStockAdjustPrice, total int64, err error) {
4396
+
4397
+	likeKey := "%" + keyword + "%"
4398
+	offset := (page - 1) * limit
4399
+	db := XTReadDB().Table("xt_stock_inventory as x").Where("x.status = 1")
4400
+	table := XTReadDB().Table("xt_good_information as t").Where("t.status = 1")
4401
+	tab := UserReadDB().Table("sgj_user_admin_role as r").Where("r.status = 1")
4402
+	fmt.Println(table, tab)
4403
+	if startime > 0 {
4404
+		db = db.Where("x.start_time>=?", startime)
4405
+	}
4406
+	if endtime > 0 {
4407
+		db = db.Where("x.end_time<=?", endtime)
4408
+	}
4409
+	if len(keyword) > 0 {
4410
+		db = db.Where("x.warehousing_order like ?", likeKey)
4411
+	}
4412
+	if orgid > 0 {
4413
+		db = db.Where("x.user_org_id = ?", orgid)
4414
+	}
4415
+	err = db.Select("x.id,x.good_name,x.specification_name,x.warehousing_unit,x.count,x.buy_price,x.packing_price,x.new_price,x.manufacturer,x.dealer,x.remark,x.good_id,x.warehousing_order,x.license_number,x.start_time,x.creater,x.checker,x.checker_status,x.checker_time,t.packing_unit,r.user_name").Joins("left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = x.creater").Joins("left join xt_good_information as t on t.id =x.good_id").Count(&total).Offset(offset).Limit(limit).Scan(&adjust).Error
4416
+	return adjust, total, err
4417
+}
4418
+
4419
+func UpdateCheckInventory(ids []string, info models.XtStockInventory) error {
4420
+	err := XTWriteDB().Model(&info).Where("id in(?)", ids).Updates(map[string]interface{}{"checker": info.Checker, "checker_status": info.CheckerStatus, "checker_time": info.CheckerTime}).Error
4421
+	return err
4422
+}
4423
+
4424
+func GetModifyPriceDetail(id int64) (models.XtStockAdjustPrice, error) {
4425
+
4426
+	info := models.XtStockAdjustPrice{}
4427
+	err := XTReadDB().Model(&info).Where("id = ? and status = 1", id).Find(&info).Error
4428
+	return info, err
4429
+}
4430
+
4431
+func UpdateStockPrice(info models.XtStockAdjustPrice, id int64) error {
4432
+
4433
+	err := XTWriteDB().Model(&info).Where("id = ? and status = 1", id).Updates(map[string]interface{}{"new_price": info.NewPrice}).Error
4434
+	return err
4435
+}
4436
+
4437
+func DeleteStockPrice(id int64) error {
4438
+	info := models.XtStockAdjustPrice{}
4439
+	err := XTWriteDB().Model(&info).Where("id = ? and status = 1", id).Updates(map[string]interface{}{"status": 0}).Error
4440
+	return err
4441
+}
4442
+
4443
+func GetStockDamageDetail(id int64) (models.XtStockReportPrice, error) {
4444
+	report := models.XtStockReportPrice{}
4445
+	err := XTReadDB().Model(&report).Where("id=? and status = 1", id).Find(&report).Error
4446
+	return report, err
4447
+}
4448
+
4449
+func ModifyPrice(id int64, info models.XtStockReportPrice) error {
4450
+
4451
+	err := XTWriteDB().Model(&info).Where("id = ?", id).Updates(map[string]interface{}{"count": info.Count}).Error
4452
+	return err
4453
+}
4454
+
4455
+func DeleteDamage(id int64) error {
4456
+	adjust := models.XtStockReportPrice{}
4457
+	err := XTWriteDB().Model(&adjust).Where("id=? and status = 1", id).Updates(map[string]interface{}{"status": 0}).Error
4458
+	return err
4459
+}
4460
+
4461
+func GetStockDamageById(ids []string) (adjust []*models.XtStockReportPrice, err error) {
4462
+
4463
+	err = XTReadDB().Where("id in(?) and status = 1", ids).Find(&adjust).Error
4464
+	return adjust, err
4465
+}
4466
+
4467
+func GetInventoryDetail(id int64) (models.XtStockInventory, error) {
4468
+
4469
+	inventory := models.XtStockInventory{}
4470
+	err := XTReadDB().Model(&inventory).Where("id=? and status = 1", id).Find(&inventory).Error
4471
+	return inventory, err
4472
+}
4473
+
4474
+func ModifyInventory(id int64, inventory models.XtStockInventory) error {
4475
+
4476
+	err := XTWriteDB().Model(&inventory).Where("id = ? and status = 1", id).Updates(map[string]interface{}{"count": inventory.Count, "remark": inventory.Remark}).Error
4477
+	return err
4478
+}
4479
+
4480
+func DeleteInventory(id int64) error {
4481
+
4482
+	inventory := models.XtStockInventory{}
4483
+	err := XTWriteDB().Model(&inventory).Where("id = ? and status = 1", id).Updates(map[string]interface{}{"status": 0}).Error
4484
+	return err
4485
+}
4486
+
4487
+func GetInventoryDetailList(keyword string, limit int64, page int64, orgid int64) (list []*models.VmStockInventory, total int64, err error) {
4488
+
4489
+	likeKey := "%" + keyword + "%"
4490
+	offset := (page - 1) * limit
4491
+	db := XTReadDB().Table("xt_stock_inventory as x").Where("x.status = 1")
4492
+	table := XTReadDB().Table("xt_good_information as t").Where("t.status = 1")
4493
+	tab := UserReadDB().Table("sgj_user_admin_role as r").Where("r.status = 1")
4494
+	fmt.Println(table, tab)
4495
+	if len(keyword) > 0 {
4496
+		db = db.Where("x.warehousing_order = ? or r.user_name like ?", keyword, likeKey)
4497
+	}
4498
+	if orgid > 0 {
4499
+		db = db.Where("x.user_org_id = ?", orgid)
4500
+	}
4501
+	err = db.Select("x.id,x.good_name,x.specification_name,x.warehousing_unit,x.count,x.buy_price,x.packing_price,x.new_price,x.manufacturer,x.dealer,x.remark,x.good_id,x.warehousing_order,x.license_number,x.start_time,x.creater,x.checker,x.checker_status,x.checker_time,t.packing_unit").Joins("left join sgj_users.sgj_user_admin_role as r on r.id = x.creater").Joins("left join xt_good_information as t on t.id =x.good_id").Count(&total).Offset(offset).Limit(limit).Scan(&list).Error
4502
+	return list, total, err
4503
+}
4504
+
4505
+func GetInventoryPrintList(ids []string) (list []*models.XtStockInventory, err error) {
4506
+
4507
+	err = XTReadDB().Where("id in(?) and status = 1", ids).Find(&list).Error
4508
+	return list, err
4509
+}
4510
+
4511
+func GetInventoryDetailPrintList(ids []string) (list []*models.XtStockInventory, err error) {
4512
+
4513
+	err = XTReadDB().Where("id in(?) and status = 1", ids).Find(&list).Error
4514
+	return list, err
4515
+}
4516
+
4517
+func DeleteDrugPrice(id int64) error {
4518
+
4519
+	info := models.XtDrugAdjustPrice{}
4520
+	err := XTReadDB().Model(&info).Where("id = ? and status = 1", id).Updates(map[string]interface{}{"status": 0}).Error
4521
+	return err
4522
+}

+ 0 - 6
service/user_service.go View File

@@ -177,9 +177,3 @@ func GetAllHisDoctor(orgid int64) (appRole []*models.App_Role, err error) {
177 177
 	err = UserReadDB().Where("org_id = ?  AND status = 1 AND  (user_type = ? OR user_type = ?) ", orgid, 2, 1).Find(&appRole).Error
178 178
 	return appRole, err
179 179
 }
180
-
181
-func UpdateCheckDamage(ids []string, reportPrice models.XtStockReportPrice) error {
182
-
183
-	err := XTWriteDB().Model(&reportPrice).Where("id in(?) and status = 1", ids).Updates(map[string]interface{}{"checker": reportPrice.Checker, "checker_time": reportPrice.CheckerTime}).Error
184
-	return err
185
-}