|
@@ -6,8 +6,497 @@ import (
|
6
|
6
|
"fmt"
|
7
|
7
|
"time"
|
8
|
8
|
"github.com/jinzhu/gorm"
|
|
9
|
+ "github.com/robfig/cron"
|
|
10
|
+ "SCRM/utils"
|
|
11
|
+ "strconv"
|
9
|
12
|
)
|
10
|
13
|
|
|
14
|
+// cron表达式 https://www.cnblogs.com/zuxingyu/p/6023919.html
|
|
15
|
+var createDefalutDataCronJob *cron.Cron
|
|
16
|
+
|
|
17
|
+func BeginAutoCreateDefalutData() {
|
|
18
|
+ //createDefalutDataCronJob.Start()
|
|
19
|
+}
|
|
20
|
+
|
|
21
|
+func init() {
|
|
22
|
+ utils.InfoLog("开启自动排班定时任务")
|
|
23
|
+ createDefalutDataCronJob = cron.New()
|
|
24
|
+ spec := "*/5 * * * * ?" // 每隔5秒执行一次
|
|
25
|
+ createDefalutDataCronJob.AddFunc(spec, func() {
|
|
26
|
+ AutoCreateDefalutSchedules()
|
|
27
|
+ })
|
|
28
|
+}
|
|
29
|
+
|
|
30
|
+func AutoCreateDefalutSchedules() {
|
|
31
|
+ utils.TraceLog("自动添加数据任务开始执行")
|
|
32
|
+ //获取是10分前的时间
|
|
33
|
+ var orginfo []*models.OrgInfo
|
|
34
|
+ nowtime := time.Now().Unix()
|
|
35
|
+ fmt.Println("当前时间",nowtime)
|
|
36
|
+ timebefor := time.Now().Add(-time.Minute * 10).Unix()
|
|
37
|
+ fmt.Println("10分钟之前时间",timebefor)
|
|
38
|
+ //1570653733 //1570654333
|
|
39
|
+ err := service.PatientReadDB().Raw("select * from sgj_users.sgj_user_org as u where u.ctime>=? AND u.ctime<= ?", timebefor, nowtime).Scan(&orginfo).Error
|
|
40
|
+ fmt.Println("err",err)
|
|
41
|
+ fmt.Println("orginfo",orginfo)
|
|
42
|
+ for i:=0;i< len(orginfo);i++ {
|
|
43
|
+ userOrgID := orginfo[i].ID
|
|
44
|
+ fmt.Println("ID是设么",userOrgID)
|
|
45
|
+ navigation, err := GetPatientNavigation(userOrgID)
|
|
46
|
+ fmt.Println("err",err)
|
|
47
|
+ if(len(navigation) == 0){
|
|
48
|
+ patientNavigation := models.SgjPatientNavigation{
|
|
49
|
+ Navtitle: "首页",
|
|
50
|
+ Navimages: "https://images.shengws.com/2089_o_1571990714383.png",
|
|
51
|
+ Status: 1,
|
|
52
|
+ UserOrgId: userOrgID,
|
|
53
|
+ Nonavimages: "https://images.shengws.com/2105_o_1571990730785.png",
|
|
54
|
+ Linktype: 1,
|
|
55
|
+ Ctime: time.Now().Unix(),
|
|
56
|
+ }
|
|
57
|
+ err := AddNavgation(&patientNavigation)
|
|
58
|
+ fmt.Println("err",err)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+ patientnavigationthree := models.SgjPatientNavigation{
|
|
62
|
+ Navtitle: "客服",
|
|
63
|
+ Navimages: "https://images.shengws.com/2101_o_1571990903053.png",
|
|
64
|
+ Status: 1,
|
|
65
|
+ UserOrgId: userOrgID,
|
|
66
|
+ Nonavimages: "https://images.shengws.com/2113_o_1571990915581.png",
|
|
67
|
+ Linktype:2,
|
|
68
|
+ Ctime: time.Now().Unix(),
|
|
69
|
+ }
|
|
70
|
+ err = AddNavgation(&patientnavigationthree)
|
|
71
|
+
|
|
72
|
+ patientnavigationtwo := models.SgjPatientNavigation{
|
|
73
|
+ Navtitle: "电话",
|
|
74
|
+ Navimages: "https://images.shengws.com/2092_o_1571990776921.png",
|
|
75
|
+ Status: 1,
|
|
76
|
+ UserOrgId: userOrgID,
|
|
77
|
+ Linktype:3,
|
|
78
|
+ Nonavimages: "https://images.shengws.com/2100_o_1571990784845.png",
|
|
79
|
+ Ctime: time.Now().Unix(),
|
|
80
|
+ }
|
|
81
|
+ err = AddNavgation(&patientnavigationtwo)
|
|
82
|
+
|
|
83
|
+ sgjPatientNavigation := models.SgjPatientNavigation{
|
|
84
|
+ Navtitle: "联系我们",
|
|
85
|
+ Navimages: "https://images.shengws.com/2124_o_1571990749565.png",
|
|
86
|
+ Status: 1,
|
|
87
|
+ UserOrgId: userOrgID,
|
|
88
|
+ Nonavimages: "https://images.shengws.com/2079_o_1571990763549.png",
|
|
89
|
+ Linktype:4,
|
|
90
|
+ Ctime: time.Now().Unix(),
|
|
91
|
+ }
|
|
92
|
+ err = AddNavgation(&sgjPatientNavigation)
|
|
93
|
+ fmt.Println("err",err)
|
|
94
|
+ }
|
|
95
|
+
|
|
96
|
+ model, err := GetData(userOrgID)
|
|
97
|
+ if(len(model) == 0){
|
|
98
|
+ patientModel := models.SgjPatientModel{
|
|
99
|
+ Title: "轮播图",
|
|
100
|
+ Sort: 1,
|
|
101
|
+ UserOrgId: userOrgID,
|
|
102
|
+ Ctime: time.Now().Unix(),
|
|
103
|
+ Status: 1,
|
|
104
|
+ ModeType: 1,
|
|
105
|
+ }
|
|
106
|
+ err := AddPatientModelTwo(&patientModel)
|
|
107
|
+ fmt.Println("err",err)
|
|
108
|
+ sgjPatientModel, err := GetQueryModelByLastData(userOrgID)
|
|
109
|
+ editpiclink := models.SgjPatientEditpiclink{
|
|
110
|
+ Images: "https://images.shengws.com/2124_o_1570607834870.png",
|
|
111
|
+ Sort: 1,
|
|
112
|
+ UserOrgId: userOrgID,
|
|
113
|
+ Status: 1,
|
|
114
|
+ Ctime: time.Now().Unix(),
|
|
115
|
+ Modeid:sgjPatientModel.ID,
|
|
116
|
+ }
|
|
117
|
+ err = AddPatientEdit(&editpiclink)
|
|
118
|
+ fmt.Println("err",err)
|
|
119
|
+
|
|
120
|
+ patientmodefour := models.SgjPatientModel{
|
|
121
|
+ Title: "魔方导航",
|
|
122
|
+ Sort: 2,
|
|
123
|
+ UserOrgId: userOrgID,
|
|
124
|
+ Ctime: time.Now().Unix(),
|
|
125
|
+ Status: 1,
|
|
126
|
+ ModeType: 8,
|
|
127
|
+ }
|
|
128
|
+ err = AddPatientModelTwo(&patientmodefour)
|
|
129
|
+ sgjpatietnmodelfour, err := GetQueryModelByLastData(userOrgID)
|
|
130
|
+ ID :=int64(sgjpatietnmodelfour.ID + 1)
|
|
131
|
+ fmt.Println("ID是多少",ID)
|
|
132
|
+ modeid := strconv.FormatInt(ID, 10)
|
|
133
|
+ orgid := strconv.FormatInt(userOrgID, 10)
|
|
134
|
+ KeID :=int64(sgjpatietnmodelfour.ID + 3)
|
|
135
|
+ OfficeID := strconv.FormatInt(KeID, 10)
|
|
136
|
+ ActiID :=int64(sgjpatietnmodelfour.ID + 5)
|
|
137
|
+ ActisID := strconv.FormatInt(ActiID, 10)
|
|
138
|
+ ActivID :=int64(sgjpatietnmodelfour.ID + 6)
|
|
139
|
+ ActivsID := strconv.FormatInt(ActivID, 10)
|
|
140
|
+ editmargin := models.SgjPatientEditmargin{
|
|
141
|
+ Margtitle: "医院介绍",
|
|
142
|
+ Margimage: "https://images.shengws.com/2162_o_1571992616722.png",
|
|
143
|
+ UserOrgId: userOrgID,
|
|
144
|
+ Status: 1,
|
|
145
|
+ Ctime: time.Now().Unix(),
|
|
146
|
+ Modeid: sgjpatietnmodelfour.ID,
|
|
147
|
+ Jumpset:2,
|
|
148
|
+ Marginaddress:"http://jk.test.sgjyun.com/#/hospitalIntroduction?id="+modeid+"&orgid="+orgid ,
|
|
149
|
+ }
|
|
150
|
+ err = AddEditMargin(&editmargin)
|
|
151
|
+ patientEditmargin := models.SgjPatientEditmargin{
|
|
152
|
+ Margtitle: "医护团队",
|
|
153
|
+ Margimage: "https://images.shengws.com/2121_o_1571992634289.png",
|
|
154
|
+ UserOrgId: userOrgID,
|
|
155
|
+ Status: 1,
|
|
156
|
+ Ctime: time.Now().Unix(),
|
|
157
|
+ Modeid: sgjpatietnmodelfour.ID,
|
|
158
|
+ Jumpset:2,
|
|
159
|
+ Marginaddress:"http://jk.test.sgjyun.com/#/medicalTeam?id="+OfficeID+"&orgid="+orgid,
|
|
160
|
+ }
|
|
161
|
+ err = AddEditMargin(&patientEditmargin)
|
|
162
|
+ sgjPatientEditmargin := models.SgjPatientEditmargin{
|
|
163
|
+ Margtitle: "医院动态",
|
|
164
|
+ Margimage: "https://images.shengws.com/2163_o_1571992676180.png",
|
|
165
|
+ UserOrgId: userOrgID,
|
|
166
|
+ Status: 1,
|
|
167
|
+ Ctime: time.Now().Unix(),
|
|
168
|
+ Modeid: sgjpatietnmodelfour.ID,
|
|
169
|
+ Jumpset:2,
|
|
170
|
+ Marginaddress:"http://jk.test.sgjyun.com/#/news?id="+ActisID+"&orgid="+orgid,
|
|
171
|
+ }
|
|
172
|
+ AddEditMargin(&sgjPatientEditmargin)
|
|
173
|
+ patienteditmarginfour := models.SgjPatientEditmargin{
|
|
174
|
+ Margtitle: "医院活动",
|
|
175
|
+ Margimage: "https://images.shengws.com/2117_o_1571992689392.png",
|
|
176
|
+ UserOrgId: userOrgID,
|
|
177
|
+ Status: 1,
|
|
178
|
+ Ctime: time.Now().Unix(),
|
|
179
|
+ Modeid: sgjpatietnmodelfour.ID,
|
|
180
|
+ Jumpset:2,
|
|
181
|
+ Marginaddress:"http://jk.test.sgjyun.com/#/activity?id="+ActivsID+"&orgid="+orgid,
|
|
182
|
+ }
|
|
183
|
+ AddEditMargin(&patienteditmarginfour)
|
|
184
|
+ patienteditmarginfive := models.SgjPatientEditmargin{
|
|
185
|
+ Margtitle: "医院环境",
|
|
186
|
+ Margimage: "https://images.shengws.com/2130_o_1571992702226.png",
|
|
187
|
+ UserOrgId: userOrgID,
|
|
188
|
+ Status: 1,
|
|
189
|
+ Ctime: time.Now().Unix(),
|
|
190
|
+ Modeid: sgjpatietnmodelfour.ID,
|
|
191
|
+ Jumpset:2,
|
|
192
|
+ Marginaddress:"http://jk.test.sgjyun.com/#/hospitalIntroduction?id="+modeid+"&orgid="+orgid,
|
|
193
|
+ }
|
|
194
|
+ AddEditMargin(&patienteditmarginfive)
|
|
195
|
+ patienteditmarginsix := models.SgjPatientEditmargin{
|
|
196
|
+ Margtitle: "咨询客服",
|
|
197
|
+ Margimage: "https://images.shengws.com/2149_o_1571992721076.png",
|
|
198
|
+ UserOrgId: userOrgID,
|
|
199
|
+ Status: 1,
|
|
200
|
+ Ctime: time.Now().Unix(),
|
|
201
|
+ Modeid: sgjpatietnmodelfour.ID,
|
|
202
|
+ Jumpset:2,
|
|
203
|
+ }
|
|
204
|
+ AddEditMargin(&patienteditmarginsix)
|
|
205
|
+
|
|
206
|
+ patienteditmarginserven := models.SgjPatientEditmargin{
|
|
207
|
+ Margtitle: "加入会员",
|
|
208
|
+ Margimage: "https://images.shengws.com/2165_o_1571992737567.png",
|
|
209
|
+ UserOrgId: userOrgID,
|
|
210
|
+ Status: 1,
|
|
211
|
+ Ctime: time.Now().Unix(),
|
|
212
|
+ Modeid: sgjpatietnmodelfour.ID,
|
|
213
|
+ Jumpset:2,
|
|
214
|
+ }
|
|
215
|
+ AddEditMargin(&patienteditmarginserven)
|
|
216
|
+
|
|
217
|
+ patienteditmargineghit := models.SgjPatientEditmargin{
|
|
218
|
+ Margtitle: "联系我们",
|
|
219
|
+ Margimage: "https://images.shengws.com/2122_o_1571992753168.png",
|
|
220
|
+ UserOrgId: userOrgID,
|
|
221
|
+ Status: 1,
|
|
222
|
+ Ctime: time.Now().Unix(),
|
|
223
|
+ Modeid: sgjpatietnmodelfour.ID,
|
|
224
|
+ }
|
|
225
|
+ AddEditMargin(&patienteditmargineghit)
|
|
226
|
+
|
|
227
|
+ patientModelTwo := models.SgjPatientModel{
|
|
228
|
+ Title: "医院介绍",
|
|
229
|
+ Sort: 4,
|
|
230
|
+ UserOrgId: userOrgID,
|
|
231
|
+ Ctime: time.Now().Unix(),
|
|
232
|
+ Status: 1,
|
|
233
|
+ ModeType: 2,
|
|
234
|
+ }
|
|
235
|
+ AddPatientModelTwo(&patientModelTwo)
|
|
236
|
+
|
|
237
|
+ sgjPatientModelTwo, err := GetQueryModelByLastData(userOrgID)
|
|
238
|
+ hospital := models.SgjPatientHospital{
|
|
239
|
+ Title: "医院介绍",
|
|
240
|
+ Sort: 4,
|
|
241
|
+ Introduction: "",
|
|
242
|
+ UserOrgId: userOrgID,
|
|
243
|
+ Modleid: sgjPatientModelTwo.ID,
|
|
244
|
+ Status: 1,
|
|
245
|
+ Ctime: time.Now().Unix(),
|
|
246
|
+ }
|
|
247
|
+ AddHospital(&hospital)
|
|
248
|
+
|
|
249
|
+ Sgjpatientmodelthree := models.SgjPatientModel{
|
|
250
|
+ Title: "科室介绍",
|
|
251
|
+ Sort: 8,
|
|
252
|
+ UserOrgId: userOrgID,
|
|
253
|
+ Ctime: time.Now().Unix(),
|
|
254
|
+ Status: 1,
|
|
255
|
+ ModeType: 3,
|
|
256
|
+
|
|
257
|
+ }
|
|
258
|
+ AddPatientModelTwo(&Sgjpatientmodelthree)
|
|
259
|
+ datathree, err := GetQueryModelByLastData(userOrgID)
|
|
260
|
+ offices := models.SgjPatientOffices{
|
|
261
|
+ Title: "科室介绍",
|
|
262
|
+ Sort: 4,
|
|
263
|
+ UserOrgId: userOrgID,
|
|
264
|
+ Ctime: time.Now().Unix(),
|
|
265
|
+ Status: 1,
|
|
266
|
+ Modleid: datathree.ID,
|
|
267
|
+ Introduction:"",
|
|
268
|
+ }
|
|
269
|
+ AddPatientOffices(&offices)
|
|
270
|
+ patientModelFive := models.SgjPatientModel{
|
|
271
|
+ Title: "医护团队",
|
|
272
|
+ Sort: 5,
|
|
273
|
+ UserOrgId: userOrgID,
|
|
274
|
+ Ctime: time.Now().Unix(),
|
|
275
|
+ Status: 1,
|
|
276
|
+ ModeType: 4,
|
|
277
|
+ }
|
|
278
|
+ AddPatientModelTwo(&patientModelFive)
|
|
279
|
+ data, err := GetQueryModelByLastData(userOrgID)
|
|
280
|
+ editdoctor := models.SgjPatientEditdoctor{
|
|
281
|
+ Dochead: "https://images.shengws.com/2062_o_1570608303729.png",
|
|
282
|
+ DocSort: 1,
|
|
283
|
+ Docintroduction: "",
|
|
284
|
+ UserOrgId: userOrgID,
|
|
285
|
+ Modleid: data.ID,
|
|
286
|
+ Status:1,
|
|
287
|
+ Ctime:time.Now().Unix(),
|
|
288
|
+ DocPostion:1,
|
|
289
|
+ }
|
|
290
|
+ AddEditDoctor(&editdoctor)
|
|
291
|
+
|
|
292
|
+ modelserven := models.SgjPatientModel{
|
|
293
|
+ Title: "医院环境",
|
|
294
|
+ Sort: 6,
|
|
295
|
+ UserOrgId: userOrgID,
|
|
296
|
+ Ctime: time.Now().Unix(),
|
|
297
|
+ Status: 1,
|
|
298
|
+ ModeType: 5,
|
|
299
|
+ }
|
|
300
|
+ AddPatientModelTwo(&modelserven)
|
|
301
|
+ lastData, err := GetQueryModelByLastData(userOrgID)
|
|
302
|
+ enviroimages := models.SgjPatientEnviroimages{
|
|
303
|
+ Enviroimages: "https://images.shengws.com/2076_o_1572602899145.jpg",
|
|
304
|
+ Sort: 1,
|
|
305
|
+ UserOrgId: userOrgID,
|
|
306
|
+ Status: 1,
|
|
307
|
+ Modeid: lastData.ID,
|
|
308
|
+ Ctime: time.Now().Unix(),
|
|
309
|
+ }
|
|
310
|
+ AddImages(&enviroimages)
|
|
311
|
+
|
|
312
|
+ modelArticles := models.SgjPatientModel{
|
|
313
|
+ Title: "医院动态",
|
|
314
|
+ Sort: 3,
|
|
315
|
+ UserOrgId: userOrgID,
|
|
316
|
+ Ctime: time.Now().Unix(),
|
|
317
|
+ Status: 1,
|
|
318
|
+ ModeType: 6,
|
|
319
|
+ }
|
|
320
|
+ AddPatientModelTwo(&modelArticles)
|
|
321
|
+ articleslist, err := GetQueryModelByLastData(userOrgID)
|
|
322
|
+ fmt.Println("articleslist",articleslist)
|
|
323
|
+ fmt.Println("hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh")
|
|
324
|
+ articlelist := models.SgjPatientArticlelist{
|
|
325
|
+ Title: "医院动态",
|
|
326
|
+ Sort:3,
|
|
327
|
+ UserOrgId: userOrgID,
|
|
328
|
+ Status: 1,
|
|
329
|
+ Ctime: time.Now().Unix(),
|
|
330
|
+ Number: 1,
|
|
331
|
+ Modeid: articleslist.ID,
|
|
332
|
+ }
|
|
333
|
+ AddActiclelist(&articlelist)
|
|
334
|
+ fmt.Println("我爱你中国法阿发法阿凡达阿凡达阿道夫阿道夫阿道夫阿发阿凡达暗室逢灯阿斯蒂芬暗室逢灯")
|
|
335
|
+ articles, err := GetAritclesData(userOrgID)
|
|
336
|
+ if(len(articles) == 0){
|
|
337
|
+ articles := models.Articles{
|
|
338
|
+ Title: "",
|
|
339
|
+ Content: "",
|
|
340
|
+ Imgs: "https://images.shengws.com/2062_o_1570608303729.png",
|
|
341
|
+ Status: 1,
|
|
342
|
+ Ctime: time.Now().Unix(),
|
|
343
|
+ UserOrgId: userOrgID,
|
|
344
|
+ ArticleStatus:1,
|
|
345
|
+ }
|
|
346
|
+ AddActicles(&articles)
|
|
347
|
+ }
|
|
348
|
+
|
|
349
|
+ modelActivitis := models.SgjPatientModel{
|
|
350
|
+ Title: "医院活动",
|
|
351
|
+ Sort: 7,
|
|
352
|
+ UserOrgId: userOrgID,
|
|
353
|
+ Ctime: time.Now().Unix(),
|
|
354
|
+ Status: 1,
|
|
355
|
+ ModeType: 7,
|
|
356
|
+ }
|
|
357
|
+ AddPatientModelTwo(&modelActivitis)
|
|
358
|
+ activtiys, err := GetQueryModelByLastData(userOrgID)
|
|
359
|
+ addactivity := models.SgjPatientAddactivity{
|
|
360
|
+ Title: "医院活动",
|
|
361
|
+ Sort: 7,
|
|
362
|
+ UserOrgId: userOrgID,
|
|
363
|
+ Ctime: time.Now().Unix(),
|
|
364
|
+ Status: 1,
|
|
365
|
+ Modeid: activtiys.ID,
|
|
366
|
+ Number:1,
|
|
367
|
+ }
|
|
368
|
+ AddActivity(&addactivity)
|
|
369
|
+
|
|
370
|
+ activity, err := GetArititys(userOrgID)
|
|
371
|
+ if(len(activity) == 0){
|
|
372
|
+ activity := models.Activity{
|
|
373
|
+ Title: "医院活动",
|
|
374
|
+ PosterPhoto: "https://images.shengws.com/2062_o_1570608303729.png",
|
|
375
|
+ UserOrgId: userOrgID,
|
|
376
|
+ CreateTime: time.Now().Unix(),
|
|
377
|
+ Status: 1,
|
|
378
|
+ }
|
|
379
|
+ AddActivitys(&activity)
|
|
380
|
+ }
|
|
381
|
+
|
|
382
|
+ }
|
|
383
|
+
|
|
384
|
+ oldmodels, err := GetContactUsModel(userOrgID)
|
|
385
|
+ fmt.Println("orgmodels是设么",oldmodels)
|
|
386
|
+ if(len(oldmodels) == 0){
|
|
387
|
+ ordmodel := models.PatientOrdmodel{
|
|
388
|
+ Title: "轮播图",
|
|
389
|
+ UserOrgId: userOrgID,
|
|
390
|
+ Sort: 1,
|
|
391
|
+ ModeType: 1,
|
|
392
|
+ Status: 1,
|
|
393
|
+ Ctime: time.Now().Unix(),
|
|
394
|
+ }
|
|
395
|
+ err := AddPatientOrdModel(ºodel)
|
|
396
|
+ fmt.Println("错误是设么",err)
|
|
397
|
+ patientOrdmodel, err := GetPatientOrdModelByLastData(userOrgID)
|
|
398
|
+ conrotation := models.SgjPatientConrotation{
|
|
399
|
+ Images: "https://images.shengws.com/2124_o_1570607834870.png",
|
|
400
|
+ Sort: 1,
|
|
401
|
+ Modeid: patientOrdmodel.ID,
|
|
402
|
+ UserOrgId: userOrgID,
|
|
403
|
+ Ctime: time.Now().Unix(),
|
|
404
|
+ }
|
|
405
|
+ AddConRotation(&conrotation)
|
|
406
|
+
|
|
407
|
+ ordmodelOne := models.PatientOrdmodel{
|
|
408
|
+ Title: "医院地址",
|
|
409
|
+ UserOrgId: userOrgID,
|
|
410
|
+ Sort: 2,
|
|
411
|
+ ModeType: 2,
|
|
412
|
+ Status: 1,
|
|
413
|
+ Ctime: time.Now().Unix(),
|
|
414
|
+ }
|
|
415
|
+ AddPatientOrdModel(ºodelOne)
|
|
416
|
+ patientOrdmodelOne, err := GetPatientOrdModelByLastData(userOrgID)
|
|
417
|
+ hosaddress := models.SgjPatientHosaddress{
|
|
418
|
+ Title: "医院地址",
|
|
419
|
+ UserOrgId: userOrgID,
|
|
420
|
+ Address: "暂无数据",
|
|
421
|
+ Ctime: time.Now().Unix(),
|
|
422
|
+ Status: 1,
|
|
423
|
+ Modeid: patientOrdmodelOne.ID,
|
|
424
|
+ }
|
|
425
|
+ AddHosAddress(&hosaddress)
|
|
426
|
+
|
|
427
|
+ ordmodeltwo := models.PatientOrdmodel{
|
|
428
|
+ Title: "联系方式",
|
|
429
|
+ UserOrgId: userOrgID,
|
|
430
|
+ Sort: 3,
|
|
431
|
+ ModeType: 3,
|
|
432
|
+ Status: 1,
|
|
433
|
+ Ctime: time.Now().Unix(),
|
|
434
|
+ }
|
|
435
|
+ AddPatientOrdModel(ºodeltwo)
|
|
436
|
+ patientOrdmodelTwo, err := GetPatientOrdModelByLastData(userOrgID)
|
|
437
|
+ connectway := models.SgjPatientConnectway{
|
|
438
|
+ Title: "联系方式",
|
|
439
|
+ UserOrgId: userOrgID,
|
|
440
|
+ Status: 1,
|
|
441
|
+ Ctime: time.Now().Unix(),
|
|
442
|
+ ModeId:patientOrdmodelTwo.ID,
|
|
443
|
+ }
|
|
444
|
+ AddConnecWay(&connectway)
|
|
445
|
+ connection := models.SgjPatientConnection{
|
|
446
|
+ Title: "电话",
|
|
447
|
+ Connecway: 1,
|
|
448
|
+ Content: "暂无数据",
|
|
449
|
+ Status: 1,
|
|
450
|
+ UserOrgId: userOrgID,
|
|
451
|
+ }
|
|
452
|
+ AddConnetion(connection)
|
|
453
|
+
|
|
454
|
+ ordmodelthree:= models.PatientOrdmodel{
|
|
455
|
+ Title: "工作时间",
|
|
456
|
+ UserOrgId: userOrgID,
|
|
457
|
+ Sort: 4,
|
|
458
|
+ ModeType: 4,
|
|
459
|
+ Status: 1,
|
|
460
|
+ Ctime: time.Now().Unix(),
|
|
461
|
+ }
|
|
462
|
+ AddPatientOrdModel(ºodelthree)
|
|
463
|
+ patientOrdmodelThree, err := GetPatientOrdModelByLastData(userOrgID)
|
|
464
|
+ worktime := models.SgjPatientWorktime{
|
|
465
|
+ Title: "工作时间",
|
|
466
|
+ UserOrgId: userOrgID,
|
|
467
|
+ Status: 1,
|
|
468
|
+ Ctime: time.Now().Unix(),
|
|
469
|
+ ModeId: patientOrdmodelThree.ID,
|
|
470
|
+ Worktime:"暂无数据",
|
|
471
|
+ }
|
|
472
|
+ AddWorkTime(&worktime)
|
|
473
|
+ ordmodelfour:= models.PatientOrdmodel{
|
|
474
|
+ Title: "乘车方式",
|
|
475
|
+ UserOrgId: userOrgID,
|
|
476
|
+ Sort: 5,
|
|
477
|
+ ModeType: 5,
|
|
478
|
+ Status: 1,
|
|
479
|
+ Ctime: time.Now().Unix(),
|
|
480
|
+ }
|
|
481
|
+ AddPatientOrdModel(ºodelfour)
|
|
482
|
+ patientOrdmodelfour, err := GetPatientOrdModelByLastData(userOrgID)
|
|
483
|
+ rideway := models.SgjPatientRideway{
|
|
484
|
+ Title: "乘车方式",
|
|
485
|
+ UserOrgId: userOrgID,
|
|
486
|
+ Status: 1,
|
|
487
|
+ Ctime: time.Now().Unix(),
|
|
488
|
+ ModeId: patientOrdmodelfour.ID,
|
|
489
|
+ RideWay: "暂无数据",
|
|
490
|
+ }
|
|
491
|
+ AddRideWay(rideway)
|
|
492
|
+ }
|
|
493
|
+ }
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+}
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
|
11
|
500
|
func AddPatientModel(model *models.SgjPatientModel)error{
|
12
|
501
|
err := service.PatientWriteDB().Create(&model).Error
|
13
|
502
|
fmt.Println("插入错误",err)
|
|
@@ -194,7 +683,7 @@ func UpdateOrdeModel(id int64,orgID int64,ordmodel models.SgjPatientOrdmodel) er
|
194
|
683
|
}
|
195
|
684
|
|
196
|
685
|
func UpdateRideWay(id int64,orgID int64,rideway models.SgjPatientRideway) error {
|
197
|
|
- err := service.PatientWriteDB().Model(rideway).Where("id = ? AND user_org_id = ? AND status =?", id, orgID, 1).Update(map[string]interface{}{"title": rideway.Title, "sort": rideway.Sort, "rideway": rideway.RideWay, "mtime": time.Now().Unix()}).Error
|
|
686
|
+ err := service.PatientWriteDB().Model(rideway).Where("id = ? AND user_org_id = ? AND status =?", id, orgID, 1).Update(map[string]interface{}{"title": rideway.Title, "sort": rideway.Sort, "ride_way": rideway.RideWay, "mtime": time.Now().Unix()}).Error
|
198
|
687
|
return err
|
199
|
688
|
}
|
200
|
689
|
|
|
@@ -441,6 +930,10 @@ func AddOrdModel(ordmodel *models.SgjPatientOrdmodel)error {
|
441
|
930
|
err := service.PatientWriteDB().Create(ºodel).Error
|
442
|
931
|
return err
|
443
|
932
|
}
|
|
933
|
+func AddPatientOrdModel(ordmodel *models.PatientOrdmodel) error {
|
|
934
|
+ err := service.PatientWriteDB().Create(ºodel).Error
|
|
935
|
+ return err
|
|
936
|
+}
|
444
|
937
|
|
445
|
938
|
func AddHosAddress(hosaddress *models.SgjPatientHosaddress) error {
|
446
|
939
|
|
|
@@ -786,7 +1279,7 @@ func GetArticlelist(orgid int64)(models.SgjPatientArticlelist,error) {
|
786
|
1279
|
}
|
787
|
1280
|
|
788
|
1281
|
func GetAllArticles(orgid int64,limit int64)(articlelist []models.Articles,err error) {
|
789
|
|
- err = service.PatientReadDB().Model(articlelist).Where("user_org_id = ? AND Status = ?", orgid, 1).Limit(limit).Find(&articlelist).Error
|
|
1282
|
+ err = service.PatientReadDB().Model(articlelist).Where("user_org_id = ? AND Status = ? AND article_status = ?", orgid, 1,1).Order("ctime desc").Limit(limit).Find(&articlelist).Error
|
790
|
1283
|
return
|
791
|
1284
|
}
|
792
|
1285
|
|
|
@@ -1047,7 +1540,7 @@ func AddActicles(articles *models.Articles)error {
|
1047
|
1540
|
|
1048
|
1541
|
func UpdateLinkAddress(id int64,orgid int64,magiclink models.SgjPatientMagiclink)error {
|
1049
|
1542
|
|
1050
|
|
- err := service.PatientWriteDB().Model(&models.SgjPatientMagiclink{}).Where("id = ? AND user_org_id = ? ", id, orgid).Update(map[string]interface{}{"linktype": magiclink.Linktype, "instationlink": magiclink.Instationlink, "articetype": magiclink.Articetype, "phone": magiclink.Phone, "outstationlink": magiclink.Outstationlink, "linkaddress": magiclink.Linkaddress, "title": magiclink.Title, "mtime": time.Now().Unix()}).Error
|
|
1543
|
+ err := service.PatientWriteDB().Model(&models.SgjPatientMagiclink{}).Where("id = ? AND user_org_id = ? ", id, orgid).Update(map[string]interface{}{"linktype": magiclink.Linktype, "instationlink": magiclink.Instationlink, "phone": magiclink.Phone, "outstationlink": magiclink.Outstationlink, "linkaddress": magiclink.Linkaddress, "mtime": time.Now().Unix()}).Error
|
1051
|
1544
|
return err
|
1052
|
1545
|
}
|
1053
|
1546
|
|
|
@@ -1300,3 +1793,42 @@ func UpdatedRotationVisble(id int64,orgid int64,linkaddress models.SgjPatientLin
|
1300
|
1793
|
return err
|
1301
|
1794
|
}
|
1302
|
1795
|
|
|
1796
|
+func GetAritclesData(orgid int64)(articles []models.Articles,err error) {
|
|
1797
|
+
|
|
1798
|
+ err = service.PatientReadDB().Model(&articles).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&articles).Error
|
|
1799
|
+
|
|
1800
|
+ return articles,err
|
|
1801
|
+
|
|
1802
|
+}
|
|
1803
|
+
|
|
1804
|
+func GetArititys(orgid int64)(activity []models.Activity,err error) {
|
|
1805
|
+
|
|
1806
|
+ err = service.PatientReadDB().Model(&activity).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&activity).Error
|
|
1807
|
+
|
|
1808
|
+ return activity,err
|
|
1809
|
+}
|
|
1810
|
+
|
|
1811
|
+func AddActivitys(activity *models.Activity) error {
|
|
1812
|
+
|
|
1813
|
+ err := service.PatientReadDB().Create(&activity).Error
|
|
1814
|
+ return err
|
|
1815
|
+}
|
|
1816
|
+
|
|
1817
|
+func GetContactUsModel(orgid int64)(oldmodels []models.PatientOrdmodel,err error) {
|
|
1818
|
+
|
|
1819
|
+ err = service.PatientReadDB().Model(&oldmodels).Where("user_org_id = ? AND status = ?", orgid, 1).Find(&oldmodels).Error
|
|
1820
|
+ return oldmodels,err
|
|
1821
|
+}
|
|
1822
|
+
|
|
1823
|
+func GetPatientOrdModelByLastData(orgid int64)(models.PatientOrdmodel,error) {
|
|
1824
|
+
|
|
1825
|
+ ordmodel := models.PatientOrdmodel{}
|
|
1826
|
+ err := service.PatientReadDB().Model(ºodel).Where("user_org_id = ? AND status = ?", orgid, 1).Last(ºodel).Error
|
|
1827
|
+ return ordmodel,err
|
|
1828
|
+}
|
|
1829
|
+
|
|
1830
|
+func AddConRotation(conrotation *models.SgjPatientConrotation) error {
|
|
1831
|
+
|
|
1832
|
+ err := service.PatientWriteDB().Create(&conrotation).Error
|
|
1833
|
+ return err
|
|
1834
|
+}
|