|
|
|
|
158
|
switch item_type {
|
158
|
switch item_type {
|
159
|
case 0:
|
159
|
case 0:
|
160
|
if time_type == "0" {
|
160
|
if time_type == "0" {
|
161
|
- err = readDb.Table("his_order_info as oi").Select("-1000 as cost_classify, oi.advice_id as advice_id, 0 as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,drug.drug_name as item_name,drug.dose as dose,drug.dose_unit as dose_unit, drug.min_number as min_number,drug.min_unit as min_unit, drug.max_unit as max_unit,drug.id as item_id").
|
|
|
|
|
161
|
+ err = readDb.Table("his_order_info as oi").Select("-1000 as cost_classify, oi.advice_id as advice_id, 0 as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,drug.drug_name as item_name,drug.dose as dose,drug.dose_unit as dose_unit, drug.min_number as min_number,drug.min_unit as min_unit, drug.max_unit as max_unit,drug.id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
162
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
162
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
163
|
Joins(" JOIN his_doctor_advice_info a ON oi.advice_id = a.id").
|
163
|
Joins(" JOIN his_doctor_advice_info a ON oi.advice_id = a.id").
|
164
|
Joins(" JOIN xt_patients pp on oi.patient_id = pp.id").
|
164
|
Joins(" JOIN xt_patients pp on oi.patient_id = pp.id").
|
|
|
|
|
167
|
|
167
|
|
168
|
} else {
|
168
|
} else {
|
169
|
|
169
|
|
170
|
- err = readDb.Table("his_order_info as oi").Select("-1000 as cost_classify,oi.advice_id as advice_id, 0 as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,drug.drug_name as item_name,drug.dose as dose,drug.dose_unit as dose_unit, drug.min_number as min_number,drug.min_unit as min_unit, drug.max_unit as max_unit,drug.id as item_id").
|
|
|
|
|
170
|
+ err = readDb.Table("his_order_info as oi").Select("-1000 as cost_classify,oi.advice_id as advice_id, 0 as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,drug.drug_name as item_name,drug.dose as dose,drug.dose_unit as dose_unit, drug.min_number as min_number,drug.min_unit as min_unit, drug.max_unit as max_unit,drug.id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
171
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
171
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
172
|
Joins(" JOIN his_doctor_advice_info a ON oi.advice_id = a.id").
|
172
|
Joins(" JOIN his_doctor_advice_info a ON oi.advice_id = a.id").
|
173
|
Joins(" JOIN xt_patients pp on oi.patient_id = pp.id").
|
173
|
Joins(" JOIN xt_patients pp on oi.patient_id = pp.id").
|
|
|
|
|
180
|
case 1:
|
180
|
case 1:
|
181
|
if time_type == "0" {
|
181
|
if time_type == "0" {
|
182
|
|
182
|
|
183
|
- err = readDb.Table("his_order_info as oi").Select("-1000 as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,oi.advice_id as advice_id, 0 as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,drug.drug_name as item_name,drug.dose as dose,drug.dose_unit as dose_unit, drug.min_number as min_number,drug.min_unit as min_unit, drug.max_unit as max_unit,drug.id as item_id").
|
|
|
|
|
183
|
+ err = readDb.Table("his_order_info as oi").Select("-1000 as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,oi.advice_id as advice_id, 0 as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,drug.drug_name as item_name,drug.dose as dose,drug.dose_unit as dose_unit, drug.min_number as min_number,drug.min_unit as min_unit, drug.max_unit as max_unit,drug.id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
184
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
184
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
185
|
Joins(" JOIN his_doctor_advice_info a ON oi.advice_id = a.id").
|
185
|
Joins(" JOIN his_doctor_advice_info a ON oi.advice_id = a.id").
|
186
|
Joins(" JOIN xt_patients pp on oi.patient_id = pp.id").
|
186
|
Joins(" JOIN xt_patients pp on oi.patient_id = pp.id").
|
|
|
|
|
188
|
Where("oi.advice_id > 0 and oi.user_org_id = ? and o.settle_accounts_date >= ? and o.settle_accounts_date <= ? and oi.status = 1 ", org_id, start_time, end_time).Scan(&patients).Error
|
188
|
Where("oi.advice_id > 0 and oi.user_org_id = ? and o.settle_accounts_date >= ? and o.settle_accounts_date <= ? and oi.status = 1 ", org_id, start_time, end_time).Scan(&patients).Error
|
189
|
|
189
|
|
190
|
} else {
|
190
|
} else {
|
191
|
- err = readDb.Table("his_order_info as oi").Select("-1000 as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,oi.advice_id as advice_id, 0 as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,drug.drug_name as item_name,drug.dose as dose,drug.dose_unit as dose_unit, drug.min_number as min_number,drug.min_unit as min_unit, drug.max_unit as max_unit,drug.id as item_id").
|
|
|
|
|
191
|
+ err = readDb.Table("his_order_info as oi").Select("-1000 as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,oi.advice_id as advice_id, 0 as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,drug.drug_name as item_name,drug.dose as dose,drug.dose_unit as dose_unit, drug.min_number as min_number,drug.min_unit as min_unit, drug.max_unit as max_unit,drug.id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
192
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
192
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
193
|
Joins(" JOIN his_doctor_advice_info a ON oi.advice_id = a.id").
|
193
|
Joins(" JOIN his_doctor_advice_info a ON oi.advice_id = a.id").
|
194
|
Joins(" JOIN xt_patients pp on oi.patient_id = pp.id").
|
194
|
Joins(" JOIN xt_patients pp on oi.patient_id = pp.id").
|
|
|
|
|
207
|
case 0:
|
207
|
case 0:
|
208
|
if time_type == "0" {
|
208
|
if time_type == "0" {
|
209
|
|
209
|
|
210
|
- err = readDb.Table("his_order_info as oi").Select("-1000 as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,oi.advice_id as advice_id, 0 as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,drug.drug_name as item_name,drug.dose as dose,drug.dose_unit as dose_unit, drug.min_number as min_number,drug.min_unit as min_unit, drug.max_unit as max_unit,drug.id as item_id").
|
|
|
|
|
210
|
+ err = readDb.Table("his_order_info as oi").Select("-1000 as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,oi.advice_id as advice_id, 0 as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,drug.drug_name as item_name,drug.dose as dose,drug.dose_unit as dose_unit, drug.min_number as min_number,drug.min_unit as min_unit, drug.max_unit as max_unit,drug.id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
211
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
211
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
212
|
Joins(" JOIN his_doctor_advice_info a ON oi.advice_id = a.id").
|
212
|
Joins(" JOIN his_doctor_advice_info a ON oi.advice_id = a.id").
|
213
|
Joins(" JOIN xt_patients pp on oi.patient_id = pp.id and pp.name like ?", keyword).
|
213
|
Joins(" JOIN xt_patients pp on oi.patient_id = pp.id and pp.name like ?", keyword).
|
|
|
|
|
216
|
|
216
|
|
217
|
} else {
|
217
|
} else {
|
218
|
|
218
|
|
219
|
- err = readDb.Table("his_order_info as oi").Select("-1000 as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,oi.advice_id as advice_id, 0 as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,drug.drug_name as item_name,drug.dose as dose,drug.dose_unit as dose_unit, drug.min_number as min_number,drug.min_unit as min_unit, drug.max_unit as max_unit,drug.id as item_id").
|
|
|
|
|
219
|
+ err = readDb.Table("his_order_info as oi").Select("-1000 as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,oi.advice_id as advice_id, 0 as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,drug.drug_name as item_name,drug.dose as dose,drug.dose_unit as dose_unit, drug.min_number as min_number,drug.min_unit as min_unit, drug.max_unit as max_unit,drug.id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
220
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
220
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
221
|
Joins(" JOIN his_doctor_advice_info a ON oi.advice_id = a.id").
|
221
|
Joins(" JOIN his_doctor_advice_info a ON oi.advice_id = a.id").
|
222
|
Joins(" JOIN xt_patients pp on oi.patient_id = pp.id and pp.name like ?", keyword).
|
222
|
Joins(" JOIN xt_patients pp on oi.patient_id = pp.id and pp.name like ?", keyword).
|
|
|
|
|
228
|
break
|
228
|
break
|
229
|
case 1:
|
229
|
case 1:
|
230
|
if time_type == "0" {
|
230
|
if time_type == "0" {
|
231
|
- err = readDb.Table("his_order_info as oi").Select("-1000 as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,oi.advice_id as advice_id, 0 as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,drug.drug_name as item_name,drug.dose as dose,drug.dose_unit as dose_unit, drug.min_number as min_number,drug.min_unit as min_unit, drug.max_unit as max_unit,drug.id as item_id").
|
|
|
|
|
231
|
+ err = readDb.Table("his_order_info as oi").Select("-1000 as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,oi.advice_id as advice_id, 0 as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,drug.drug_name as item_name,drug.dose as dose,drug.dose_unit as dose_unit, drug.min_number as min_number,drug.min_unit as min_unit, drug.max_unit as max_unit,drug.id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
232
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
232
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
233
|
Joins(" JOIN his_doctor_advice_info a ON oi.advice_id = a.id").
|
233
|
Joins(" JOIN his_doctor_advice_info a ON oi.advice_id = a.id").
|
234
|
Joins(" JOIN xt_patients pp on oi.patient_id = pp.id and pp.name like ?", keyword).
|
234
|
Joins(" JOIN xt_patients pp on oi.patient_id = pp.id and pp.name like ?", keyword).
|
|
|
|
|
237
|
|
237
|
|
238
|
} else {
|
238
|
} else {
|
239
|
|
239
|
|
240
|
- err = readDb.Table("his_order_info as oi").Select("-1000 as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,oi.advice_id as advice_id, 0 as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,drug.drug_name as item_name,drug.dose as dose,drug.dose_unit as dose_unit, drug.min_number as min_number,drug.min_unit as min_unit, drug.max_unit as max_unit,drug.id as item_id").
|
|
|
|
|
240
|
+ err = readDb.Table("his_order_info as oi").Select("-1000 as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,oi.advice_id as advice_id, 0 as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,drug.drug_name as item_name,drug.dose as dose,drug.dose_unit as dose_unit, drug.min_number as min_number,drug.min_unit as min_unit, drug.max_unit as max_unit,drug.id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
241
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
241
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
242
|
Joins(" JOIN his_doctor_advice_info a ON oi.advice_id = a.id").
|
242
|
Joins(" JOIN his_doctor_advice_info a ON oi.advice_id = a.id").
|
243
|
Joins(" JOIN xt_patients pp on oi.patient_id = pp.id and pp.name like ?", keyword).
|
243
|
Joins(" JOIN xt_patients pp on oi.patient_id = pp.id and pp.name like ?", keyword).
|
|
|
|
|
259
|
switch item_type {
|
259
|
switch item_type {
|
260
|
case 0:
|
260
|
case 0:
|
261
|
if time_type == "0" {
|
261
|
if time_type == "0" {
|
262
|
- err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id").
|
|
|
|
|
262
|
+ err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
263
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
263
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
264
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id ").
|
264
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id ").
|
265
|
Joins(" left join xt_his_project project on p.project_id = project.id").
|
265
|
Joins(" left join xt_his_project project on p.project_id = project.id").
|
|
|
|
|
269
|
|
269
|
|
270
|
} else {
|
270
|
} else {
|
271
|
|
271
|
|
272
|
- err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id").
|
|
|
|
|
272
|
+ err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
273
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
273
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
274
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id ").
|
274
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id ").
|
275
|
Joins(" left join xt_his_project project on p.project_id = project.id").
|
275
|
Joins(" left join xt_his_project project on p.project_id = project.id").
|
|
|
|
|
298
|
break
|
298
|
break
|
299
|
case 2:
|
299
|
case 2:
|
300
|
if time_type == "0" {
|
300
|
if time_type == "0" {
|
301
|
- err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id").
|
|
|
|
|
301
|
+ err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
302
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1 ", start_time_str, end_time_str).
|
302
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1 ", start_time_str, end_time_str).
|
303
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
303
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
304
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
304
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
|
|
|
|
307
|
Where("oi.project_id > 0 and oi.user_org_id = ? and o.settle_accounts_date >= ? and o.settle_accounts_date <= ? and oi.status = 1 ", org_id, start_time, end_time).Scan(&patients).Error
|
307
|
Where("oi.project_id > 0 and oi.user_org_id = ? and o.settle_accounts_date >= ? and o.settle_accounts_date <= ? and oi.status = 1 ", org_id, start_time, end_time).Scan(&patients).Error
|
308
|
|
308
|
|
309
|
} else {
|
309
|
} else {
|
310
|
- err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id").
|
|
|
|
|
310
|
+ err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
311
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1 ", start_time_str, end_time_str).
|
311
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1 ", start_time_str, end_time_str).
|
312
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
312
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
313
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
313
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
|
|
|
|
320
|
break
|
320
|
break
|
321
|
case 3:
|
321
|
case 3:
|
322
|
if time_type == "0" {
|
322
|
if time_type == "0" {
|
323
|
- err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id").
|
|
|
|
|
323
|
+ err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
324
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1 ", start_time_str, end_time_str).
|
324
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1 ", start_time_str, end_time_str).
|
325
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 3").
|
325
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 3").
|
326
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
326
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
|
|
|
|
329
|
Where("oi.project_id > 0 and oi.user_org_id = ? and o.settle_accounts_date >= ? and o.settle_accounts_date <= ? and oi.status = 1 ", org_id, start_time, end_time).Scan(&patients).Error
|
329
|
Where("oi.project_id > 0 and oi.user_org_id = ? and o.settle_accounts_date >= ? and o.settle_accounts_date <= ? and oi.status = 1 ", org_id, start_time, end_time).Scan(&patients).Error
|
330
|
|
330
|
|
331
|
} else {
|
331
|
} else {
|
332
|
- err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id").
|
|
|
|
|
332
|
+ err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
333
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1 ", start_time_str, end_time_str).
|
333
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1 ", start_time_str, end_time_str).
|
334
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 3").
|
334
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 3").
|
335
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
335
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
|
|
|
|
342
|
break
|
342
|
break
|
343
|
case 4:
|
343
|
case 4:
|
344
|
if time_type == "0" {
|
344
|
if time_type == "0" {
|
345
|
- err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id").
|
|
|
|
|
345
|
+ err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
346
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1 ", start_time_str, end_time_str).
|
346
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1 ", start_time_str, end_time_str).
|
347
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
347
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
348
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
348
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
|
|
|
|
351
|
Where("oi.project_id > 0 and oi.user_org_id = ? and o.settle_accounts_date >= ? and o.settle_accounts_date <= ? and oi.status = 1 and project.cost_classify = 3", org_id, start_time, end_time).Scan(&patients).Error
|
351
|
Where("oi.project_id > 0 and oi.user_org_id = ? and o.settle_accounts_date >= ? and o.settle_accounts_date <= ? and oi.status = 1 and project.cost_classify = 3", org_id, start_time, end_time).Scan(&patients).Error
|
352
|
|
352
|
|
353
|
} else {
|
353
|
} else {
|
354
|
- err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id").
|
|
|
|
|
354
|
+ err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
355
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1 ", start_time_str, end_time_str).
|
355
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1 ", start_time_str, end_time_str).
|
356
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
356
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
357
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
357
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
|
|
|
|
364
|
break
|
364
|
break
|
365
|
case 5:
|
365
|
case 5:
|
366
|
if time_type == "0" {
|
366
|
if time_type == "0" {
|
367
|
- err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id").
|
|
|
|
|
367
|
+ err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
368
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1 ", start_time_str, end_time_str).
|
368
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1 ", start_time_str, end_time_str).
|
369
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
369
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
370
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
370
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
|
|
|
|
373
|
Where("oi.project_id > 0 and oi.user_org_id = ? and o.settle_accounts_date >= ? and o.settle_accounts_date <= ? and oi.status = 1 and project.cost_classify = 2", org_id, start_time, end_time).Scan(&patients).Error
|
373
|
Where("oi.project_id > 0 and oi.user_org_id = ? and o.settle_accounts_date >= ? and o.settle_accounts_date <= ? and oi.status = 1 and project.cost_classify = 2", org_id, start_time, end_time).Scan(&patients).Error
|
374
|
|
374
|
|
375
|
} else {
|
375
|
} else {
|
376
|
- err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id").
|
|
|
|
|
376
|
+ err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
377
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1 ", start_time_str, end_time_str).
|
377
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1 ", start_time_str, end_time_str).
|
378
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
378
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
379
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
379
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
|
|
|
|
386
|
break
|
386
|
break
|
387
|
case 6:
|
387
|
case 6:
|
388
|
if time_type == "0" {
|
388
|
if time_type == "0" {
|
389
|
- err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id").
|
|
|
|
|
389
|
+ err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
390
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1 ", start_time_str, end_time_str).
|
390
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1 ", start_time_str, end_time_str).
|
391
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
391
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
392
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
392
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
|
|
|
|
395
|
Where("oi.project_id > 0 and oi.user_org_id = ? and o.settle_accounts_date >= ? and o.settle_accounts_date <= ? and oi.status = 1 and project.cost_classify = 6", org_id, start_time, end_time).Scan(&patients).Error
|
395
|
Where("oi.project_id > 0 and oi.user_org_id = ? and o.settle_accounts_date >= ? and o.settle_accounts_date <= ? and oi.status = 1 and project.cost_classify = 6", org_id, start_time, end_time).Scan(&patients).Error
|
396
|
|
396
|
|
397
|
} else {
|
397
|
} else {
|
398
|
- err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id").
|
|
|
|
|
398
|
+ err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
399
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1 ", start_time_str, end_time_str).
|
399
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1 ", start_time_str, end_time_str).
|
400
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
400
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
401
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
401
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
|
|
|
|
406
|
break
|
406
|
break
|
407
|
case 7:
|
407
|
case 7:
|
408
|
if time_type == "0" {
|
408
|
if time_type == "0" {
|
409
|
- err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id").
|
|
|
|
|
409
|
+ err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
410
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1 ", start_time_str, end_time_str).
|
410
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1 ", start_time_str, end_time_str).
|
411
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
411
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
412
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
412
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
|
|
|
|
415
|
Where("oi.project_id > 0 and oi.user_org_id = ? and o.settle_accounts_date >= ? and o.settle_accounts_date <= ? and oi.status = 1 and project.cost_classify = 11", org_id, start_time, end_time).Scan(&patients).Error
|
415
|
Where("oi.project_id > 0 and oi.user_org_id = ? and o.settle_accounts_date >= ? and o.settle_accounts_date <= ? and oi.status = 1 and project.cost_classify = 11", org_id, start_time, end_time).Scan(&patients).Error
|
416
|
|
416
|
|
417
|
} else {
|
417
|
} else {
|
418
|
- err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id").
|
|
|
|
|
418
|
+ err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
419
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1 ", start_time_str, end_time_str).
|
419
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1 ", start_time_str, end_time_str).
|
420
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
420
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
421
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
421
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
|
|
|
|
431
|
switch item_type {
|
431
|
switch item_type {
|
432
|
case 0:
|
432
|
case 0:
|
433
|
if time_type == "0" {
|
433
|
if time_type == "0" {
|
434
|
- err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id").
|
|
|
|
|
434
|
+ err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
435
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
435
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
436
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id ").
|
436
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id ").
|
437
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
437
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
|
|
|
|
441
|
|
441
|
|
442
|
} else {
|
442
|
} else {
|
443
|
|
443
|
|
444
|
- err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id").
|
|
|
|
|
444
|
+ err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
445
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
445
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
446
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id ").
|
446
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id ").
|
447
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
447
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
|
|
|
|
456
|
case 2:
|
456
|
case 2:
|
457
|
if time_type == "0" {
|
457
|
if time_type == "0" {
|
458
|
|
458
|
|
459
|
- err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id").
|
|
|
|
|
459
|
+ err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
460
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
460
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
461
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
461
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
462
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
462
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
|
|
|
|
465
|
Where("oi.project_id > 0 and oi.user_org_id = ? and o.settle_accounts_date >= ? and o.settle_accounts_date <= ? and oi.status = 1 ", org_id, start_time, end_time).Scan(&patients).Error
|
465
|
Where("oi.project_id > 0 and oi.user_org_id = ? and o.settle_accounts_date >= ? and o.settle_accounts_date <= ? and oi.status = 1 ", org_id, start_time, end_time).Scan(&patients).Error
|
466
|
|
466
|
|
467
|
} else {
|
467
|
} else {
|
468
|
- err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id").
|
|
|
|
|
468
|
+ err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
469
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
469
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
470
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
470
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
471
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
471
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
|
|
|
|
479
|
case 3:
|
479
|
case 3:
|
480
|
if time_type == "0" {
|
480
|
if time_type == "0" {
|
481
|
|
481
|
|
482
|
- err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id").
|
|
|
|
|
482
|
+ err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
483
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
483
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
484
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 3").
|
484
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 3").
|
485
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
485
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
|
|
|
|
489
|
|
489
|
|
490
|
} else {
|
490
|
} else {
|
491
|
|
491
|
|
492
|
- err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id").
|
|
|
|
|
492
|
+ err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
493
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
493
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
494
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 3").
|
494
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 3").
|
495
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
495
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
|
|
|
|
501
|
case 4:
|
501
|
case 4:
|
502
|
if time_type == "0" {
|
502
|
if time_type == "0" {
|
503
|
|
503
|
|
504
|
- err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id").
|
|
|
|
|
504
|
+ err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
505
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
505
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
506
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
506
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
507
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
507
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
|
|
|
|
510
|
Where("oi.project_id > 0 and oi.user_org_id = ? and o.settle_accounts_date >= ? and o.settle_accounts_date <= ? and oi.status = 1 and project.cost_classify = 3 ", org_id, start_time, end_time).Scan(&patients).Error
|
510
|
Where("oi.project_id > 0 and oi.user_org_id = ? and o.settle_accounts_date >= ? and o.settle_accounts_date <= ? and oi.status = 1 and project.cost_classify = 3 ", org_id, start_time, end_time).Scan(&patients).Error
|
511
|
|
511
|
|
512
|
} else {
|
512
|
} else {
|
513
|
- err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id").
|
|
|
|
|
513
|
+ err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
514
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
514
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
515
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
515
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
516
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
516
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
|
|
|
|
522
|
case 5:
|
522
|
case 5:
|
523
|
if time_type == "0" {
|
523
|
if time_type == "0" {
|
524
|
|
524
|
|
525
|
- err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id").
|
|
|
|
|
525
|
+ err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
526
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
526
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
527
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
527
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
528
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
528
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
|
|
|
|
531
|
Where("oi.project_id > 0 and oi.user_org_id = ? and o.settle_accounts_date >= ? and o.settle_accounts_date <= ? and oi.status = 1 and project.cost_classify = 2", org_id, start_time, end_time).Scan(&patients).Error
|
531
|
Where("oi.project_id > 0 and oi.user_org_id = ? and o.settle_accounts_date >= ? and o.settle_accounts_date <= ? and oi.status = 1 and project.cost_classify = 2", org_id, start_time, end_time).Scan(&patients).Error
|
532
|
|
532
|
|
533
|
} else {
|
533
|
} else {
|
534
|
- err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id").
|
|
|
|
|
534
|
+ err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
535
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
535
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
536
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
536
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
537
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
537
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
|
|
|
|
543
|
case 6:
|
543
|
case 6:
|
544
|
if time_type == "0" {
|
544
|
if time_type == "0" {
|
545
|
|
545
|
|
546
|
- err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id").
|
|
|
|
|
546
|
+ err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
547
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
547
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
548
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
548
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
549
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
549
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
|
|
|
|
552
|
Where("oi.project_id > 0 and oi.user_org_id = ? and o.settle_accounts_date >= ? and o.settle_accounts_date <= ? and oi.status = 1 and project.cost_classify = 10", org_id, start_time, end_time).Scan(&patients).Error
|
552
|
Where("oi.project_id > 0 and oi.user_org_id = ? and o.settle_accounts_date >= ? and o.settle_accounts_date <= ? and oi.status = 1 and project.cost_classify = 10", org_id, start_time, end_time).Scan(&patients).Error
|
553
|
|
553
|
|
554
|
} else {
|
554
|
} else {
|
555
|
- err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id").
|
|
|
|
|
555
|
+ err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
556
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
556
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
557
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
557
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
558
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
558
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
|
|
|
|
564
|
case 7:
|
564
|
case 7:
|
565
|
if time_type == "0" {
|
565
|
if time_type == "0" {
|
566
|
|
566
|
|
567
|
- err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id").
|
|
|
|
|
567
|
+ err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
568
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
568
|
Joins("JOIN his_order o ON oi.order_number = o.number and FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
569
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
569
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
570
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
570
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
|
|
|
|
573
|
Where("oi.project_id > 0 and oi.user_org_id = ? and o.settle_accounts_date >= ? and o.settle_accounts_date <= ? and oi.status = 1 and project.cost_classify = 11", org_id, start_time, end_time).Scan(&patients).Error
|
573
|
Where("oi.project_id > 0 and oi.user_org_id = ? and o.settle_accounts_date >= ? and o.settle_accounts_date <= ? and oi.status = 1 and project.cost_classify = 11", org_id, start_time, end_time).Scan(&patients).Error
|
574
|
|
574
|
|
575
|
} else {
|
575
|
} else {
|
576
|
- err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id").
|
|
|
|
|
576
|
+ err = readDb.Table("his_order_info as oi").Select("(case p.type when 2 then project.cost_classify when 3 then -100 END) as cost_classify,FROM_UNIXTIME(o.settle_accounts_date, '%Y-%m-%d %H:%i:%S') as pdate,0 as advice_id, oi.project_id as project_id, oi.patient_id as p_id,oi.cnt as cnt,oi.pric as pric,pp.name as p_name,p.type as p_type, (case p.type when 2 then project.project_name when 3 then good.good_name END) as item_name,(case p.type when 2 then '' when 3 then good.specification_name END) as specification_name, p.project_id as item_id,oi.det_item_fee_sumamt as det_item_fee_sumamt").
|
577
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
577
|
Joins("JOIN his_order o ON oi.order_number = o.number and o.setl_time BETWEEN ? AND ? and o.order_status = 2 and o.status = 1", start_time_str, end_time_str).
|
578
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
578
|
Joins(" JOIN his_prescription_project p ON oi.project_id = p.id and p.type = 2").
|
579
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
579
|
Joins("left join xt_his_project project on p.project_id = project.id").
|
|
|
|
|
1207
|
err = db.Where(" oi.user_org_id = ? AND o.record_date >= ? AND o.record_date <= ? AND oi.status = 1", org_id, start_time, end_time).Group("oi.id").Scan(&patients).Error
|
1207
|
err = db.Where(" oi.user_org_id = ? AND o.record_date >= ? AND o.record_date <= ? AND oi.status = 1", org_id, start_time, end_time).Group("oi.id").Scan(&patients).Error
|
1208
|
return
|
1208
|
return
|
1209
|
}
|
1209
|
}
|
|
|
1210
|
+
|
|
|
1211
|
+func GetHisPreOrderByPatient(patient_id int64, org_id int64, record_date int64) (total int64, err error) {
|
|
|
1212
|
+ err = readDb.Model(&models.HisOrder{}).Where("order_status = 1 and status = 1 and user_org_id = ? and patient_id = ? and settle_account_date = ?", org_id, patient_id, record_date).Count(&total).Error
|
|
|
1213
|
+ return
|
|
|
1214
|
+}
|