|
@@ -2,6 +2,7 @@ package service
|
2
|
2
|
|
3
|
3
|
import (
|
4
|
4
|
"XT_New/models"
|
|
5
|
+ "fmt"
|
5
|
6
|
"github.com/jinzhu/gorm"
|
6
|
7
|
"time"
|
7
|
8
|
)
|
|
@@ -456,3 +457,568 @@ func SaveHis(his *models.HisPatient) {
|
456
|
457
|
writeDb.Save(his)
|
457
|
458
|
return
|
458
|
459
|
}
|
|
460
|
+
|
|
461
|
+func GetAllProjectPrescription() (pre []*models.HisPrescription) {
|
|
462
|
+ readDb.Model(&models.HisPrescription{}).Where("user_org_id = 10215 AND status = 1 AND type = 2 AND order_status = 1 AND record_date >= 1659283200").Find(&pre)
|
|
463
|
+ return
|
|
464
|
+}
|
|
465
|
+
|
|
466
|
+func GetAllProject(id int64) (pre []*models.HisPrescriptionProject) {
|
|
467
|
+ readDb.Model(&models.HisPrescriptionProject{}).Where("user_org_id = 10215 AND status = 1 AND project_id = 1735 AND prescription_id = ?", id).Find(&pre)
|
|
468
|
+ return
|
|
469
|
+}
|
|
470
|
+
|
|
471
|
+//func GetHisOrderDetailByNumberTwo(order_number string, org_id int64) (order []*HisOrderInfo, err error) {
|
|
472
|
+// readDb.Model(&models.Patients{})
|
|
473
|
+//
|
|
474
|
+// err = readDb.Model(&HisOrderInfo{}).Where("order_number = ? AND status = 1", order_number).Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
|
|
475
|
+// return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("VMHisPrescriptionTwo", "status = 1 AND user_org_id = ?", org_id).Preload("VMHisProject", "status = 1 AND user_org_id = ?", org_id).Preload("VMGoodInfo", "status = 1 AND org_id = ?", org_id)
|
|
476
|
+// }).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
|
|
477
|
+// return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("VMHisPrescriptionTwo", "status = 1 AND user_org_id = ?", org_id).Preload("Drug", "status = 1 AND org_id = ?", org_id)
|
|
478
|
+// }).Find(&order).Error
|
|
479
|
+// return
|
|
480
|
+//}
|
|
481
|
+
|
|
482
|
+type HisOrderTen struct {
|
|
483
|
+ ID int64 `gorm:"column:id" json:"id" form:"id"`
|
|
484
|
+ UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
|
|
485
|
+ HisPatientId int64 `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
|
|
486
|
+ SettleAccountsDate int64 `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
|
|
487
|
+ Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
|
|
488
|
+ Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
|
|
489
|
+ Status int64 `gorm:"column:status" json:"status" form:"status"`
|
|
490
|
+ Number string `gorm:"column:number" json:"number" form:"number"`
|
|
491
|
+ PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
|
|
492
|
+ Infcode int64 `gorm:"column:infcode" json:"infcode" form:"infcode"`
|
|
493
|
+ WarnMsg string `gorm:"column:warn_msg" json:"warn_msg" form:"warn_msg"`
|
|
494
|
+ Cainfo string `gorm:"column:cainfo" json:"cainfo" form:"cainfo"`
|
|
495
|
+ ErrMsg string `gorm:"column:err_msg" json:"err_msg" form:"err_msg"`
|
|
496
|
+ RespondTime string `gorm:"column:respond_time" json:"respond_time" form:"respond_time"`
|
|
497
|
+ InfRefmsgid string `gorm:"column:inf_refmsgid" json:"inf_refmsgid" form:"inf_refmsgid"`
|
|
498
|
+ OrderStatus int64 `gorm:"column:order_status" json:"order_status" form:"order_status"`
|
|
499
|
+ MdtrtId string `gorm:"column:mdtrt_id" json:"mdtrt_id" form:"mdtrt_id"`
|
|
500
|
+ SetlId string `gorm:"column:setl_id" json:"setl_id" form:"setl_id"`
|
|
501
|
+ PsnNo string `gorm:"column:psn_no" json:"psn_no" form:"psn_no"`
|
|
502
|
+ PsnName string `gorm:"column:psn_name" json:"psn_name" form:"psn_name"`
|
|
503
|
+ PsnCertType string `gorm:"column:psn_cert_type" json:"psn_cert_type" form:"psn_cert_type"`
|
|
504
|
+ Certno string `gorm:"column:certno" json:"certno" form:"certno"`
|
|
505
|
+ Gend string `gorm:"column:gend" json:"gend" form:"gend"`
|
|
506
|
+ Naty string `gorm:"column:naty" json:"naty" form:"naty"`
|
|
507
|
+ Brdy time.Time `gorm:"column:brdy" json:"brdy" form:"brdy"`
|
|
508
|
+ Age float64 `gorm:"column:age" json:"age" form:"age"`
|
|
509
|
+ Insutype string `gorm:"column:insutype" json:"insutype" form:"insutype"`
|
|
510
|
+ PsnType string `gorm:"column:psn_type" json:"psn_type" form:"psn_type"`
|
|
511
|
+ CvlservFlag string `gorm:"column:cvlserv_flag" json:"cvlserv_flag" form:"cvlserv_flag"`
|
|
512
|
+ SetlTime string `gorm:"column:setl_time" json:"setl_time" form:"setl_time"`
|
|
513
|
+ MdtrtCertType string `gorm:"column:mdtrt_cert_type" json:"mdtrt_cert_type" form:"mdtrt_cert_type"`
|
|
514
|
+ MedType string `gorm:"column:med_type" json:"med_type" form:"med_type"`
|
|
515
|
+ MedfeeSumamt float64 `gorm:"column:medfee_sumamt" json:"medfee_sumamt" form:"medfee_sumamt"`
|
|
516
|
+ FulamtOwnpayAmt float64 `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
|
|
517
|
+ OverlmtSelfPay float64 `gorm:"column:overlmt_self_pay" json:"overlmt_self_pay" form:"overlmt_self_pay"`
|
|
518
|
+ PreselfpayAmt float64 `gorm:"column:preselfpay_amt" json:"preselfpay_amt" form:"preselfpay_amt"`
|
|
519
|
+ InscpScpAmt float64 `gorm:"column:inscp_scp_amt" json:"inscp_scp_amt" form:"inscp_scp_amt"`
|
|
520
|
+ ActPayDedc float64 `gorm:"column:act_pay_dedc" json:"act_pay_dedc" form:"act_pay_dedc"`
|
|
521
|
+ HifpPay float64 `gorm:"column:hifp_pay" json:"hifp_pay" form:"hifp_pay"`
|
|
522
|
+ CvlservPay float64 `gorm:"column:cvlserv_pay" json:"cvlserv_pay" form:"cvlserv_pay"`
|
|
523
|
+ PoolPropSelfpay float64 `gorm:"column:pool_prop_selfpay" json:"pool_prop_selfpay" form:"pool_prop_selfpay"`
|
|
524
|
+ HifesPay float64 `gorm:"column:hifes_pay" json:"hifes_pay" form:"hifes_pay"`
|
|
525
|
+ HifmiPay float64 `gorm:"column:hifmi_pay" json:"hifmi_pay" form:"hifmi_pay"`
|
|
526
|
+ HifobPay float64 `gorm:"column:hifob_pay" json:"hifob_pay" form:"hifob_pay"`
|
|
527
|
+ MafPay float64 `gorm:"column:maf_pay" json:"maf_pay" form:"maf_pay"`
|
|
528
|
+ OthPay float64 `gorm:"column:oth_pay" json:"oth_pay" form:"oth_pay"`
|
|
529
|
+ FundPaySumamt float64 `gorm:"column:fund_pay_sumamt" json:"fund_pay_sumamt" form:"fund_pay_sumamt"`
|
|
530
|
+ PsnPartAmt float64 `gorm:"column:psn_part_amt" json:"psn_part_amt" form:"psn_part_amt"`
|
|
531
|
+ AcctPay float64 `gorm:"column:acct_pay" json:"acct_pay" form:"acct_pay"`
|
|
532
|
+ PsnCashPay float64 `gorm:"column:psn_cash_pay" json:"psn_cash_pay" form:"psn_cash_pay"`
|
|
533
|
+ HospPartAmt float64 `gorm:"column:hosp_part_amt" json:"hosp_part_amt" form:"hosp_part_amt"`
|
|
534
|
+ Balc float64 `gorm:"column:balc" json:"balc" form:"balc"`
|
|
535
|
+ AcctMulaidPay float64 `gorm:"column:acct_mulaid_pay" json:"acct_mulaid_pay" form:"acct_mulaid_pay"`
|
|
536
|
+ MedinsSetlId string `gorm:"column:medins_setl_id" json:"medins_setl_id" form:"medins_setl_id"`
|
|
537
|
+ ClrOptins string `gorm:"column:clr_optins" json:"clr_optins" form:"clr_optins"`
|
|
538
|
+ ClrWay string `gorm:"column:clr_way" json:"clr_way" form:"clr_way"`
|
|
539
|
+ ClrType string `gorm:"column:clr_type" json:"clr_type" form:"clr_type"`
|
|
540
|
+ SetlDetail string `gorm:"column:setl_detail" json:"setl_detail" form:"setl_detail"`
|
|
541
|
+ IsMedicineInsurance int64 `gorm:"column:is_medicine_insurance" json:"is_medicine_insurance" form:"is_medicine_insurance"`
|
|
542
|
+ PayWay int64 `gorm:"column:pay_way" json:"pay_way" form:"pay_way"`
|
|
543
|
+ PayPrice float64 `gorm:"column:pay_price" json:"pay_price" form:"pay_price"`
|
|
544
|
+ PayCardNo string `gorm:"column:pay_card_no" json:"pay_card_no" form:"pay_card_no"`
|
|
545
|
+ DiscountPrice float64 `gorm:"column:discount_price" json:"discount_price" form:"discount_price"`
|
|
546
|
+ PreferentialPrice float64 `gorm:"column:preferential_price" json:"preferential_price" form:"preferential_price"`
|
|
547
|
+ RealityPrice float64 `gorm:"column:reality_price" json:"reality_price" form:"reality_price"`
|
|
548
|
+ FoundPrice float64 `gorm:"column:found_price" json:"found_price" form:"found_price"`
|
|
549
|
+ MedicalInsurancePrice float64 `gorm:"column:medical_insurance_price" json:"medical_insurance_price" form:"medical_insurance_price"`
|
|
550
|
+ PrivatePrice float64 `gorm:"column:private_price" json:"private_price" form:"private_price"`
|
|
551
|
+ DepartmentName string `gorm:"-" json:"department_name" form:"department_name"`
|
|
552
|
+ DoctorName string `gorm:"-" json:"doctor_name" form:"doctor_name"`
|
|
553
|
+ Creator int64 `gorm:"column:creator" json:"creator" form:"creator"`
|
|
554
|
+ PType int64 `gorm:"column:p_type" json:"p_type" form:"p_type"`
|
|
555
|
+ Decimal float64 `gorm:"column:decimal" json:"decimal" form:"decimal"`
|
|
556
|
+ HisPrescriptionTen []*HisPrescriptionTen `gorm:"ForeignKey:BatchNumber;AssociationForeignKey:Number" json:"info"`
|
|
557
|
+ Patients Patients `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
|
|
558
|
+}
|
|
559
|
+
|
|
560
|
+func (HisOrderTen) TableName() string {
|
|
561
|
+ return "his_order"
|
|
562
|
+}
|
|
563
|
+
|
|
564
|
+type HisPrescriptionTen struct {
|
|
565
|
+ ID int64 `gorm:"column:id" json:"id" form:"id"`
|
|
566
|
+ UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
|
|
567
|
+ RecordDate int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
|
|
568
|
+ PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
|
|
569
|
+ HisPatientId int64 `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
|
|
570
|
+ Status int64 `gorm:"column:status" json:"status" form:"status"`
|
|
571
|
+ Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
|
|
572
|
+ Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
|
|
573
|
+ Number string `gorm:"column:number" json:"number" form:"number"`
|
|
574
|
+ Type int64 `gorm:"column:type" json:"type" form:"type"`
|
|
575
|
+ Doctor string `gorm:"column:doctor" json:"doctor" form:"doctor"`
|
|
576
|
+ Creator int64 `gorm:"column:creator" json:"creator" form:"creator"`
|
|
577
|
+ Modifier int64 `gorm:"column:modifier" json:"modifier" form:"modifier"`
|
|
578
|
+ OrderStatus int64 `gorm:"column:order_status" json:"order_status" form:"order_status"`
|
|
579
|
+ PreTime int64 `gorm:"column:pre_time" json:"pre_time" form:"pre_time"`
|
|
580
|
+ BatchNumber string `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
|
|
581
|
+ PrescriptionNumber string `gorm:"column:prescription_number" json:"prescription_number" form:"prescription_number"`
|
|
582
|
+ Patients Patients `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
|
|
583
|
+ HisDoctorAdviceInfoTen []*HisDoctorAdviceInfoTen `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"advices"`
|
|
584
|
+ HisPrescriptionProjectTen []*HisPrescriptionProjectTen `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"project"`
|
|
585
|
+ Total string `gorm:"-" json:"total" form:"total"`
|
|
586
|
+ PType int64 `gorm:"column:p_type" json:"p_type" form:"p_type"`
|
|
587
|
+ MedType string `gorm:"column:med_type" json:"med_type" form:"med_type"`
|
|
588
|
+ IsMedicine int64 `gorm:"column:is_medicine" json:"is_medicine" form:"is_medicine"`
|
|
589
|
+}
|
|
590
|
+
|
|
591
|
+func (HisPrescriptionTen) TableName() string {
|
|
592
|
+ return "his_prescription"
|
|
593
|
+}
|
|
594
|
+
|
|
595
|
+func GetHisOrderDetailThree() (order []*HisOrderTen, err error) {
|
|
596
|
+ err = readDb.Model(&HisOrderTen{}).Preload("Patients", "status = 1").Preload("HisPrescriptionTen", func(db *gorm.DB) *gorm.DB {
|
|
597
|
+ return db.Where("status = 1").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
|
|
598
|
+ return db.Where("status = 1").Preload("VMHisProject", "status = 1").Preload("VMGoodInfo", "status = 1")
|
|
599
|
+ }).Preload("HisDoctorAdviceInfoTen", func(db *gorm.DB) *gorm.DB {
|
|
600
|
+ return db.Where("status = 1").Preload("Drug", "status = 1")
|
|
601
|
+ })
|
|
602
|
+ }).Where("settle_accounts_date >= 1659283200 AND settle_accounts_date <= 1661788800 AND status = 1 AND order_status =2 and p_type = 1 AND user_org_id = 10215").Find(&order).Order("patient_id").Error
|
|
603
|
+ return
|
|
604
|
+}
|
|
605
|
+
|
|
606
|
+type HisDoctorAdviceInfoTen struct {
|
|
607
|
+ ID int64 `gorm:"column:id" json:"id" form:"id"`
|
|
608
|
+ UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
|
|
609
|
+ PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
|
|
610
|
+ AdviceDate int64 `gorm:"column:advice_date" json:"advice_date" form:"advice_date"`
|
|
611
|
+ AdviceName string `gorm:"column:advice_name" json:"advice_name" form:"advice_name"`
|
|
612
|
+ AdviceDesc string `gorm:"column:advice_desc" json:"advice_desc" form:"advice_desc"`
|
|
613
|
+ SingleDose float64 `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
|
|
614
|
+ SingleDoseUnit string `gorm:"column:single_dose_unit" json:"single_dose_unit" form:"single_dose_unit"`
|
|
615
|
+ PrescribingNumber float64 `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
|
|
616
|
+ PrescribingNumberUnit string `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
|
|
617
|
+ DeliveryWay string `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
|
|
618
|
+ ExecutionFrequency string `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
|
|
619
|
+ Status int64 `gorm:"column:status" json:"status" form:"status"`
|
|
620
|
+ CreatedTime int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
|
|
621
|
+ RecordDate int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
|
|
622
|
+ DrugSpec float64 `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
|
|
623
|
+ DrugSpecUnit string `gorm:"column:drug_spec_unit" json:"drug_spec_unit" form:"drug_spec_unit"`
|
|
624
|
+ PrescriptionId int64 `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
|
|
625
|
+
|
|
626
|
+ Price float64 `gorm:"column:price" json:"price" form:"price"`
|
|
627
|
+ DrugId int64 `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
|
|
628
|
+ Drug Drug `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId" json:"drug"`
|
|
629
|
+ IsMedicine int64 `gorm:"column:is_medicine" json:"is_medicine" form:"is_medicine"`
|
|
630
|
+ ExecutionFrequencyId int64 `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
|
|
631
|
+}
|
|
632
|
+
|
|
633
|
+func (HisDoctorAdviceInfoTen) TableName() string {
|
|
634
|
+ return "his_doctor_advice_info"
|
|
635
|
+}
|
|
636
|
+
|
|
637
|
+type HisPrescriptionProjectTen struct {
|
|
638
|
+ ID int64 `gorm:"column:id" json:"id" form:"id"`
|
|
639
|
+ ProjectId int64 `gorm:"column:project_id" json:"project_id" form:"project_id"`
|
|
640
|
+ Price float64 `gorm:"column:price" json:"price" form:"price"`
|
|
641
|
+ UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
|
|
642
|
+ Status int64 `gorm:"column:status" json:"status" form:"status"`
|
|
643
|
+ Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
|
|
644
|
+ Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
|
|
645
|
+ PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
|
|
646
|
+ HisPatientId int64 `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
|
|
647
|
+ RecordDate int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
|
|
648
|
+ PrescriptionId int64 `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
|
|
649
|
+ Count string `gorm:"column:count" json:"count" form:"count"`
|
|
650
|
+ FeedetlSn string `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
|
|
651
|
+ MedListCodg string `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
|
|
652
|
+ SingleDose string `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
|
|
653
|
+ DeliveryWay string `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
|
|
654
|
+ ExecutionFrequency string `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
|
|
655
|
+ Day string `gorm:"column:day" json:"day" form:"day"`
|
|
656
|
+ VMHisProject VMHisProject `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"project"`
|
|
657
|
+ VMGoodInfo VMGoodInfo `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"good_info"`
|
|
658
|
+ Remark string `gorm:"column:remark" json:"remark" form:"remark"`
|
|
659
|
+ Unit string `gorm:"column:unit" json:"unit" form:"unit"`
|
|
660
|
+ Type int64 `gorm:"column:type" json:"type" form:"type"`
|
|
661
|
+ Doctor int64 `gorm:"column:doctor" json:"doctor" form:"doctor"`
|
|
662
|
+ ExecutionTime int64 `gorm:"column:execution_time" json:"execution_time" form:"execution_time"`
|
|
663
|
+ ExecutionStaff int64 `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
|
|
664
|
+ ExecutionState int64 `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
|
|
665
|
+ CheckTime int64 `gorm:"column:check_time" json:"check_time" form:"check_time"`
|
|
666
|
+ CheckState int64 `gorm:"column:check_state" json:"check_state" form:"check_state"`
|
|
667
|
+ Checker int64 `gorm:"column:checker" json:"checker" form:"checker"`
|
|
668
|
+ StartTime int64 `gorm:"column:start_time" json:"start_time" form:"start_time"`
|
|
669
|
+ TeamId int64 `gorm:"column:team_id" json:"team_id" form:"team_id"`
|
|
670
|
+
|
|
671
|
+ FrequencyType int64 `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
|
|
672
|
+ DayCount int64 `gorm:"column:day_count" json:"day_count" form:"day_count"`
|
|
673
|
+ WeekDay string `gorm:"column:week_day" json:"week_day" form:"week_day"`
|
|
674
|
+ ExecutionFrequencyId int64 `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
|
|
675
|
+}
|
|
676
|
+
|
|
677
|
+func (HisPrescriptionProjectTen) TableName() string {
|
|
678
|
+ return "his_prescription_project"
|
|
679
|
+}
|
|
680
|
+
|
|
681
|
+func GetHisPatient11111(orgid int64) (paitent []*models.HisHospitalCheckRecord, err error) {
|
|
682
|
+ err = XTReadDB().Model(&paitent).Where("user_org_id = ? and status = 1 AND in_hosptial_time >= '2022-11-01 00:00:00' AND in_hosptial_time <= '2022-11-30 23:59:59'", orgid).Find(&paitent).Error
|
|
683
|
+ return paitent, err
|
|
684
|
+}
|
|
685
|
+
|
|
686
|
+func SaveHP(paitent *models.HisHospitalCheckRecord) {
|
|
687
|
+ writeDb.Save(&paitent)
|
|
688
|
+
|
|
689
|
+}
|
|
690
|
+
|
|
691
|
+type HisOrder9504 struct {
|
|
692
|
+ ID int64 `gorm:"column:id" json:"id" form:"id"`
|
|
693
|
+ UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
|
|
694
|
+ HisPatientId int64 `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
|
|
695
|
+ SettleAccountsDate int64 `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
|
|
696
|
+ Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
|
|
697
|
+ Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
|
|
698
|
+ Status int64 `gorm:"column:status" json:"status" form:"status"`
|
|
699
|
+ Number string `gorm:"column:number" json:"number" form:"number"`
|
|
700
|
+ PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
|
|
701
|
+ Infcode int64 `gorm:"column:infcode" json:"infcode" form:"infcode"`
|
|
702
|
+ WarnMsg string `gorm:"column:warn_msg" json:"warn_msg" form:"warn_msg"`
|
|
703
|
+ Cainfo string `gorm:"column:cainfo" json:"cainfo" form:"cainfo"`
|
|
704
|
+ ErrMsg string `gorm:"column:err_msg" json:"err_msg" form:"err_msg"`
|
|
705
|
+ RespondTime string `gorm:"column:respond_time" json:"respond_time" form:"respond_time"`
|
|
706
|
+ InfRefmsgid string `gorm:"column:inf_refmsgid" json:"inf_refmsgid" form:"inf_refmsgid"`
|
|
707
|
+ OrderStatus int64 `gorm:"column:order_status" json:"order_status" form:"order_status"`
|
|
708
|
+ MdtrtId string `gorm:"column:mdtrt_id" json:"mdtrt_id" form:"mdtrt_id"`
|
|
709
|
+ SetlId string `gorm:"column:setl_id" json:"setl_id" form:"setl_id"`
|
|
710
|
+ PsnNo string `gorm:"column:psn_no" json:"psn_no" form:"psn_no"`
|
|
711
|
+ PsnName string `gorm:"column:psn_name" json:"psn_name" form:"psn_name"`
|
|
712
|
+ PsnCertType string `gorm:"column:psn_cert_type" json:"psn_cert_type" form:"psn_cert_type"`
|
|
713
|
+ Certno string `gorm:"column:certno" json:"certno" form:"certno"`
|
|
714
|
+ Gend string `gorm:"column:gend" json:"gend" form:"gend"`
|
|
715
|
+ Naty string `gorm:"column:naty" json:"naty" form:"naty"`
|
|
716
|
+ Brdy time.Time `gorm:"column:brdy" json:"brdy" form:"brdy"`
|
|
717
|
+ Age float64 `gorm:"column:age" json:"age" form:"age"`
|
|
718
|
+ Insutype string `gorm:"column:insutype" json:"insutype" form:"insutype"`
|
|
719
|
+ PsnType string `gorm:"column:psn_type" json:"psn_type" form:"psn_type"`
|
|
720
|
+ CvlservFlag string `gorm:"column:cvlserv_flag" json:"cvlserv_flag" form:"cvlserv_flag"`
|
|
721
|
+ SetlTime string `gorm:"column:setl_time" json:"setl_time" form:"setl_time"`
|
|
722
|
+ MdtrtCertType string `gorm:"column:mdtrt_cert_type" json:"mdtrt_cert_type" form:"mdtrt_cert_type"`
|
|
723
|
+ MedType string `gorm:"column:med_type" json:"med_type" form:"med_type"`
|
|
724
|
+ MedfeeSumamt float64 `gorm:"column:medfee_sumamt" json:"medfee_sumamt" form:"medfee_sumamt"`
|
|
725
|
+ FulamtOwnpayAmt float64 `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
|
|
726
|
+ OverlmtSelfPay float64 `gorm:"column:overlmt_self_pay" json:"overlmt_self_pay" form:"overlmt_self_pay"`
|
|
727
|
+ PreselfpayAmt float64 `gorm:"column:preselfpay_amt" json:"preselfpay_amt" form:"preselfpay_amt"`
|
|
728
|
+ InscpScpAmt float64 `gorm:"column:inscp_scp_amt" json:"inscp_scp_amt" form:"inscp_scp_amt"`
|
|
729
|
+ ActPayDedc float64 `gorm:"column:act_pay_dedc" json:"act_pay_dedc" form:"act_pay_dedc"`
|
|
730
|
+ HifpPay float64 `gorm:"column:hifp_pay" json:"hifp_pay" form:"hifp_pay"`
|
|
731
|
+ CvlservPay float64 `gorm:"column:cvlserv_pay" json:"cvlserv_pay" form:"cvlserv_pay"`
|
|
732
|
+ PoolPropSelfpay float64 `gorm:"column:pool_prop_selfpay" json:"pool_prop_selfpay" form:"pool_prop_selfpay"`
|
|
733
|
+ HifesPay float64 `gorm:"column:hifes_pay" json:"hifes_pay" form:"hifes_pay"`
|
|
734
|
+ HifmiPay float64 `gorm:"column:hifmi_pay" json:"hifmi_pay" form:"hifmi_pay"`
|
|
735
|
+ HifobPay float64 `gorm:"column:hifob_pay" json:"hifob_pay" form:"hifob_pay"`
|
|
736
|
+ MafPay float64 `gorm:"column:maf_pay" json:"maf_pay" form:"maf_pay"`
|
|
737
|
+ OthPay float64 `gorm:"column:oth_pay" json:"oth_pay" form:"oth_pay"`
|
|
738
|
+ FundPaySumamt float64 `gorm:"column:fund_pay_sumamt" json:"fund_pay_sumamt" form:"fund_pay_sumamt"`
|
|
739
|
+ PsnPartAmt float64 `gorm:"column:psn_part_amt" json:"psn_part_amt" form:"psn_part_amt"`
|
|
740
|
+ AcctPay float64 `gorm:"column:acct_pay" json:"acct_pay" form:"acct_pay"`
|
|
741
|
+ PsnCashPay float64 `gorm:"column:psn_cash_pay" json:"psn_cash_pay" form:"psn_cash_pay"`
|
|
742
|
+ HospPartAmt float64 `gorm:"column:hosp_part_amt" json:"hosp_part_amt" form:"hosp_part_amt"`
|
|
743
|
+ Balc float64 `gorm:"column:balc" json:"balc" form:"balc"`
|
|
744
|
+ AcctMulaidPay float64 `gorm:"column:acct_mulaid_pay" json:"acct_mulaid_pay" form:"acct_mulaid_pay"`
|
|
745
|
+ MedinsSetlId string `gorm:"column:medins_setl_id" json:"medins_setl_id" form:"medins_setl_id"`
|
|
746
|
+ ClrOptins string `gorm:"column:clr_optins" json:"clr_optins" form:"clr_optins"`
|
|
747
|
+ ClrWay string `gorm:"column:clr_way" json:"clr_way" form:"clr_way"`
|
|
748
|
+ ClrType string `gorm:"column:clr_type" json:"clr_type" form:"clr_type"`
|
|
749
|
+ SetlDetail string `gorm:"column:setl_detail" json:"setl_detail" form:"setl_detail"`
|
|
750
|
+ IsMedicineInsurance int64 `gorm:"column:is_medicine_insurance" json:"is_medicine_insurance" form:"is_medicine_insurance"`
|
|
751
|
+ PayWay int64 `gorm:"column:pay_way" json:"pay_way" form:"pay_way"`
|
|
752
|
+ PayPrice float64 `gorm:"column:pay_price" json:"pay_price" form:"pay_price"`
|
|
753
|
+ PayCardNo string `gorm:"column:pay_card_no" json:"pay_card_no" form:"pay_card_no"`
|
|
754
|
+ DiscountPrice float64 `gorm:"column:discount_price" json:"discount_price" form:"discount_price"`
|
|
755
|
+ PreferentialPrice float64 `gorm:"column:preferential_price" json:"preferential_price" form:"preferential_price"`
|
|
756
|
+ RealityPrice float64 `gorm:"column:reality_price" json:"reality_price" form:"reality_price"`
|
|
757
|
+ FoundPrice float64 `gorm:"column:found_price" json:"found_price" form:"found_price"`
|
|
758
|
+ MedicalInsurancePrice float64 `gorm:"column:medical_insurance_price" json:"medical_insurance_price" form:"medical_insurance_price"`
|
|
759
|
+ PrivatePrice float64 `gorm:"column:private_price" json:"private_price" form:"private_price"`
|
|
760
|
+ DepartmentName string `gorm:"-" json:"department_name" form:"department_name"`
|
|
761
|
+ DoctorName string `gorm:"-" json:"doctor_name" form:"doctor_name"`
|
|
762
|
+ SettleStartTime int64 `gorm:"settle_start_time" json:"settle_start_time" form:"settle_start_time"`
|
|
763
|
+
|
|
764
|
+ Creator int64 `gorm:"column:creator" json:"creator" form:"creator"`
|
|
765
|
+ PType int64 `gorm:"column:p_type" json:"p_type" form:"p_type"`
|
|
766
|
+ Decimal float64 `gorm:"column:decimal" json:"decimal" form:"decimal"`
|
|
767
|
+ VmHisOrderInfo9504 []*VmHisOrderInfo9504 `gorm:"ForeignKey:OrderNumber;AssociationForeignKey:Number" json:"info"`
|
|
768
|
+ Patients Patients `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
|
|
769
|
+}
|
|
770
|
+
|
|
771
|
+func (HisOrder9504) TableName() string {
|
|
772
|
+ return "his_order"
|
|
773
|
+}
|
|
774
|
+
|
|
775
|
+type VmHisOrderInfo9504 struct {
|
|
776
|
+ ID int64 `gorm:"column:id" json:"id" form:"id"`
|
|
777
|
+ OrderNumber string `gorm:"column:order_number" json:"order_number" form:"order_number"`
|
|
778
|
+ UploadDate int64 `gorm:"column:upload_date" json:"upload_date" form:"upload_date"`
|
|
779
|
+ AdviceId int64 `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
|
|
780
|
+ DetItemFeeSumamt float64 `gorm:"column:det_item_fee_sumamt" json:"det_item_fee_sumamt" form:"det_item_fee_sumamt"`
|
|
781
|
+ Cnt float64 `gorm:"column:cnt" json:"cnt" form:"cnt"`
|
|
782
|
+ Pric float64 `gorm:"column:pric" json:"pric" form:"pric"`
|
|
783
|
+ PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
|
|
784
|
+ PricUplmtAmt float64 `gorm:"column:pric_uplmt_amt" json:"pric_uplmt_amt" form:"pric_uplmt_amt"`
|
|
785
|
+ SelfpayProp float64 `gorm:"column:selfpay_prop" json:"selfpay_prop" form:"selfpay_prop"`
|
|
786
|
+ FulamtOwnpayAmt float64 `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
|
|
787
|
+ OverlmtAmt float64 `gorm:"column:overlmt_amt" json:"overlmt_amt" form:"overlmt_amt"`
|
|
788
|
+ PreselfpayAmt float64 `gorm:"column:preselfpay_amt" json:"preselfpay_amt" form:"preselfpay_amt"`
|
|
789
|
+ BasMednFlag string `gorm:"column:bas_medn_flag" json:"bas_medn_flag" form:"bas_medn_flag"`
|
|
790
|
+ MedChrgitmType string `gorm:"column:med_chrgitm_type" json:"med_chrgitm_type" form:"med_chrgitm_type"`
|
|
791
|
+ HiNegoDrugFlag string `gorm:"column:hi_nego_drug_flag" json:"hi_nego_drug_flag" form:"hi_nego_drug_flag"`
|
|
792
|
+ Status int64 `gorm:"column:status" json:"status" form:"status"`
|
|
793
|
+ Memo string `gorm:"column:memo" json:"memo" form:"memo"`
|
|
794
|
+ FeedetlSn string `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
|
|
795
|
+ Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
|
|
796
|
+ InscpScpAmt float64 `gorm:"column:inscp_scp_amt" json:"inscp_scp_amt" form:"inscp_scp_amt"`
|
|
797
|
+ DrtReimFlag string `gorm:"column:drt_reim_flag" json:"drt_reim_flag" form:"drt_reim_flag"`
|
|
798
|
+ Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
|
|
799
|
+ ListSpItemFlag string `gorm:"column:list_sp_item_flag" json:"list_sp_item_flag" form:"list_sp_item_flag"`
|
|
800
|
+ ChldMedcFlag string `gorm:"column:chld_medc_flag" json:"chld_medc_flag" form:"chld_medc_flag"`
|
|
801
|
+ LmtUsedFlag string `gorm:"column:lmt_used_flag" json:"lmt_used_flag" form:"lmt_used_flag"`
|
|
802
|
+ ChrgitmLv string `gorm:"column:chrgitm_lv" json:"chrgitm_lv" form:"chrgitm_lv"`
|
|
803
|
+ UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
|
|
804
|
+ HisPatientId int64 `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
|
|
805
|
+ OrderId int64 `gorm:"column:order_id" json:"order_id" form:"order_id"`
|
|
806
|
+ ProjectId int64 `gorm:"column:project_id" json:"project_id" form:"project_id"`
|
|
807
|
+ Type int64 `gorm:"column:type" json:"type" form:"type"`
|
|
808
|
+ ItemId int64 `gorm:"column:item_id" json:"item_id" form:"item_id"`
|
|
809
|
+ SettleType int64 `gorm:"column:settle_type" json:"settle_type" form:"settle_type"`
|
|
810
|
+ HisPrescriptionProjectTen HisPrescriptionProjectTen `gorm:"ForeignKey:ID;AssociationForeignKey:ProjectId" json:"project"`
|
|
811
|
+ HisDoctorAdviceInfoTen HisDoctorAdviceInfoTen `gorm:"ForeignKey:ID;AssociationForeignKey:AdviceId" json:"advices"`
|
|
812
|
+}
|
|
813
|
+
|
|
814
|
+func (VmHisOrderInfo9504) TableName() string {
|
|
815
|
+ return "his_order_info"
|
|
816
|
+}
|
|
817
|
+
|
|
818
|
+type VmHisOrderInfo95042 struct {
|
|
819
|
+ ID int64 `gorm:"column:id" json:"id" form:"id"`
|
|
820
|
+ OrderNumber string `gorm:"column:order_number" json:"order_number" form:"order_number"`
|
|
821
|
+ UploadDate int64 `gorm:"column:upload_date" json:"upload_date" form:"upload_date"`
|
|
822
|
+ AdviceId int64 `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
|
|
823
|
+ DetItemFeeSumamt float64 `gorm:"column:det_item_fee_sumamt" json:"det_item_fee_sumamt" form:"det_item_fee_sumamt"`
|
|
824
|
+ Cnt float64 `gorm:"column:cnt" json:"cnt" form:"cnt"`
|
|
825
|
+ Pric float64 `gorm:"column:pric" json:"pric" form:"pric"`
|
|
826
|
+ PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
|
|
827
|
+ PricUplmtAmt float64 `gorm:"column:pric_uplmt_amt" json:"pric_uplmt_amt" form:"pric_uplmt_amt"`
|
|
828
|
+ SelfpayProp float64 `gorm:"column:selfpay_prop" json:"selfpay_prop" form:"selfpay_prop"`
|
|
829
|
+ FulamtOwnpayAmt float64 `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
|
|
830
|
+ OverlmtAmt float64 `gorm:"column:overlmt_amt" json:"overlmt_amt" form:"overlmt_amt"`
|
|
831
|
+ PreselfpayAmt float64 `gorm:"column:preselfpay_amt" json:"preselfpay_amt" form:"preselfpay_amt"`
|
|
832
|
+ BasMednFlag string `gorm:"column:bas_medn_flag" json:"bas_medn_flag" form:"bas_medn_flag"`
|
|
833
|
+ MedChrgitmType string `gorm:"column:med_chrgitm_type" json:"med_chrgitm_type" form:"med_chrgitm_type"`
|
|
834
|
+ HiNegoDrugFlag string `gorm:"column:hi_nego_drug_flag" json:"hi_nego_drug_flag" form:"hi_nego_drug_flag"`
|
|
835
|
+ Status int64 `gorm:"column:status" json:"status" form:"status"`
|
|
836
|
+ Memo string `gorm:"column:memo" json:"memo" form:"memo"`
|
|
837
|
+ FeedetlSn string `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
|
|
838
|
+ Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
|
|
839
|
+ InscpScpAmt float64 `gorm:"column:inscp_scp_amt" json:"inscp_scp_amt" form:"inscp_scp_amt"`
|
|
840
|
+ DrtReimFlag string `gorm:"column:drt_reim_flag" json:"drt_reim_flag" form:"drt_reim_flag"`
|
|
841
|
+ Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
|
|
842
|
+ ListSpItemFlag string `gorm:"column:list_sp_item_flag" json:"list_sp_item_flag" form:"list_sp_item_flag"`
|
|
843
|
+ ChldMedcFlag string `gorm:"column:chld_medc_flag" json:"chld_medc_flag" form:"chld_medc_flag"`
|
|
844
|
+ LmtUsedFlag string `gorm:"column:lmt_used_flag" json:"lmt_used_flag" form:"lmt_used_flag"`
|
|
845
|
+ ChrgitmLv string `gorm:"column:chrgitm_lv" json:"chrgitm_lv" form:"chrgitm_lv"`
|
|
846
|
+ UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
|
|
847
|
+ HisPatientId int64 `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
|
|
848
|
+ OrderId int64 `gorm:"column:order_id" json:"order_id" form:"order_id"`
|
|
849
|
+ ProjectId int64 `gorm:"column:project_id" json:"project_id" form:"project_id"`
|
|
850
|
+ Type int64 `gorm:"column:type" json:"type" form:"type"`
|
|
851
|
+ ItemId int64 `gorm:"column:item_id" json:"item_id" form:"item_id"`
|
|
852
|
+ SettleType int64 `gorm:"column:settle_type" json:"settle_type" form:"settle_type"`
|
|
853
|
+}
|
|
854
|
+
|
|
855
|
+func (VmHisOrderInfo95042) TableName() string {
|
|
856
|
+ return "his_order_info"
|
|
857
|
+}
|
|
858
|
+
|
|
859
|
+func GetHisOrderDetail9504() (order []*HisOrder9504, err error) {
|
|
860
|
+ err = readDb.Model(&HisOrder9504{}).Preload("Patients", "status = 1").Preload("VmHisOrderInfo9504", func(db *gorm.DB) *gorm.DB {
|
|
861
|
+ return db.Where("status = 1").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
|
|
862
|
+ return db.Where("status = 1").Preload("VMHisProject", "status = 1").Preload("VMGoodInfo", "status = 1")
|
|
863
|
+ }).Preload("HisDoctorAdviceInfoTen", func(db *gorm.DB) *gorm.DB {
|
|
864
|
+ return db.Where("status = 1").Preload("Drug", "status = 1")
|
|
865
|
+ })
|
|
866
|
+ }).Where("settle_accounts_date >= 1640966400 AND settle_accounts_date <= 1661875200 AND status = 1 AND order_status =2 AND user_org_id = 9504").Find(&order).Order("setl_time").Error
|
|
867
|
+ return
|
|
868
|
+}
|
|
869
|
+
|
|
870
|
+func GetHisOrderDetail10188() (order []*HisOrder9504, err error) {
|
|
871
|
+ err = readDb.Model(&HisOrder9504{}).Preload("Patients", "status = 1").Preload("VmHisOrderInfo9504", func(db *gorm.DB) *gorm.DB {
|
|
872
|
+ return db.Where("status = 1").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
|
|
873
|
+ return db.Where("status = 1").Preload("VMHisProject", "status = 1").Preload("VMGoodInfo", "status = 1")
|
|
874
|
+ })
|
|
875
|
+ }).Where("settle_accounts_date >= 1654012800 AND settle_accounts_date <= 1661875200 AND status = 1 AND order_status =2 AND user_org_id = 10188").Find(&order).Order("setl_time").Error
|
|
876
|
+ return
|
|
877
|
+}
|
|
878
|
+
|
|
879
|
+//func GetHisOrderDetail10138() (order []*HisOrder9504, err error) {
|
|
880
|
+// err = readDb.Model(&HisOrder9504{}).Preload("Patients", "status = 1").Preload("VmHisOrderInfo9504", func(db *gorm.DB) *gorm.DB {
|
|
881
|
+// return db.Where("status = 1").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
|
|
882
|
+// return db.Where("status = 1").Preload("VMHisProject", "status = 1")
|
|
883
|
+// })
|
|
884
|
+// }).Where("settle_accounts_date >= 1640966400 AND settle_accounts_date <= 1648656000 AND status = 1 AND order_status =2 AND user_org_id = 10138").Find(&order).Order("setl_time").Error
|
|
885
|
+// return
|
|
886
|
+//}
|
|
887
|
+
|
|
888
|
+func GetHisOrderDetail10138() (order []*HisOrderTen, err error) {
|
|
889
|
+ err = readDb.Model(&HisOrderTen{}).Preload("HisPrescriptionTen", func(db *gorm.DB) *gorm.DB {
|
|
890
|
+ return db.Where("status = 1 AND order_status = 2").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
|
|
891
|
+ return db.Where("status = 1").Preload("VMHisProject")
|
|
892
|
+ })
|
|
893
|
+ }).Where("settle_accounts_date >= 1656604800 AND settle_accounts_date <= 1664553599 AND status = 1 AND order_status =2 AND user_org_id = 10138").Find(&order).Error
|
|
894
|
+ return
|
|
895
|
+}
|
|
896
|
+
|
|
897
|
+func GetHisOrderDetail10265() (order_infos []*VmHisOrderInfo9504, err error) {
|
|
898
|
+ err = readDb.Model(&VmHisOrderInfo9504{}).Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
|
|
899
|
+ return db.Preload("VMHisProject").Preload("VMGoodInfo", "status = 1")
|
|
900
|
+ }).Preload("HisDoctorAdviceInfoTen", func(db *gorm.DB) *gorm.DB {
|
|
901
|
+ return db.Where("status = 1").Preload("Drug", "status = 1")
|
|
902
|
+ }).Where(" status = 1 AND user_org_id = 10265 AND order_number = '2022090814370516482'").Find(&order_infos).Error
|
|
903
|
+ return
|
|
904
|
+}
|
|
905
|
+
|
|
906
|
+func GetHisOrder10265() (order_infos []*VmHisOrderInfo9504, err error) {
|
|
907
|
+ err = readDb.Model(&VmHisOrderInfo95042{}).Where(" status = 1 AND user_org_id = 10265 AND order_number = '2022092912130116192' AND project_id > 0").Find(&order_infos).Error
|
|
908
|
+ return
|
|
909
|
+}
|
|
910
|
+
|
|
911
|
+func SaveOrderInfo(info *VmHisOrderInfo9504) {
|
|
912
|
+ writeDb.Save(&info)
|
|
913
|
+}
|
|
914
|
+
|
|
915
|
+func GetHisOrderDetail10106(start_time int64, end_time int64) (order []*HisOrder9504, err error) {
|
|
916
|
+ err = readDb.Model(&HisOrder9504{}).Preload("VmHisOrderInfo9504", func(db *gorm.DB) *gorm.DB {
|
|
917
|
+ return db.Where("status = 1").Preload("HisPrescriptionProjectTen", func(db *gorm.DB) *gorm.DB {
|
|
918
|
+ return db.Where("status = 1").Preload("VMHisProject").Preload("VMGoodInfo")
|
|
919
|
+ }).Preload("HisDoctorAdviceInfoTen", func(db *gorm.DB) *gorm.DB {
|
|
920
|
+ return db.Where("status = 1").Preload("Drug")
|
|
921
|
+ })
|
|
922
|
+ }).Where("settle_accounts_date >= ? AND settle_accounts_date <= ? AND status = 1 AND order_status =2 AND user_org_id = 10106", start_time, end_time).Find(&order).Order("setl_time").Error
|
|
923
|
+ return
|
|
924
|
+}
|
|
925
|
+
|
|
926
|
+func GetLongSolution() {
|
|
927
|
+ records, _ := GetAllSchedules()
|
|
928
|
+ fmt.Println(records)
|
|
929
|
+ for _, item := range records {
|
|
930
|
+ //1.透析器 2.灌流器 3.透析器/灌流器
|
|
931
|
+ so, _ := GetDialysisSolutionTwo(item.UserOrgId, item.PatientId, item.ModeId)
|
|
932
|
+ filedRecordOne, _ := FindFiledBy(item.UserOrgId, "透析器")
|
|
933
|
+ filedRecordTwo, _ := FindFiledBy(item.UserOrgId, "灌流器")
|
|
934
|
+ filedRecordThree, _ := FindFiledBy(item.UserOrgId, "透析器/灌流器")
|
|
935
|
+ if filedRecordOne.IsShow == 1 {
|
|
936
|
+ item.DialysisMachineName = so.DialysisDialyszers
|
|
937
|
+ }
|
|
938
|
+ if filedRecordThree.IsShow == 1 {
|
|
939
|
+ if len(item.DialysisMachineName) > 0 {
|
|
940
|
+ item.DialysisMachineName = item.DialysisMachineName + "," + so.DialyzerPerfusionApparatus
|
|
941
|
+
|
|
942
|
+ } else {
|
|
943
|
+ item.DialysisMachineName = so.DialyzerPerfusionApparatus
|
|
944
|
+
|
|
945
|
+ }
|
|
946
|
+ }
|
|
947
|
+ if filedRecordTwo.IsShow == 1 {
|
|
948
|
+ if len(item.DialysisMachineName) > 0 {
|
|
949
|
+ item.DialysisMachineName = item.DialysisMachineName + "," + so.DialysisIrrigation
|
|
950
|
+
|
|
951
|
+ } else {
|
|
952
|
+ item.DialysisMachineName = so.DialysisIrrigation
|
|
953
|
+
|
|
954
|
+ }
|
|
955
|
+ }
|
|
956
|
+
|
|
957
|
+ UpdateSch(item)
|
|
958
|
+
|
|
959
|
+ }
|
|
960
|
+}
|
|
961
|
+
|
|
962
|
+func GetAllSchMode() (modes []*models.PatientScheduleTemplateMode, getModesErr error) {
|
|
963
|
+ getModesErr = readDb.Model(&models.PatientScheduleTemplateMode{}).Where("mode <> 0 AND status = 1 ").Find(&modes).Error
|
|
964
|
+ return
|
|
965
|
+}
|
|
966
|
+
|
|
967
|
+type DialysisSolutionTwo struct {
|
|
968
|
+ ID int64 `gorm:"column:id" json:"id" form:"id"`
|
|
969
|
+ UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
|
|
970
|
+}
|
|
971
|
+
|
|
972
|
+func (DialysisSolutionTwo) TableName() string {
|
|
973
|
+ return "xt_dialysis_solution"
|
|
974
|
+}
|
|
975
|
+
|
|
976
|
+type Schedule struct {
|
|
977
|
+ ID int64 `gorm:"column:id" json:"id" form:"id"`
|
|
978
|
+ UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
|
|
979
|
+ PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
|
|
980
|
+ Status int64 `gorm:"column:status" json:"status" form:"status"`
|
|
981
|
+ ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
|
|
982
|
+ ModeId int64 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
|
|
983
|
+ DialysisMachineName string `gorm:"column:dialysis_machine_name" json:"dialysis_machine_name" form:"dialysis_machine_name"`
|
|
984
|
+}
|
|
985
|
+
|
|
986
|
+func (Schedule) TableName() string {
|
|
987
|
+ return "xt_schedule"
|
|
988
|
+}
|
|
989
|
+
|
|
990
|
+func GetAllSchedules() ([]Schedule, error) {
|
|
991
|
+ var record []Schedule
|
|
992
|
+
|
|
993
|
+ err := readDb.Model(&Schedule{}).Where("status = 1 AND schedule_date > 1670774400").Find(&record).Error
|
|
994
|
+ if err != nil {
|
|
995
|
+ if err == gorm.ErrRecordNotFound {
|
|
996
|
+ return nil, nil
|
|
997
|
+ } else {
|
|
998
|
+ return nil, err
|
|
999
|
+ }
|
|
1000
|
+ }
|
|
1001
|
+ return record, nil
|
|
1002
|
+}
|
|
1003
|
+
|
|
1004
|
+func FindFiledBy(org_id int64, name string) (filedConfig models.FiledConfig, err error) {
|
|
1005
|
+ err = readDb.Model(&models.FiledConfig{}).Where("org_id =? AND module = 1 AND filed_name_cn= ?", org_id, name).First(&filedConfig).Error
|
|
1006
|
+ return
|
|
1007
|
+}
|
|
1008
|
+
|
|
1009
|
+// 透析方案
|
|
1010
|
+func GetDialysisSolutionTwo(orgID int64, patientID int64, mode_id int64) (models.DialysisSolution, error) {
|
|
1011
|
+ var record models.DialysisSolution
|
|
1012
|
+ err := readDb.Model(&models.DialysisSolution{}).Where("patient_id = ? and user_org_id = ? and status = 1 AND mode_id = ?", patientID, orgID, mode_id).Last(&record).Error
|
|
1013
|
+ return record, err
|
|
1014
|
+}
|
|
1015
|
+
|
|
1016
|
+func UpdateSch(sch Schedule) (err error) {
|
|
1017
|
+ err = writeDb.Model(&Schedule{}).Where("status=1 AND id = ?", sch.ID).Updates(map[string]interface{}{"dialysis_machine_name": sch.DialysisMachineName}).Error
|
|
1018
|
+ return
|
|
1019
|
+}
|
|
1020
|
+
|
|
1021
|
+func SaveSch(sch models.Schedule) (err error) {
|
|
1022
|
+ err = writeDb.Save(&sch).Error
|
|
1023
|
+ return
|
|
1024
|
+}
|