|
@@ -18,18 +18,108 @@ func GetBatchDrugHisPrescription(ids []string, record_time int64, user_org_id in
|
18
|
18
|
return
|
19
|
19
|
}
|
20
|
20
|
|
|
21
|
+type HisPrintPrescriptionProject struct {
|
|
22
|
+ ID int64 `gorm:"column:id" json:"id" form:"id"`
|
|
23
|
+ ProjectId int64 `gorm:"column:project_id" json:"project_id" form:"project_id"`
|
|
24
|
+ Price float64 `gorm:"column:price" json:"price" form:"price"`
|
|
25
|
+ UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
|
|
26
|
+ Status int64 `gorm:"column:status" json:"status" form:"status"`
|
|
27
|
+ Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
|
|
28
|
+ Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
|
|
29
|
+ PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
|
|
30
|
+ HisPatientId int64 `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
|
|
31
|
+ RecordDate int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
|
|
32
|
+ PrescriptionId int64 `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
|
|
33
|
+ Count string `gorm:"column:count" json:"count" form:"count"`
|
|
34
|
+ FeedetlSn string `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
|
|
35
|
+ MedListCodg string `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
|
|
36
|
+ SingleDose string `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
|
|
37
|
+ DeliveryWay string `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
|
|
38
|
+ ExecutionFrequency string `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
|
|
39
|
+ Day string `gorm:"column:day" json:"day" form:"day"`
|
|
40
|
+ HisProject HisProject `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"project"`
|
|
41
|
+ GoodInfo GoodInfo `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"good_info"`
|
|
42
|
+ Remark string `gorm:"column:remark" json:"remark" form:"remark"`
|
|
43
|
+ Unit string `gorm:"column:unit" json:"unit" form:"unit"`
|
|
44
|
+ Type int64 `gorm:"column:type" json:"type" form:"type"`
|
|
45
|
+ Doctor int64 `gorm:"column:doctor" json:"doctor" form:"doctor"`
|
|
46
|
+ ExecutionTime int64 `gborm:"column:execution_time" json:"execution_time" form:"execution_time"`
|
|
47
|
+ ExecutionStaff int64 `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
|
|
48
|
+ ExecutionState int64 `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
|
|
49
|
+ CheckTime int64 `gorm:"column:check_time" json:"check_time" form:"check_time"`
|
|
50
|
+ CheckState int64 `gorm:"column:check_state" json:"check_state" form:"check_state"`
|
|
51
|
+ Checker int64 `gorm:"column:checker" json:"checker" form:"checker"`
|
|
52
|
+ StartTime int64 `gorm:"column:start_time" json:"start_time" form:"start_time"`
|
|
53
|
+ TeamId int64 `gorm:"column:team_id" json:"team_id" form:"team_id"`
|
|
54
|
+
|
|
55
|
+ FrequencyType int64 `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
|
|
56
|
+ DayCount int64 `gorm:"column:day_count" json:"day_count" form:"day_count"`
|
|
57
|
+ WeekDay string `gorm:"column:week_day" json:"week_day" form:"week_day"`
|
|
58
|
+ IsCheckTeam int64 `gorm:"-" json:"is_check_team" form:"is_check_team"`
|
|
59
|
+ ExecutionFrequencyId int64 `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
|
|
60
|
+}
|
|
61
|
+
|
|
62
|
+type HisProject struct {
|
|
63
|
+ ID int64 `gorm:"column:id" json:"id" form:"id"`
|
|
64
|
+ ProjectName string `gorm:"column:project_name" json:"project_name" form:"project_name"`
|
|
65
|
+ Pinyin string `gorm:"column:pinyin" json:"pinyin" form:"pinyin"`
|
|
66
|
+ Wubi string `gorm:"column:wubi" json:"wubi" form:"wubi"`
|
|
67
|
+ Price float64 `gorm:"column:price" json:"price" form:"price"`
|
|
68
|
+ Unit string `gorm:"column:unit" json:"unit" form:"unit"`
|
|
69
|
+ CostClassify int64 `gorm:"column:cost_classify" json:"cost_classify" form:"cost_classify"`
|
|
70
|
+ ExecutiveSection int64 `gorm:"column:executive_section" json:"executive_section" form:"executive_section"`
|
|
71
|
+ MedicalCoverage int64 `gorm:"column:medical_coverage" json:"medical_coverage" form:"medical_coverage"`
|
|
72
|
+ StatisticalClassification int64 `gorm:"column:statistical_classification" json:"statistical_classification" form:"statistical_classification"`
|
|
73
|
+ DiseaseDirectory int64 `gorm:"column:disease_directory" json:"disease_directory" form:"disease_directory"`
|
|
74
|
+ IsRecord int64 `gorm:"column:is_record" json:"is_record" form:"is_record"`
|
|
75
|
+ MedicalCode string `gorm:"column:medical_code" json:"medical_code" form:"medical_code"`
|
|
76
|
+ TubeColor int64 `gorm:"column:tube_color" json:"tube_color" form:"tube_color"`
|
|
77
|
+ MedicalStatus int64 `gorm:"column:medical_status" json:"medical_status" form:"medical_status"`
|
|
78
|
+ Remark string `gorm:"column:remark" json:"remark" form:"remark"`
|
|
79
|
+ Sign int64 `gorm:"column:sign" json:"sign" form:"sign"`
|
|
80
|
+ DefaultNumber string `gorm:"column:default_number" json:"default_number" form:"default_number"`
|
|
81
|
+ IsDefault int64 `gorm:"column:is_default" json:"is_default" form:"is_default"`
|
|
82
|
+ IsCharge int64 `gorm:"column:is_charge" json:"is_charge" form:"is_charge"`
|
|
83
|
+ IsEstimate int64 `gorm:"column:is_estimate" json:"is_estimate" form:"is_estimate"`
|
|
84
|
+ IsWorkload int64 `gorm:"column:is_workload" json:"is_workload" form:"is_workload"`
|
|
85
|
+ Sort string `gorm:"column:sort" json:"sort" form:"sort"`
|
|
86
|
+ DoctorAdvice int64 `gorm:"column:doctor_advice" json:"doctor_advice" form:"doctor_advice"`
|
|
87
|
+ UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
|
|
88
|
+ Status int64 `gorm:"column:status" json:"status" form:"status"`
|
|
89
|
+ CreatedTime int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
|
|
90
|
+ UpdatedTime int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
|
|
91
|
+ DeliveryWay string `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
|
|
92
|
+ NumberDays string `gorm:"column:number_days" json:"number_days" form:"number_days"`
|
|
93
|
+ Total string `gorm:"column:total" json:"total" form:"total"`
|
|
94
|
+ Category int64 `gorm:"column:category" json:"category" form:"category"`
|
|
95
|
+ IsMark int64 `gorm:"column:is_mark" json:"is_mark" form:"is_mark"`
|
|
96
|
+ SpecailProject int64 `gorm:"column:specail_project" json:"specail_project" form:"specail_project"`
|
|
97
|
+ SocialSecurityDirectoryCode string `gorm:"column:social_security_directory_code" json:"social_security_directory_code" form:"social_security_directory_code"`
|
|
98
|
+ RecordDate int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
|
|
99
|
+ SingleDose string `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
|
|
100
|
+ ExecutionFrequency string `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
|
|
101
|
+}
|
|
102
|
+
|
|
103
|
+func (HisProject) TableName() string {
|
|
104
|
+ return "xt_his_project"
|
|
105
|
+}
|
|
106
|
+
|
|
107
|
+func (HisPrintPrescriptionProject) TableName() string {
|
|
108
|
+ return "his_prescription_project"
|
|
109
|
+}
|
|
110
|
+
|
21
|
111
|
func GetBatchProjectHisPrescription(ids []string, record_time int64, user_org_id int64) (patients []*models.PrintPatient, err error) {
|
22
|
112
|
readDb.Model(&models.PrintPatient{}).Preload("HisPrintPatient", "status = 1 AND record_date = ?", record_time).
|
23
|
113
|
Preload("HisPrintPrescription", func(db *gorm.DB) *gorm.DB {
|
24
|
114
|
return db.Where("status = 1 AND user_org_id = ? AND record_date = ? AND type <> 1 AND p_type = 2", user_org_id, record_time).
|
25
|
115
|
Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
|
26
|
|
- return db.Joins("Join xt_his_project p On p.id = his_prescription_project.project_id AND p.cost_classify != 3").Where("his_prescription_project.status = 1 AND his_prescription_project.user_org_id = ?", user_org_id).Where("his_prescription_project.status = 1 ").Preload("HisProject", "status = 1").Preload("GoodInfo", "status=1")
|
|
116
|
+ return db.Joins("").Joins("Join xt_his_project p On p.id = his_prescription_project.project_id ").Where("his_prescription_project.status = 1 AND his_prescription_project.user_org_id = ?", user_org_id).Where("his_prescription_project.status = 1 ").Preload("HisProject", "status = 1").Preload("GoodInfo", "status=1")
|
27
|
117
|
})
|
28
|
118
|
}).
|
29
|
119
|
Preload("HisPrescriptionInfoTwo", "status = 1 AND record_date = ?", record_time).
|
30
|
120
|
Where("id in (?) AND user_org_id = ? ", ids, user_org_id).Find(&patients)
|
31
|
|
- return
|
32
|
121
|
|
|
122
|
+ return
|
33
|
123
|
}
|
34
|
124
|
|
35
|
125
|
func GetBatchInspectionProjectHisPrescription(ids []string, record_time int64, user_org_id int64) (patients []*models.PrintPatient, err error) {
|