Browse Source

Merge branch 'master' of http://git.shengws.com/csx/gdyb

csx 1 year ago
parent
commit
218e622ab5

+ 3 - 3
controllers/js/jsyb_controller.go View File

@@ -132,14 +132,14 @@ func (c *JSybController) Get3503() {
132 132
 	}
133 133
 
134 134
 	userJSONBytes, _ := json.Marshal(respJSON["config"])
135
-	var struct3503 []models.Struct3503
135
+	var struct3503 models.Struct3503
136 136
 	if err := json.Unmarshal(userJSONBytes, &struct3503); err != nil {
137 137
 		utils.ErrorLog("解析失败:%v", err)
138 138
 		return
139 139
 	}
140 140
 
141
-	result, request_log := service.Jsyb3503(struct3503[0])
142
-	saveJsLog(result, request_log, "3501", "库存盘点", struct3503[0].OrgName)
141
+	result, request_log := service.Jsyb3503(struct3503)
142
+	saveJsLog(result, request_log, "3503", "库存采购", struct3503.OrgName)
143 143
 	var dat2 map[string]interface{}
144 144
 	if err := json.Unmarshal([]byte(request_log), &dat2); err == nil {
145 145
 	} else {

+ 0 - 1
enums/error_code.go View File

@@ -470,7 +470,6 @@ var ErrCodeMsgs = map[int]string{
470 470
 	ErrorCodeRegisterOneException: "无参保信息",
471 471
 
472 472
 	ErrorCodeRegisterTwoException:    "挂号失败",
473
-	ErrorCodeCreatePreOrderException: "创建预结算订单失败",
474 473
 	ErrorCodeCalOrderException:       "结算失败",
475 474
 	ErrorCodeGdybOneException:        "获取人员信息失败",
476 475
 	ErrorCodeRegisterThreeException:  "就诊信息上传失败",

+ 2 - 0
main.go View File

@@ -27,8 +27,10 @@ func init() {
27 27
 	if org_id == 10191 {
28 28
 		service.GetFjAuthorizationInfo(miConfig.Code)
29 29
 	}
30
+
30 31
 }
31 32
 func main() {
33
+	service.BeginAutoCreateWeekSchedulesJob()
32 34
 	beego.Run()
33 35
 }
34 36
 

+ 6 - 0
models/models_3501.go View File

@@ -21,6 +21,12 @@ type Struct3501 struct {
21 21
 	RequestUrl          string
22 22
 	AccessKey           string
23 23
 	Cainfo              string
24
+	Aprvno              string
25
+	SplerName           string
26
+	ProdentpName        string
27
+	PurcRetnCnt         string
28
+	PurcRetnStoinTime   string
29
+	PurcRetnOpterName   string
24 30
 }
25 31
 type Struct3502 struct {
26 32
 	MedListCodg         string

+ 377 - 0
models/new_stock_models.go View File

@@ -0,0 +1,377 @@
1
+package models
2
+
3
+type NewWarehousing struct {
4
+	ID                int64        `gorm:"column:id" json:"id"`
5
+	WarehousingOrder  string       `gorm:"column:warehousing_order" json:"warehousing_order"`
6
+	OperationTime     int64        `gorm:"column:operation_time" json:"operation_time"`
7
+	OrgId             int64        `gorm:"column:org_id" json:"org_id"`
8
+	Creater           int64        `gorm:"column:creater" json:"creater"`
9
+	Ctime             int64        `gorm:"column:ctime" json:"ctime"`
10
+	Modifier          int64        `gorm:"column:modifier" json:"modifier"`
11
+	Mtime             int64        `gorm:"column:mtime" json:"mtime"`
12
+	Status            int64        `gorm:"column:status" json:"status"`
13
+	WarehousingTime   int64        `gorm:"column:warehousing_time" json:"warehousing_time"`
14
+	Dealer            int64        `gorm:"column:dealer" json:"dealer"`
15
+	Manufacturer      int64        `gorm:"column:manufacturer" json:"manufacturer"`
16
+	Manufacturers     Manufacturer `gorm:"ForeignKey:ID;AssociationForeignKey:Manufacturer" json:"Manufacturer"`
17
+	Dealers           Dealer       `gorm:"ForeignKey:ID;AssociationForeignKey:Dealer" json:"Dealer"`
18
+	Type              int64        `gorm:"column:type" json:"type"`
19
+	SupplyWarehouseId int64        `gorm:"column:supply_warehouse_id" json:"supply_warehouse_id" form:"supply_warehouse_id"`
20
+	StorehouseId      int64        `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
21
+	IsSys             int64        `gorm:"column:is_sys" json:"is_sys" form:"is_sys"`
22
+	SecondWarehouseId int64        `gorm:"column:second_warehouse_id" json:"second_warehouse_id" form:"second_warehouse_id"`
23
+	IsCheck           int64        `gorm:"column:is_check" json:"is_check" form:"is_check"`
24
+}
25
+
26
+func (NewWarehousing) TableName() string {
27
+	return "xt_warehouse"
28
+}
29
+
30
+type NewWarehousingInfo struct {
31
+	ID                    int64        `gorm:"column:id" json:"id"`
32
+	WarehousingId         int64        `gorm:"column:warehousing_id" json:"warehousing_id"`
33
+	GoodId                int64        `gorm:"column:good_id" json:"good_id"`
34
+	GoodTypeId            int64        `gorm:"column:good_type_id" json:"good_type_id"`
35
+	Number                string       `gorm:"column:number" json:"number"`
36
+	ProductDate           int64        `gorm:"column:product_date" json:"product_date"`
37
+	ExpiryDate            int64        `gorm:"column:expiry_date" json:"expiry_date"`
38
+	WarehousingCount      int64        `gorm:"column:warehousing_count" json:"warehousing_count"`
39
+	WarehousingUnit       string       `gorm:"column:warehousing_unit" json:"warehousing_unit"`
40
+	Price                 float64      `gorm:"column:price" json:"price"`
41
+	TotalPrice            float64      `gorm:"column:total_price" json:"total_price"`
42
+	Dealer                int64        `gorm:"column:dealer" json:"dealer"`
43
+	Manufacturer          int64        `gorm:"column:manufacturer" json:"manufacturer"`
44
+	Remark                string       `gorm:"column:remark" json:"remark"`
45
+	Ctime                 int64        `gorm:"column:ctime" json:"ctime"`
46
+	Mtime                 int64        `gorm:"column:mtime" json:"mtime"`
47
+	Status                int64        `gorm:"column:status" json:"status"`
48
+	OrgId                 int64        `gorm:"column:org_id" json:"org_id"`
49
+	IsReturn              int64        `gorm:"column:is_return" json:"is_return"`
50
+	StockCount            int64        `gorm:"column:stock_count" json:"stock_count" form:"stock_count"`
51
+	WarehousingOrder      string       `gorm:"column:warehousing_order" json:"warehousing_order"`
52
+	Type                  int64        `gorm:"column:type" json:"type"`
53
+	GoodName              string       `json:"good_name"`
54
+	PackingUnit           string       `json:"packing_unit"`
55
+	TotalCount            int64        `json:"total_count"`
56
+	SpecificationName     string       `json:"specification_name"`
57
+	LicenseNumber         string       `gorm:"column:license_number" json:"license_number" form:"license_number"`
58
+	StorehouseId          int64        `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
59
+	SecondWarehouseInfoId int64        `gorm:"column:second_warehouse_info_id" json:"second_warehouse_info_id" form:"second_warehouse_info_id"`
60
+	GoodInfo              GoodInfo     `gorm:"ForeignKey:ID;AssociationForeignKey:GoodId" json:"infos"`
61
+	Manufacturers         Manufacturer `gorm:"ForeignKey:ID;AssociationForeignKey:Manufacturer" json:"Manufacturer"`
62
+	Dealers               Dealer       `gorm:"ForeignKey:ID;AssociationForeignKey:Dealer" json:"Dealer"`
63
+}
64
+
65
+func (NewWarehousingInfo) TableName() string {
66
+	return "xt_warehouse_info"
67
+}
68
+
69
+type NewWarehouseOut struct {
70
+	ID                      int64        `gorm:"column:id" json:"id"`
71
+	WarehouseOutOrderNumber string       `gorm:"column:warehouse_out_order_number" json:"warehouse_out_order_number"`
72
+	OperationTime           int64        `gorm:"column:operation_time" json:"operation_time"`
73
+	Creater                 int64        `gorm:"column:creater" json:"creater"`
74
+	OrgId                   int64        `gorm:"column:org_id" json:"org_id"`
75
+	Modifier                int64        `gorm:"column:modifier" json:"modifier"`
76
+	Remark                  string       `gorm:"column:remark" json:"remark"`
77
+	Ctime                   int64        `gorm:"column:ctime" json:"ctime"`
78
+	Mtime                   int64        `gorm:"column:mtime" json:"mtime"`
79
+	Status                  int64        `gorm:"column:status" json:"status"`
80
+	WarehouseOutTime        int64        `gorm:"column:warehouse_out_time" json:"warehouse_out_time"`
81
+	Dealer                  int64        `gorm:"column:dealer" json:"dealer"`
82
+	Manufacturer            int64        `gorm:"column:manufacturer" json:"manufacturer"`
83
+	Manufacturers           Manufacturer `gorm:"ForeignKey:ID;AssociationForeignKey:Manufacturer" json:"Manufacturer"`
84
+	Dealers                 Dealer       `gorm:"ForeignKey:ID;AssociationForeignKey:Dealer" json:"Dealer"`
85
+	Type                    int64        `gorm:"column:type" json:"type"`
86
+	IsSys                   int64        `gorm:"column:is_sys" json:"is_sys"`
87
+	SupplyCancelOutId       int64        `gorm:"column:supply_cancel_out_id" json:"supply_cancel_out_id" form:"supply_cancel_out_id"`
88
+	SupplyWarehouseId       int64        `gorm:"column:supply_warehouse_id" json:"supply_warehouse_id" form:"supply_warehouse_id"`
89
+	StorehouseId            int64        `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
90
+	SecondWarehouseId       int64        `gorm:"column:second_warehouse_id" json:"second_warehouse_id" form:"second_warehouse_id"`
91
+	IsCheck                 int64        `gorm:"column:is_check" json:"is_check" form:"is_check"`
92
+}
93
+
94
+func (NewWarehouseOut) TableName() string {
95
+	return "xt_warehouse_out"
96
+}
97
+
98
+type NewWarehouseOutInfo struct {
99
+	ID                      int64           `gorm:"column:id" json:"id"`
100
+	WarehouseOutId          int64           `gorm:"column:warehouse_out_id" json:"warehouse_out_id"`
101
+	WarehouseInfotId        int64           `gorm:"column:warehouse_info_id" json:"warehouse_info_id"`
102
+	GoodId                  int64           `gorm:"column:good_id" json:"good_id"`
103
+	GoodTypeId              int64           `gorm:"column:good_type_id" json:"good_type_id"`
104
+	WarehousingOutTarget    int64           `gorm:"column:warehousing_out_target" json:"warehousing_out_target"`
105
+	Count                   int64           `gorm:"column:count" json:"count"`
106
+	Price                   float64         `gorm:"column:price" json:"price"`
107
+	TotalPrice              float64         `gorm:"column:total_price" json:"total_price"`
108
+	ProductDate             int64           `gorm:"column:product_date" json:"product_date"`
109
+	ExpiryDate              int64           `gorm:"column:expiry_date" json:"expiry_date"`
110
+	Mtime                   int64           `gorm:"column:mtime" json:"mtime"`
111
+	Ctime                   int64           `gorm:"column:ctime" json:"ctime"`
112
+	Status                  int64           `gorm:"column:status" json:"status"`
113
+	OrgId                   int64           `gorm:"column:org_id" json:"org_id"`
114
+	Remark                  string          `gorm:"column:remark" json:"remark"`
115
+	IsCancel                int64           `gorm:"column:is_cancel" json:"is_cancel"`
116
+	WarehouseOutOrderNumber string          `gorm:"column:warehouse_out_order_number" json:"warehouse_out_order_number"`
117
+	GoodInfo                GoodInfo        `gorm:"ForeignKey:ID;AssociationForeignKey:GoodId" json:"info"`
118
+	Type                    int64           `gorm:"column:type" json:"type"`
119
+	Dealer                  int64           `gorm:"column:dealer" json:"dealer"`
120
+	Manufacturer            int64           `gorm:"column:manufacturer" json:"manufacturer"`
121
+	IsSys                   int64           `gorm:"column:is_sys" json:"is_sys"`
122
+	SysRecordTime           int64           `gorm:"column:sys_record_time" json:"sys_record_time"`
123
+	PatientId               int64           `gorm:"column:patient_id" json:"patient_id"`
124
+	Number                  string          `gorm:"column:number" json:"number" form:"number"`
125
+	LicenseNumber           string          `gorm:"column:license_number" json:"license_number" form:"license_number"`
126
+	ConsumableType          int64           `gorm:"column:consumable_type" json:"consumable_type" form:"consumable_type"`
127
+	ProjectId               int64           `gorm:"column:project_id" json:"project_id" form:"project_id"`
128
+	SupplyCancelOutId       int64           `gorm:"column:supply_cancel_out_id" json:"supply_cancel_out_id" form:"supply_cancel_out_id"`
129
+	SupplyWarehouseId       int64           `gorm:"column:supply_warehouse_id" json:"supply_warehouse_id" form:"supply_warehouse_id"`
130
+	IsSource                int64           `gorm:"column:is_source" json:"is_source" form:"is_source"`
131
+	StorehouseId            int64           `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
132
+	SecondWarehouseInfoId   int64           `gorm:"column:second_warehouse_info_id" json:"second_warehouse_info_id" form:"second_warehouse_info_id"`
133
+	AdminUserId             int64           `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
134
+	BuyPrice                float64         `gorm:"column:buy_price" json:"buy_price" form:"buy_price"`
135
+	StockCount              string          `gorm:"column:stock_count" json:"stock_count" form:"stock_count"`
136
+	IsCheck                 int64           `gorm:"column:is_check" json:"is_check" form:"is_check"`
137
+	RegisterNumber          string          `gorm:"column:register_number" json:"register_number" form:"register_number"`
138
+	WarehousingInfo         WarehousingInfo `gorm:"ForeignKey:ID;AssociationForeignKey:WarehouseInfotId" `
139
+	VmStockFlow             VmStockFlow     `gorm:"ForeignKey:ID;AssociationForeignKey:WarehouseOutDetailId" json:"stock_flow"`
140
+	OverCount               int64           `gorm:"column:over_count" json:"over_count" form:"over_count"`
141
+	Manufacturers           Manufacturer    `gorm:"ForeignKey:ID;AssociationForeignKey:Manufacturer" json:"Manufacturer"`
142
+	Dealers                 Dealer          `gorm:"ForeignKey:ID;AssociationForeignKey:Dealer" json:"Dealer"`
143
+}
144
+
145
+func (NewWarehouseOutInfo) TableName() string {
146
+	return "xt_warehouse_out_info"
147
+}
148
+
149
+type NewCancelStock struct {
150
+	ID           int64  `gorm:"column:id" json:"id"`
151
+	OrderNumber  string `gorm:"column:order_number" json:"order_number"`
152
+	OperaTime    int64  `gorm:"column:opera_time" json:"opera_time"`
153
+	Total        int64  `gorm:"column:total" json:"total"`
154
+	Creater      int64  `gorm:"column:creater" json:"creater"`
155
+	Ctime        int64  `gorm:"column:ctime" json:"ctime"`
156
+	Mtime        int64  `gorm:"column:mtime" json:"mtime"`
157
+	Status       int64  `gorm:"column:status" json:"status"`
158
+	OrgId        int64  `gorm:"column:org_id" json:"org_id"`
159
+	ReturnTime   int64  `gorm:"column:return_time" json:"return_time"`
160
+	Dealer       int64  `gorm:"column:dealer" json:"dealer"`
161
+	Manufacturer int64  `gorm:"column:manufacturer" json:"manufacturer"`
162
+	Type         int64  `gorm:"column:type" json:"type"`
163
+	StorehouseId int64  `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
164
+	IsCheck      int64  `gorm:"column:is_check" json:"is_check" form:"is_check"`
165
+}
166
+
167
+func (NewCancelStock) TableName() string {
168
+	return "xt_cancel_stock"
169
+}
170
+
171
+type NewCancelStockInfo struct {
172
+	ID              int64        `gorm:"column:id" json:"id"`
173
+	GoodId          int64        `gorm:"column:good_id" json:"good_id"`
174
+	CancelStockId   int64        `gorm:"column:cancel_stock_id" json:"cancel_stock_id"`
175
+	GoodTypeId      int64        `gorm:"column:good_type_id" json:"good_type_id"`
176
+	Count           int64        `gorm:"column:count" json:"count"`
177
+	Price           float64      `gorm:"column:price" json:"price"`
178
+	Total           float64      `gorm:"column:total" json:"total"`
179
+	ProductDate     int64        `gorm:"column:product_date" json:"product_date"`
180
+	ExpiryDate      int64        `gorm:"column:expiry_date" json:"expiry_date"`
181
+	Ctime           int64        `gorm:"column:ctime" json:"ctime"`
182
+	Mtime           int64        `gorm:"column:mtime" json:"mtime"`
183
+	Status          int64        `gorm:"column:status" json:"status"`
184
+	OrgId           int64        `gorm:"column:org_id" json:"org_id"`
185
+	OrderNumber     string       `gorm:"column:order_number" json:"order_number"`
186
+	Type            int64        `gorm:"column:type" json:"type"`
187
+	Dealer          string       `gorm:"column:dealer" json:"dealer"`
188
+	Manufacturer    string       `gorm:"column:manufacturer" json:"manufacturer"`
189
+	Number          string       `gorm:"column:number" json:"number" form:"number"`
190
+	RegisterAccount string       `gorm:"column:register_account" json:"register_account" form:"register_account"`
191
+	Remark          string       `gorm:"column:remark" json:"remark" form:"remark"`
192
+	WarehouseInfoId int64        `gorm:"column:warehouse_info_id" json:"warehouse_info_id" form:"warehouse_info_id"`
193
+	PatientId       int64        `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
194
+	RecordDate      int64        `gorm:"column:record_date" json:"record_date" form:"record_date"`
195
+	StorehouseId    int64        `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
196
+	IsCheck         int64        `gorm:"column:is_check" json:"is_check" form:"is_check"`
197
+	GoodInfo        GoodInfo     `gorm:"ForeignKey:ID;AssociationForeignKey:GoodId" json:"info"`
198
+	Manufacturers   Manufacturer `gorm:"ForeignKey:ID;AssociationForeignKey:Manufacturer" json:"Manufacturer"`
199
+	Dealers         Dealer       `gorm:"ForeignKey:ID;AssociationForeignKey:Dealer" json:"Dealer"`
200
+}
201
+
202
+func (NewCancelStockInfo) TableName() string {
203
+	return "xt_cancel_stock_info"
204
+}
205
+
206
+type NewDrugWarehouse struct {
207
+	ID               int64  `gorm:"column:id" json:"id" form:"id"`
208
+	WarehousingOrder string `gorm:"column:warehousing_order" json:"warehousing_order" form:"warehousing_order"`
209
+	OperationTime    int64  `gorm:"column:operation_time" json:"operation_time" form:"operation_time"`
210
+	OrgId            int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
211
+	Creater          int64  `gorm:"column:creater" json:"creater" form:"creater"`
212
+	Ctime            int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
213
+	Modifier         int64  `gorm:"column:modifier" json:"modifier" form:"modifier"`
214
+	Mtime            int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
215
+	Status           int64  `gorm:"column:status" json:"status" form:"status"`
216
+	WarehousingTime  int64  `gorm:"column:warehousing_time" json:"warehousing_time" form:"warehousing_time"`
217
+	Dealer           int64  `gorm:"column:dealer" json:"dealer" form:"dealer"`
218
+	Manufacturer     int64  `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
219
+	Type             int64  `gorm:"column:type" json:"type" form:"type"`
220
+}
221
+
222
+func (NewDrugWarehouse) TableName() string {
223
+	return "xt_drug_warehouse"
224
+}
225
+
226
+type NewDrugWarehouseInfo struct {
227
+	ID               int64        `gorm:"column:id" json:"id" form:"id"`
228
+	WarehousingId    int64        `gorm:"column:warehousing_id" json:"warehousing_id" form:"warehousing_id"`
229
+	DrugId           int64        `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
230
+	Number           string       `gorm:"column:number" json:"number" form:"number"`
231
+	ProductDate      int64        `gorm:"column:product_date" json:"product_date" form:"product_date"`
232
+	ExpiryDate       int64        `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
233
+	WarehousingCount int64        `gorm:"column:warehousing_count" json:"warehousing_count" form:"warehousing_count"`
234
+	Price            float64      `gorm:"column:price" json:"price" form:"price"`
235
+	TotalPrice       float64      `gorm:"column:total_price" json:"total_price" form:"total_price"`
236
+	Dealer           int64        `gorm:"column:dealer" json:"dealer" form:"dealer"`
237
+	Manufacturer     int64        `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
238
+	Remark           string       `gorm:"column:remark" json:"remark" form:"remark"`
239
+	Ctime            int64        `gorm:"column:ctime" json:"ctime" form:"ctime"`
240
+	Mtime            int64        `gorm:"column:mtime" json:"mtime" form:"mtime"`
241
+	Status           int64        `gorm:"column:status" json:"status" form:"status"`
242
+	OrgId            int64        `gorm:"column:org_id" json:"org_id" form:"org_id"`
243
+	IsReturn         int64        `gorm:"column:is_return" json:"is_return" form:"is_return"`
244
+	WarehousingOrder string       `gorm:"column:warehousing_order" json:"warehousing_order" form:"warehousing_order"`
245
+	Type             int64        `gorm:"column:type" json:"type" form:"type"`
246
+	RetailPrice      float64      `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
247
+	RetailTotalPrice float64      `gorm:"column:retail_total_price" json:"retail_total_price" form:"retail_total_price"`
248
+	BaseDrugLib      BaseDrugLib  `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId" json:"drug"`
249
+	Manufacturers    Manufacturer `gorm:"ForeignKey:ID;AssociationForeignKey:Manufacturer" json:"Manufacturer"`
250
+	Dealers          Dealer       `gorm:"ForeignKey:ID;AssociationForeignKey:Dealer" json:"Dealer"`
251
+
252
+	BatchNumber               string `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
253
+	MaxUnit                   string `gorm:"column:max_unit" json:"max_unit" form:"max_unit"`
254
+	MinUnit                   string `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
255
+	StockMaxNumber            int64  `gorm:"column:stock_max_number" json:"stock_max_number" form:"stock_max_number"`
256
+	StockMinNumber            int64  `gorm:"column:stock_min_number" json:"stock_min_number" form:"stock_min_number"`
257
+	WarehousingInfoId         int64  `gorm:"column:warehousing_info_id" json:"warehousing_info_id" form:"warehousing_info_id"`
258
+	SupplyWarehouseId         int64  `gorm:"column:supply_warehouse_id" json:"supply_warehouse_id" form:"supply_warehouse_id"`
259
+	SupplyWarehouseDetailInfo int64  `gorm:"column:supply_warehouse_detail_info" json:"supply_warehouse_detail_info" form:"supply_warehouse_detail_info"`
260
+	StorehouseId              int64  `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
261
+	SecondWarehouseInfoId     int64  `gorm:"column:second_warehouse_info_id" json:"second_warehouse_info_id" form:"second_warehouse_info_id"`
262
+	IsCheck                   int64  `gorm:"column:is_check" json:"is_check" form:"is_check"`
263
+}
264
+
265
+func (NewDrugWarehouseInfo) TableName() string {
266
+	return "xt_drug_warehouse_info"
267
+}
268
+
269
+type NewDrugWarehouseOut struct {
270
+	ID                      int64         `gorm:"column:id" json:"id" form:"id"`
271
+	WarehouseOutOrderNumber string        `gorm:"column:warehouse_out_order_number" json:"warehouse_out_order_number" form:"warehouse_out_order_number"`
272
+	OperationTime           int64         `gorm:"column:operation_time" json:"operation_time" form:"operation_time"`
273
+	Creater                 int64         `gorm:"column:creater" json:"creater" form:"creater"`
274
+	OrgId                   int64         `gorm:"column:org_id" json:"org_id" form:"org_id"`
275
+	Modifier                int64         `gorm:"column:modifier" json:"modifier" form:"modifier"`
276
+	Remark                  string        `gorm:"column:remark" json:"remark" form:"remark"`
277
+	Ctime                   int64         `gorm:"column:ctime" json:"ctime" form:"ctime"`
278
+	Mtime                   int64         `gorm:"column:mtime" json:"mtime" form:"mtime"`
279
+	Status                  int64         `gorm:"column:status" json:"status" form:"status"`
280
+	WarehouseOutTime        int64         `gorm:"column:warehouse_out_time" json:"warehouse_out_time" form:"warehouse_out_time"`
281
+	Dealer                  int64         `gorm:"column:dealer" json:"dealer" form:"dealer"`
282
+	Manufacturer            int64         `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
283
+	Type                    int64         `gorm:"column:type" json:"type" form:"type"`
284
+	IsSys                   int64         `gorm:"column:is_sys" json:"is_sys" form:"is_sys"`
285
+	Manufacturers           *Manufacturer `gorm:"ForeignKey:Manufacturer;AssociationForeignKey:ID" json:"manufacturers"`
286
+	Dealers                 *Dealer       `gorm:"ForeignKey:Dealer;AssociationForeignKey:ID" json:"dealers"`
287
+}
288
+
289
+func (NewDrugWarehouseOut) TableName() string {
290
+	return "xt_drug_warehouse_out"
291
+}
292
+
293
+type NewDrugWarehouseOutInfo struct {
294
+	ID                      int64        `gorm:"column:id" json:"id" form:"id"`
295
+	WarehouseOutId          int64        `gorm:"column:warehouse_out_id" json:"warehouse_out_id" form:"warehouse_out_id"`
296
+	DrugId                  int64        `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
297
+	WarehousingOutTarget    int64        `gorm:"column:warehousing_out_target" json:"warehousing_out_target" form:"warehousing_out_target"`
298
+	Count                   int64        `gorm:"column:count" json:"count" form:"count"`
299
+	Price                   float64      `gorm:"column:price" json:"price" form:"price"`
300
+	TotalPrice              float64      `gorm:"column:total_price" json:"total_price" form:"total_price"`
301
+	ProductDate             int64        `gorm:"column:product_date" json:"product_date" form:"product_date"`
302
+	ExpiryDate              int64        `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
303
+	Mtime                   int64        `gorm:"column:mtime" json:"mtime" form:"mtime"`
304
+	Ctime                   int64        `gorm:"column:ctime" json:"ctime" form:"ctime"`
305
+	Status                  int64        `gorm:"column:status" json:"status" form:"status"`
306
+	OrgId                   int64        `gorm:"column:org_id" json:"org_id" form:"org_id"`
307
+	Remark                  string       `gorm:"column:remark" json:"remark" form:"remark"`
308
+	IsCancel                int64        `gorm:"column:is_cancel" json:"is_cancel" form:"is_cancel"`
309
+	WarehouseOutOrderNumber string       `gorm:"column:warehouse_out_order_number" json:"warehouse_out_order_number" form:"warehouse_out_order_number"`
310
+	Type                    int64        `gorm:"column:type" json:"type" form:"type"`
311
+	Dealer                  int64        `gorm:"column:dealer" json:"dealer" form:"dealer"`
312
+	Manufacturer            int64        `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
313
+	IsSys                   int64        `gorm:"column:is_sys" json:"is_sys" form:"is_sys"`
314
+	SysRecordTime           int64        `gorm:"column:sys_record_time" json:"sys_record_time" form:"sys_record_time"`
315
+	RetailPrice             float64      `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
316
+	RetailTotalPrice        float64      `gorm:"column:retail_total_price" json:"retail_total_price" form:"retail_total_price"`
317
+	BaseDrugLib             BaseDrugLib  `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId" json:"drug"`
318
+	Manufacturers           Manufacturer `gorm:"ForeignKey:ID;AssociationForeignKey:Manufacturer" json:"Manufacturer"`
319
+	Dealers                 Dealer       `gorm:"ForeignKey:ID;AssociationForeignKey:Dealer" json:"Dealer"`
320
+	BatchNumber             string       `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
321
+}
322
+
323
+func (NewDrugWarehouseOutInfo) TableName() string {
324
+	return "xt_drug_warehouse_out_info"
325
+}
326
+
327
+type NewDrugCancelStock struct {
328
+	ID            int64         `gorm:"column:id" json:"id" form:"id"`
329
+	OrderNumber   string        `gorm:"column:order_number" json:"order_number" form:"order_number"`
330
+	OperaTime     int64         `gorm:"column:opera_time" json:"opera_time" form:"opera_time"`
331
+	Total         int64         `gorm:"column:total" json:"total" form:"total"`
332
+	Creater       int64         `gorm:"column:creater" json:"creater" form:"creater"`
333
+	Ctime         int64         `gorm:"column:ctime" json:"ctime" form:"ctime"`
334
+	Mtime         int64         `gorm:"column:mtime" json:"mtime" form:"mtime"`
335
+	Status        int64         `gorm:"column:status" json:"status" form:"status"`
336
+	OrgId         int64         `gorm:"column:org_id" json:"org_id" form:"org_id"`
337
+	ReturnTime    int64         `gorm:"column:return_time" json:"return_time" form:"return_time"`
338
+	Dealer        int64         `gorm:"column:dealer" json:"dealer" form:"dealer"`
339
+	Manufacturer  int64         `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
340
+	Type          int64         `gorm:"column:type" json:"type" form:"type"`
341
+	Manufacturers *Manufacturer `gorm:"ForeignKey:Manufacturer;AssociationForeignKey:ID" json:"manufacturers"`
342
+	Dealers       *Dealer       `gorm:"ForeignKey:Dealer;AssociationForeignKey:ID" json:"dealers"`
343
+}
344
+
345
+func (NewDrugCancelStock) TableName() string {
346
+	return "xt_drug_cancel_stock"
347
+}
348
+
349
+type NewDrugCancelStockInfo struct {
350
+	ID               int64        `gorm:"column:id" json:"id" form:"id"`
351
+	DrugId           int64        `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
352
+	CancelStockId    int64        `gorm:"column:cancel_stock_id" json:"cancel_stock_id" form:"cancel_stock_id"`
353
+	Count            int64        `gorm:"column:count" json:"count" form:"count"`
354
+	Price            float64      `gorm:"column:price" json:"price" form:"price"`
355
+	Total            float64      `gorm:"column:total" json:"total" form:"total"`
356
+	ProductDate      int64        `gorm:"column:product_date" json:"product_date" form:"product_date"`
357
+	ExpiryDate       int64        `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
358
+	Ctime            int64        `gorm:"column:ctime" json:"ctime" form:"ctime"`
359
+	Mtime            int64        `gorm:"column:mtime" json:"mtime" form:"mtime"`
360
+	Status           int64        `gorm:"column:status" json:"status" form:"status"`
361
+	OrgId            int64        `gorm:"column:org_id" json:"org_id" form:"org_id"`
362
+	OrderNumber      string       `gorm:"column:order_number" json:"order_number" form:"order_number"`
363
+	Type             int64        `gorm:"column:type" json:"type" form:"type"`
364
+	Dealer           int64        `gorm:"column:dealer" json:"dealer" form:"dealer"`
365
+	Manufacturer     int64        `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
366
+	RetailPrice      float64      `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
367
+	RetailTotalPrice float64      `gorm:"column:retail_total_price" json:"retail_total_price" form:"retail_total_price"`
368
+	Number           string       `gorm:"column:number" json:"number" form:"number"`
369
+	BaseDrugLib      BaseDrugLib  `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId" json:"drug"`
370
+	Manufacturers    Manufacturer `gorm:"ForeignKey:ID;AssociationForeignKey:Manufacturer" json:"Manufacturer"`
371
+	Dealers          Dealer       `gorm:"ForeignKey:ID;AssociationForeignKey:Dealer" json:"Dealer"`
372
+	BatchNumber      string       `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
373
+}
374
+
375
+func (NewDrugCancelStockInfo) TableName() string {
376
+	return "xt_drug_cancel_stock_info"
377
+}

File diff suppressed because it is too large
+ 1360 - 100
models/stock_models.go


+ 609 - 0
service/auto_create_week_schedules_service.go View File

@@ -0,0 +1,609 @@
1
+package service
2
+
3
+import (
4
+	"bytes"
5
+	"encoding/json"
6
+	"gdyb/models"
7
+	"gdyb/utils"
8
+	"github.com/astaxie/beego"
9
+	"github.com/robfig/cron"
10
+	"io/ioutil"
11
+	"math/rand"
12
+	"net/http"
13
+	"strconv"
14
+	"time"
15
+)
16
+
17
+type ResultSix struct {
18
+	Cainfo      interface{} `json:"cainfo"`
19
+	ErrMsg      string      `json:"err_msg"`
20
+	InfRefmsgid string      `json:"inf_refmsgid"`
21
+	Infcode     int64       `json:"infcode"`
22
+	Output      struct {
23
+	} `json:"output"`
24
+	RefmsgTime  string      `json:"refmsg_time"`
25
+	RespondTime string      `json:"respond_time"`
26
+	Signtype    interface{} `json:"signtype"`
27
+	WarnMsg     interface{} `json:"warn_msg"`
28
+}
29
+
30
+type ResultSix10265 struct {
31
+	Cainfo      interface{} `json:"cainfo"`
32
+	ErrMsg      string      `json:"err_msg"`
33
+	InfRefmsgid string      `json:"inf_refmsgid"`
34
+	Infcode     string      `json:"infcode"`
35
+	Output      struct {
36
+	} `json:"output"`
37
+	RefmsgTime  string      `json:"refmsg_time"`
38
+	RespondTime string      `json:"respond_time"`
39
+	Signtype    interface{} `json:"signtype"`
40
+	WarnMsg     interface{} `json:"warn_msg"`
41
+}
42
+
43
+// cron表达式 https://www.cnblogs.com/zuxingyu/p/6023919.html
44
+var createWeekSchedulesCronJob *cron.Cron
45
+
46
+func init() {
47
+	utils.InfoLog("开启自动排班定时任务")
48
+	createWeekSchedulesCronJob = cron.New()
49
+	spec := "0 0 18 * * ?" // 每天6点上传当天数据
50
+	//spec := "0 */1 * * * ?"
51
+	createWeekSchedulesCronJob.AddFunc(spec, func() {
52
+		AutoCreateStock()
53
+
54
+	})
55
+}
56
+
57
+func BeginAutoCreateWeekSchedulesJob() {
58
+	createWeekSchedulesCronJob.Start()
59
+}
60
+
61
+func AutoCreateStock() {
62
+	org_id, _ := beego.AppConfig.Int64("org_id")
63
+	var NewWarehousing []*models.NewWarehousingInfo
64
+	var NewWarehouseOut []*models.NewWarehouseOutInfo
65
+	var NewCancelStock []*models.NewCancelStockInfo
66
+
67
+	var NewDrugWarehouse []*models.NewDrugWarehouseInfo
68
+	var NewDrugWarehouseOut []*models.NewDrugWarehouseOutInfo
69
+	var NewDrugCancelStock []*models.NewDrugCancelStockInfo
70
+
71
+	readDb.Model(&models.NewWarehousingInfo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("GoodInfo", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewWarehousing)
72
+	readDb.Model(&models.NewWarehouseOutInfo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("GoodInfo", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewWarehouseOut)
73
+	readDb.Model(&models.NewCancelStockInfo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("GoodInfo", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewCancelStock)
74
+
75
+	readDb.Model(&models.NewDrugWarehouseInfo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugWarehouse)
76
+	readDb.Model(&models.NewDrugWarehouseOutInfo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugWarehouseOut)
77
+	readDb.Model(&models.NewDrugCancelStockInfo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugCancelStock)
78
+
79
+	for _, item := range NewWarehousing {
80
+		res := Post3503ForGoodInfo(org_id, item)
81
+		if res.Infcode == 0 {
82
+			writeDb.Model(&models.NewWarehousingInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
83
+				"is_upload": 1,
84
+			})
85
+		} else {
86
+
87
+			continue
88
+		}
89
+	}
90
+
91
+	for _, item := range NewWarehouseOut {
92
+		res := Post3505ForGoodInfo(org_id, item)
93
+		if res.Infcode == 0 {
94
+			writeDb.Model(&models.NewWarehouseOutInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
95
+				"is_upload": 1,
96
+			})
97
+		} else {
98
+
99
+			continue
100
+		}
101
+	}
102
+
103
+	for _, item := range NewCancelStock {
104
+		res := Post3506ForGoodInfo(org_id, item)
105
+		if res.Infcode == 0 {
106
+			writeDb.Model(&models.NewCancelStockInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
107
+				"is_upload": 1,
108
+			})
109
+		} else {
110
+
111
+			continue
112
+		}
113
+	}
114
+
115
+	for _, item := range NewDrugWarehouse {
116
+		res := Post3503ForDrug(org_id, item)
117
+		if res.Infcode == 0 {
118
+			writeDb.Model(&models.NewDrugWarehouseInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
119
+				"is_upload": 1,
120
+			})
121
+		} else {
122
+
123
+			continue
124
+		}
125
+	}
126
+
127
+	for _, item := range NewDrugWarehouseOut {
128
+		res := Post3505ForDrug(org_id, item)
129
+		if res.Infcode == 0 {
130
+			writeDb.Model(&models.NewDrugWarehouseOutInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
131
+				"is_upload": 1,
132
+			})
133
+		}
134
+	}
135
+
136
+	for _, item := range NewDrugCancelStock {
137
+		res := Post3506ForDrug(org_id, item)
138
+		if res.Infcode == 0 {
139
+			writeDb.Model(&models.NewDrugCancelStockInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{
140
+				"is_upload": 1,
141
+			})
142
+		} else {
143
+
144
+			continue
145
+		}
146
+	}
147
+
148
+}
149
+
150
+//采购
151
+func Post3503ForGoodInfo(org_id int64, infos *models.NewWarehousingInfo) ResultSix {
152
+
153
+	var res ResultSix
154
+	miConfig, _ := FindMedicalInsuranceInfo(org_id)
155
+	data := make(map[string]interface{})
156
+	var struct3503s []models.Struct3503
157
+	var struct3503 models.Struct3503
158
+	struct3503.MedListCodg = infos.GoodInfo.MedicalInsuranceNumber
159
+	struct3503.FixmedinsHilistId = miConfig.Code
160
+	struct3503.FixmedinsHilistName = miConfig.OrgName
161
+	struct3503.FixmedinsBchno = infos.Number
162
+	struct3503.SplerName = infos.Dealers.DealerName
163
+	struct3503.ManuLotnum = infos.Number
164
+	struct3503.ProdentpName = infos.Manufacturers.ManufacturerName
165
+	struct3503.Aprvno = infos.LicenseNumber
166
+	struct3503.ManuDate = time.Unix(infos.ProductDate, 0).Format("2006-01-02 15:04:05")
167
+	struct3503.ExpyEnd = time.Unix(infos.ExpiryDate, 0).Format("2006-01-02 15:04:05")
168
+	struct3503.PurcRetnCnt = strconv.FormatInt(infos.TotalCount, 10)
169
+	struct3503.RxFlag = "0"
170
+	struct3503.PurcRetnStoinTime = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05")
171
+	struct3503.PurcRetnOpterName = "仓管员"
172
+	struct3503.OrgName = miConfig.OrgName
173
+	struct3503.AccessKey = miConfig.AccessKey
174
+	struct3503.RequestUrl = miConfig.Url
175
+	struct3503.SecretKey = miConfig.SecretKey
176
+	struct3503.Memo = ""
177
+	struct3503s = append(struct3503s, struct3503)
178
+	data["struct_3501s"] = struct3503s
179
+	client := &http.Client{}
180
+	bytesData, _ := json.Marshal(data)
181
+	var req *http.Request
182
+
183
+	if miConfig.MdtrtareaAdmvs == "320921" {
184
+		req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3503", bytes.NewReader(bytesData))
185
+	} else {
186
+		req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3503", bytes.NewReader(bytesData))
187
+	}
188
+
189
+	resp, _ := client.Do(req)
190
+	defer resp.Body.Close()
191
+	body, ioErr := ioutil.ReadAll(resp.Body)
192
+	if ioErr != nil {
193
+		utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
194
+		res.Infcode = -1
195
+		return res
196
+	}
197
+	var respJSON map[string]interface{}
198
+	if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
199
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
200
+		res.Infcode = -1
201
+		return res
202
+	}
203
+	var resSix10265 ResultSix10265 //1101结果
204
+
205
+	respJSON = respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{})
206
+	result, _ := json.Marshal(respJSON)
207
+	if err := json.Unmarshal([]byte(result), &resSix10265); err != nil {
208
+		utils.ErrorLog("解析失败:%v", err)
209
+		res.Infcode = -1
210
+		return res
211
+
212
+	}
213
+	res.InfRefmsgid = resSix10265.InfRefmsgid
214
+	res.Output = resSix10265.Output
215
+	res.ErrMsg = resSix10265.ErrMsg
216
+	res.Cainfo = resSix10265.Cainfo
217
+	res.WarnMsg = resSix10265.WarnMsg
218
+	infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
219
+	res.Infcode = infocode
220
+	return res
221
+}
222
+func Post3503ForDrug(org_id int64, infos *models.NewDrugWarehouseInfo) ResultSix {
223
+	var res ResultSix
224
+	miConfig, _ := FindMedicalInsuranceInfo(org_id)
225
+	data := make(map[string]interface{})
226
+	var struct3501s []models.Struct3503
227
+	var struct3501 models.Struct3503
228
+	struct3501.MedListCodg = infos.BaseDrugLib.MedicalInsuranceNumber
229
+	struct3501.FixmedinsHilistId = miConfig.Code
230
+	struct3501.FixmedinsHilistName = miConfig.OrgName
231
+	struct3501.FixmedinsBchno = infos.BatchNumber
232
+	struct3501.SplerName = infos.Dealers.DealerName
233
+	struct3501.ManuLotnum = infos.BatchNumber
234
+	struct3501.ProdentpName = infos.Manufacturers.ManufacturerName
235
+	struct3501.Aprvno = infos.BaseDrugLib.Number
236
+	struct3501.ManuDate = time.Unix(infos.ProductDate, 0).Format("2006-01-02 15:04:05")
237
+	struct3501.ExpyEnd = time.Unix(infos.ExpiryDate, 0).Format("2006-01-02 15:04:05")
238
+	struct3501.PurcRetnCnt = strconv.FormatInt(infos.WarehousingCount, 10)
239
+	struct3501.RxFlag = "0"
240
+	struct3501.PurcRetnStoinTime = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05")
241
+	struct3501.PurcRetnOpterName = "仓管员"
242
+	struct3501.OrgName = miConfig.OrgName
243
+	struct3501.AccessKey = miConfig.AccessKey
244
+	struct3501.RequestUrl = miConfig.Url
245
+	struct3501.SecretKey = miConfig.SecretKey
246
+	struct3501.Memo = ""
247
+	struct3501s = append(struct3501s, struct3501)
248
+	data["struct_3501s"] = struct3501s
249
+	client := &http.Client{}
250
+	bytesData, _ := json.Marshal(data)
251
+	var req *http.Request
252
+
253
+	if miConfig.MdtrtareaAdmvs == "320921" {
254
+		req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3503", bytes.NewReader(bytesData))
255
+	} else {
256
+		req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3503", bytes.NewReader(bytesData))
257
+	}
258
+
259
+	resp, _ := client.Do(req)
260
+	defer resp.Body.Close()
261
+	body, ioErr := ioutil.ReadAll(resp.Body)
262
+	if ioErr != nil {
263
+		utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
264
+		res.Infcode = -1
265
+		return res
266
+	}
267
+	var respJSON map[string]interface{}
268
+	if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
269
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
270
+		res.Infcode = -1
271
+		return res
272
+	}
273
+
274
+	var resSix10265 ResultSix10265 //1101结果
275
+
276
+	respJSON = respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{})
277
+	result, _ := json.Marshal(respJSON)
278
+	if err := json.Unmarshal([]byte(result), &resSix10265); err != nil {
279
+		utils.ErrorLog("解析失败:%v", err)
280
+		res.Infcode = -1
281
+		return res
282
+	}
283
+	res.InfRefmsgid = resSix10265.InfRefmsgid
284
+	res.Output = resSix10265.Output
285
+	res.ErrMsg = resSix10265.ErrMsg
286
+	res.Cainfo = resSix10265.Cainfo
287
+	res.WarnMsg = resSix10265.WarnMsg
288
+	infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
289
+	res.Infcode = infocode
290
+
291
+	return res
292
+}
293
+
294
+//销售
295
+func Post3505ForGoodInfo(org_id int64, infos *models.NewWarehouseOutInfo) ResultSix {
296
+	var res ResultSix
297
+
298
+	miConfig, _ := FindMedicalInsuranceInfo(org_id)
299
+	data := make(map[string]interface{})
300
+	var struct3501s []models.Struct3505
301
+	var struct3501 models.Struct3505
302
+
303
+	struct3501.OrgName = miConfig.OrgName
304
+	struct3501.AccessKey = miConfig.AccessKey
305
+	struct3501.RequestUrl = miConfig.Url
306
+	struct3501.SecretKey = miConfig.SecretKey
307
+
308
+	struct3501.MedListCodg = infos.GoodInfo.MedicalInsuranceNumber
309
+	struct3501.FixmedinsHilistId = miConfig.Code
310
+	struct3501.FixmedinsHilistName = miConfig.OrgName
311
+	struct3501.FixmedinsBchno = infos.Number
312
+	if org_id == 10188 {
313
+		struct3501.PrscDrName = "王曙光"
314
+		struct3501.PharName = "王曙光"
315
+		struct3501.PharPracCertNo = ""
316
+
317
+	} else if org_id == 10217 {
318
+		struct3501.PrscDrName = "王云刚"
319
+		struct3501.PharName = "王云刚"
320
+		struct3501.PharPracCertNo = ""
321
+	}
322
+	timestamp := time.Now().Unix()
323
+	tempTime := time.Unix(timestamp, 0)
324
+	timeFormat := tempTime.Format("20060102150405")
325
+	chrgBchno := rand.Intn(100000) + 10000
326
+	ipt_otp_no := timeFormat + strconv.FormatInt(int64(chrgBchno), 10)
327
+	struct3501.MdtrtSn = ipt_otp_no
328
+	struct3501.ManuLotnum = infos.Number
329
+	struct3501.ManuDate = time.Unix(infos.ProductDate, 0).Format("2006-01-02 15:04:05")
330
+	struct3501.ExpyEnd = time.Unix(infos.ExpiryDate, 0).Format("2006-01-02 15:04:05")
331
+	struct3501.RxFlag = "0"
332
+	struct3501.TrdnFlag = "1"
333
+	struct3501.RtalDocno = strconv.FormatInt(int64(infos.ID), 10)
334
+	struct3501.SelRetnCnt = strconv.FormatInt(int64(infos.Count), 10)
335
+	struct3501.SelRetnTime = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05")
336
+	struct3501.SelRetnOpterName = "仓管员"
337
+	struct3501s = append(struct3501s, struct3501)
338
+	data["struct_3501s"] = struct3501s
339
+	client := &http.Client{}
340
+	bytesData, _ := json.Marshal(data)
341
+	var req *http.Request
342
+
343
+	if miConfig.MdtrtareaAdmvs == "320921" {
344
+		req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3501", bytes.NewReader(bytesData))
345
+	} else {
346
+		req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3501", bytes.NewReader(bytesData))
347
+	}
348
+
349
+	resp, _ := client.Do(req)
350
+	defer resp.Body.Close()
351
+	body, ioErr := ioutil.ReadAll(resp.Body)
352
+	if ioErr != nil {
353
+		utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
354
+		res.Infcode = -1
355
+		return res
356
+	}
357
+	var respJSON map[string]interface{}
358
+	if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
359
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
360
+		res.Infcode = -1
361
+		return res
362
+	}
363
+	var resSix10265 ResultSix10265 //1101结果
364
+
365
+	respJSON = respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{})
366
+	result, _ := json.Marshal(respJSON)
367
+	if err := json.Unmarshal([]byte(result), &resSix10265); err != nil {
368
+		utils.ErrorLog("解析失败:%v", err)
369
+		res.Infcode = -1
370
+		return res
371
+	}
372
+	res.InfRefmsgid = resSix10265.InfRefmsgid
373
+	res.Output = resSix10265.Output
374
+	res.ErrMsg = resSix10265.ErrMsg
375
+	res.Cainfo = resSix10265.Cainfo
376
+	res.WarnMsg = resSix10265.WarnMsg
377
+	infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
378
+	res.Infcode = infocode
379
+
380
+	return res
381
+}
382
+func Post3505ForDrug(org_id int64, infos *models.NewDrugWarehouseOutInfo) ResultSix {
383
+	var res ResultSix
384
+
385
+	miConfig, _ := FindMedicalInsuranceInfo(org_id)
386
+	data := make(map[string]interface{})
387
+	var struct3501s []models.Struct3505
388
+	var struct3501 models.Struct3505
389
+
390
+	struct3501.OrgName = miConfig.OrgName
391
+	struct3501.AccessKey = miConfig.AccessKey
392
+	struct3501.RequestUrl = miConfig.Url
393
+	struct3501.SecretKey = miConfig.SecretKey
394
+
395
+	struct3501.MedListCodg = infos.BaseDrugLib.MedicalInsuranceNumber
396
+	struct3501.FixmedinsHilistId = miConfig.Code
397
+	struct3501.FixmedinsHilistName = miConfig.OrgName
398
+	struct3501.FixmedinsBchno = infos.BatchNumber
399
+	if org_id == 10188 {
400
+		struct3501.PrscDrName = "王曙光"
401
+		struct3501.PharName = "王曙光"
402
+		struct3501.PharPracCertNo = ""
403
+
404
+	} else if org_id == 10217 {
405
+		struct3501.PrscDrName = "王云刚"
406
+		struct3501.PharName = "王云刚"
407
+		struct3501.PharPracCertNo = ""
408
+	}
409
+	timestamp := time.Now().Unix()
410
+	tempTime := time.Unix(timestamp, 0)
411
+	timeFormat := tempTime.Format("20060102150405")
412
+	chrgBchno := rand.Intn(100000) + 10000
413
+	ipt_otp_no := timeFormat + strconv.FormatInt(int64(chrgBchno), 10)
414
+	struct3501.MdtrtSn = ipt_otp_no
415
+	struct3501.ManuLotnum = infos.BatchNumber
416
+	struct3501.ManuDate = time.Unix(infos.ProductDate, 0).Format("2006-01-02 15:04:05")
417
+	struct3501.ExpyEnd = time.Unix(infos.ExpiryDate, 0).Format("2006-01-02 15:04:05")
418
+	struct3501.RxFlag = "0"
419
+	struct3501.TrdnFlag = "1"
420
+	struct3501.RtalDocno = strconv.FormatInt(int64(infos.ID), 10)
421
+	struct3501.SelRetnCnt = strconv.FormatInt(int64(infos.Count), 10)
422
+	struct3501.SelRetnTime = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05")
423
+	struct3501.SelRetnOpterName = "仓管员"
424
+
425
+	struct3501s = append(struct3501s, struct3501)
426
+	data["struct_3501s"] = struct3501s
427
+	client := &http.Client{}
428
+	bytesData, _ := json.Marshal(data)
429
+	var req *http.Request
430
+
431
+	if miConfig.MdtrtareaAdmvs == "320921" {
432
+		req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3505", bytes.NewReader(bytesData))
433
+	} else {
434
+		req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3505", bytes.NewReader(bytesData))
435
+	}
436
+
437
+	resp, _ := client.Do(req)
438
+	defer resp.Body.Close()
439
+	body, ioErr := ioutil.ReadAll(resp.Body)
440
+	if ioErr != nil {
441
+		utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
442
+		res.Infcode = -1
443
+		return res
444
+	}
445
+	var respJSON map[string]interface{}
446
+	if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
447
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
448
+		res.Infcode = -1
449
+		return res
450
+	}
451
+	var resSix10265 ResultSix10265 //1101结果
452
+
453
+	respJSON = respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{})
454
+	result, _ := json.Marshal(respJSON)
455
+	if err := json.Unmarshal([]byte(result), &resSix10265); err != nil {
456
+		utils.ErrorLog("解析失败:%v", err)
457
+		res.Infcode = -1
458
+		return res
459
+	}
460
+	res.InfRefmsgid = resSix10265.InfRefmsgid
461
+	res.Output = resSix10265.Output
462
+	res.ErrMsg = resSix10265.ErrMsg
463
+	res.Cainfo = resSix10265.Cainfo
464
+	res.WarnMsg = resSix10265.WarnMsg
465
+	infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
466
+	res.Infcode = infocode
467
+
468
+	return res
469
+}
470
+
471
+//销售退货
472
+func Post3506ForGoodInfo(org_id int64, infos *models.NewCancelStockInfo) ResultSix {
473
+	var res ResultSix
474
+	miConfig, _ := FindMedicalInsuranceInfo(org_id)
475
+	data := make(map[string]interface{})
476
+	var struct3501s []models.Struct3506
477
+	var struct3501 models.Struct3506
478
+
479
+	struct3501.OrgName = miConfig.OrgName
480
+	struct3501.AccessKey = miConfig.AccessKey
481
+	struct3501.RequestUrl = miConfig.Url
482
+	struct3501.SecretKey = miConfig.SecretKey
483
+	struct3501.MedListCodg = infos.GoodInfo.MedicalInsuranceNumber
484
+	struct3501.FixmedinsHilistId = miConfig.Code
485
+	struct3501.FixmedinsHilistName = miConfig.OrgName
486
+	struct3501.FixmedinsBchno = infos.Number
487
+	struct3501.ManuLotnum = infos.Number
488
+	struct3501.ManuDate = time.Unix(infos.ProductDate, 0).Format("2006-01-02 15:04:05")
489
+	//struct3501.ExpyEnd = time.Unix(infos.ExpiryDate, 0).Format("2006-01-02 15:04:05")
490
+	struct3501.RxFlag = "0"
491
+	struct3501.TrdnFlag = "1"
492
+	struct3501.SelRetnCnt = strconv.FormatInt(int64(infos.Count), 10)
493
+	struct3501.SelRetnTime = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05")
494
+	struct3501.SelRetnOpterName = "仓管员"
495
+	struct3501.Memo = ""
496
+
497
+	struct3501s = append(struct3501s, struct3501)
498
+	data["struct_3501s"] = struct3501s
499
+	client := &http.Client{}
500
+	bytesData, _ := json.Marshal(data)
501
+	var req *http.Request
502
+
503
+	if miConfig.MdtrtareaAdmvs == "320921" {
504
+		req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3501", bytes.NewReader(bytesData))
505
+	} else {
506
+		req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3501", bytes.NewReader(bytesData))
507
+	}
508
+
509
+	resp, _ := client.Do(req)
510
+	defer resp.Body.Close()
511
+	body, ioErr := ioutil.ReadAll(resp.Body)
512
+	if ioErr != nil {
513
+		utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
514
+		res.Infcode = -1
515
+		return res
516
+	}
517
+	var respJSON map[string]interface{}
518
+	if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
519
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
520
+		res.Infcode = -1
521
+		return res
522
+	}
523
+	var resSix10265 ResultSix10265 //1101结果
524
+
525
+	respJSON = respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{})
526
+	result, _ := json.Marshal(respJSON)
527
+	if err := json.Unmarshal([]byte(result), &resSix10265); err != nil {
528
+		utils.ErrorLog("解析失败:%v", err)
529
+		res.Infcode = -1
530
+		return res
531
+	}
532
+	res.InfRefmsgid = resSix10265.InfRefmsgid
533
+	res.Output = resSix10265.Output
534
+	res.ErrMsg = resSix10265.ErrMsg
535
+	res.Cainfo = resSix10265.Cainfo
536
+	res.WarnMsg = resSix10265.WarnMsg
537
+	infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
538
+	res.Infcode = infocode
539
+
540
+	return res
541
+}
542
+func Post3506ForDrug(org_id int64, infos *models.NewDrugCancelStockInfo) ResultSix {
543
+	var res ResultSix
544
+
545
+	miConfig, _ := FindMedicalInsuranceInfo(org_id)
546
+	data := make(map[string]interface{})
547
+	var struct3501s []models.Struct3506
548
+	var struct3501 models.Struct3506
549
+	struct3501.OrgName = miConfig.OrgName
550
+	struct3501.AccessKey = miConfig.AccessKey
551
+	struct3501.RequestUrl = miConfig.Url
552
+	struct3501.SecretKey = miConfig.SecretKey
553
+	struct3501.MedListCodg = infos.BaseDrugLib.MedicalInsuranceNumber
554
+	struct3501.FixmedinsHilistId = miConfig.Code
555
+	struct3501.FixmedinsHilistName = miConfig.OrgName
556
+	struct3501.FixmedinsBchno = infos.BatchNumber
557
+	struct3501.ManuLotnum = infos.BatchNumber
558
+	struct3501.ManuDate = time.Unix(infos.ProductDate, 0).Format("2006-01-02 15:04:05")
559
+	struct3501.RxFlag = "0"
560
+	struct3501.TrdnFlag = "1"
561
+	struct3501.SelRetnCnt = strconv.FormatInt(int64(infos.Count), 10)
562
+	struct3501.SelRetnTime = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05")
563
+	struct3501.SelRetnOpterName = "仓管员"
564
+	struct3501.Memo = ""
565
+	struct3501s = append(struct3501s, struct3501)
566
+	data["struct_3501s"] = struct3501s
567
+	client := &http.Client{}
568
+	bytesData, _ := json.Marshal(data)
569
+	var req *http.Request
570
+
571
+	if miConfig.MdtrtareaAdmvs == "320921" {
572
+		req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3501", bytes.NewReader(bytesData))
573
+	} else {
574
+		req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3501", bytes.NewReader(bytesData))
575
+	}
576
+
577
+	resp, _ := client.Do(req)
578
+	defer resp.Body.Close()
579
+	body, ioErr := ioutil.ReadAll(resp.Body)
580
+	if ioErr != nil {
581
+		utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
582
+		res.Infcode = -1
583
+		return res
584
+	}
585
+	var respJSON map[string]interface{}
586
+	if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
587
+		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
588
+		res.Infcode = -1
589
+		return res
590
+	}
591
+	var resSix10265 ResultSix10265 //1101结果
592
+
593
+	respJSON = respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{})
594
+	result, _ := json.Marshal(respJSON)
595
+	if err := json.Unmarshal([]byte(result), &resSix10265); err != nil {
596
+		utils.ErrorLog("解析失败:%v", err)
597
+		res.Infcode = -1
598
+		return res
599
+	}
600
+	res.InfRefmsgid = resSix10265.InfRefmsgid
601
+	res.Output = resSix10265.Output
602
+	res.ErrMsg = resSix10265.ErrMsg
603
+	res.Cainfo = resSix10265.Cainfo
604
+	res.WarnMsg = resSix10265.WarnMsg
605
+	infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
606
+	res.Infcode = infocode
607
+
608
+	return res
609
+}

+ 0 - 1
service/jsyb_service.go View File

@@ -1853,7 +1853,6 @@ func Jsyb3504(struct3504 models.Struct3504) (string, string) {
1853 1853
 	return HttpRequest(struct3504.RequestUrl, struct3504.AccessKey, struct3504.SecretKey, timestamp, string(bytesData)), string(bytesData)
1854 1854
 
1855 1855
 }
1856
-
1857 1856
 func Jsyb3505(struct3505 models.Struct3505) (string, string) {
1858 1857
 	timestamp := time.Now().Unix()
1859 1858
 	// 生成输入报文