|
@@ -10,7 +10,7 @@ import (
|
10
|
10
|
"time"
|
11
|
11
|
)
|
12
|
12
|
|
13
|
|
-
|
|
13
|
+
|
14
|
14
|
func GetSchedualPatientList(orgID int64, schedulDate int64, schedulType int64, partitionType int64, keywords string, page int64, limit int64) (schedule []*models.DialysisSchedule, err error) {
|
15
|
15
|
var total int64
|
16
|
16
|
|
|
@@ -62,7 +62,7 @@ func GetSchedualPatientList(orgID int64, schedulDate int64, schedulType int64, p
|
62
|
62
|
return schedule, errors
|
63
|
63
|
}
|
64
|
64
|
|
65
|
|
-
|
|
65
|
+
|
66
|
66
|
func FindPatientInfoById(orgID int64, id int64, time int64) (patient models.SchedualPatient2, err error) {
|
67
|
67
|
err = readDb.Preload("DialysisSchedule", func(db *gorm.DB) *gorm.DB {
|
68
|
68
|
return db.Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).Preload("DeviceZone", "status = 1 AND org_id = ?", orgID).Where("patient_id = ? AND user_org_id = ? AND schedule_date = ? ", id, orgID, time)
|
|
@@ -70,31 +70,31 @@ func FindPatientInfoById(orgID int64, id int64, time int64) (patient models.Sche
|
70
|
70
|
return
|
71
|
71
|
}
|
72
|
72
|
|
73
|
|
-
|
|
73
|
+
|
74
|
74
|
func FindPatientPrescribeById(orgID int64, patientsId int64, recordDate int64) (patient models.DialysisPrescription, err error) {
|
75
|
75
|
err = readDb.Model(&models.DialysisPrescription{}).Where("patient_id = ? and user_org_id=? and status=1 and record_date = ? ", patientsId, orgID, recordDate).First(&patient).Error
|
76
|
76
|
return
|
77
|
77
|
}
|
78
|
78
|
|
79
|
|
-
|
|
79
|
+
|
80
|
80
|
func FindDialysisSolution(orgID int64, patientsId int64) (patient models.DialysisSolution, err error) {
|
81
|
81
|
err = readDb.Model(&models.DialysisSolution{}).Where("patient_id = ? and user_org_id=? and status=1", patientsId, orgID).Last(&patient).Error
|
82
|
82
|
return
|
83
|
83
|
}
|
84
|
84
|
|
85
|
|
-
|
|
85
|
+
|
86
|
86
|
func FindTreatmentModeById(modeId int64) (mode models.TreatmentMode, err error) {
|
87
|
87
|
err = readDb.Model(&models.TreatmentMode{}).Where("id = ? AND status=1", modeId).First(&mode).Error
|
88
|
88
|
return
|
89
|
89
|
}
|
90
|
90
|
|
91
|
|
-
|
|
91
|
+
|
92
|
92
|
func FindReceiverTreatmentAccessRecordById(orgID int64, patientsId int64, recordDate int64) (receiveTreatmentAsses models.ReceiveTreatmentAsses, err error) {
|
93
|
93
|
err = readDb.Model(&models.ReceiveTreatmentAsses{}).Where("patient_id = ? and user_org_id=? and status=1 and record_date = ?", patientsId, orgID, recordDate).First(&receiveTreatmentAsses).Error
|
94
|
94
|
return
|
95
|
95
|
}
|
96
|
96
|
|
97
|
|
-
|
|
97
|
+
|
98
|
98
|
func FindPredialysisEvaluationById(orgID int64, patientsId int64, recordDate int64) (patient models.PredialysisEvaluation, err error) {
|
99
|
99
|
err = readDb.Model(&models.PredialysisEvaluation{}).Where("patient_id = ? and user_org_id=? and status=1 and assessment_date = ?", patientsId, orgID, recordDate).First(&patient).Error
|
100
|
100
|
return
|
|
@@ -106,7 +106,7 @@ func FindPredialysisName(id int64, orgid int64) (models.Dataconfig, error) {
|
106
|
106
|
return dataconfig, err
|
107
|
107
|
}
|
108
|
108
|
|
109
|
|
-
|
|
109
|
+
|
110
|
110
|
func FindDoctorAdviceById(orgID int64, patientsId int64, recordDate int64) (patient []*models.DoctorAdvice, err error) {
|
111
|
111
|
err = readDb.Model(&models.DoctorAdvice{}).Where("patient_id = ? and user_org_id=? and status=1 and record_date = ? AND advice_type = 2", patientsId, orgID, recordDate).Find(&patient).Error
|
112
|
112
|
return
|
|
@@ -128,7 +128,7 @@ func GetTotalDialysisCout(orgid int64, patientid int64) (order []*models.Dialysi
|
128
|
128
|
return order, total, err
|
129
|
129
|
}
|
130
|
130
|
|
131
|
|
-
|
|
131
|
+
|
132
|
132
|
func FindDoctorAdviceOrderById(orgID int64, patientsId int64, recordDate int64) (patient []*models.DoctorAdvice, err error) {
|
133
|
133
|
err = readDb.Model(&models.DoctorAdvice{}).
|
134
|
134
|
Where("patient_id = ? and user_org_id=? and status=1 and record_date = ? and (advice_type = 2 or advice_type = 3)", patientsId, orgID, recordDate).
|
|
@@ -137,13 +137,13 @@ func FindDoctorAdviceOrderById(orgID int64, patientsId int64, recordDate int64)
|
137
|
137
|
return
|
138
|
138
|
}
|
139
|
139
|
|
140
|
|
-
|
|
140
|
+
|
141
|
141
|
func FindDoubleCheckById(orgID int64, patientsId int64, recordDate int64) (patient models.DoubleCheck, err error) {
|
142
|
142
|
err = readDb.Model(&models.DoubleCheck{}).Where("patient_id = ? and user_org_id=? and status=1 and check_date = ? ", patientsId, orgID, recordDate).First(&patient).Error
|
143
|
143
|
return
|
144
|
144
|
}
|
145
|
145
|
|
146
|
|
-
|
|
146
|
+
|
147
|
147
|
func FindAllMonitorRecord(orgID int64, patientsId int64, recordDate int64) (record []*models.MonitoringRecord, err error) {
|
148
|
148
|
err = readDb.Model(&models.MonitoringRecord{}).Where("patient_id = ? and user_org_id=? and status=1 and monitoring_date = ?", patientsId, orgID, recordDate).Order("operate_time ASC").Find(&record).Error
|
149
|
149
|
return
|
|
@@ -154,37 +154,37 @@ func FindAllMonitor(orgID int64, patientsId int64, recordDate int64) (record []*
|
154
|
154
|
return
|
155
|
155
|
}
|
156
|
156
|
|
157
|
|
-
|
|
157
|
+
|
158
|
158
|
func FindAssessmentAfterDislysisById(orgID int64, patientsId int64, recordDate int64) (patient models.AssessmentAfterDislysis, err error) {
|
159
|
159
|
err = readDb.Model(&models.AssessmentAfterDislysis{}).Where("patient_id = ? and user_org_id=? and status=1 and assessment_date =?", patientsId, orgID, recordDate).First(&patient).Error
|
160
|
160
|
return
|
161
|
161
|
}
|
162
|
162
|
|
163
|
|
-
|
|
163
|
+
|
164
|
164
|
func FindTreatmentSummaryById(orgID int64, patientsId int64, recordDate int64) (patient models.TreatmentSummary, err error) {
|
165
|
165
|
err = readDb.Model(&models.TreatmentSummary{}).Where("patient_id = ? and user_org_id=? and status=1 and assessment_date = ? ", patientsId, orgID, recordDate).First(&patient).Error
|
166
|
166
|
return
|
167
|
167
|
}
|
168
|
168
|
|
169
|
|
-
|
|
169
|
+
|
170
|
170
|
func FindQueueCallInfo(orgID int64) (queueConfig models.QueueCallConfig, err error) {
|
171
|
171
|
err = readDb.Model(&models.QueueCallConfig{}).Where("org_id=? ", orgID).First(&queueConfig).Error
|
172
|
172
|
return
|
173
|
173
|
}
|
174
|
174
|
|
175
|
|
-
|
|
175
|
+
|
176
|
176
|
func UpDateQueueCallInfo(queueConfig models.QueueCallConfig) error {
|
177
|
177
|
err := writeDb.Save(&queueConfig).Error
|
178
|
178
|
return err
|
179
|
179
|
}
|
180
|
180
|
|
181
|
|
-
|
|
181
|
+
|
182
|
182
|
func FindAllDeviceInfo(orgID int64) (device []*models.Device, err error) {
|
183
|
183
|
err = readDb.Model(&models.Device{}).Where("org_id=? and status=1 and device_type = 1", orgID).Find(&device).Error
|
184
|
184
|
return device, err
|
185
|
185
|
}
|
186
|
186
|
|
187
|
|
-
|
|
187
|
+
|
188
|
188
|
func GetAllDeviceZone(orgId int64) (error, []*models.DeviceZone) {
|
189
|
189
|
var zone []*models.DeviceZone
|
190
|
190
|
err := readDb.Model(&zone).Where("org_id = ? AND status = 1", orgId).Find(&zone).Error
|
|
@@ -192,7 +192,7 @@ func GetAllDeviceZone(orgId int64) (error, []*models.DeviceZone) {
|
192
|
192
|
return err, zone
|
193
|
193
|
}
|
194
|
194
|
|
195
|
|
-
|
|
195
|
+
|
196
|
196
|
func FindAllSubDoctorAdvice(id int64, parentId int64) (error, []models.DoctorAdvice) {
|
197
|
197
|
var subAdvies []models.DoctorAdvice
|
198
|
198
|
err := readDb.Model(&subAdvies).Where("patient_id = ? AND parent_id = ?", id, parentId).Find(&subAdvies).Error
|
|
@@ -272,7 +272,7 @@ func AddSigleDoubleCheck(check *models.DoubleCheck) (err error) {
|
272
|
272
|
return errors
|
273
|
273
|
}
|
274
|
274
|
|
275
|
|
-
|
|
275
|
+
|
276
|
276
|
func UpDateDialysisPrescription(dialysisPrescription *models.DialysisPrescription) error {
|
277
|
277
|
tx := writeDb.Begin()
|
278
|
278
|
err := writeDb.Save(&dialysisPrescription).Error
|
|
@@ -283,25 +283,25 @@ func UpDateDialysisPrescription(dialysisPrescription *models.DialysisPrescriptio
|
283
|
283
|
return err
|
284
|
284
|
}
|
285
|
285
|
|
286
|
|
-
|
|
286
|
+
|
287
|
287
|
func UpadateReceiveTreatmentAsses(receiveTreatmentAsses *models.ReceiveTreatmentAsses) error {
|
288
|
288
|
err := writeDb.Save(receiveTreatmentAsses).Error
|
289
|
289
|
return err
|
290
|
290
|
}
|
291
|
291
|
|
292
|
|
-
|
|
292
|
+
|
293
|
293
|
func UpadatePredialysisEvaluation(predialysisEvaluation *models.PredialysisEvaluation) error {
|
294
|
294
|
err := writeDb.Save(&predialysisEvaluation).Error
|
295
|
295
|
return err
|
296
|
296
|
}
|
297
|
297
|
|
298
|
|
-
|
|
298
|
+
|
299
|
299
|
func UpdateDoubleCheck(check *models.DoubleCheck) error {
|
300
|
300
|
err := writeDb.Save(&check).Error
|
301
|
301
|
return err
|
302
|
302
|
}
|
303
|
303
|
|
304
|
|
-
|
|
304
|
+
|
305
|
305
|
func UpdateAssessmentAfterDislysisRecord(assessmentAfterDislysis *models.AssessmentAfterDislysis) error {
|
306
|
306
|
err := writeDb.Save(&assessmentAfterDislysis).Error
|
307
|
307
|
return err
|
|
@@ -330,21 +330,21 @@ func UpdatePredialysisEvaluationFour(predialysisevaluation *models.PredialysisEv
|
330
|
330
|
return err
|
331
|
331
|
}
|
332
|
332
|
|
333
|
|
-
|
|
333
|
+
|
334
|
334
|
func UpdateSummeRecord(treatmentSummary *models.TreatmentSummary) error {
|
335
|
335
|
err := writeDb.Save(&treatmentSummary).Error
|
336
|
336
|
return err
|
337
|
337
|
}
|
338
|
338
|
|
339
|
|
-
|
340
|
|
-
|
341
|
|
-
|
342
|
|
-
|
343
|
|
-
|
344
|
|
-
|
345
|
|
-
|
346
|
|
-
|
347
|
|
-
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
|
348
|
348
|
func ExceDoctorAdviceById(m *models.DoctorAdvice, id int64, patientId int64) error {
|
349
|
349
|
err := writeDb.Model(&models.DoctorAdvice{}).Where("patient_id = ? AND (id = ? Or parent_id=?) AND status = 1 ", patientId, id, id).Updates(map[string]interface{}{"execution_time": m.ExecutionTime, "execution_staff": m.ExecutionStaff, "execution_state": 1}).Error
|
350
|
350
|
return err
|
|
@@ -412,7 +412,7 @@ func UpdateSolution(solution *models.DialysisSolution) {
|
412
|
412
|
|
413
|
413
|
}
|
414
|
414
|
|
415
|
|
-
|
|
415
|
+
|
416
|
416
|
func CreateSolution(solution *models.DialysisSolution) {
|
417
|
417
|
writeDb.Create(&solution)
|
418
|
418
|
}
|
|
@@ -442,7 +442,7 @@ func SavePrescriptionAndCreateSolution(solution *models.DialysisSolution, prescr
|
442
|
442
|
return
|
443
|
443
|
}
|
444
|
444
|
|
445
|
|
-
|
|
445
|
+
|
446
|
446
|
func FindDialysisPrescriptionByReordDate(id int64, recordDate int64, orgId int64) (error, *models.DialysisPrescription) {
|
447
|
447
|
dialysisPrescription := models.DialysisPrescription{}
|
448
|
448
|
err := readDb.Model(&dialysisPrescription).Where("patient_id = ? AND record_date = ? AND status = 1 AND user_org_id = ? ", id, recordDate, orgId).Find(&dialysisPrescription).Error
|
|
@@ -455,14 +455,14 @@ func FindReceiveTreatmentAssesByReordDate(id int64, recordDate int64, orgId int6
|
455
|
455
|
return err, &receiveTreatmentAsses
|
456
|
456
|
}
|
457
|
457
|
|
458
|
|
-
|
|
458
|
+
|
459
|
459
|
func FindPredialysisEvaluationByReordDate(id int64, recordDate int64, orgId int64) (error, *models.PredialysisEvaluation) {
|
460
|
460
|
dialysisEvaluation := models.PredialysisEvaluation{}
|
461
|
461
|
err := readDb.Model(&models.PredialysisEvaluation{}).Where("patient_id = ? AND assessment_date = ? AND status = 1 AND user_org_id = ?", id, recordDate, orgId).First(&dialysisEvaluation).Error
|
462
|
462
|
return err, &dialysisEvaluation
|
463
|
463
|
}
|
464
|
464
|
|
465
|
|
-
|
|
465
|
+
|
466
|
466
|
func FindDoubleCheckByReordDate(id int64, recordDate int64, orgId int64) (error, *models.DoubleCheck) {
|
467
|
467
|
check := models.DoubleCheck{}
|
468
|
468
|
err := readDb.Model(&models.DoubleCheck{}).Where("patient_id = ? AND check_date = ? AND status = 1 AND user_org_id = ?", id, recordDate, orgId).First(&check).Error
|
|
@@ -571,7 +571,7 @@ func UpdateSolutionByPatientId(id int64) error {
|
571
|
571
|
|
572
|
572
|
}
|
573
|
573
|
|
574
|
|
-
|
|
574
|
+
|
575
|
575
|
func UpDateRecordIdToDialysisPrescription(patientId int64, orgId int64, recordTime int64, recordId int64) error {
|
576
|
576
|
errors := writeDb.Model(&models.DialysisPrescription{}).Where("user_org_id = ? AND patient_id = ? AND record_date = ? ", orgId, patientId, recordTime).Updates(map[string]interface{}{"record_id": recordId}).Error
|
577
|
577
|
return errors
|
|
@@ -612,7 +612,7 @@ func UpDateRecordIdToDoctorAdvice(patientId int64, orgId int64, recordTime int64
|
612
|
612
|
return errors
|
613
|
613
|
}
|
614
|
614
|
|
615
|
|
-
|
|
615
|
+
|
616
|
616
|
func FindPatientPrescribeWidyDevideById(orgID int64, patientsId int64, recordDate int64) (patient models.DialysisPrescriptionAddtional, err error) {
|
617
|
617
|
err = readDb.Preload("Device", "status = 1 AND org_id = ?", orgID).
|
618
|
618
|
Model(&models.DialysisPrescriptionAddtional{}).
|
|
@@ -687,7 +687,7 @@ func FindDoctorName(adminid int64, appid int64, orgid int64) (models.App_Roles,
|
687
|
687
|
return role, err
|
688
|
688
|
}
|
689
|
689
|
|
690
|
|
-
|
|
690
|
+
|
691
|
691
|
func GetDialysisScheduals(orgID int64, scheduleDate int64) ([]*MDialysisScheduleVM, error) {
|
692
|
692
|
var vms []*MDialysisScheduleVM
|
693
|
693
|
db := readDb.
|
|
@@ -2051,3 +2051,16 @@ func GetFiledConfig(orgid int64) (models.FiledConfig, error) {
|
2051
|
2051
|
err := XTReadDB().Where("filed_name = 'dialyzer_perfusion_apparatus' and org_id = ? and module =1 and is_show = 1", orgid).First(&config).Error
|
2052
|
2052
|
return config, err
|
2053
|
2053
|
}
|
|
2054
|
+
|
|
2055
|
+func GetDoctorAdviceCheckList(patient_id int64, advice_date int64, user_org_id int64) (doctor []*models.DoctorAdvice, err error) {
|
|
2056
|
+
|
|
2057
|
+ err = XTReadDB().Where("patient_id = ? and advice_date = ? and user_org_id =? and status= 1 and check_state= 0", patient_id, advice_date, user_org_id).Find(&doctor).Error
|
|
2058
|
+ return doctor, err
|
|
2059
|
+}
|
|
2060
|
+
|
|
2061
|
+func UpdateDoctorAdviceList(id int64, checker int64) error {
|
|
2062
|
+
|
|
2063
|
+ advice := models.DoctorAdvice{}
|
|
2064
|
+ err := XTWriteDB().Model(&advice).Where("id = ? and status =1", id).Updates(map[string]interface{}{"checker": checker, "check_state": 1, "check_time": time.Now().Unix()}).Error
|
|
2065
|
+ return err
|
|
2066
|
+}
|