|
@@ -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)
|
|
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
|
}
|
|
@@ -1200,6 +1200,35 @@ func CreateSickbed(wms []*sz.TempHdSickbed, rdb *gorm.DB) (err error) {
|
1200
|
1200
|
return
|
1201
|
1201
|
}
|
1202
|
1202
|
|
|
1203
|
+
|
|
1204
|
+func CreateSickbed2(wms []*sz.TempHdSickbed, rdb *gorm.DB) (err error) {
|
|
1205
|
+ if len(wms) > 0 {
|
|
1206
|
+ utx := rdb
|
|
1207
|
+ if len(wms) > 0 {
|
|
1208
|
+ for _, wm := range wms {
|
|
1209
|
+ thisSQL := "INSERT INTO t_hd_sickbed (sickbed_no,hospital_id,division_id,sickbed_code,sickbed_type,xgbz,create_time,update_time,sjscsj,ylyl1) VALUES "
|
|
1210
|
+ insertParams := make([]string, 0)
|
|
1211
|
+ insertData := make([]interface{}, 0)
|
|
1212
|
+ insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?)")
|
|
1213
|
+ insertData = append(insertData, wm.SickbedNo)
|
|
1214
|
+ insertData = append(insertData, wm.HospitalId)
|
|
1215
|
+ insertData = append(insertData, wm.DivisionId)
|
|
1216
|
+ insertData = append(insertData, wm.SickbedCode)
|
|
1217
|
+ insertData = append(insertData, wm.SickbedType)
|
|
1218
|
+ insertData = append(insertData, wm.Xgbz)
|
|
1219
|
+ insertData = append(insertData, wm.CreateTime)
|
|
1220
|
+ insertData = append(insertData, wm.UpdateTime)
|
|
1221
|
+ insertData = append(insertData, wm.Sjscsj)
|
|
1222
|
+ insertData = append(insertData, wm.Ylyl1)
|
|
1223
|
+
|
|
1224
|
+ thisSQL += strings.Join(insertParams, ", ")
|
|
1225
|
+ utx.Exec(thisSQL, insertData...)
|
|
1226
|
+ }
|
|
1227
|
+ }
|
|
1228
|
+ }
|
|
1229
|
+ return
|
|
1230
|
+}
|
|
1231
|
+
|
1203
|
1232
|
func CreateDiagnosis(wms []*sz.TempHdDiagnosis, rdb *gorm.DB) (err error) {
|
1204
|
1233
|
if len(wms) > 0 {
|
1205
|
1234
|
utx := rdb
|
|
@@ -1906,3 +1935,29 @@ func BatchCreateTB_STAT_YWL_Report(ps *sz.TB_STAT_YWL_Report, rdb *gorm.DB) (err
|
1906
|
1935
|
err = rdb.Create(&ps).Error
|
1907
|
1936
|
return err
|
1908
|
1937
|
}
|
|
1938
|
+
|
|
1939
|
+func FindOrgPatientDataTwo(org_id int64,ids []int64) (patient []*models.Patients, err error) {
|
|
1940
|
+ db := readDb.Model(&models.Patients{}).Where("status = 1 AND user_org_id = ? and id in (?)", org_id,ids)
|
|
1941
|
+ err = db.Find(&patient).Error
|
|
1942
|
+ return
|
|
1943
|
+}
|
|
1944
|
+
|
|
1945
|
+func FindNewOrgHisOrder(org_id int64, lastUploadTime int64, nowTime int64) (patient []*models.HisOrder, err error) {
|
|
1946
|
+ db := readDb.Model(&models.HisOrder{}).Preload("HisPatient", "status = 1").Where("status = 1 AND user_org_id = ? AND med_type = 14", org_id)
|
|
1947
|
+ db = db.Where("ctime >= ? AND ctime <= ?", lastUploadTime, nowTime)
|
|
1948
|
+ err = db.Find(&patient).Error
|
|
1949
|
+ return
|
|
1950
|
+}
|
|
1951
|
+
|
|
1952
|
+func FindUserRoleData(org_id int64, admin_user_id int64) (role models.UserAdminRole, err error) {
|
|
1953
|
+ db := readUserDb.Model(&models.UserAdminRole{}).Where("status = 1 AND org_id = ? and admin_user_id = ? ", org_id, admin_user_id)
|
|
1954
|
+ //db = db.Where("ctime >= ? AND ctime <= ?", lastUploadTime, nowTime)
|
|
1955
|
+ err = db.Find(&role).Error
|
|
1956
|
+ return
|
|
1957
|
+}
|
|
1958
|
+
|
|
1959
|
+
|
|
1960
|
+func BatchCreateTB_HIS_MZ_BL_Detail(ps *sz.TB_HIS_MZ_BL_Detail, rdb *gorm.DB) (err error) {
|
|
1961
|
+ err = rdb.Create(&ps).Error
|
|
1962
|
+ return err
|
|
1963
|
+}
|