|
@@ -141,7 +141,7 @@ func FindOrgHisDoctorAdviceInfo(org_id int64, lastUploadTime int64, nowTime int6
|
141
|
141
|
}
|
142
|
142
|
|
143
|
143
|
func FindOrgHisDoctorAdviceInfoByPid(org_id int64, pid int64) (patient []*models.HisDoctorAdviceInfo, err error) {
|
144
|
|
- db := readDb.Model(&models.HisDoctorAdviceInfo{}).Where("status = 1 AND user_org_id = ? and prescription_id = ?", org_id,pid)
|
|
144
|
+ db := readDb.Model(&models.HisDoctorAdviceInfo{}).Where("status = 1 AND user_org_id = ? and prescription_id = ?", org_id, pid)
|
145
|
145
|
err = db.Find(&patient).Error
|
146
|
146
|
return
|
147
|
147
|
}
|
|
@@ -402,13 +402,6 @@ func FindOrgInspectionGroupSzblbr(org_id int64, lastUploadTime int64, nowTime in
|
402
|
402
|
return
|
403
|
403
|
}
|
404
|
404
|
|
405
|
|
-func FindOrgInspectionGroupSzblpg(org_id int64, lastUploadTime int64, nowTime int64, patient_id int64) (inspection []*models.XtInspection, err error) {
|
406
|
|
- db := readDb.Model(&models.XtInspection{}).Where("status = 1 AND org_id = ? and project_id in (1013804) and patient_id = ?", org_id, patient_id)
|
407
|
|
- db = db.Where("created_time >= ? AND created_time <= ?", lastUploadTime, nowTime).Group("inspect_date")
|
408
|
|
- err = db.Find(&inspection).Error
|
409
|
|
- return
|
410
|
|
-}
|
411
|
|
-
|
412
|
405
|
// 传染病查询
|
413
|
406
|
func FindOrgInspectionGroupSzblTwo(org_id int64, inspect_date int64, patient_id int64) (inspection []*models.XtInspection, err error) {
|
414
|
407
|
db := readDb.Model(&models.XtInspection{}).Where("status = 1 AND org_id = ? and project_id in (1013800,1013870) and patient_id = ? and inspect_date = ?", org_id, patient_id, inspect_date)
|
|
@@ -423,13 +416,6 @@ func FindOrgInspectionGroupSzblbrTwo(org_id int64, inspect_date int64, patient_i
|
423
|
416
|
return
|
424
|
417
|
}
|
425
|
418
|
|
426
|
|
-// 传染病查询
|
427
|
|
-func FindOrgInspectionGroupSzblpgTwo(org_id int64, inspect_date int64, patient_id int64) (inspection []*models.XtInspection, err error) {
|
428
|
|
- db := readDb.Model(&models.XtInspection{}).Where("status = 1 AND org_id = ? and project_id in (1013804) and patient_id = ? and inspect_date = ?", org_id, patient_id, inspect_date)
|
429
|
|
- err = db.Find(&inspection).Error
|
430
|
|
- return
|
431
|
|
-}
|
432
|
|
-
|
433
|
419
|
// 传染病查询
|
434
|
420
|
func FindOrgInspectionGroupTwo(org_id int64, inspect_date int64, patient_id int64) (inspection []*models.XtInspection, err error) {
|
435
|
421
|
db := readDb.Model(&models.XtInspection{}).Where("status = 1 AND org_id = ? and project_id = 14 and patient_id = ? and inspect_date = ?", org_id, patient_id, inspect_date)
|
|
@@ -550,10 +536,10 @@ func BatchCreateStaffRecord(staffs []*sz.TempHdStaff, rdb *gorm.DB) (err error)
|
550
|
536
|
var id_no int64
|
551
|
537
|
id_no = 429001198701091670
|
552
|
538
|
for _, info := range staffs {
|
553
|
|
- thisSQL := "INSERT INTO t_hd_staff (hospital_id,staff_id, id_no,id_type,staff_name, position, staff_status, staff_no, permanent_type, in_date ,create_time, sjscsj, xgbz) VALUES "
|
|
539
|
+ thisSQL := "INSERT INTO t_hd_staff (hospital_id,staff_id, id_no,id_type,staff_name, position, staff_status, staff_no, permanent_type, in_date ,create_time,update_time, sjscsj, xgbz) VALUES "
|
554
|
540
|
insertParams := make([]string, 0)
|
555
|
541
|
insertData := make([]interface{}, 0)
|
556
|
|
- insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?)")
|
|
542
|
+ insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
|
557
|
543
|
|
558
|
544
|
insertData = append(insertData, info.HospitalId)
|
559
|
545
|
insertData = append(insertData, info.StaffId)
|
|
@@ -566,6 +552,7 @@ func BatchCreateStaffRecord(staffs []*sz.TempHdStaff, rdb *gorm.DB) (err error)
|
566
|
552
|
insertData = append(insertData, info.PermanentType)
|
567
|
553
|
insertData = append(insertData, "2019-09-01")
|
568
|
554
|
insertData = append(insertData, info.CreateTime)
|
|
555
|
+ insertData = append(insertData, info.UpdateTime)
|
569
|
556
|
insertData = append(insertData, info.Sjscsj)
|
570
|
557
|
insertData = append(insertData, info.Xgbz)
|
571
|
558
|
thisSQL += strings.Join(insertParams, ", ")
|
|
@@ -720,10 +707,11 @@ func BatchCreatePsm(psms []*sz.TempHdPsMedicine, rdb *gorm.DB) (err error) {
|
720
|
707
|
if len(psms) > 0 {
|
721
|
708
|
|
722
|
709
|
for _, psm := range psms {
|
723
|
|
- thisSQL := "INSERT INTO t_hd_ps_medicine (sn,hospital_id, medicine_type_id,medicine_id,create_time,sjscsj,xgbz) VALUES "
|
|
710
|
+ thisSQL := "INSERT INTO t_hd_ps_medicine (sn,prescribe_id,hospital_id, medicine_type_id,medicine_id,create_time,sjscsj,xgbz) VALUES "
|
724
|
711
|
insertParams := make([]string, 0)
|
725
|
712
|
insertData := make([]interface{}, 0)
|
726
|
|
- insertParams = append(insertParams, "(?,?,?,?,?,?,?)")
|
|
713
|
+ insertParams = append(insertParams, "(?,?,?,?,?,?,?,?)")
|
|
714
|
+ insertData = append(insertData, psm.Sn)
|
727
|
715
|
insertData = append(insertData, psm.Sn)
|
728
|
716
|
insertData = append(insertData, psm.HospitalId)
|
729
|
717
|
insertData = append(insertData, psm.MedicineTypeId)
|
|
@@ -746,6 +734,11 @@ func BatchCreatePsm(psms []*sz.TempHdPsMedicine, rdb *gorm.DB) (err error) {
|
746
|
734
|
return
|
747
|
735
|
}
|
748
|
736
|
|
|
737
|
+func BatchCreateDialysisOne(ps *sz.TempHdDialysis, rdb *gorm.DB) (err error) {
|
|
738
|
+ err = rdb.Create(&ps).Error
|
|
739
|
+ return err
|
|
740
|
+}
|
|
741
|
+
|
749
|
742
|
func BatchCreateDialysis(psms []*sz.TempHdDialysis, rdb *gorm.DB) (err error) {
|
750
|
743
|
if len(psms) > 0 {
|
751
|
744
|
utx := rdb
|
|
@@ -1214,35 +1207,6 @@ func CreateSickbed(wms []*sz.TempHdSickbed, rdb *gorm.DB) (err error) {
|
1214
|
1207
|
return
|
1215
|
1208
|
}
|
1216
|
1209
|
|
1217
|
|
-
|
1218
|
|
-func CreateSickbed2(wms []*sz.TempHdSickbed, rdb *gorm.DB) (err error) {
|
1219
|
|
- if len(wms) > 0 {
|
1220
|
|
- utx := rdb
|
1221
|
|
- if len(wms) > 0 {
|
1222
|
|
- for _, wm := range wms {
|
1223
|
|
- thisSQL := "INSERT INTO t_hd_sickbed (sickbed_no,hospital_id,division_id,sickbed_code,sickbed_type,xgbz,create_time,update_time,sjscsj,ylyl1) VALUES "
|
1224
|
|
- insertParams := make([]string, 0)
|
1225
|
|
- insertData := make([]interface{}, 0)
|
1226
|
|
- insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?)")
|
1227
|
|
- insertData = append(insertData, wm.SickbedNo)
|
1228
|
|
- insertData = append(insertData, wm.HospitalId)
|
1229
|
|
- insertData = append(insertData, wm.DivisionId)
|
1230
|
|
- insertData = append(insertData, wm.SickbedCode)
|
1231
|
|
- insertData = append(insertData, wm.SickbedType)
|
1232
|
|
- insertData = append(insertData, wm.Xgbz)
|
1233
|
|
- insertData = append(insertData, wm.CreateTime)
|
1234
|
|
- insertData = append(insertData, wm.UpdateTime)
|
1235
|
|
- insertData = append(insertData, wm.Sjscsj)
|
1236
|
|
- insertData = append(insertData, wm.Ylyl1)
|
1237
|
|
-
|
1238
|
|
- thisSQL += strings.Join(insertParams, ", ")
|
1239
|
|
- utx.Exec(thisSQL, insertData...)
|
1240
|
|
- }
|
1241
|
|
- }
|
1242
|
|
- }
|
1243
|
|
- return
|
1244
|
|
-}
|
1245
|
|
-
|
1246
|
1210
|
func CreateDiagnosis(wms []*sz.TempHdDiagnosis, rdb *gorm.DB) (err error) {
|
1247
|
1211
|
if len(wms) > 0 {
|
1248
|
1212
|
utx := rdb
|
|
@@ -1949,29 +1913,3 @@ func BatchCreateTB_STAT_YWL_Report(ps *sz.TB_STAT_YWL_Report, rdb *gorm.DB) (err
|
1949
|
1913
|
err = rdb.Create(&ps).Error
|
1950
|
1914
|
return err
|
1951
|
1915
|
}
|
1952
|
|
-
|
1953
|
|
-func FindOrgPatientDataTwo(org_id int64,ids []int64) (patient []*models.Patients, err error) {
|
1954
|
|
- db := readDb.Model(&models.Patients{}).Where("status = 1 AND user_org_id = ? and id in (?)", org_id,ids)
|
1955
|
|
- err = db.Find(&patient).Error
|
1956
|
|
- return
|
1957
|
|
-}
|
1958
|
|
-
|
1959
|
|
-func FindNewOrgHisOrder(org_id int64, lastUploadTime int64, nowTime int64) (patient []*models.HisOrder, err error) {
|
1960
|
|
- db := readDb.Model(&models.HisOrder{}).Preload("HisPatient", "status = 1").Where("status = 1 AND user_org_id = ? AND med_type = 14", org_id)
|
1961
|
|
- db = db.Where("ctime >= ? AND ctime <= ?", lastUploadTime, nowTime)
|
1962
|
|
- err = db.Find(&patient).Error
|
1963
|
|
- return
|
1964
|
|
-}
|
1965
|
|
-
|
1966
|
|
-func FindUserRoleData(org_id int64, admin_user_id int64) (role models.UserAdminRole, err error) {
|
1967
|
|
- db := readUserDb.Model(&models.UserAdminRole{}).Where("status = 1 AND org_id = ? and admin_user_id = ? ", org_id, admin_user_id)
|
1968
|
|
- //db = db.Where("ctime >= ? AND ctime <= ?", lastUploadTime, nowTime)
|
1969
|
|
- err = db.Find(&role).Error
|
1970
|
|
- return
|
1971
|
|
-}
|
1972
|
|
-
|
1973
|
|
-
|
1974
|
|
-func BatchCreateTB_HIS_MZ_BL_Detail(ps *sz.TB_HIS_MZ_BL_Detail, rdb *gorm.DB) (err error) {
|
1975
|
|
- err = rdb.Create(&ps).Error
|
1976
|
|
- return err
|
1977
|
|
-}
|