|
@@ -364,6 +364,72 @@ func (VMDrugCancelStockInfo) TableName() string {
|
364
|
364
|
return "xt_drug_cancel_stock_info"
|
365
|
365
|
}
|
366
|
366
|
|
|
367
|
+type GoodInfo111 struct {
|
|
368
|
+ ID int64 `gorm:"column:id" json:"id" form:"id"`
|
|
369
|
+ GoodCode string `gorm:"column:good_code" json:"good_code" form:"good_code"`
|
|
370
|
+ SpecificationName string `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
|
|
371
|
+ GoodTypeId int64 `gorm:"column:good_type_id" json:"good_type_id" form:"good_type_id"`
|
|
372
|
+ GoodUnit int64 `gorm:"column:good_unit" json:"good_unit" form:"good_unit"`
|
|
373
|
+ BuyPrice float64 `gorm:"column:buy_price" json:"buy_price" form:"buy_price"`
|
|
374
|
+ SellPrice float64 `gorm:"column:sell_price" json:"sell_price" form:"sell_price"`
|
|
375
|
+ Remark string `gorm:"column:remark" json:"remark" form:"remark"`
|
|
376
|
+ Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
|
|
377
|
+ Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
|
|
378
|
+ Manufacturer int64 `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
|
|
379
|
+ Dealer int64 `gorm:"column:dealer" json:"dealer" form:"dealer"`
|
|
380
|
+ ExpiryDateWarnDayCount int64 `gorm:"column:expiry_date_warn_day_count" json:"expiry_date_warn_day_count" form:"expiry_date_warn_day_count"`
|
|
381
|
+ StockWarnCount int64 `gorm:"column:stock_warn_count" json:"stock_warn_count" form:"stock_warn_count"`
|
|
382
|
+ IsReuse int64 `gorm:"column:is_reuse" json:"is_reuse" form:"is_reuse"`
|
|
383
|
+ Status int64 `gorm:"column:status" json:"status" form:"status"`
|
|
384
|
+ FilmArea string `gorm:"column:film_area" json:"film_area" form:"film_area"`
|
|
385
|
+ IsUse int64 `gorm:"column:is_use" json:"is_use" form:"is_use"`
|
|
386
|
+ FilmMaterialQuality string `gorm:"column:film_material_quality" json:"film_material_quality" form:"film_material_quality"`
|
|
387
|
+ OrgId int64 `gorm:"column:org_id" json:"org_id" form:"org_id"`
|
|
388
|
+ Modifier int64 `gorm:"column:modifier" json:"modifier" form:"modifier"`
|
|
389
|
+ Creater int64 `gorm:"column:creater" json:"creater" form:"creater"`
|
|
390
|
+ GoodName string `gorm:"column:good_name" json:"good_name" form:"good_name"`
|
|
391
|
+ Pinyin string `gorm:"column:pinyin" json:"pinyin" form:"pinyin"`
|
|
392
|
+ Wubi string `gorm:"column:wubi" json:"wubi" form:"wubi"`
|
|
393
|
+ GoodKind int64 `gorm:"column:good_kind" json:"good_kind" form:"good_kind"`
|
|
394
|
+ MedicalInsuranceLevel int64 `gorm:"column:medical_insurance_level" json:"medical_insurance_level" form:"medical_insurance_level"`
|
|
395
|
+ RetailPrice float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
|
|
396
|
+ MedicalInsuranceNumber string `gorm:"column:medical_insurance_number" json:"medical_insurance_number" form:"medical_insurance_number"`
|
|
397
|
+ ProvincesCode string `gorm:"column:provinces_code" json:"provinces_code" form:"provinces_code"`
|
|
398
|
+
|
|
399
|
+ Code string `gorm:"column:code" json:"code" form:"code"`
|
|
400
|
+ IsSpecialDiseases int64 `gorm:"column:is_special_diseases" json:"is_special_diseases" form:"is_special_diseases"`
|
|
401
|
+ IsRecord int64 `gorm:"column:is_record" json:"is_record" form:"is_record"`
|
|
402
|
+ StatisticsCategory int64 `gorm:"column:statistics_category" json:"statistics_category" form:"statistics_category"`
|
|
403
|
+ GoodStatus string `gorm:"column:good_status" json:"good_status" form:"good_status"`
|
|
404
|
+ DefaultCount int64 `gorm:"column:default_count" json:"default_count" form:"default_count"`
|
|
405
|
+ Sign int64 `gorm:"column:sign" json:"sign" form:"sign"`
|
|
406
|
+ IsDefault int64 `gorm:"column:is_default" json:"is_default" form:"is_default"`
|
|
407
|
+ IsChargeUse int64 `gorm:"column:is_charge_use" json:"is_charge_use" form:"is_charge_use"`
|
|
408
|
+ IsChargePredict int64 `gorm:"column:is_charge_predict" json:"is_charge_predict" form:"is_charge_predict"`
|
|
409
|
+ IsStatisticsWork int64 `gorm:"column:is_statistics_work" json:"is_statistics_work" form:"is_statistics_work"`
|
|
410
|
+ Sort int64 `gorm:"column:sort" json:"sort" form:"sort"`
|
|
411
|
+ IsDoctorUse int64 `gorm:"column:is_doctor_use" json:"is_doctor_use" form:"is_doctor_use"`
|
|
412
|
+ Agent string `gorm:"column:agent" json:"agent" form:"agent"`
|
|
413
|
+ GoodNumber string `gorm:"column:good_number" json:"good_number" form:"good_number"`
|
|
414
|
+
|
|
415
|
+ IsUser int64 `gorm:"column:is_user" json:"is_user" form:"is_user"`
|
|
416
|
+ PackingUnit string `gorm:"column:packing_unit" json:"packing_unit" form:"packing_unit"`
|
|
417
|
+ Number string `gorm:"column:number" json:"number" form:"number"`
|
|
418
|
+ ZuobiaoId string `gorm:"column:zuobiao_id" json:"zuobiao_id" form:"zuobiao_id"`
|
|
419
|
+ Bck01b string `gorm:"column:bck01b" json:"bck01b" form:"bck01b"`
|
|
420
|
+ Bby01 string `gorm:"column:bby01" json:"bby01" form:"bby01"`
|
|
421
|
+
|
|
422
|
+ IsZeroFlag int64 `gorm:"column:is_zero_flag" json:"is_zero_flag" form:"is_zero_flag"`
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+}
|
|
428
|
+
|
|
429
|
+func (GoodInfo111) TableName() string {
|
|
430
|
+ return "xt_good_information"
|
|
431
|
+}
|
|
432
|
+
|
367
|
433
|
type BaseDrugLib struct {
|
368
|
434
|
ID int64 `gorm:"column:id" json:"id" form:"id"`
|
369
|
435
|
DrugName string `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
|
|
@@ -447,6 +513,11 @@ func GetDrugLibById(id int64) (list BaseDrugLib, err error) {
|
447
|
513
|
Where("id = ? AND status = 1", id).First(&list).Error
|
448
|
514
|
return
|
449
|
515
|
}
|
|
516
|
+func GetGoodLibById(id int64) (list GoodInfo111, err error) {
|
|
517
|
+ err = readDb.Model(&GoodInfo111{}).
|
|
518
|
+ Where("id = ? AND status = 1", id).First(&list).Error
|
|
519
|
+ return
|
|
520
|
+}
|
450
|
521
|
|
451
|
522
|
|
452
|
523
|
func CreateAddtionalCharge(charge *models.HisAdditionalCharge) (err error) {
|
|
@@ -643,6 +714,7 @@ type HisOrder struct {
|
643
|
714
|
SetlDetail string `gorm:"column:setl_detail" json:"setl_detail" form:"setl_detail"`
|
644
|
715
|
FaPiaoSn string `gorm:"column:fa_piao_sn" json:"fa_piao_sn" form:"fa_piao_sn"`
|
645
|
716
|
//FaPiaoSn string `gorm:"column:fa_piao_sn" json:"fa_piao_sn" form:"fa_piao_sn"`
|
|
717
|
+ MdtrtId string `gorm:"column:mdtrt_id" json:"mdtrt_id" form:"mdtrt_id"`
|
646
|
718
|
|
647
|
719
|
HisOrderInfo models.HisOrderInfo `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"order_info"`
|
648
|
720
|
Patients models.Patients `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
|
|
@@ -1577,24 +1649,24 @@ func GetAllHisOrder10106(org_id int64) (his []*models.HisOrder, err error) {
|
1577
|
1649
|
return
|
1578
|
1650
|
}
|
1579
|
1651
|
func GetAllHisOrder10138() (his []*models.HisOrder, err error) {
|
1580
|
|
- err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10138 AND status = 1 AND order_status = 2 AND setl_id <> '' AND setl_time >= '2025-03-01 00:00:00' and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
|
|
1652
|
+ err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10138 AND status = 1 AND order_status = 2 AND setl_id <> '' AND setl_time >= '2025-04-01 00:00:00' and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
|
1581
|
1653
|
fmt.Println(err)
|
1582
|
1654
|
return
|
1583
|
1655
|
}
|
1584
|
1656
|
|
1585
|
1657
|
func GetAllHisOrder9504() (his []*models.HisOrder, err error) {
|
1586
|
|
- err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 9504 AND status = 1 AND order_status = 2 AND setl_id <> '' AND setl_time >= '2025-03-01 00:00:00' and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
|
|
1658
|
+ err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 9504 AND status = 1 AND order_status = 2 AND setl_id <> '' AND setl_time >= '2025-04-01 00:00:00' and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
|
1587
|
1659
|
fmt.Println(err)
|
1588
|
1660
|
return
|
1589
|
1661
|
}
|
1590
|
1662
|
|
1591
|
1663
|
func GetAllHisOrder10028() (his []*models.HisOrder, err error) {
|
1592
|
|
- err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10028 AND status = 1 AND order_status = 2 AND setl_id <> '' AND setl_time >= '2025-02-01 00:00:00' and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
|
|
1664
|
+ err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10028 AND status = 1 AND order_status = 2 AND setl_id <> '' AND setl_time >= '2025-04-01 00:00:00' and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
|
1593
|
1665
|
fmt.Println(err)
|
1594
|
1666
|
return
|
1595
|
1667
|
}
|
1596
|
1668
|
func GetAllHisOrder10610() (his []*models.HisOrder, err error) {
|
1597
|
|
- err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10610 AND status = 1 AND order_status = 2 AND setl_id <> '' AND setl_time >= '2025-03-01 00:00:00' and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
|
|
1669
|
+ err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10610 AND status = 1 AND order_status = 2 AND setl_id <> '' AND setl_time >= '2025-04-01 00:00:00' and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
|
1598
|
1670
|
fmt.Println(err)
|
1599
|
1671
|
return
|
1600
|
1672
|
}
|
|
@@ -1605,7 +1677,7 @@ func GetOrderError10138() (order []*models.HisOrderError, err error) {
|
1605
|
1677
|
|
1606
|
1678
|
func GetAllHisOrder10278() (his []*models.HisOrder, err error) {
|
1607
|
1679
|
|
1608
|
|
- err = readDb.Model(&models.HisOrder{}).Where(" user_org_id = 10278 AND status = 1 AND order_status = 2 AND setl_id <> '' AND setl_time >= '2025-03-01 00:00:00' and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
|
|
1680
|
+ err = readDb.Model(&models.HisOrder{}).Where(" user_org_id = 10278 AND status = 1 AND order_status = 2 AND setl_id <> '' AND setl_time >= '2025-04-01 00:00:00' and mdtrt_id not like '%out%'").Order("setl_time asc").Find(&his).Error
|
1609
|
1681
|
fmt.Println(err)
|
1610
|
1682
|
return
|
1611
|
1683
|
}
|
|
@@ -1792,6 +1864,11 @@ func GetNewDrugFlowInfoByPatient( drug_id int64, time int64, org_id int64) (flow
|
1792
|
1864
|
return
|
1793
|
1865
|
}
|
1794
|
1866
|
|
|
1867
|
+func GetNewGoodFlowInfoByPatient( drug_id int64, time int64, org_id int64) (flows models.NewWarehouseOutInfo, err error) {
|
|
1868
|
+ err = readDb.Model(&models.NewWarehouseOutInfo{}).Where("org_id = ? and status = 1 and good_id = ? and sys_record_time = ?", org_id, drug_id, time).Last(&flows).Error
|
|
1869
|
+ return
|
|
1870
|
+}
|
|
1871
|
+
|
1795
|
1872
|
func GetNewUploadDrugFlowInfoByPatientTwo(patient_id int64, advice_id int64, time int64, org_id int64) (flows []*models.DrugFlow, err error) {
|
1796
|
1873
|
err = readDb.Model(&models.DrugFlow{}).Where("user_org_id = ? and status = 1 and patient_id = ? and drug_id = ? and system_time = ? and is_sale = 1", org_id, patient_id, advice_id, time).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
|
1797
|
1874
|
return db.Where("status = 1").Preload("BaseDrugLib", "status=1")
|
|
@@ -1892,7 +1969,10 @@ func GetSaleDate(id string) (flow models.DrugFlow) {
|
1892
|
1969
|
readDb.Model(&models.DrugFlow{}).Where("id = ?",id).First(&flow)
|
1893
|
1970
|
return
|
1894
|
1971
|
}
|
1895
|
|
-
|
|
1972
|
+func GetSaleDatetwo(id string) (flow models.HisDoctorAdviceInfo) {
|
|
1973
|
+ readDb.Model(&models.HisDoctorAdviceInfo{}).Where("id = ?",id).First(&flow)
|
|
1974
|
+ return
|
|
1975
|
+}
|
1896
|
1976
|
func GetBbx01ByTeamID(team_id int64) (team models.XtHisProjectTeam) {
|
1897
|
1977
|
err = readDb.Model(&models.XtHisProjectTeam{}).Where("id = ?", team_id).First(&team).Error
|
1898
|
1978
|
return
|
|
@@ -2172,6 +2252,8 @@ type HisPrescriptionProject struct {
|
2172
|
2252
|
Checker int64 `gorm:"column:checker" json:"checker" form:"checker"`
|
2173
|
2253
|
StartTime int64 `gorm:"column:start_time" json:"start_time" form:"start_time"`
|
2174
|
2254
|
TeamId int64 `gorm:"column:team_id" json:"team_id" form:"team_id"`
|
|
2255
|
+ IsUpload int64 `gorm:"column:is_upload" json:"is_upload" form:"is_upload"`
|
|
2256
|
+ DrugCode string `gorm:"column:drug_code" json:"drug_code" form:"drug_code"`
|
2175
|
2257
|
|
2176
|
2258
|
FrequencyType int64 `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
|
2177
|
2259
|
DayCount int64 `gorm:"column:day_count" json:"day_count" form:"day_count"`
|
|
@@ -2230,6 +2312,15 @@ func SaveDoctoradviceStatus(id int64,upload_date string) {
|
2230
|
2312
|
|
2231
|
2313
|
}
|
2232
|
2314
|
|
|
2315
|
+func SaveDoctoradviceStatus2(id int64) {
|
|
2316
|
+ writeDb.Model(&models.HisDoctorAdviceInfo{}).Where("id = ?", id).Updates(map[string]interface{}{"is_upload": 0,"upload_date":""})
|
|
2317
|
+
|
|
2318
|
+}
|
|
2319
|
+func SavePStatus(id int64,upload_date string) {
|
|
2320
|
+ writeDb.Model(&models.HisPrescriptionProject{}).Where("id = ?", id).Updates(map[string]interface{}{"is_upload": 1,"upload_date":upload_date})
|
|
2321
|
+
|
|
2322
|
+}
|
|
2323
|
+
|
2233
|
2324
|
func SaveDoctoradviceStatusTwo(id int64) {
|
2234
|
2325
|
writeDb.Model(&models.HisDoctorAdviceInfo{}).Where("id = ?", id).Updates(map[string]interface{}{"is_upload": 0})
|
2235
|
2326
|
|
|
@@ -2240,6 +2331,16 @@ func FindHisAdviceDocAdvice(id int64) (advice []*models.HisDoctorAdviceInfo, err
|
2240
|
2331
|
err = db.Find(&advice).Error
|
2241
|
2332
|
return advice, err
|
2242
|
2333
|
}
|
|
2334
|
+func FindHisAdviceDocAdvice2(id int64) (advice []*models.HisDoctorAdviceInfo, err error) {
|
|
2335
|
+ db := XTReadDB().Model(&advice).Where("status= 1 and id = ? and is_upload = 1", id)
|
|
2336
|
+ err = db.Find(&advice).Error
|
|
2337
|
+ return advice, err
|
|
2338
|
+}
|
|
2339
|
+func FindHisPAdvice(id int64) (advice []*models.HisPrescriptionProject, err error) {
|
|
2340
|
+ db := XTReadDB().Model(&advice).Where("status= 1 and id = ? and is_upload <> 1", id)
|
|
2341
|
+ err = db.Find(&advice).Error
|
|
2342
|
+ return advice, err
|
|
2343
|
+}
|
2243
|
2344
|
|
2244
|
2345
|
|
2245
|
2346
|
func FinddelHisAdviceDocAdvice(id int64) (advice []*models.HisDoctorAdviceInfo, err error) {
|