Browse Source

Merge branch 'master' of http://git.shengws.com/csx/XT_New

XMLWAN 5 years ago
parent
commit
c664074618

+ 2 - 0
controllers/mobile_api_controllers/mobile_api_base_controller.go View File

@@ -5,6 +5,7 @@ import (
5 5
 	"XT_New/enums"
6 6
 	"XT_New/models"
7 7
 	"XT_New/service"
8
+	"fmt"
8 9
 )
9 10
 
10 11
 type MobileBaseAPIController struct {
@@ -46,6 +47,7 @@ func (this *MobileBaseAPIAuthController) Prepare() {
46 47
 	this.MobileBaseAPIController.Prepare()
47 48
 
48 49
 	adminUserInfo := this.GetMobileAdminUserInfo()
50
+	fmt.Println(adminUserInfo)
49 51
 
50 52
 	if adminUserInfo == nil {
51 53
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)

+ 1 - 10
controllers/new_mobile_api_controllers/forget_password_controller.go View File

@@ -141,16 +141,7 @@ func (this *ForgetPwdController) ModifyPassword() {
141 141
 			//service.GetOrgSubscibeState(&subscibe)
142 142
 			templateInfo, _ := service.GetOrgInfoTemplate(org.Id)
143 143
 
144
-			type MobileAdminUserInfo struct {
145
-				AdminUser    *models.AdminUser
146
-				Org          *models.Org
147
-				App          *models.OrgApp
148
-				AppRole      *models.App_Role
149
-				Subscibe     *models.ServeSubscibe
150
-				TemplateInfo *models.GobalTemplate
151
-			}
152
-
153
-			mobileAdminUserInfo := &MobileAdminUserInfo{
144
+			mobileAdminUserInfo := &mobile_api_controllers.MobileAdminUserInfo{
154 145
 				AdminUser:    &adminUser,
155 146
 				Org:          &org,
156 147
 				App:          &app,

+ 182 - 19
controllers/new_mobile_api_controllers/mobile_regist_controller.go View File

@@ -6,7 +6,14 @@ import (
6 6
 	"XT_New/models"
7 7
 	"XT_New/service"
8 8
 	"XT_New/utils"
9
+	"bytes"
10
+	"encoding/json"
9 11
 	"github.com/astaxie/beego"
12
+	"log"
13
+	"os"
14
+	"path"
15
+	"regexp"
16
+	"runtime"
10 17
 	"time"
11 18
 )
12 19
 
@@ -123,13 +130,13 @@ func (this *MobileRegistController) CreateOrg() {
123 130
 		return
124 131
 	}
125 132
 
126
-	name := this.GetString("name")
133
+	name := this.GetString("org_name")
127 134
 	shortName := name
128
-	provinceName := this.GetString("province")
129
-	cityName := this.GetString("city")
130
-	districtName := this.GetString("district")
135
+	provinceName := this.GetString("provinces_name")
136
+	cityName := this.GetString("city_name")
137
+	districtName := this.GetString("district_name")
131 138
 	address := this.GetString("address")
132
-	category, _ := this.GetInt64("category")
139
+	org_type := this.GetString("org_type")
133 140
 	contactName := this.GetString("contact_name")
134 141
 
135 142
 	//openXT, _ := this.GetBool("open_xt")
@@ -142,12 +149,12 @@ func (this *MobileRegistController) CreateOrg() {
142 149
 	openSCRM := false
143 150
 	openMall := false
144 151
 
145
-	if len(name) == 0 || len(shortName) == 0 || len(contactName) == 0 || len(address) == 0 || len(provinceName) <= 0 || len(cityName) <= 0 || len(districtName) <= 0 || category <= 0 {
152
+	if len(name) == 0 || len(shortName) == 0 || len(contactName) == 0 || len(address) == 0 || len(provinceName) <= 0 || len(cityName) <= 0 || len(districtName) <= 0 || len(org_type) <= 0 {
146 153
 		this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
147 154
 		this.ServeJSON()
148 155
 		return
149 156
 	}
150
-	orgPhone := this.GetString("org_phone")
157
+	orgPhone := this.GetString("telephone")
151 158
 
152 159
 	if len(orgPhone) > 0 {
153 160
 		if utils.PhoneRegexp().MatchString(orgPhone) == false {
@@ -189,6 +196,8 @@ func (this *MobileRegistController) CreateOrg() {
189 196
 		}
190 197
 	}
191 198
 
199
+	orgType := service.GetOrgTypeByName(org_type)
200
+
192 201
 	org := models.Org{
193 202
 		Creator:      adminUser.Id,
194 203
 		OrgName:      name,
@@ -197,7 +206,7 @@ func (this *MobileRegistController) CreateOrg() {
197 206
 		City:         int64(cityID),
198 207
 		District:     int64(districtID),
199 208
 		Address:      address,
200
-		OrgType:      category,
209
+		OrgType:      orgType.ID,
201 210
 		Telephone:    orgPhone,
202 211
 		ContactName:  contactName,
203 212
 		Claim:        1,
@@ -207,9 +216,115 @@ func (this *MobileRegistController) CreateOrg() {
207 216
 		ModifyTime:   time.Now().Unix(),
208 217
 	}
209 218
 
210
-	//创建机构,创建应用,创建显示配置, 创建打印模版
211
-
212 219
 	createErr := service.CreateOrg(&org, adminUser.Mobile, openXT, openCDM, openSCRM, openMall) // 创建机构以及所有类型的 app,如果有新类型的平台,则需要在这个方法里面把创建这一新类型的 app 的代码加上
220
+	var ids []int64
221
+
222
+	//数据初始化
223
+	//创建两个虚拟病人
224
+	patients := LoadConfig("./patient.json").patients
225
+	for _, item := range patients {
226
+		item.UserOrgId = org.Id
227
+		item.CreatedTime = time.Now().Unix()
228
+		item.UpdatedTime = time.Now().Unix()
229
+		item.Status = 1
230
+		service.CreateVMOrgPatient(item)
231
+		ids = append(ids, item.ID)
232
+	}
233
+
234
+	//创建1个分组
235
+	vmGroup := &models.VMDeviceGroup{
236
+		OrgId:  org.Id,
237
+		Name:   "测试分组1",
238
+		Status: 1,
239
+		Ctime:  time.Now().Unix(),
240
+		Mtime:  time.Now().Unix(),
241
+	}
242
+
243
+	service.CreateVMGroup(vmGroup)
244
+
245
+	//创建两个虚拟分区
246
+	vmZone1 := &models.VMDeviceZone{
247
+		OrgId:  org.Id,
248
+		Name:   "分区1",
249
+		Type:   1,
250
+		Status: 1,
251
+		Ctime:  time.Now().Unix(),
252
+		Mtime:  time.Now().Unix(),
253
+	}
254
+	service.CreateVMZone(vmZone1)
255
+
256
+	vmZone2 := &models.VMDeviceZone{
257
+		OrgId:  org.Id,
258
+		Name:   "分区2",
259
+		Type:   2,
260
+		Status: 1,
261
+		Ctime:  time.Now().Unix(),
262
+		Mtime:  time.Now().Unix(),
263
+	}
264
+	service.CreateVMZone(vmZone2)
265
+
266
+	//创建4个虚拟床位
267
+	vmDeviceNumber1 := &models.VMDeviceNumber{
268
+		OrgId:   org.Id,
269
+		Number:  "1",
270
+		GroupId: vmGroup.ID,
271
+		ZoneId:  vmZone1.ID,
272
+		Status:  1,
273
+		Ctime:   time.Now().Unix(),
274
+		Mtime:   time.Now().Unix(),
275
+	}
276
+	service.CreateVMDeviceNumber(vmDeviceNumber1)
277
+
278
+	vmDeviceNumber2 := &models.VMDeviceNumber{
279
+		OrgId:   org.Id,
280
+		Number:  "2",
281
+		GroupId: vmGroup.ID,
282
+		ZoneId:  vmZone2.ID,
283
+		Status:  1,
284
+		Ctime:   time.Now().Unix(),
285
+		Mtime:   time.Now().Unix(),
286
+	}
287
+	service.CreateVMDeviceNumber(vmDeviceNumber2)
288
+
289
+	//创建两个虚拟病人排班
290
+	stime, _ := time.Parse("2006-01-02", time.Now().Format("2006-01-02"))
291
+	for index, id := range ids {
292
+		if index == 0 {
293
+			sch := &models.VMSchedule{
294
+				UserOrgId:    org.Id,
295
+				PartitionId:  vmZone1.ID,
296
+				BedId:        vmDeviceNumber1.ID,
297
+				PatientId:    id,
298
+				ScheduleDate: stime.Unix(),
299
+				ScheduleType: 1,
300
+				ScheduleWeek: int64(time.Now().Weekday()),
301
+				ModeId:       1,
302
+				Status:       1,
303
+				CreatedTime:  time.Now().Unix(),
304
+				UpdatedTime:  time.Now().Unix(),
305
+			}
306
+			service.CreateVMSch(sch)
307
+		}
308
+
309
+		if index == 1 {
310
+
311
+			sch := &models.VMSchedule{
312
+				UserOrgId:    org.Id,
313
+				PartitionId:  vmZone2.ID,
314
+				BedId:        vmDeviceNumber2.ID,
315
+				PatientId:    id,
316
+				ScheduleDate: stime.Unix(),
317
+				ScheduleType: 1,
318
+				ScheduleWeek: int64(time.Now().Weekday()),
319
+				ModeId:       1,
320
+				Status:       1,
321
+				CreatedTime:  time.Now().Unix(),
322
+				UpdatedTime:  time.Now().Unix(),
323
+			}
324
+			service.CreateVMSch(sch)
325
+		}
326
+	}
327
+
213 328
 	if createErr != nil {
214 329
 		utils.ErrorLog("mobile=%v的超级管理员创建机构失败:%v", adminUser.Mobile, createErr)
215 330
 		this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeDBCreate)
@@ -243,16 +358,8 @@ func (this *MobileRegistController) Login() {
243 358
 		this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
244 359
 		this.ServeJSON()
245 360
 	} else {
246
-		type MobileAdminUserInfo struct {
247
-			AdminUser    *models.AdminUser
248
-			Org          *models.Org
249
-			App          *models.OrgApp
250
-			AppRole      *models.App_Role
251
-			Subscibe     *models.ServeSubscibe
252
-			TemplateInfo *models.GobalTemplate
253
-		}
254 361
 
255
-		mobileAdminUserInfo := &MobileAdminUserInfo{
362
+		mobileAdminUserInfo := &mobile_api_controllers.MobileAdminUserInfo{
256 363
 			AdminUser:    adminUser,
257 364
 			Org:          nil,
258 365
 			App:          nil,
@@ -286,3 +393,59 @@ func (this *MobileRegistController) Login() {
286 393
 	}
287 394
 
288 395
 }
396
+
397
+type Config struct {
398
+	patients []*models.VMOrgPatients "json:patients"
399
+}
400
+
401
+func LoadConfig(dataFile string) *Config {
402
+	var config Config
403
+	_, filename, _, _ := runtime.Caller(1)
404
+	datapath := path.Join(path.Dir(filename), dataFile)
405
+	config_file, err := os.Open(datapath)
406
+	if err != nil {
407
+		emit("Failed to open config file '%s': %s\n", datapath, err)
408
+		return &config
409
+	}
410
+
411
+	fi, _ := config_file.Stat()
412
+
413
+	buffer := make([]byte, fi.Size())
414
+	_, err = config_file.Read(buffer)
415
+
416
+	buffer, err = StripComments(buffer) //去掉注释
417
+	if err != nil {
418
+		emit("Failed to strip comments from json: %s\n", err)
419
+		return &config
420
+	}
421
+
422
+	buffer = []byte(os.ExpandEnv(string(buffer))) //特殊
423
+	err = json.Unmarshal(buffer, &config)         //解析json格式数据
424
+	if err != nil {
425
+		emit("Failed unmarshalling json: %s\n", err)
426
+		return &config
427
+	}
428
+	return &config
429
+}
430
+
431
+func emit(msgfmt string, args ...interface{}) {
432
+	log.Printf(msgfmt, args...)
433
+}
434
+
435
+func StripComments(data []byte) ([]byte, error) {
436
+	data = bytes.Replace(data, []byte("\r"), []byte(""), 0) // Windows
437
+	lines := bytes.Split(data, []byte("\n"))                //split to muli lines
438
+	filtered := make([][]byte, 0)
439
+
440
+	for _, line := range lines {
441
+		match, err := regexp.Match(`^\s*#`, line)
442
+		if err != nil {
443
+			return nil, err
444
+		}
445
+		if !match {
446
+			filtered = append(filtered, line)
447
+		}
448
+	}
449
+
450
+	return bytes.Join(filtered, []byte("\n")), nil
451
+}

+ 6 - 20
controllers/new_mobile_api_controllers/new_login_api_controller.go View File

@@ -7,6 +7,7 @@ import (
7 7
 	"XT_New/service"
8 8
 	"XT_New/utils"
9 9
 	"encoding/json"
10
+	"fmt"
10 11
 	"github.com/astaxie/beego"
11 12
 	"io/ioutil"
12 13
 	"net/http"
@@ -88,25 +89,19 @@ func (this *NewLoginApiController) GetLogin() {
88 89
 				FiledList, _ = service.FindFiledByOrgId(org.Id)
89 90
 			}
90 91
 
91
-			type MobileAdminUserInfo struct {
92
-				AdminUser    *models.AdminUser
93
-				Org          *models.Org
94
-				App          *models.OrgApp
95
-				AppRole      *models.App_Role
96
-				Subscibe     *models.ServeSubscibe
97
-				TemplateInfo *models.GobalTemplate
98
-			}
99
-
100
-			mobileAdminUserInfo := &MobileAdminUserInfo{
92
+			mobileAdminUserInfo := &mobile_api_controllers.MobileAdminUserInfo{
101 93
 				AdminUser:    adminUser,
102 94
 				Org:          org,
103 95
 				App:          app,
104 96
 				AppRole:      appRole,
105 97
 				TemplateInfo: &templateInfo,
106 98
 			}
99
+			fmt.Println(this.GetSession("mobile_admin_user_info"))
100
+
107 101
 			if this.GetSession("mobile_admin_user_info") == nil {
108 102
 				this.SetSession("mobile_admin_user_info", mobileAdminUserInfo)
109 103
 			}
104
+			fmt.Println(this.GetSession("mobile_admin_user_info"))
110 105
 
111 106
 			this.ServeSuccessJSON(map[string]interface{}{
112 107
 				"admin": adminUser,
@@ -447,16 +442,7 @@ func (this *NewLoginApiController) LoginByCs() {
447 442
 					service.GetOrgSubscibeState(&subscibe)
448 443
 					templateInfo, _ := service.GetOrgInfoTemplate(org.Id)
449 444
 
450
-					type MobileAdminUserInfo struct {
451
-						AdminUser    *models.AdminUser
452
-						Org          *models.Org
453
-						App          *models.OrgApp
454
-						AppRole      *models.App_Role
455
-						Subscibe     *models.ServeSubscibe
456
-						TemplateInfo *models.GobalTemplate
457
-					}
458
-
459
-					mobileAdminUserInfo := &MobileAdminUserInfo{
445
+					mobileAdminUserInfo := &mobile_api_controllers.MobileAdminUserInfo{
460 446
 						AdminUser:    &adminUser,
461 447
 						Org:          &org,
462 448
 						App:          &app,

+ 163 - 0
controllers/new_mobile_api_controllers/patient.json View File

@@ -0,0 +1,163 @@
1
+{
2
+  "patients": [
3
+    {
4
+      "avatar": "https://images.shengws.com/201809182128111.png",
5
+      "patient_type": 1,
6
+      "dialysis_no": "01",
7
+      "admission_number": "",
8
+      "source": 1,
9
+      "lapseto": 2,
10
+      "partition_id": 0,
11
+      "bed_id": 0,
12
+      "name": "测试病人",
13
+      "alias": "",
14
+      "gender": 2,
15
+      "nation": "汉",
16
+      "native_place": "广东深圳",
17
+      "marital_status": 1,
18
+      "id_card_no": "430503196002063010",
19
+      "birthday": -312537600,
20
+      "reimbursement_way_id": 7,
21
+      "health_care_type": 0,
22
+      "health_care_no": "604324517",
23
+      "health_care_due_date": 0,
24
+      "height": 158,
25
+      "blood_type": 0,
26
+      "rh": 0,
27
+      "health_care_due_alert_date": 0,
28
+      "education_level": 5,
29
+      "profession": 10,
30
+      "phone": "13535547901",
31
+      "home_telephone": "12221903097",
32
+      "relative_phone": "18123074302",
33
+      "relative_relations": "哥哥",
34
+      "home_address": "深圳市罗湖区鸿翔花园",
35
+      "work_unit": "无",
36
+      "unit_address": "无",
37
+      "children": 2,
38
+      "receiving_date": 0,
39
+      "is_hospital_first_dialysis": 1,
40
+      "first_dialysis_date": 1110816000,
41
+      "first_dialysis_hospital": "深圳市人民医院",
42
+      "predialysis_condition": "",
43
+      "pre_hospital_dialysis_frequency": "每周3次",
44
+      "pre_hospital_dialysis_times": 1820,
45
+      "hospital_first_dialysis_date": 1511366400,
46
+      "induction_period": 0,
47
+      "initial_dialysis": 0,
48
+      "total_dialysis": 14,
49
+      "attending_doctor_id": 0,
50
+      "head_nurse_id": 0,
51
+      "evaluate": "",
52
+      "diagnose": "慢病肾功能不全(尿毒症期)",
53
+      "remark": "慢病肾功能不全(尿毒症期)肾性贫血,肾性高血压,多囊肾,多囊肝,支气管炎;",
54
+      "registrars_id": 185,
55
+      "registrars": "",
56
+      "qr_code": "",
57
+      "binding_state": 2,
58
+      "patient_complains": "慢病肾功能不全(尿毒症期)",
59
+      "present_history": "慢病肾功能不全(尿毒症期)肾性贫血,肾性高血压,多囊肾,多囊肝,支气管炎;",
60
+      "past_history": "慢病肾功能不全(尿毒症期)肾性贫血,肾性高血压,多囊肾,多囊肝,支气管炎;",
61
+      "temperature": 39,
62
+      "pulse": 60,
63
+      "respiratory": 100,
64
+      "sbp": 0,
65
+      "dbp": 0,
66
+      "status": 1,
67
+      "created_time": 1537347970,
68
+      "updated_time": 1584343696,
69
+      "solutions": null,
70
+      "age": 60,
71
+      "schedules": null,
72
+      "contagions": null,
73
+      "diseases": null,
74
+      "response_result": "",
75
+      "is_open_remind": 1,
76
+      "dialysis_age": 0,
77
+      "expense_kind": 3,
78
+      "tell_phone": "21212",
79
+      "first_treatment_date": 1582560000,
80
+      "contact_name": "21221"
81
+    },
82
+    {
83
+      "avatar": "https://images.shengws.com/201809182128111.png",
84
+      "patient_type": 1,
85
+      "dialysis_no": "01",
86
+      "admission_number": "",
87
+      "source": 1,
88
+      "lapseto": 2,
89
+      "partition_id": 0,
90
+      "bed_id": 0,
91
+      "name": "测试病人2",
92
+      "alias": "",
93
+      "gender": 2,
94
+      "nation": "汉",
95
+      "native_place": "广东深圳",
96
+      "marital_status": 1,
97
+      "id_card_no": "430503196002063010",
98
+      "birthday": -312537600,
99
+      "reimbursement_way_id": 7,
100
+      "health_care_type": 0,
101
+      "health_care_no": "604324517",
102
+      "health_care_due_date": 0,
103
+      "height": 158,
104
+      "blood_type": 0,
105
+      "rh": 0,
106
+      "health_care_due_alert_date": 0,
107
+      "education_level": 5,
108
+      "profession": 10,
109
+      "phone": "13535547901",
110
+      "home_telephone": "12221903097",
111
+      "relative_phone": "18123074302",
112
+      "relative_relations": "哥哥",
113
+      "home_address": "深圳市罗湖区鸿翔花园",
114
+      "work_unit": "无",
115
+      "unit_address": "无",
116
+      "children": 2,
117
+      "receiving_date": 0,
118
+      "is_hospital_first_dialysis": 1,
119
+      "first_dialysis_date": 1110816000,
120
+      "first_dialysis_hospital": "深圳市人民医院",
121
+      "predialysis_condition": "",
122
+      "pre_hospital_dialysis_frequency": "每周3次",
123
+      "pre_hospital_dialysis_times": 1820,
124
+      "hospital_first_dialysis_date": 1511366400,
125
+      "induction_period": 0,
126
+      "initial_dialysis": 0,
127
+      "total_dialysis": 14,
128
+      "attending_doctor_id": 0,
129
+      "head_nurse_id": 0,
130
+      "evaluate": "",
131
+      "diagnose": "慢病肾功能不全(尿毒症期)",
132
+      "remark": "慢病肾功能不全(尿毒症期)肾性贫血,肾性高血压,多囊肾,多囊肝,支气管炎;",
133
+      "registrars_id": 185,
134
+      "registrars": "",
135
+      "qr_code": "",
136
+      "binding_state": 2,
137
+      "patient_complains": "慢病肾功能不全(尿毒症期)",
138
+      "present_history": "慢病肾功能不全(尿毒症期)肾性贫血,肾性高血压,多囊肾,多囊肝,支气管炎;",
139
+      "past_history": "慢病肾功能不全(尿毒症期)肾性贫血,肾性高血压,多囊肾,多囊肝,支气管炎;",
140
+      "temperature": 39,
141
+      "pulse": 60,
142
+      "respiratory": 100,
143
+      "sbp": 0,
144
+      "dbp": 0,
145
+      "status": 1,
146
+      "created_time": 1537347970,
147
+      "updated_time": 1584343696,
148
+      "solutions": null,
149
+      "age": 60,
150
+      "schedules": null,
151
+      "contagions": null,
152
+      "diseases": null,
153
+      "response_result": "",
154
+      "is_open_remind": 1,
155
+      "dialysis_age": 0,
156
+      "expense_kind": 3,
157
+      "tell_phone": "21212",
158
+      "first_treatment_date": 1582560000,
159
+      "contact_name": "21221"
160
+    }
161
+  ]
162
+}
163
+

+ 153 - 0
models/vm_models.go View File

@@ -0,0 +1,153 @@
1
+package models
2
+
3
+type VMOrgPatients struct {
4
+	ID                           int64                `gorm:"column:id" json:"id" form:"id"`
5
+	UserOrgId                    int64                `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
6
+	UserId                       int64                `gorm:"column:user_id" json:"user_id" form:"user_id"`
7
+	Avatar                       string               `gorm:"column:avatar" json:"avatar" form:"avatar"`
8
+	PatientType                  int64                `gorm:"column:patient_type" json:"patient_type" form:"patient_type"`
9
+	DialysisNo                   string               `gorm:"column:dialysis_no" json:"dialysis_no" form:"dialysis_no"`
10
+	AdmissionNumber              string               `gorm:"column:admission_number" json:"admission_number" form:"admission_number"`
11
+	Source                       int64                `gorm:"column:source" json:"source" form:"source"`
12
+	Lapseto                      int64                `gorm:"column:lapseto" json:"lapseto" form:"lapseto"`
13
+	PartitionId                  int64                `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
14
+	BedId                        int64                `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
15
+	Name                         string               `gorm:"column:name" json:"name" form:"name"`
16
+	Alias                        string               `gorm:"column:alias" json:"alias" form:"alias"`
17
+	Gender                       int64                `gorm:"column:gender" json:"gender" form:"gender"`
18
+	Nation                       string               `gorm:"column:nation" json:"nation" form:"nation"`
19
+	NativePlace                  string               `gorm:"column:native_place" json:"native_place" form:"native_place"`
20
+	MaritalStatus                int64                `gorm:"column:marital_status" json:"marital_status" form:"marital_status"`
21
+	IdCardNo                     string               `gorm:"column:id_card_no" json:"id_card_no" form:"id_card_no"`
22
+	Birthday                     int64                `gorm:"column:birthday" json:"birthday" form:"birthday"`
23
+	ReimbursementWayId           int64                `gorm:"column:reimbursement_way_id" json:"reimbursement_way_id" form:"reimbursement_way_id"`
24
+	HealthCareType               int64                `gorm:"column:health_care_type" json:"health_care_type" form:"health_care_type"`
25
+	HealthCareNo                 string               `gorm:"column:health_care_no" json:"health_care_no" form:"health_care_no"`
26
+	HealthCareDueDate            int64                `gorm:"column:health_care_due_date" json:"health_care_due_date" form:"health_care_due_date"`
27
+	Height                       int64                `gorm:"column:height" json:"height" form:"height"`
28
+	BloodType                    int64                `gorm:"column:blood_type" json:"blood_type" form:"blood_type"`
29
+	Rh                           int64                `gorm:"column:rh" json:"rh" form:"rh"`
30
+	HealthCareDueAlertDate       int64                `gorm:"column:health_care_due_alert_date" json:"health_care_due_alert_date" form:"health_care_due_alert_date"`
31
+	EducationLevel               int64                `gorm:"column:education_level" json:"education_level" form:"education_level"`
32
+	Profession                   int64                `gorm:"column:profession" json:"profession" form:"profession"`
33
+	Phone                        string               `gorm:"column:phone" json:"phone" form:"phone"`
34
+	HomeTelephone                string               `gorm:"column:home_telephone" json:"home_telephone" form:"home_telephone"`
35
+	RelativePhone                string               `gorm:"column:relative_phone" json:"relative_phone" form:"relative_phone"`
36
+	RelativeRelations            string               `gorm:"column:relative_relations" json:"relative_relations" form:"relative_relations"`
37
+	HomeAddress                  string               `gorm:"column:home_address" json:"home_address" form:"home_address"`
38
+	WorkUnit                     string               `gorm:"column:work_unit" json:"work_unit" form:"work_unit"`
39
+	UnitAddress                  string               `gorm:"column:unit_address" json:"unit_address" form:"unit_address"`
40
+	Children                     int64                `gorm:"column:children" json:"children" form:"children"`
41
+	ReceivingDate                int64                `gorm:"column:receiving_date" json:"receiving_date" form:"receiving_date"`
42
+	IsHospitalFirstDialysis      int64                `gorm:"column:is_hospital_first_dialysis" json:"is_hospital_first_dialysis" form:"is_hospital_first_dialysis"`
43
+	FirstDialysisDate            int64                `gorm:"column:first_dialysis_date" json:"first_dialysis_date" form:"first_dialysis_date"`
44
+	FirstDialysisHospital        string               `gorm:"column:first_dialysis_hospital" json:"first_dialysis_hospital" form:"first_dialysis_hospital"`
45
+	PredialysisCondition         string               `gorm:"column:predialysis_condition" json:"predialysis_condition" form:"predialysis_condition"`
46
+	PreHospitalDialysisFrequency string               `gorm:"column:pre_hospital_dialysis_frequency" json:"pre_hospital_dialysis_frequency" form:"pre_hospital_dialysis_frequency"`
47
+	PreHospitalDialysisTimes     int64                `gorm:"column:pre_hospital_dialysis_times" json:"pre_hospital_dialysis_times" form:"pre_hospital_dialysis_times"`
48
+	HospitalFirstDialysisDate    int64                `gorm:"column:hospital_first_dialysis_date" json:"hospital_first_dialysis_date" form:"hospital_first_dialysis_date"`
49
+	InductionPeriod              int64                `gorm:"column:induction_period" json:"induction_period" form:"induction_period"`
50
+	InitialDialysis              int64                `gorm:"column:initial_dialysis" json:"initial_dialysis" form:"initial_dialysis"`
51
+	TotalDialysis                int64                `gorm:"column:total_dialysis" json:"total_dialysis" form:"total_dialysis"`
52
+	AttendingDoctorId            int64                `gorm:"column:attending_doctor_id" json:"attending_doctor_id" form:"attending_doctor_id"`
53
+	HeadNurseId                  int64                `gorm:"column:head_nurse_id" json:"head_nurse_id" form:"head_nurse_id"`
54
+	Evaluate                     string               `gorm:"column:evaluate" json:"evaluate" form:"evaluate"`
55
+	Diagnose                     string               `gorm:"column:diagnose" json:"diagnose" form:"diagnose"`
56
+	Remark                       string               `gorm:"column:remark" json:"remark" form:"remark"`
57
+	RegistrarsId                 int64                `gorm:"column:registrars_id" json:"registrars_id" form:"registrars_id"`
58
+	Registrars                   string               `gorm:"column:registrars" json:"registrars" form:"registrars"`
59
+	QrCode                       string               `gorm:"column:qr_code" json:"qr_code" form:"qr_code"`
60
+	BindingState                 int64                `gorm:"column:binding_state" json:"binding_state" form:"binding_state"`
61
+	PatientComplains             string               `gorm:"column:patient_complains" json:"patient_complains"` // 主诉
62
+	PresentHistory               string               `gorm:"column:present_history" json:"present_history"`     // 现病史
63
+	PastHistory                  string               `gorm:"column:past_history" json:"past_history"`           // 既往史
64
+	Temperature                  float64              `gorm:"column:temperature" json:"temperature"`             // 体格检查-体温
65
+	Pulse                        int64                `gorm:"column:pulse" json:"pulse"`                         // 体格检查-脉搏
66
+	Respiratory                  int64                `gorm:"column:respiratory" json:"respiratory"`             // 体格检查-呼吸频率
67
+	SBP                          int64                `gorm:"column:sbp" json:"sbp"`                             // 体格检查-收缩压
68
+	DBP                          int64                `gorm:"column:dbp" json:"dbp"`                             // 体格检查-舒张压
69
+	Status                       int64                `gorm:"column:status" json:"status" form:"status"`
70
+	CreatedTime                  int64                `gorm:"column:created_time" json:"created_time" form:"created_time"`
71
+	UpdatedTime                  int64                `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
72
+	DialysisSolutions            []DialysisSolution   `json:"solutions" gorm:"foreignkey:PatientId"`
73
+	Age                          int64                `gorm:"column:age" json:"age"`
74
+	Schedules                    []Schedule           `json:"schedules" gorm:"foreignkey:PatientId"`
75
+	Contagions                   []InfectiousDiseases `json:"contagions" gorm:"foreignkey:PatientId"`
76
+	Diseases                     []ChronicDiseases    `json:"diseases" gorm:"foreignkey:PatientId"`
77
+
78
+	InfectiousNextRecordTime int64  `gorm:"column:infectious_next_record_time" json:"infectious_next_record_time"`
79
+	IsInfectious             int64  `gorm:"column:is_infectious" json:"is_infectious"`
80
+	RemindCycle              int64  `gorm:"column:remind_cycle" json:"remind_cycle"`
81
+	ResponseResult           string `gorm:"column:response_result" json:"response_result"`
82
+	IsOpenRemind             int64  `gorm:"column:is_open_remind" json:"is_open_remind"`
83
+	DialysisAge              int64  `gorm:"column:dialysis_age" json:"dialysis_age" form:"dialysis_age"`
84
+	ExpenseKind              int64  `gorm:"column:expense_kind" json:"expense_kind" form:"expense_kind"`
85
+	TellPhone                string `gorm:"column:tell_phone" json:"tell_phone" form:"tell_phone"`
86
+	FirstTreatmentDate       int64  `gorm:"column:first_treatment_date" json:"first_treatment_date" form:"first_treatment_date"`
87
+	ContactName              string `gorm:"column:contact_name" json:"contact_name" form:"contact_name"`
88
+}
89
+
90
+func (VMOrgPatients) TableName() string {
91
+	return "xt_patients"
92
+}
93
+
94
+type VMDeviceGroup struct {
95
+	ID     int64  `gorm:"column:id" json:"id" form:"id"`
96
+	OrgId  int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
97
+	Name   string `gorm:"column:name" json:"name" form:"name"`
98
+	Status int64  `gorm:"column:status" json:"status" form:"status"`
99
+	Ctime  int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
100
+	Mtime  int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
101
+}
102
+
103
+func (VMDeviceGroup) TableName() string {
104
+	return "xt_device_group"
105
+}
106
+
107
+type VMDeviceZone struct {
108
+	ID     int64  `gorm:"column:id" json:"id" form:"id"`
109
+	OrgId  int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
110
+	Name   string `gorm:"column:name" json:"name" form:"name"`
111
+	Type   int64  `gorm:"column:type" json:"type" form:"type"`
112
+	Status int64  `gorm:"column:status" json:"status" form:"status"`
113
+	Ctime  int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
114
+	Mtime  int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
115
+}
116
+
117
+func (VMDeviceZone) TableName() string {
118
+	return "xt_device_zone"
119
+}
120
+
121
+type VMDeviceNumber struct {
122
+	ID      int64  `gorm:"column:id" json:"id" form:"id"`
123
+	OrgId   int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
124
+	Number  string `gorm:"column:number" json:"number" form:"number"`
125
+	GroupId int64  `gorm:"column:group_id" json:"group_id" form:"group_id"`
126
+	ZoneId  int64  `gorm:"column:zone_id" json:"zone_id" form:"zone_id"`
127
+	Status  int64  `gorm:"column:status" json:"status" form:"status"`
128
+	Ctime   int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
129
+	Mtime   int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
130
+}
131
+
132
+func (VMDeviceNumber) TableName() string {
133
+	return "xt_device_number"
134
+}
135
+
136
+type VMSchedule struct {
137
+	ID           int64 `gorm:"column:id" json:"id" form:"id"`
138
+	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
139
+	PartitionId  int64 `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
140
+	BedId        int64 `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
141
+	PatientId    int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
142
+	ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
143
+	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
144
+	ScheduleWeek int64 `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
145
+	ModeId       int64 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
146
+	Status       int64 `gorm:"column:status" json:"status" form:"status"`
147
+	CreatedTime  int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
148
+	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
149
+}
150
+
151
+func (VMSchedule) TableName() string {
152
+	return "xt_schedule"
153
+}

+ 5 - 0
service/orginfo_service.go View File

@@ -135,3 +135,8 @@ func createOrgApp(tx *gorm.DB, superAdminRole *models.Role, userName string, app
135 135
 	}
136 136
 	return nil
137 137
 }
138
+
139
+func GetOrgTypeByName(org_type_name string) (org_type models.OrgType) {
140
+	readUserDb.Model(&models.OrgType{}).Where("status = 1 AND name = ?", org_type_name).First(&org_type)
141
+	return
142
+}

+ 23 - 0
service/vm_service.go View File

@@ -0,0 +1,23 @@
1
+package service
2
+
3
+import "XT_New/models"
4
+
5
+func CreateVMOrgPatient(patients *models.VMOrgPatients) {
6
+	writeDb.Model(&models.VMOrgPatients{}).Create(&patients)
7
+}
8
+
9
+func CreateVMZone(zone *models.VMDeviceZone) {
10
+	writeDb.Model(&models.VMDeviceZone{}).Create(&zone)
11
+}
12
+
13
+func CreateVMGroup(group *models.VMDeviceGroup) {
14
+	writeDb.Model(&models.VMDeviceGroup{}).Create(&group)
15
+}
16
+
17
+func CreateVMDeviceNumber(number *models.VMDeviceNumber) {
18
+	writeDb.Model(&models.VMDeviceNumber{}).Create(&number)
19
+}
20
+
21
+func CreateVMSch(sch *models.VMSchedule) {
22
+	writeDb.Model(&models.VMSchedule{}).Create(&sch)
23
+}