Browse Source

11月8日库存管理

XMLWAN 2 years ago
parent
commit
8974b0ca71

+ 2 - 1
controllers/drug_stock_api_contorller.go View File

@@ -1696,6 +1696,7 @@ func (c *StockDrugApiController) GetDrugWarehouseOutList() {
1696 1696
 	types, _ := c.GetInt64("type", 0)
1697 1697
 	keywords := c.GetString("keywords")
1698 1698
 	storehouse_id, _ := c.GetInt64("storehouse_id")
1699
+	way_type, _ := c.GetInt64("way_type")
1699 1700
 	timeLayout := "2006-01-02"
1700 1701
 	loc, _ := time.LoadLocation("Local")
1701 1702
 	var startTime int64
@@ -1739,7 +1740,7 @@ func (c *StockDrugApiController) GetDrugWarehouseOutList() {
1739 1740
 
1740 1741
 	}
1741 1742
 
1742
-	warehouseOutList, total, err := service.FindAllDrugWarehouseOutListOne(adminUserInfo.CurrentOrgId, page, limit, startTime, endTime, types, keywords, ids, storehouse_id)
1743
+	warehouseOutList, total, err := service.FindAllDrugWarehouseOutListOne(adminUserInfo.CurrentOrgId, page, limit, startTime, endTime, types, keywords, ids, storehouse_id, way_type)
1743 1744
 
1744 1745
 	houseList, _ := service.GetAllStoreHouseList(adminUserInfo.CurrentOrgId)
1745 1746
 	fmt.Println(err)

+ 449 - 6
controllers/his_summary_controller.go View File

@@ -4,6 +4,7 @@ import (
4 4
 	"XT_New/enums"
5 5
 	"XT_New/service"
6 6
 	"github.com/astaxie/beego"
7
+	"github.com/shopspring/decimal"
7 8
 	"time"
8 9
 )
9 10
 
@@ -15,7 +16,7 @@ func HisSummaryApiRegistRouters() {
15 16
 
16 17
 	beego.Router("/api/gethissummarydetaillist", &HisSummaryApiController{}, "Get:GetHisSummaryDetailList")
17 18
 	beego.Router("/api/his/getgatherdetailist", &HisSummaryApiController{}, "Get:GetGatherDetaiList")
18
-
19
+	beego.Router("/api/his/getdetailpatients", &HisSummaryApiController{}, "Get:GetDetailPatients")
19 20
 }
20 21
 
21 22
 func (this *HisSummaryApiController) GetHisSummaryDetailList() {
@@ -42,9 +43,18 @@ func (this *HisSummaryApiController) GetHisSummaryDetailList() {
42 43
 	endRecordDateTime := endTime.Unix()
43 44
 
44 45
 	list, err := service.GetHisSummaryDetailList(keyword, item_type, patient_id, adminUser.CurrentOrgId, startRecordDateTime, endRecordDateTime)
46
+	patient, _ := service.GetPatientByID(adminUser.CurrentOrgId, patient_id)
47
+
48
+	his_patient, _ := service.GetHisSummaryPatientInfo(adminUser.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
49
+
50
+	//获取所有的科室
51
+	hisDepatment, _ := service.GetHisDepatment(adminUser.CurrentOrgId)
45 52
 	if err == nil {
46 53
 		this.ServeSuccessJSON(map[string]interface{}{
47
-			"list": list,
54
+			"list":         list,
55
+			"patient":      patient,
56
+			"his_patient":  his_patient,
57
+			"hisDepatment": hisDepatment,
48 58
 		})
49 59
 		return
50 60
 	} else {
@@ -77,13 +87,446 @@ func (this *HisSummaryApiController) GetGatherDetaiList() {
77 87
 	}
78 88
 	endRecordDateTime := endTime.Unix()
79 89
 
80
-	list, err := service.GetAdviceGatherDetaiList(keyword, item_type, patient_id, adminUser.CurrentOrgId, startRecordDateTime, endRecordDateTime)
90
+	//查询该病人这段时间的记录单号
91
+	orderInfo, _ := service.GetGatherHisOrder(keyword, item_type, patient_id, adminUser.CurrentOrgId, startRecordDateTime, endRecordDateTime)
92
+
93
+	org_id := this.GetAdminUserInfo().CurrentOrgId
94
+	appid := this.GetAdminUserInfo().CurrentAppId
95
+	var order_info []*service.HisOrderInfo
96
+
97
+	var MdtrtId string
98
+
99
+	patient, _ := service.GetPatientByID(org_id, patient_id)
100
+	for _, item := range orderInfo {
101
+		orderinfo, _ := service.GetHisOrderDetailByNumber(item.Number, org_id)
102
+		//number = item.Number
103
+		MdtrtId = item.MdtrtId
104
+		for _, it := range orderinfo {
105
+
106
+			order_info = append(order_info, it)
107
+		}
108
+	}
109
+	his, _ := service.GetHisPatientInfoFive(org_id, patient_id, startRecordDateTime, endRecordDateTime)
110
+
111
+	record, _ := service.GetInHospitalRecordByNumber(MdtrtId)
112
+
113
+	//获取所有客户
114
+	adminInfo, _ := service.GetAllDoctorSix(org_id, appid)
115
+
116
+	var bedCostTotal float64 = 0 //床位总费
117
+
118
+	var operationCostTotal float64 = 0 //手术费
119
+
120
+	var otherCostTotal float64 = 0 //其他费用
121
+
122
+	var materialCostTotal float64 = 0 //材料费
123
+
124
+	var westernMedicineCostTotal float64 = 0 //西药费
125
+
126
+	var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
127
+
128
+	var checkCostTotal float64 = 0 //检查费
129
+
130
+	var laboratoryCostTotal float64 = 0 //化验费
131
+
132
+	var treatCostTotal float64 = 0 //治疗费用
133
+
134
+	var zhenChaCostTotal float64 = 0 //其他费用
135
+
136
+	decimal.DivisionPrecision = 2
137
+	var BalanceAccountsType int64
138
+	if his.ID > 0 {
139
+		BalanceAccountsType = his.BalanceAccountsType
140
+	} else {
141
+		BalanceAccountsType = record.BalanceAccountsType
142
+	}
143
+
144
+	his_patient, _ := service.GetHisSummaryPatientInfo(adminUser.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
145
+
146
+	//获取所有的科室
147
+	hisDepatment, _ := service.GetHisDepatment(adminUser.CurrentOrgId)
148
+
149
+	//统计
150
+	prescription, _ := service.GetHisPrescriptionTenty(adminUser.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime, keyword, item_type)
151
+
152
+	var medicalInsuranceLevel = "医保等级"
153
+	medicalInsuranceLevelParent, _ := service.GetDrugDataConfig(0, medicalInsuranceLevel)
154
+	medicalInsuranceLevelList, _ := service.GetParentDataConfig(medicalInsuranceLevelParent.ID, adminUser.CurrentOrgId)
155
+	if BalanceAccountsType != 2 && BalanceAccountsType > 0 {
156
+		for _, item := range order_info {
157
+			if org_id == 10215 {
158
+				if item.MedChrgitmType == "01" { //床位费
159
+					bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
160
+				}
161
+				if item.MedChrgitmType == "02" { //诊察费
162
+					zhenChaCostTotal, _ = decimal.NewFromFloat(zhenChaCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
163
+
164
+				}
165
+				if item.MedChrgitmType == "03" { //检查费
166
+					checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
167
+
168
+				}
169
+
170
+				if item.MedChrgitmType == "04" { //化验费
171
+					laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
172
+				}
173
+
174
+				if item.MedChrgitmType == "05" || item.MedChrgitmType == "1402" || item.MedChrgitmType == "1403" { //治疗费
175
+					treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
176
+
177
+				}
178
+
179
+				if item.MedChrgitmType == "06" { //手术费
180
+					operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
181
+				}
182
+
183
+				if item.MedChrgitmType == "08" { //材料费
184
+					materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
185
+				}
186
+
187
+				if item.MedChrgitmType == "09" { //西药费
188
+					westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
189
+				}
190
+
191
+				if item.MedChrgitmType == "11" { //中成费
192
+					chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
193
+				}
194
+
195
+				if item.MedChrgitmType == "14" || item.MedChrgitmType == "0" || item.MedChrgitmType == "12" { //其他费
196
+					otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
197
+				}
198
+
199
+			} else if org_id == 10188 || org_id == 10217 {
200
+				if item.MedChrgitmType == "01" { //床位费
201
+					bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
202
+
203
+				}
204
+				if item.MedChrgitmType == "02" { //诊察费
205
+					zhenChaCostTotal, _ = decimal.NewFromFloat(zhenChaCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
206
+				}
207
+				if item.MedChrgitmType == "03" { //检查费
208
+					laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
209
+				}
210
+
211
+				if item.MedChrgitmType == "04" { //化验费
212
+					laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
213
+				}
214
+
215
+				if item.MedChrgitmType == "05" || item.MedChrgitmType == "1402" || item.MedChrgitmType == "1403" { //治疗费
216
+					treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
217
+				}
218
+
219
+				if item.MedChrgitmType == "06" { //手术费
220
+					operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
221
+				}
222
+
223
+				if item.MedChrgitmType == "08" { //材料费
224
+					materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
225
+				}
226
+
227
+				if item.MedChrgitmType == "09" { //西药费
228
+					westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
229
+				}
230
+
231
+				if item.MedChrgitmType == "11" { //中成费
232
+					chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
233
+				}
234
+
235
+				if item.MedChrgitmType == "14" || item.MedChrgitmType == "0" || item.MedChrgitmType == "12" { //其他费
236
+					otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
237
+				}
238
+
239
+			} else {
240
+
241
+				if item.MedChrgitmType == "01" { //床位费
242
+					bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
243
+
244
+				}
245
+
246
+				if item.MedChrgitmType == "03" { //检查费
247
+					checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
248
+				}
249
+
250
+				if item.MedChrgitmType == "04" { //化验费
251
+					laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
252
+
253
+				}
254
+
255
+				if item.MedChrgitmType == "05" || item.MedChrgitmType == "1402" || item.MedChrgitmType == "1403" { //治疗费
256
+					treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
257
+				}
258
+
259
+				if item.MedChrgitmType == "06" { //手术费
260
+					operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
261
+				}
81 262
 
82
-	detailList, _ := service.GetProjectGatherDetailList(keyword, item_type, patient_id, adminUser.CurrentOrgId, startRecordDateTime, endRecordDateTime)
263
+				if item.MedChrgitmType == "08" { //材料费
264
+					materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
265
+				}
266
+
267
+				if item.MedChrgitmType == "09" { //西药费
268
+					westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
269
+				}
270
+
271
+				if item.MedChrgitmType == "11" { //中成费
272
+					chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
273
+				}
274
+
275
+				if item.MedChrgitmType == "14" || item.MedChrgitmType == "0" || item.MedChrgitmType == "12" || item.MedChrgitmType == "02" { //其他费
276
+					otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
277
+
278
+				}
279
+
280
+			}
281
+		}
282
+		this.ServeSuccessJSON(map[string]interface{}{
283
+			"order":                               orderInfo,
284
+			"order_info":                          order_info,
285
+			"patient":                             patient,
286
+			"admin_info":                          adminInfo,
287
+			"his_hospital":                        record,
288
+			"bedCostTotal":                        bedCostTotal,
289
+			"operationCostTotal":                  operationCostTotal,
290
+			"otherCostTotal":                      otherCostTotal,
291
+			"materialCostTotal":                   materialCostTotal,
292
+			"westernMedicineCostTotal":            westernMedicineCostTotal,
293
+			"chineseTraditionalMedicineCostTotal": chineseTraditionalMedicineCostTotal,
294
+			"checkCostTotal":                      checkCostTotal,
295
+			"zhenChaCostTotal":                    zhenChaCostTotal,
296
+			"laboratoryCostTotal":                 laboratoryCostTotal,
297
+			"treatCostTotal":                      treatCostTotal,
298
+			"his_patient":                         his_patient,
299
+			"hisDepatment":                        hisDepatment,
300
+		})
301
+	} else {
302
+		for _, item := range order_info {
303
+
304
+			item.FulamtOwnpayAmt = item.DetItemFeeSumamt
305
+			if item.HisDoctorAdviceInfo.ID > 0 && item.HisPrescriptionProject.ID == 0 { //药品
306
+				item.MedChrgitmType = "09"
307
+			}
308
+			if item.HisPrescriptionProject.ID > 0 && item.HisDoctorAdviceInfo.ID == 0 {
309
+				if item.HisPrescriptionProject.Type == 2 {
310
+					if this.GetAdminUserInfo().CurrentOrgId == 10215 {
311
+						switch item.HisPrescriptionProject.VMHisProject.CostClassify {
312
+						case 0:
313
+							item.MedChrgitmType = "0"
314
+							break
315
+						case 1:
316
+							item.MedChrgitmType = "14"
317
+							break
318
+						case 2:
319
+							item.MedChrgitmType = "05"
320
+
321
+							break
322
+						case 3:
323
+							item.MedChrgitmType = "03"
324
+
325
+							break
326
+						case 4:
327
+							item.MedChrgitmType = "03"
328
+
329
+							break
330
+						case 5:
331
+							item.MedChrgitmType = "08"
332
+
333
+							break
334
+						case 6:
335
+							item.MedChrgitmType = "14"
336
+
337
+							break
338
+						case 7:
339
+							item.MedChrgitmType = "14"
340
+
341
+							break
342
+						case 8:
343
+							item.MedChrgitmType = "03"
344
+							break
345
+						case 9:
346
+							item.MedChrgitmType = "14"
347
+							break
348
+						case 10:
349
+							item.MedChrgitmType = "14"
350
+							break
351
+						case 11:
352
+							item.MedChrgitmType = "06"
353
+							break
354
+						case 12:
355
+							item.MedChrgitmType = "12"
356
+							break
357
+						case 13:
358
+							item.MedChrgitmType = "01"
359
+							break
360
+						case 14:
361
+							item.MedChrgitmType = "04"
362
+							break
363
+						case 15:
364
+							item.MedChrgitmType = "14"
365
+							break
366
+
367
+						}
368
+
369
+					} else {
370
+						switch item.HisPrescriptionProject.VMHisProject.CostClassify {
371
+
372
+						case 1:
373
+							item.MedChrgitmType = "14"
374
+							break
375
+						case 2:
376
+							item.MedChrgitmType = "05"
377
+
378
+							break
379
+						case 3:
380
+							item.MedChrgitmType = "04"
381
+
382
+							break
383
+						case 4:
384
+							item.MedChrgitmType = "14"
385
+
386
+							break
387
+						case 5:
388
+							item.MedChrgitmType = "08"
389
+
390
+							break
391
+						case 6:
392
+							item.MedChrgitmType = "14"
393
+
394
+							break
395
+						case 7:
396
+							item.MedChrgitmType = "14"
397
+
398
+							break
399
+						case 8:
400
+							item.MedChrgitmType = "03"
401
+							break
402
+						case 9:
403
+							item.MedChrgitmType = "14"
404
+							break
405
+						}
406
+					}
407
+				} else if item.HisPrescriptionProject.Type == 3 {
408
+					item.MedChrgitmType = "08"
409
+				}
410
+			}
411
+		}
412
+
413
+		for _, item := range order_info {
414
+			if org_id == 10215 {
415
+				if item.MedChrgitmType == "01" { //床位费
416
+					bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
417
+				}
418
+				if item.MedChrgitmType == "02" { //诊察费
419
+					zhenChaCostTotal, _ = decimal.NewFromFloat(zhenChaCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
420
+				}
421
+
422
+				if item.MedChrgitmType == "03" { //检查费
423
+					checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
424
+				}
425
+
426
+				if item.MedChrgitmType == "04" { //化验费
427
+					laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
428
+				}
429
+
430
+				if item.MedChrgitmType == "05" || item.MedChrgitmType == "1402" || item.MedChrgitmType == "1403" { //治疗费
431
+					treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
432
+				}
433
+
434
+				if item.MedChrgitmType == "06" { //手术费
435
+					operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
436
+				}
437
+
438
+				if item.MedChrgitmType == "08" { //材料费
439
+					materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
440
+				}
441
+
442
+				if item.MedChrgitmType == "09" { //西药费
443
+					westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
444
+				}
445
+
446
+				if item.MedChrgitmType == "11" { //中成费
447
+					chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
448
+				}
449
+
450
+				if item.MedChrgitmType == "14" || item.MedChrgitmType == "0" || item.MedChrgitmType == "12" { //其他费
451
+					otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
452
+				}
453
+
454
+			} else {
455
+
456
+				if item.MedChrgitmType == "01" { //床位费
457
+					bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
458
+				}
459
+
460
+				if item.MedChrgitmType == "03" { //检查费
461
+					checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
462
+				}
463
+
464
+				if item.MedChrgitmType == "04" { //化验费
465
+					laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
466
+				}
467
+
468
+				if item.MedChrgitmType == "05" || item.MedChrgitmType == "1402" || item.MedChrgitmType == "1403" { //治疗费
469
+					treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
470
+				}
471
+
472
+				if item.MedChrgitmType == "06" { //手术费
473
+					operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
474
+				}
475
+
476
+				if item.MedChrgitmType == "08" { //材料费
477
+					materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
478
+				}
479
+
480
+				if item.MedChrgitmType == "09" { //西药费
481
+					westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
482
+				}
483
+
484
+				if item.MedChrgitmType == "11" { //中成费
485
+					chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
486
+				}
487
+
488
+				if item.MedChrgitmType == "14" || item.MedChrgitmType == "0" || item.MedChrgitmType == "12" || item.MedChrgitmType == "02" { //其他费
489
+					otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
490
+				}
491
+
492
+			}
493
+
494
+		}
495
+
496
+		this.ServeSuccessJSON(map[string]interface{}{
497
+			"order":                               orderInfo,
498
+			"order_info":                          order_info,
499
+			"patient":                             patient,
500
+			"admin_info":                          adminInfo,
501
+			"his_hospital":                        record,
502
+			"bedCostTotal":                        bedCostTotal,
503
+			"operationCostTotal":                  operationCostTotal,
504
+			"otherCostTotal":                      otherCostTotal,
505
+			"materialCostTotal":                   materialCostTotal,
506
+			"westernMedicineCostTotal":            westernMedicineCostTotal,
507
+			"chineseTraditionalMedicineCostTotal": chineseTraditionalMedicineCostTotal,
508
+			"checkCostTotal":                      checkCostTotal,
509
+			"zhenChaCostTotal":                    zhenChaCostTotal,
510
+			"laboratoryCostTotal":                 laboratoryCostTotal,
511
+			"treatCostTotal":                      treatCostTotal,
512
+			"his_patient":                         his_patient,
513
+			"hisDepatment":                        hisDepatment,
514
+			"prescription":                        prescription,
515
+			"balanceAccountsType":                 BalanceAccountsType,
516
+			"medicalInsuranceLevelList":           medicalInsuranceLevelList,
517
+		})
518
+
519
+	}
520
+}
521
+
522
+func (this *HisSummaryApiController) GetDetailPatients() {
523
+
524
+	keyword := this.GetString("keyword")
525
+	orgId := this.GetAdminUserInfo().CurrentOrgId
526
+	patients, err := service.GetDetailPatients(keyword, orgId)
83 527
 	if err == nil {
84 528
 		this.ServeSuccessJSON(map[string]interface{}{
85
-			"detailList": detailList,
86
-			"list":       list,
529
+			"patient": patients,
87 530
 		})
88 531
 		return
89 532
 	} else {

+ 2 - 1
controllers/stock_in_api_controller.go View File

@@ -1530,6 +1530,7 @@ func (c *StockManagerApiController) GetWarehouseOutList() {
1530 1530
 	types, _ := c.GetInt64("type", 0)
1531 1531
 	keywords := c.GetString("keywords")
1532 1532
 	storehouse_id, _ := c.GetInt64("storehouse_id")
1533
+	way_type, _ := c.GetInt64("way_type")
1533 1534
 	timeLayout := "2006-01-02"
1534 1535
 	loc, _ := time.LoadLocation("Local")
1535 1536
 	var startTime int64
@@ -1571,7 +1572,7 @@ func (c *StockManagerApiController) GetWarehouseOutList() {
1571 1572
 		}
1572 1573
 
1573 1574
 	}
1574
-	warehouseOutList, total, err := service.FindAllWarehouseOutListOne(adminUserInfo.CurrentOrgId, page, limit, startTime, endTime, types, keywords, ids, storehouse_id)
1575
+	warehouseOutList, total, err := service.FindAllWarehouseOutListOne(adminUserInfo.CurrentOrgId, page, limit, startTime, endTime, types, keywords, ids, storehouse_id, way_type)
1575 1576
 	houselist, _ := service.GetAllStoreHouseList(adminUserInfo.CurrentOrgId)
1576 1577
 	fmt.Println(err)
1577 1578
 	if err == nil {

+ 22 - 16
models/his_charge_models.go View File

@@ -1,15 +1,15 @@
1 1
 package models
2 2
 
3 3
 type HisChargePrescriptionProject struct {
4
-	ID         int64  `gorm:"column:id" json:"id" form:"id"`
5
-	ProjectId  int64  `gorm:"column:project_id" json:"project_id" form:"project_id"`
6
-	UserOrgId  int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
7
-	Status     int64  `gorm:"column:status" json:"status" form:"status"`
8
-	PatientId  int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
9
-	RecordDate int64  `gorm:"column:record_date" json:"record_date" form:"record_date"`
10
-	Count      string `gorm:"column:count" json:"count" form:"count"`
11
-	Type       int64  `gorm:"column:type" json:"type" form:"type"`
12
-
4
+	ID                int64             `gorm:"column:id" json:"id" form:"id"`
5
+	ProjectId         int64             `gorm:"column:project_id" json:"project_id" form:"project_id"`
6
+	UserOrgId         int64             `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
7
+	Status            int64             `gorm:"column:status" json:"status" form:"status"`
8
+	PatientId         int64             `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
9
+	RecordDate        int64             `gorm:"column:record_date" json:"record_date" form:"record_date"`
10
+	Count             string            `gorm:"column:count" json:"count" form:"count"`
11
+	Type              int64             `gorm:"column:type" json:"type" form:"type"`
12
+	Unit              string            `gorm:"column:unit" json:"unit" form:"unit"`
13 13
 	HisChargeProject  HisChargeProject  `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"project"`
14 14
 	HisChargeGoodInfo HisChargeGoodInfo `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"good_info"`
15 15
 }
@@ -19,13 +19,14 @@ func (HisChargePrescriptionProject) TableName() string {
19 19
 }
20 20
 
21 21
 type HisChargeDoctorAdviceInfo struct {
22
-	ID         int64  `gorm:"column:id" json:"id" form:"id"`
23
-	UserOrgId  int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
24
-	PatientId  int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
25
-	AdviceName string `gorm:"column:advice_name" json:"advice_name" form:"advice_name"`
26
-	Status     int64  `gorm:"column:status" json:"status" form:"status"`
27
-	DrugId     int64  `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
28
-	Drug       Drug   `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId" json:"drug"`
22
+	ID                    int64  `gorm:"column:id" json:"id" form:"id"`
23
+	UserOrgId             int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
24
+	PatientId             int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
25
+	AdviceName            string `gorm:"column:advice_name" json:"advice_name" form:"advice_name"`
26
+	PrescribingNumberUnit string `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
27
+	Status                int64  `gorm:"column:status" json:"status" form:"status"`
28
+	DrugId                int64  `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
29
+	Drug                  Drug   `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId" json:"drug"`
29 30
 }
30 31
 
31 32
 func (HisChargeDoctorAdviceInfo) TableName() string {
@@ -92,6 +93,10 @@ type HisChargeOrder struct {
92 93
 	OrderStatus        int64                 `gorm:"column:order_status" json:"order_status" form:"order_status"`
93 94
 	MdtrtId            string                `gorm:"column:mdtrt_id" json:"mdtrt_id" form:"mdtrt_id"`
94 95
 	PatientId          int64                 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
96
+	HifesPay           float64               `gorm:"column:hifes_pay" json:"hifes_pay" form:"hifes_pay"`
97
+	MafPay             float64               `gorm:"column:maf_pay" json:"maf_pay" form:"maf_pay"`
98
+	FundPaySumamt      float64               `gorm:"column:fund_pay_sumamt" json:"fund_pay_sumamt" form:"fund_pay_sumamt"`
99
+	AcctPay            float64               `gorm:"column:acct_pay" json:"acct_pay" form:"acct_pay"`
95 100
 	HisChargeOrderInfo []*HisChargeOrderInfo `gorm:"ForeignKey:OrderNumber;AssociationForeignKey:Number" json:"order_info"`
96 101
 }
97 102
 
@@ -175,6 +180,7 @@ type HisChargeGoodInfo struct {
175 180
 	GoodUnit           int64  `gorm:"column:good_unit" json:"good_unit"`
176 181
 	SpecificationnName string `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
177 182
 	RegisterNumber     string `gorm:"column:register_number" json:"register_number" form:"register_number"`
183
+	PackingUnit        string `gorm:"column:packing_unit" json:"packing_unit" form:"packing_unit"`
178 184
 }
179 185
 
180 186
 func (HisChargeGoodInfo) TableName() string {

+ 246 - 0
models/his_summary_models.go View File

@@ -1,5 +1,7 @@
1 1
 package models
2 2
 
3
+import "time"
4
+
3 5
 type HisPrescriptionModeTemplate struct {
4 6
 	ID        int64  `gorm:"column:id" json:"id" form:"id"`
5 7
 	UserOrgId int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
@@ -132,3 +134,247 @@ type HisPrescriptionProjectModeTemplate struct {
132 134
 func (HisPrescriptionProjectModeTemplate) TableName() string {
133 135
 	return "his_prescription_project_mode_template"
134 136
 }
137
+
138
+type VmHisOrderInfo struct {
139
+	ID                     int64                       `gorm:"column:id" json:"id" form:"id"`
140
+	OrderNumber            string                      `gorm:"column:order_number" json:"order_number" form:"order_number"`
141
+	UploadDate             int64                       `gorm:"column:upload_date" json:"upload_date" form:"upload_date"`
142
+	AdviceId               int64                       `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
143
+	DetItemFeeSumamt       float64                     `gorm:"column:det_item_fee_sumamt" json:"det_item_fee_sumamt" form:"det_item_fee_sumamt"`
144
+	Cnt                    float64                     `gorm:"column:cnt" json:"cnt" form:"cnt"`
145
+	Pric                   float64                     `gorm:"column:pric" json:"pric" form:"pric"`
146
+	PatientId              int64                       `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
147
+	PricUplmtAmt           float64                     `gorm:"column:pric_uplmt_amt" json:"pric_uplmt_amt" form:"pric_uplmt_amt"`
148
+	SelfpayProp            float64                     `gorm:"column:selfpay_prop" json:"selfpay_prop" form:"selfpay_prop"`
149
+	FulamtOwnpayAmt        float64                     `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
150
+	OverlmtAmt             float64                     `gorm:"column:overlmt_amt" json:"overlmt_amt" form:"overlmt_amt"`
151
+	PreselfpayAmt          float64                     `gorm:"column:preselfpay_amt" json:"preselfpay_amt" form:"preselfpay_amt"`
152
+	BasMednFlag            string                      `gorm:"column:bas_medn_flag" json:"bas_medn_flag" form:"bas_medn_flag"`
153
+	MedChrgitmType         string                      `gorm:"column:med_chrgitm_type" json:"med_chrgitm_type" form:"med_chrgitm_type"`
154
+	HiNegoDrugFlag         string                      `gorm:"column:hi_nego_drug_flag" json:"hi_nego_drug_flag" form:"hi_nego_drug_flag"`
155
+	Status                 int64                       `gorm:"column:status" json:"status" form:"status"`
156
+	Memo                   string                      `gorm:"column:memo" json:"memo" form:"memo"`
157
+	FeedetlSn              string                      `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
158
+	Mtime                  int64                       `gorm:"column:mtime" json:"mtime" form:"mtime"`
159
+	InscpScpAmt            float64                     `gorm:"column:inscp_scp_amt" json:"inscp_scp_amt" form:"inscp_scp_amt"`
160
+	DrtReimFlag            string                      `gorm:"column:drt_reim_flag" json:"drt_reim_flag" form:"drt_reim_flag"`
161
+	Ctime                  int64                       `gorm:"column:ctime" json:"ctime" form:"ctime"`
162
+	ListSpItemFlag         string                      `gorm:"column:list_sp_item_flag" json:"list_sp_item_flag" form:"list_sp_item_flag"`
163
+	ChldMedcFlag           string                      `gorm:"column:chld_medc_flag" json:"chld_medc_flag" form:"chld_medc_flag"`
164
+	LmtUsedFlag            string                      `gorm:"column:lmt_used_flag" json:"lmt_used_flag" form:"lmt_used_flag"`
165
+	ChrgitmLv              string                      `gorm:"column:chrgitm_lv" json:"chrgitm_lv" form:"chrgitm_lv"`
166
+	UserOrgId              int64                       `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
167
+	HisPatientId           int64                       `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
168
+	OrderId                int64                       `gorm:"column:order_id" json:"order_id" form:"order_id"`
169
+	ProjectId              int64                       `gorm:"column:project_id" json:"project_id" form:"project_id"`
170
+	Type                   int64                       `gorm:"column:type" json:"type" form:"type"`
171
+	ItemId                 int64                       `gorm:"column:item_id" json:"item_id" form:"item_id"`
172
+	SettleType             int64                       `gorm:"column:settle_type" json:"settle_type" form:"settle_type"`
173
+	HisPrescriptionProject []*VmHisPrescriptionProject `gorm:"ForeignKey:ID;AssociationForeignKey:ProjectId" json:"vmproject"`
174
+	HisDoctorAdviceInfo    []*VmHisDoctorAdviceInfo    `gorm:"ForeignKey:ID;AssociationForeignKey:AdviceId" json:"vmadvice"`
175
+}
176
+
177
+func (VmHisOrderInfo) TableName() string {
178
+	return "his_order_info"
179
+}
180
+
181
+type VmHisPrescriptionProject struct {
182
+	ID                 int64   `gorm:"column:id" json:"id" form:"id"`
183
+	ProjectId          int64   `gorm:"column:project_id" json:"project_id" form:"project_id"`
184
+	Price              float64 `gorm:"column:price" json:"price" form:"price"`
185
+	UserOrgId          int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
186
+	Status             int64   `gorm:"column:status" json:"status" form:"status"`
187
+	Ctime              int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
188
+	Mtime              int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
189
+	PatientId          int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
190
+	HisPatientId       int64   `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
191
+	RecordDate         int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
192
+	PrescriptionId     int64   `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
193
+	Count              string  `gorm:"column:count" json:"count" form:"count"`
194
+	FeedetlSn          string  `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
195
+	MedListCodg        string  `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
196
+	SingleDose         string  `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
197
+	DeliveryWay        string  `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
198
+	ExecutionFrequency string  `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
199
+	Day                string  `gorm:"column:day" json:"day" form:"day"`
200
+	Remark             string  `gorm:"column:remark" json:"remark" form:"remark"`
201
+	Unit               string  `gorm:"column:unit" json:"unit" form:"unit"`
202
+	Type               int64   `gorm:"column:type" json:"type" form:"type"`
203
+	Doctor             int64   `gorm:"column:doctor" json:"doctor" form:"doctor"`
204
+	ExecutionTime      int64   `gorm:"column:execution_time" json:"execution_time" form:"execution_time"`
205
+	ExecutionStaff     int64   `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
206
+	ExecutionState     int64   `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
207
+	CheckTime          int64   `gorm:"column:check_time" json:"check_time" form:"check_time"`
208
+	CheckState         int64   `gorm:"column:check_state" json:"check_state" form:"check_state"`
209
+	Checker            int64   `gorm:"column:checker" json:"checker" form:"checker"`
210
+	StartTime          int64   `gorm:"column:start_time" json:"start_time" form:"start_time"`
211
+	TeamId             int64   `gorm:"column:team_id" json:"team_id" form:"team_id"`
212
+	FrequencyType      int64   `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
213
+	DayCount           int64   `gorm:"column:day_count" json:"day_count" form:"day_count"`
214
+	WeekDay            string  `gorm:"column:week_day" json:"week_day" form:"week_day"`
215
+}
216
+
217
+func (VmHisPrescriptionProject) TableName() string {
218
+	return "his_prescription_project"
219
+}
220
+
221
+type VmHisDoctorAdviceInfo struct {
222
+	ID                    int64   `gorm:"column:id" json:"id" form:"id"`
223
+	UserOrgId             int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
224
+	PatientId             int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
225
+	HisPatientId          int64   `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
226
+	AdviceType            int64   `gorm:"column:advice_type" json:"advice_type" form:"advice_type"`
227
+	AdviceDate            int64   `gorm:"column:advice_date" json:"advice_date" form:"advice_date"`
228
+	StartTime             int64   `gorm:"column:start_time" json:"start_time" form:"start_time"`
229
+	AdviceName            string  `gorm:"column:advice_name" json:"advice_name" form:"advice_name"`
230
+	AdviceDesc            string  `gorm:"column:advice_desc" json:"advice_desc" form:"advice_desc"`
231
+	ReminderDate          int64   `gorm:"column:reminder_date" json:"reminder_date" form:"reminder_date"`
232
+	SingleDose            float64 `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
233
+	SingleDoseUnit        string  `gorm:"column:single_dose_unit" json:"single_dose_unit" form:"single_dose_unit"`
234
+	PrescribingNumber     float64 `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
235
+	PrescribingNumberUnit string  `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
236
+	DeliveryWay           string  `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
237
+	ExecutionFrequency    string  `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
238
+	AdviceDoctor          int64   `gorm:"column:advice_doctor" json:"advice_doctor" form:"advice_doctor"`
239
+	Status                int64   `gorm:"column:status" json:"status" form:"status"`
240
+	CreatedTime           int64   `gorm:"column:created_time" json:"created_time" form:"created_time"`
241
+	UpdatedTime           int64   `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
242
+	AdviceAffirm          string  `gorm:"column:advice_affirm" json:"advice_affirm" form:"advice_affirm"`
243
+	Remark                string  `gorm:"column:remark" json:"remark" form:"remark"`
244
+	StopTime              int64   `gorm:"column:stop_time" json:"stop_time" form:"stop_time"`
245
+	StopReason            string  `gorm:"column:stop_reason" json:"stop_reason" form:"stop_reason"`
246
+	StopDoctor            int64   `gorm:"column:stop_doctor" json:"stop_doctor" form:"stop_doctor"`
247
+	StopState             int64   `gorm:"column:stop_state" json:"stop_state" form:"stop_state"`
248
+	ParentId              int64   `gorm:"column:parent_id" json:"parent_id" form:"parent_id"`
249
+	ExecutionTime         int64   `gorm:"column:execution_time" json:"execution_time" form:"execution_time"`
250
+	ExecutionStaff        int64   `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
251
+	ExecutionState        int64   `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
252
+	Checker               int64   `gorm:"column:checker" json:"checker" form:"checker"`
253
+	RecordDate            int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
254
+	DialysisOrderId       int64   `gorm:"column:dialysis_order_id" json:"dialysis_order_id" form:"dialysis_order_id"`
255
+	CheckTime             int64   `gorm:"column:check_time" json:"check_time" form:"check_time"`
256
+	CheckState            int64   `gorm:"column:check_state" json:"check_state" form:"check_state"`
257
+	DrugSpec              float64 `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
258
+	DrugSpecUnit          string  `gorm:"column:drug_spec_unit" json:"drug_spec_unit" form:"drug_spec_unit"`
259
+	Groupno               int64   `gorm:"column:groupno" json:"groupno" form:"groupno"`
260
+	RemindType            int64   `gorm:"column:remind_type" json:"remind_type" form:"remind_type"`
261
+	FrequencyType         int64   `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
262
+	DayCount              int64   `gorm:"column:day_count" json:"day_count" form:"day_count"`
263
+	WeekDay               string  `gorm:"column:week_day" json:"week_day" form:"week_day"`
264
+	TemplateId            string  `gorm:"column:template_id" json:"template_id" form:"template_id"`
265
+	Modifier              int64   `gorm:"column:modifier" json:"modifier" form:"modifier"`
266
+	DrugId                int64   `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
267
+	Price                 float64 `gorm:"column:price" json:"price" form:"price"`
268
+	PrescriptionId        int64   `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
269
+	MedListCodg           string  `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
270
+	FeedetlSn             string  `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
271
+	Day                   int64   `gorm:"column:day" json:"day" form:"day"`
272
+	Diagnosis             int64   `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
273
+	HospApprFlag          int64   `gorm:"column:hosp_appr_flag" json:"hosp_appr_flag" form:"hosp_appr_flag"`
274
+	LmtUsedFlag           int64   `gorm:"column:lmt_used_flag" json:"lmt_used_flag" form:"lmt_used_flag"`
275
+	Way                   int64   `gorm:"column:way" json:"way" form:"way"`
276
+	Mtime                 int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
277
+	AdviceId              int64   `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
278
+}
279
+
280
+func (VmHisDoctorAdviceInfo) TableName() string {
281
+	return "his_doctor_advice_info"
282
+}
283
+
284
+type GatherHisOrder struct {
285
+	ID                      int64     `gorm:"column:id" json:"id" form:"id"`
286
+	UserOrgId               int64     `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
287
+	HisPatientId            int64     `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
288
+	SettleAccountsDate      int64     `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
289
+	Ctime                   int64     `gorm:"column:ctime" json:"ctime" form:"ctime"`
290
+	Mtime                   int64     `gorm:"column:mtime" json:"mtime" form:"mtime"`
291
+	Status                  int64     `gorm:"column:status" json:"status" form:"status"`
292
+	Number                  string    `gorm:"column:number" json:"number" form:"number"`
293
+	PatientId               int64     `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
294
+	Infcode                 int64     `gorm:"column:infcode" json:"infcode" form:"infcode"`
295
+	WarnMsg                 string    `gorm:"column:warn_msg" json:"warn_msg" form:"warn_msg"`
296
+	Cainfo                  string    `gorm:"column:cainfo" json:"cainfo" form:"cainfo"`
297
+	ErrMsg                  string    `gorm:"column:err_msg" json:"err_msg" form:"err_msg"`
298
+	RespondTime             string    `gorm:"column:respond_time" json:"respond_time" form:"respond_time"`
299
+	InfRefmsgid             string    `gorm:"column:inf_refmsgid" json:"inf_refmsgid" form:"inf_refmsgid"`
300
+	OrderStatus             int64     `gorm:"column:order_status" json:"order_status" form:"order_status"`
301
+	MdtrtId                 string    `gorm:"column:mdtrt_id" json:"mdtrt_id" form:"mdtrt_id"`
302
+	SetlId                  string    `gorm:"column:setl_id" json:"setl_id" form:"setl_id"`
303
+	PsnNo                   string    `gorm:"column:psn_no" json:"psn_no" form:"psn_no"`
304
+	PsnName                 string    `gorm:"column:psn_name" json:"psn_name" form:"psn_name"`
305
+	PsnCertType             string    `gorm:"column:psn_cert_type" json:"psn_cert_type" form:"psn_cert_type"`
306
+	Certno                  string    `gorm:"column:certno" json:"certno" form:"certno"`
307
+	Gend                    string    `gorm:"column:gend" json:"gend" form:"gend"`
308
+	Naty                    string    `gorm:"column:naty" json:"naty" form:"naty"`
309
+	Brdy                    time.Time `gorm:"column:brdy" json:"brdy" form:"brdy"`
310
+	Age                     float64   `gorm:"column:age" json:"age" form:"age"`
311
+	Insutype                string    `gorm:"column:insutype" json:"insutype" form:"insutype"`
312
+	PsnType                 string    `gorm:"column:psn_type" json:"psn_type" form:"psn_type"`
313
+	CvlservFlag             string    `gorm:"column:cvlserv_flag" json:"cvlserv_flag" form:"cvlserv_flag"`
314
+	SetlTime                string    `gorm:"column:setl_time" json:"setl_time" form:"setl_time"`
315
+	MdtrtCertType           string    `gorm:"column:mdtrt_cert_type" json:"mdtrt_cert_type" form:"mdtrt_cert_type"`
316
+	MedType                 string    `gorm:"column:med_type" json:"med_type" form:"med_type"`
317
+	MedfeeSumamt            float64   `gorm:"column:medfee_sumamt" json:"medfee_sumamt" form:"medfee_sumamt"`
318
+	FulamtOwnpayAmt         float64   `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
319
+	OverlmtSelfPay          float64   `gorm:"column:overlmt_self_pay" json:"overlmt_self_pay" form:"overlmt_self_pay"`
320
+	PreselfpayAmt           float64   `gorm:"column:preselfpay_amt" json:"preselfpay_amt" form:"preselfpay_amt"`
321
+	InscpScpAmt             float64   `gorm:"column:inscp_scp_amt" json:"inscp_scp_amt" form:"inscp_scp_amt"`
322
+	ActPayDedc              float64   `gorm:"column:act_pay_dedc" json:"act_pay_dedc" form:"act_pay_dedc"`
323
+	HifpPay                 float64   `gorm:"column:hifp_pay" json:"hifp_pay" form:"hifp_pay"`
324
+	CvlservPay              float64   `gorm:"column:cvlserv_pay" json:"cvlserv_pay" form:"cvlserv_pay"`
325
+	PoolPropSelfpay         float64   `gorm:"column:pool_prop_selfpay" json:"pool_prop_selfpay" form:"pool_prop_selfpay"`
326
+	HifesPay                float64   `gorm:"column:hifes_pay" json:"hifes_pay" form:"hifes_pay"`
327
+	HifmiPay                float64   `gorm:"column:hifmi_pay" json:"hifmi_pay" form:"hifmi_pay"`
328
+	HifobPay                float64   `gorm:"column:hifob_pay" json:"hifob_pay" form:"hifob_pay"`
329
+	MafPay                  float64   `gorm:"column:maf_pay" json:"maf_pay" form:"maf_pay"`
330
+	OthPay                  float64   `gorm:"column:oth_pay" json:"oth_pay" form:"oth_pay"`
331
+	FundPaySumamt           float64   `gorm:"column:fund_pay_sumamt" json:"fund_pay_sumamt" form:"fund_pay_sumamt"`
332
+	PsnPartAmt              float64   `gorm:"column:psn_part_amt" json:"psn_part_amt" form:"psn_part_amt"`
333
+	AcctPay                 float64   `gorm:"column:acct_pay" json:"acct_pay" form:"acct_pay"`
334
+	PsnCashPay              float64   `gorm:"column:psn_cash_pay" json:"psn_cash_pay" form:"psn_cash_pay"`
335
+	HospPartAmt             float64   `gorm:"column:hosp_part_amt" json:"hosp_part_amt" form:"hosp_part_amt"`
336
+	Balc                    float64   `gorm:"column:balc" json:"balc" form:"balc"`
337
+	AcctMulaidPay           float64   `gorm:"column:acct_mulaid_pay" json:"acct_mulaid_pay" form:"acct_mulaid_pay"`
338
+	MedinsSetlId            string    `gorm:"column:medins_setl_id" json:"medins_setl_id" form:"medins_setl_id"`
339
+	ClrOptins               string    `gorm:"column:clr_optins" json:"clr_optins" form:"clr_optins"`
340
+	ClrWay                  string    `gorm:"column:clr_way" json:"clr_way" form:"clr_way"`
341
+	ClrType                 string    `gorm:"column:clr_type" json:"clr_type" form:"clr_type"`
342
+	SetlDetail              string    `gorm:"column:setl_detail" json:"setl_detail" form:"setl_detail"`
343
+	PayWay                  int64     `gorm:"column:pay_way" json:"pay_way" form:"pay_way"`
344
+	PayPrice                float64   `gorm:"column:pay_price" json:"pay_price" form:"pay_price"`
345
+	PayCardNo               string    `gorm:"column:pay_card_no" json:"pay_card_no" form:"pay_card_no"`
346
+	DiscountPrice           float64   `gorm:"column:discount_price" json:"discount_price" form:"discount_price"`
347
+	PreferentialPrice       float64   `gorm:"column:preferential_price" json:"preferential_price" form:"preferential_price"`
348
+	RealityPrice            float64   `gorm:"column:reality_price" json:"reality_price" form:"reality_price"`
349
+	FoundPrice              float64   `gorm:"column:found_price" json:"found_price" form:"found_price"`
350
+	MedicalInsurancePrice   float64   `gorm:"column:medical_insurance_price" json:"medical_insurance_price" form:"medical_insurance_price"`
351
+	PrivatePrice            float64   `gorm:"column:private_price" json:"private_price" form:"private_price"`
352
+	IsMedicineInsurance     int64     `gorm:"column:is_medicine_insurance" json:"is_medicine_insurance" form:"is_medicine_insurance"`
353
+	SettleType              int64     `gorm:"column:settle_type" json:"settle_type" form:"settle_type"`
354
+	SettleStartTime         int64     `gorm:"column:settle_start_time" json:"settle_start_time" form:"settle_start_time"`
355
+	SettleEndTime           int64     `gorm:"column:settle_end_time" json:"settle_end_time" form:"settle_end_time"`
356
+	Creator                 int64     `gorm:"column:creator" json:"creator" form:"creator"`
357
+	Modify                  int64     `gorm:"column:modify" json:"modify" form:"modify"`
358
+	SzChargeInfo            string    `gorm:"column:sz_charge_info" json:"sz_charge_info" form:"sz_charge_info"`
359
+	SzProjectInfo           string    `gorm:"column:sz_project_info" json:"sz_project_info" form:"sz_project_info"`
360
+	SzMedicineInsuranceInfo string    `gorm:"column:sz_medicine_insurance_info" json:"sz_medicine_insurance_info" form:"sz_medicine_insurance_info"`
361
+	AccountPrice            float64   `gorm:"column:account_price" json:"account_price" form:"account_price"`
362
+	MzNumber                string    `gorm:"column:mz_number" json:"mz_number" form:"mz_number"`
363
+	OrgSetlNumber           string    `gorm:"column:org_setl_number" json:"org_setl_number" form:"org_setl_number"`
364
+	YiliaoNumber            string    `gorm:"column:yiliao_number" json:"yiliao_number" form:"yiliao_number"`
365
+	RefundLog               string    `gorm:"column:refund_log" json:"refund_log" form:"refund_log"`
366
+	DetailLog               string    `gorm:"column:detail_log" json:"detail_log" form:"detail_log"`
367
+	RequestLog              string    `gorm:"column:request_log" json:"request_log" form:"request_log"`
368
+	RefundRequestLog        string    `gorm:"column:refund_request_log" json:"refund_request_log" form:"refund_request_log"`
369
+	FaPiaoCode              string    `gorm:"column:fa_piao_code" json:"fa_piao_code" form:"fa_piao_code"`
370
+	FaPiaoNumber            string    `gorm:"column:fa_piao_number" json:"fa_piao_number" form:"fa_piao_number"`
371
+	PType                   int64     `gorm:"column:p_type" json:"p_type" form:"p_type"`
372
+	IsPre                   int64     `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
373
+	Diagnosis               string    `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
374
+	FaPiaoBatchnumberId     int64     `gorm:"column:fa_piao_batchnumber_id" json:"fa_piao_batchnumber_id" form:"fa_piao_batchnumber_id"`
375
+	Decimal                 float64   `gorm:"column:decimal" json:"decimal" form:"decimal"`
376
+}
377
+
378
+func (GatherHisOrder) TableName() string {
379
+	return "his_order"
380
+}

+ 17 - 18
service/his_service.go View File

@@ -1726,24 +1726,23 @@ func (HisPrescriptionProject) TableName() string {
1726 1726
 }
1727 1727
 
1728 1728
 type HisOrderInfo struct {
1729
-	ID               int64   `gorm:"column:id" json:"id" form:"id"`
1730
-	OrderNumber      string  `gorm:"column:order_number" json:"order_number" form:"order_number"`
1731
-	UploadDate       int64   `gorm:"column:upload_date" json:"upload_date" form:"upload_date"`
1732
-	AdviceId         int64   `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
1733
-	DetItemFeeSumamt float64 `gorm:"column:det_item_fee_sumamt" json:"det_item_fee_sumamt" form:"det_item_fee_sumamt"`
1734
-	Cnt              float64 `gorm:"column:cnt" json:"cnt" form:"cnt"`
1735
-	Pric             float64 `gorm:"column:pric" json:"pric" form:"pric"`
1736
-	PatientId        int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1737
-	MedChrgitmType   string  `gorm:"column:med_chrgitm_type" json:"med_chrgitm_type" form:"med_chrgitm_type"`
1738
-	Status           int64   `gorm:"column:status" json:"status" form:"status"`
1739
-	FeedetlSn        string  `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
1740
-	ChldMedcFlag     string  `gorm:"column:chld_medc_flag" json:"chld_medc_flag" form:"chld_medc_flag"`
1741
-	ChrgitmLv        string  `gorm:"column:chrgitm_lv" json:"chrgitm_lv" form:"chrgitm_lv"`
1742
-	UserOrgId        int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1743
-	ProjectId        int64   `gorm:"column:project_id" json:"project_id" form:"project_id"`
1744
-	ItemId           int64   `gorm:"column:item_id" json:"item_id" form:"item_id"`
1745
-	FulamtOwnpayAmt  float64 `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
1746
-
1729
+	ID                     int64                  `gorm:"column:id" json:"id" form:"id"`
1730
+	OrderNumber            string                 `gorm:"column:order_number" json:"order_number" form:"order_number"`
1731
+	UploadDate             int64                  `gorm:"column:upload_date" json:"upload_date" form:"upload_date"`
1732
+	AdviceId               int64                  `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
1733
+	DetItemFeeSumamt       float64                `gorm:"column:det_item_fee_sumamt" json:"det_item_fee_sumamt" form:"det_item_fee_sumamt"`
1734
+	Cnt                    float64                `gorm:"column:cnt" json:"cnt" form:"cnt"`
1735
+	Pric                   float64                `gorm:"column:pric" json:"pric" form:"pric"`
1736
+	PatientId              int64                  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1737
+	MedChrgitmType         string                 `gorm:"column:med_chrgitm_type" json:"med_chrgitm_type" form:"med_chrgitm_type"`
1738
+	Status                 int64                  `gorm:"column:status" json:"status" form:"status"`
1739
+	FeedetlSn              string                 `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
1740
+	ChldMedcFlag           string                 `gorm:"column:chld_medc_flag" json:"chld_medc_flag" form:"chld_medc_flag"`
1741
+	ChrgitmLv              string                 `gorm:"column:chrgitm_lv" json:"chrgitm_lv" form:"chrgitm_lv"`
1742
+	UserOrgId              int64                  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1743
+	ProjectId              int64                  `gorm:"column:project_id" json:"project_id" form:"project_id"`
1744
+	ItemId                 int64                  `gorm:"column:item_id" json:"item_id" form:"item_id"`
1745
+	FulamtOwnpayAmt        float64                `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
1747 1746
 	HisPrescriptionProject HisPrescriptionProject `gorm:"ForeignKey:ID;AssociationForeignKey:ProjectId" json:"project"`
1748 1747
 	HisDoctorAdviceInfo    HisDoctorAdviceInfo    `gorm:"ForeignKey:ID;AssociationForeignKey:AdviceId" json:"advice"`
1749 1748
 }

+ 135 - 18
service/his_summary_service.go View File

@@ -18,10 +18,10 @@ func GetHisSummaryDetailList(keyword string, item_type int64, patient_id int64,
18 18
 							Preload("HisChargeDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
19 19
 								return db.Preload("Drug", "status = 1").Where("status = 1")
20 20
 							}).Preload("HisChargePrescriptionProject", func(db *gorm.DB) *gorm.DB {
21
-							return db.Select("id,project_id,user_org_id,status,patient_id,record_date,count,type").Preload("HisChargeProject", func(db *gorm.DB) *gorm.DB {
21
+							return db.Select("id,project_id,user_org_id,status,patient_id,record_date,count,type,unit").Preload("HisChargeProject", func(db *gorm.DB) *gorm.DB {
22 22
 								return db.Select("id,project_name,unit").Where("status = 1 ")
23 23
 							}).Preload("HisChargeGoodInfo", func(db *gorm.DB) *gorm.DB {
24
-								return db.Select("id,good_name,good_unit,specification_name").Where("status = 1 ")
24
+								return db.Select("id,good_name,good_unit,specification_name,packing_unit").Where("status = 1 ")
25 25
 							}).Where("status = 1 ")
26 26
 						})
27 27
 					}).Where("status = 1  AND ctime >= ? AND ctime <= ? AND user_org_id = ? AND order_status = 2", start_time, end_time, org_id)
@@ -79,10 +79,10 @@ func GetHisSummaryDetailList(keyword string, item_type int64, patient_id int64,
79 79
 		}
80 80
 
81 81
 	} else {
82
-		keyword := "%" + keyword + "%"
82
+		//	keyword := "%" + keyword + "%"
83 83
 		switch item_type {
84 84
 		case 0:
85
-			err = XTReadDB().Table("xt_patients as p").Select("p.id,p.user_org_id,p.name,p.lapseto,p.status").Joins("JOIN his_order AS orders ON orders.patient_id = p.id AND orders.status = 1  AND orders.ctime >= ? AND orders.ctime <= ? AND orders.user_org_id = ? AND orders.order_status = 2 and orders.patient_id ?", start_time, end_time, org_id, patient_id).Preload("HisChargeOrder", func(db *gorm.DB) *gorm.DB {
85
+			err = XTReadDB().Table("xt_patients as p").Select("p.id,p.user_org_id,p.name,p.lapseto,p.status").Joins("JOIN his_order AS orders ON orders.patient_id = p.id AND orders.status = 1  AND orders.ctime >= ? AND orders.ctime <= ? AND orders.user_org_id = ? AND orders.order_status = 2", start_time, end_time, org_id).Preload("HisChargeOrder", func(db *gorm.DB) *gorm.DB {
86 86
 				return db.Select("id,user_org_id,his_patient_id,settle_accounts_date,status,number,order_status,mdtrt_id,patient_id").
87 87
 					Preload("HisChargeOrderInfo", func(db *gorm.DB) *gorm.DB {
88 88
 						return db.Select("id,order_number,advice_id,det_item_fee_sumamt,cnt,pric,med_chrgitm_type,status,chld_medc_flag,chrgitm_lv,user_org_id,project_id,type").Preload("HisChargeDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
@@ -95,11 +95,11 @@ func GetHisSummaryDetailList(keyword string, item_type int64, patient_id int64,
95 95
 							}).Where("status = 1 ")
96 96
 						})
97 97
 					}).Where("status = 1  AND ctime >= ? AND ctime <= ? AND user_org_id = ? AND order_status = 2", start_time, end_time, org_id)
98
-			}).Where("p.status = 1  AND p.user_org_id = ? AND p.name LIKE ?", org_id, keyword).Group("id").Find(&patients).Error
99
-
98
+			}).Where("p.status = 1  AND p.user_org_id = ? and p.id = ?", org_id, patient_id).Group("id").Find(&patients).Error
100 99
 			break
100
+
101 101
 		case 1:
102
-			err = XTReadDB().Table("xt_patients as p").Select("p.id,p.user_org_id,p.name,p.lapseto,p.status").Joins("JOIN his_order AS orders ON orders.patient_id = p.id AND orders.status = 1  AND orders.ctime >= ? AND orders.ctime <= ? AND orders.user_org_id = ? AND orders.order_status = 2 and AND orders.patient_id = ?", start_time, end_time, org_id, patient_id).Preload("HisChargeOrder", func(db *gorm.DB) *gorm.DB {
102
+			err = XTReadDB().Table("xt_patients as p").Select("p.id,p.user_org_id,p.name,p.lapseto,p.status").Joins("JOIN his_order AS orders ON orders.patient_id = p.id AND orders.status = 1  AND orders.ctime >= ? AND orders.ctime <= ? AND orders.user_org_id = ? AND orders.order_status = 2 and ", start_time, end_time, org_id).Preload("HisChargeOrder", func(db *gorm.DB) *gorm.DB {
103 103
 				return db.Select("id,user_org_id,his_patient_id,settle_accounts_date,status,number,order_status,mdtrt_id,patient_id").
104 104
 					Preload("HisChargeOrderInfo", func(db *gorm.DB) *gorm.DB {
105 105
 						return db.Select("id,order_number,advice_id,det_item_fee_sumamt,cnt,pric,med_chrgitm_type,status,chld_medc_flag,chrgitm_lv,user_org_id,project_id,type").Where("advice_id > 0 AND project_id = 0").Preload("HisChargeDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
@@ -112,11 +112,11 @@ func GetHisSummaryDetailList(keyword string, item_type int64, patient_id int64,
112 112
 							}).Where("status = 1 ")
113 113
 						})
114 114
 					}).Where("status = 1  AND ctime >= ? AND ctime <= ? AND user_org_id = ? AND order_status = 2", start_time, end_time, org_id)
115
-			}).Where("p.status = 1  AND p.user_org_id = ? AND p.name LIKE ?", org_id, keyword).Group("id").Find(&patients).Error
115
+			}).Where("p.status = 1  AND p.user_org_id = ? and p.id = ?", org_id, patient_id).Group("id").Find(&patients).Error
116 116
 
117 117
 			break
118 118
 		case 2:
119
-			err = XTReadDB().Table("xt_patients as p").Select("p.id,p.user_org_id,p.name,p.lapseto,p.status").Joins("JOIN his_order AS orders ON orders.patient_id = p.id AND orders.status = 1  AND orders.ctime >= ? AND orders.ctime <= ? AND orders.user_org_id = ? AND orders.order_status = 2 and  orders.patient_id = ?", start_time, end_time, org_id, patient_id).Preload("HisChargeOrder", func(db *gorm.DB) *gorm.DB {
119
+			err = XTReadDB().Table("xt_patients as p").Select("p.id,p.user_org_id,p.name,p.lapseto,p.status").Joins("JOIN his_order AS orders ON orders.patient_id = p.id AND orders.status = 1  AND orders.ctime >= ? AND orders.ctime <= ? AND orders.user_org_id = ? AND orders.order_status = 2", start_time, end_time, org_id).Preload("HisChargeOrder", func(db *gorm.DB) *gorm.DB {
120 120
 				return db.Select("id,user_org_id,his_patient_id,settle_accounts_date,status,number,order_status,mdtrt_id,patient_id").
121 121
 					Preload("HisChargeOrderInfo", func(db *gorm.DB) *gorm.DB {
122 122
 						return db.Select("id,order_number,advice_id,det_item_fee_sumamt,cnt,pric,med_chrgitm_type,status,chld_medc_flag,chrgitm_lv,user_org_id,project_id,type").Where("advice_id = 0 AND project_id > 0").Preload("HisChargeDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
@@ -127,11 +127,11 @@ func GetHisSummaryDetailList(keyword string, item_type int64, patient_id int64,
127 127
 							}).Where("status = 1 ")
128 128
 						})
129 129
 					}).Where("status = 1  AND ctime >= ? AND ctime <= ? AND user_org_id = ? AND order_status = 2", start_time, end_time, org_id)
130
-			}).Where("p.status = 1  AND p.user_org_id = ? AND p.name LIKE ?", org_id, keyword).Group("id").Find(&patients).Error
130
+			}).Where("p.status = 1  AND p.user_org_id = ? and p.id = ?", org_id, patient_id).Group("id").Find(&patients).Error
131 131
 
132 132
 			break
133 133
 		case 3:
134
-			err = XTReadDB().Table("xt_patients as p").Select("p.id,p.user_org_id,p.name,p.lapseto,p.status").Joins("JOIN his_order AS orders ON orders.patient_id = p.id AND orders.status = 1  AND orders.ctime >= ? AND orders.ctime <= ? AND orders.user_org_id = ? AND orders.order_status = 2 and orders.patient_id = ?", start_time, end_time, org_id, patient_id).Preload("HisChargeOrder", func(db *gorm.DB) *gorm.DB {
134
+			err = XTReadDB().Table("xt_patients as p").Select("p.id,p.user_org_id,p.name,p.lapseto,p.status").Joins("JOIN his_order AS orders ON orders.patient_id = p.id AND orders.status = 1  AND orders.ctime >= ? AND orders.ctime <= ? AND orders.user_org_id = ? AND orders.order_status = 2", start_time, end_time, org_id).Preload("HisChargeOrder", func(db *gorm.DB) *gorm.DB {
135 135
 				return db.Select("id,user_org_id,his_patient_id,settle_accounts_date,status,number,order_status,mdtrt_id,patient_id").
136 136
 					Preload("HisChargeOrderInfo", func(db *gorm.DB) *gorm.DB {
137 137
 						return db.Select("id,order_number,advice_id,det_item_fee_sumamt,cnt,pric,med_chrgitm_type,status,chld_medc_flag,chrgitm_lv,user_org_id,project_id,type").Where("advice_id = 0 AND project_id > 0").Preload("HisChargeDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
@@ -142,7 +142,7 @@ func GetHisSummaryDetailList(keyword string, item_type int64, patient_id int64,
142 142
 							}).Where("status = 1 ")
143 143
 						})
144 144
 					}).Where("status = 1  AND ctime >= ? AND ctime <= ? AND user_org_id = ? AND order_status = 2", start_time, end_time, org_id)
145
-			}).Where("p.status = 1  AND p.user_org_id = ? AND p.name LIKE ?", org_id, keyword).Group("id").Find(&patients).Error
145
+			}).Where("p.status = 1  AND p.user_org_id = ? and p.id = ?", org_id, patient_id).Group("id").Find(&patients).Error
146 146
 
147 147
 			break
148 148
 
@@ -264,12 +264,12 @@ func DelelteHisPrescriptionInfoModeTemplate(id int64, user_org_id int64) (err er
264 264
 	return
265 265
 }
266 266
 
267
-func GetAdviceGatherDetaiList(keyword string, item_type int64, patient_id int64, org_id int64, start_time int64, end_time int64) (orderInfo []*models.HisOrderInfo, err error) {
267
+func GetAdviceGatherDetaiList(keyword string, item_type int64, patient_id int64, org_id int64, start_time int64, end_time int64) (orderInfo []*models.VmHisOrderInfo, err error) {
268 268
 
269 269
 	db := XTReadDB().Model(&orderInfo).Where("status = 1")
270 270
 
271 271
 	if org_id > 0 {
272
-		db = db.Where("user_org_id = ?", org_id)
272
+		db = db.Where("user_org_id = ? and advice_id > 0", org_id)
273 273
 	}
274 274
 	if start_time > 0 {
275 275
 		db = db.Where("ctime >=?", start_time)
@@ -277,15 +277,15 @@ func GetAdviceGatherDetaiList(keyword string, item_type int64, patient_id int64,
277 277
 	if end_time > 0 {
278 278
 		db = db.Where("ctime <=?", end_time)
279 279
 	}
280
-	err = db.Group("advice_id").Find(&orderInfo).Error
280
+	err = db.Preload("VmHisDoctorAdviceInfo", "patient_id = ? and advice_date>=? and advice_date<=?", patient_id, start_time, end_time).Group("advice_id").Scan(&orderInfo).Error
281 281
 	return orderInfo, err
282 282
 }
283 283
 
284
-func GetProjectGatherDetailList(keyword string, item_type int64, patient_id int64, org_id int64, start_time int64, end_time int64) (orderInfo []*models.HisOrderInfo, err error) {
284
+func GetProjectGatherDetailList(keyword string, item_type int64, patient_id int64, org_id int64, start_time int64, end_time int64) (orderInfo []*models.VmHisOrderInfo, err error) {
285 285
 	db := XTReadDB().Model(&orderInfo).Where("status = 1")
286 286
 
287 287
 	if org_id > 0 {
288
-		db = db.Where("user_org_id = ?", org_id)
288
+		db = db.Where("user_org_id = ? and project_id > 0", org_id)
289 289
 	}
290 290
 	if start_time > 0 {
291 291
 		db = db.Where("ctime >=?", start_time)
@@ -293,6 +293,123 @@ func GetProjectGatherDetailList(keyword string, item_type int64, patient_id int6
293 293
 	if end_time > 0 {
294 294
 		db = db.Where("ctime <=?", end_time)
295 295
 	}
296
-	err = db.Group("project_id").Find(&orderInfo).Error
296
+	err = db.Group("project_id").Preload("HisPrescriptionProject", "patient_id = ? and record_date>=? and record_date<=?", patient_id, start_time, end_time).Find(&orderInfo).Error
297 297
 	return orderInfo, err
298 298
 }
299
+
300
+func GetGatherHisOrder(keyword string, item_type int64, patient_id int64, org_id int64, start_time int64, end_time int64) (order []*models.GatherHisOrder, err error) {
301
+
302
+	db := XTReadDB().Model(&order).Where("status = 1")
303
+
304
+	if org_id > 0 {
305
+		db = db.Where("user_org_id = ?", org_id)
306
+	}
307
+	if start_time > 0 {
308
+		db = db.Where("settle_accounts_date >=?", start_time)
309
+	}
310
+	if end_time > 0 {
311
+		db = db.Where("settle_accounts_date<=?", end_time)
312
+	}
313
+
314
+	if patient_id > 0 {
315
+		db = db.Where("patient_id = ?", patient_id)
316
+	}
317
+
318
+	if len(keyword) > 0 {
319
+
320
+	}
321
+
322
+	err = db.Find(&order).Error
323
+
324
+	return order, err
325
+}
326
+
327
+func GetGatherHisOrderTwo(keyword string, item_type int64, patient_id int64, org_id int64, start_time int64, end_time int64) (models.GatherHisOrder, error) {
328
+
329
+	hisOrder := models.GatherHisOrder{}
330
+	db := XTReadDB().Model(&hisOrder).Where("status = 1")
331
+
332
+	if org_id > 0 {
333
+		db = db.Where("user_org_id = ?", org_id)
334
+	}
335
+	if start_time > 0 {
336
+		db = db.Where("settle_accounts_date >=?", start_time)
337
+	}
338
+	if end_time > 0 {
339
+		db = db.Where("settle_accounts_date<=?", end_time)
340
+	}
341
+
342
+	if patient_id > 0 {
343
+		db = db.Where("patient_id = ?", patient_id)
344
+	}
345
+
346
+	if len(keyword) > 0 {
347
+
348
+	}
349
+
350
+	err = db.Last(&hisOrder).Error
351
+
352
+	return hisOrder, err
353
+}
354
+
355
+func GetHisSummaryPatientInfo(org_id int64, patient_id int64, start_time int64, end_time int64) (info models.HisPatient, err error) {
356
+	err = readDb.Model(&models.HisPatient{}).Where("user_org_id = ? AND status = 1 AND record_date >= ? AND  record_date <= ? AND patient_id = ?", org_id, start_time, end_time, patient_id).Last(&info).Error
357
+	return
358
+}
359
+
360
+func GetDetailPatients(keywords string, org_id int64) (patients []*models.ChargePatientTwo, err error) {
361
+	if len(keywords) == 0 {
362
+		err = readDb.Model(&models.ChargePatientTwo{}).Where("user_org_id = ? AND status = 1", org_id).Find(&patients).Error
363
+	}
364
+
365
+	if len(keywords) > 0 {
366
+		keyword := "%" + keywords + "%"
367
+		err = readDb.Model(&models.ChargePatientTwo{}).Where("user_org_id = ? AND status = 1 and name like ?", org_id, keyword).Find(&patients).Error
368
+	}
369
+
370
+	return
371
+}
372
+
373
+func GetHisDepatment(user_org_id int64) (hisdepartment []*models.XtHisDepartment, err error) {
374
+
375
+	err = XTReadDB().Where("user_org_id = ? and status = 1", user_org_id).Find(&hisdepartment).Error
376
+	return hisdepartment, err
377
+}
378
+
379
+func GetHisPatientInfoFive(org_id int64, patient_id int64, startime int64, endtime int64) (info models.HisPatient, err error) {
380
+	err = readDb.Model(&models.HisPatient{}).Where("user_org_id = ? AND status = 1 and patient_id = ? AND record_date >= ? and record_date <=?", org_id, patient_id, startime, endtime).Last(&info).Error
381
+	return
382
+}
383
+
384
+func GetHisPrescriptionTenty(org_id int64, patient_id int64, start_time int64, end_time int64, keyword string, item_type int64) (prescription []*models.HisPrescription, err error) {
385
+
386
+	db := readDb.Model(&models.HisPrescription{}).Where("status = 1")
387
+	if org_id > 0 {
388
+		db = db.Where("user_org_id = ?", org_id)
389
+	}
390
+	if start_time > 0 {
391
+		db = db.Where("record_date >=?", start_time)
392
+	}
393
+	if end_time > 0 {
394
+		db = db.Where("record_date <=?", end_time)
395
+	}
396
+	if patient_id > 0 {
397
+		db = db.Where("patient_id = ?", patient_id)
398
+	}
399
+	if len(keyword) > 0 {
400
+		err = db.Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
401
+			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("Drug", "status=1")
402
+		}).Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
403
+			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject").Preload("GoodInfo", "status=1")
404
+		}).Preload("HisAdditionalCharge", "status = 1 AND user_org_id = ?", org_id).Find(&prescription).Error
405
+	} else {
406
+		err = db.Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
407
+			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("Drug", "status=1")
408
+		}).Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
409
+			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject").Preload("GoodInfo", "status=1")
410
+		}).
411
+			Preload("HisAdditionalCharge", "status = 1 AND user_org_id = ?", org_id).Find(&prescription).Error
412
+	}
413
+
414
+	return
415
+}

+ 27 - 2
service/stock_service.go View File

@@ -1530,7 +1530,7 @@ func FindAllWarehouseOutList(orgId int64, page int64, limit int64, startTime int
1530 1530
 
1531 1531
 }
1532 1532
 
1533
-func FindAllWarehouseOutListOne(orgId int64, page int64, limit int64, startTime int64, endTime int64, types int64, keywords string, ids []int64, storehouse_id int64) (list []*models.WarehouseOut, total int64, err error) {
1533
+func FindAllWarehouseOutListOne(orgId int64, page int64, limit int64, startTime int64, endTime int64, types int64, keywords string, ids []int64, storehouse_id int64, way_type int64) (list []*models.WarehouseOut, total int64, err error) {
1534 1534
 	db := readDb.Model(&models.WarehouseOut{})
1535 1535
 	db = db.Where("xt_warehouse_out.org_id = ? AND xt_warehouse_out.status = 1 AND xt_warehouse_out.type = ?", orgId, types)
1536 1536
 
@@ -1549,6 +1549,18 @@ func FindAllWarehouseOutListOne(orgId int64, page int64, limit int64, startTime
1549 1549
 	if storehouse_id > 0 {
1550 1550
 		db = db.Where("xt_warehouse_out.storehouse_id = ?", storehouse_id)
1551 1551
 	}
1552
+	if way_type == 0 {
1553
+		db = db.Where("xt_warehouse_out.is_sys = 0 || xt_warehouse_out.is_sys = 1 || xt_warehouse_out.is_sys = 12")
1554
+	}
1555
+	if way_type == 1 {
1556
+		db = db.Where("xt_warehouse_out.is_sys = 0")
1557
+	}
1558
+	if way_type == 2 {
1559
+		db = db.Where("xt_warehouse_out.is_sys = 1")
1560
+	}
1561
+	if way_type == 3 {
1562
+		db = db.Where("xt_warehouse_out.is_sys = 12")
1563
+	}
1552 1564
 	db = db.Count(&total)
1553 1565
 	offset := (page - 1) * limit
1554 1566
 	if orgId == 10191 {
@@ -1586,7 +1598,7 @@ func FindAllDrugWarehouseOutList(orgId int64, page int64, limit int64, startTime
1586 1598
 
1587 1599
 }
1588 1600
 
1589
-func FindAllDrugWarehouseOutListOne(orgId int64, page int64, limit int64, startTime int64, endTime int64, types int64, keywords string, ids []int64, storehouse_id int64) (list []*models.DrugWarehouseOut, total int64, err error) {
1601
+func FindAllDrugWarehouseOutListOne(orgId int64, page int64, limit int64, startTime int64, endTime int64, types int64, keywords string, ids []int64, storehouse_id int64, way_type int64) (list []*models.DrugWarehouseOut, total int64, err error) {
1590 1602
 	db := readDb.Model(&models.DrugWarehouseOut{})
1591 1603
 	db = db.Where("xt_drug_warehouse_out.org_id = ? AND xt_drug_warehouse_out.status = 1 ", orgId)
1592 1604
 
@@ -1606,6 +1618,19 @@ func FindAllDrugWarehouseOutListOne(orgId int64, page int64, limit int64, startT
1606 1618
 	if storehouse_id > 0 {
1607 1619
 		db = db.Where("xt_drug_warehouse_out.storehouse_id = ?", storehouse_id)
1608 1620
 	}
1621
+
1622
+	if way_type == 0 {
1623
+		db = db.Where("xt_drug_warehouse_out.is_sys = 0 || xt_drug_warehouse_out.is_sys = 1 || xt_drug_warehouse_out.is_sys = 12")
1624
+	}
1625
+	if way_type == 1 {
1626
+		db = db.Where("xt_drug_warehouse_out.is_sys = 0")
1627
+	}
1628
+	if way_type == 2 {
1629
+		db = db.Where("xt_drug_warehouse_out.is_sys = 1")
1630
+	}
1631
+	if way_type == 3 {
1632
+		db = db.Where("xt_drug_warehouse_out.is_sys = 12")
1633
+	}
1609 1634
 	db = db.Count(&total)
1610 1635
 	offset := (page - 1) * limit
1611 1636
 	if orgId == 10191 {

+ 7 - 2
service/warhouse_service.go View File

@@ -4325,7 +4325,8 @@ func AutoDrugDeliverInfoTwenty(orgID int64, prescribingNumber int64, warehouseou
4325 4325
 
4326 4326
 		maxNumber = deliver_number / drup.MinNumber
4327 4327
 		minNumber = deliver_number % drup.MinNumber
4328
-
4328
+		fmt.Println("maxNumber2323232233232332332323232323233232", maxNumber)
4329
+		fmt.Println("minNumber3223233232323233232332322332", minNumber)
4329 4330
 		if warehouse.StockMaxNumber == 0 && drup.MaxUnit == drup.MinUnit {
4330 4331
 			minNumber = maxNumber
4331 4332
 		}
@@ -4353,7 +4354,11 @@ func AutoDrugDeliverInfoTwenty(orgID int64, prescribingNumber int64, warehouseou
4353 4354
 			warehouse.StockMinNumber = warehouse.StockMinNumber + drup.MinNumber - minNumber
4354 4355
 		} else {
4355 4356
 			if minNumber > 0 {
4356
-				warehouse.StockMinNumber = warehouse.StockMinNumber - minNumber
4357
+				if minNumber == 1 && maxNumber == 1 && drup.MaxUnit != drup.MinUnit {
4358
+					warehouse.StockMinNumber = warehouse.StockMinNumber - deliver_number
4359
+				} else {
4360
+					warehouse.StockMinNumber = warehouse.StockMinNumber - minNumber
4361
+				}
4357 4362
 			}
4358 4363
 
4359 4364
 			if minNumber == 0 && maxNumber != 1 {