Browse Source

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

csx 4 years ago
parent
commit
ba3bf013d8

+ 218 - 4
controllers/new_mobile_api_controllers/common_api_controller.go View File

@@ -7,6 +7,8 @@ import (
7 7
 	"XT_New/service"
8 8
 	"encoding/json"
9 9
 	"fmt"
10
+	"github.com/jinzhu/gorm"
11
+	"strconv"
10 12
 	"time"
11 13
 )
12 14
 
@@ -28,7 +30,6 @@ func (this *CommonApiController) GetInspectionMajor() {
28 30
 
29 31
 func (this *CommonApiController) GetInspectionMinor() {
30 32
 	id, _ := this.GetInt64("id")
31
-	fmt.Println("id----------------------------------------", id)
32 33
 	minor, err := service.GetInspectionMinor(id)
33 34
 	if err != nil {
34 35
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
@@ -55,8 +56,6 @@ func (this *CommonApiController) GetInspectionRange() {
55 56
 func (this *CommonApiController) SaveConfiguration() {
56 57
 	adminInfo := this.GetAdminUserInfo()
57 58
 	orgid := adminInfo.CurrentOrgId
58
-	fmt.Println(orgid)
59
-	fmt.Println("触发-------------------0")
60 59
 	dataBody := make(map[string]interface{}, 0)
61 60
 	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
62 61
 	fmt.Println("err", err)
@@ -69,13 +68,14 @@ func (this *CommonApiController) SaveConfiguration() {
69 68
 	largerange := dataBody["large_range"].(string)
70 69
 	fmt.Println("largerange", largerange)
71 70
 	sort := dataBody["sort"].(string)
71
+	sorts, err := strconv.ParseInt(sort, 10, 64)
72 72
 	fmt.Println("sort", sort)
73 73
 	standard := models.XtQualityControlStandard{
74 74
 		InspectionMajor: inspectionmajor,
75 75
 		InspectionMinor: inspectionMinor,
76 76
 		MinRange:        minrange,
77 77
 		LargeRange:      largerange,
78
-		Sort:            sort,
78
+		Sort:            sorts,
79 79
 		UserOrgId:       orgid,
80 80
 		Status:          1,
81 81
 		CreatedTime:     time.Now().Unix(),
@@ -106,3 +106,217 @@ func (this *CommonApiController) GetConfigurationlist() {
106 106
 		"total":             total,
107 107
 	})
108 108
 }
109
+
110
+func (this *CommonApiController) GetConfigurationDetail() {
111
+	id, _ := this.GetInt64("id")
112
+	fmt.Println("id是", id)
113
+	detail, err := service.GetConfigurationDetail(id)
114
+	if err != nil {
115
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
116
+		return
117
+	}
118
+	this.ServeSuccessJSON(map[string]interface{}{
119
+		"configurationdetail": detail,
120
+	})
121
+}
122
+
123
+func (this *CommonApiController) GetAllInspectionminor() {
124
+
125
+	minor, err := service.GetAllInspectionMinor(0)
126
+	if err != nil {
127
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
128
+		return
129
+	}
130
+	this.ServeSuccessJSON(map[string]interface{}{
131
+		"minor": minor,
132
+	})
133
+}
134
+
135
+func (this *CommonApiController) UpdateConfiguration() {
136
+	id, _ := this.GetInt64("id")
137
+	fmt.Println("id", id)
138
+	dataBody := make(map[string]interface{}, 0)
139
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
140
+	fmt.Println("err", err)
141
+	inspectionmajor := int64(dataBody["inspectionMajor"].(float64))
142
+	fmt.Println("大项", inspectionmajor)
143
+	inspectionMinor := int64(dataBody["inspectionMinor"].(float64))
144
+	fmt.Println("小项", inspectionMinor)
145
+	minrange := dataBody["min_range"].(string)
146
+	fmt.Println("minragne", minrange)
147
+	largerange := dataBody["large_range"].(string)
148
+	fmt.Println("largerange", largerange)
149
+	sort := int64(dataBody["sort"].(float64))
150
+
151
+	standard := models.XtQualityControlStandard{
152
+		InspectionMajor: inspectionmajor,
153
+		InspectionMinor: inspectionMinor,
154
+		MinRange:        minrange,
155
+		LargeRange:      largerange,
156
+		Sort:            sort,
157
+	}
158
+	err = service.UpdarteConfiguration(&standard, id)
159
+	if err != nil {
160
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
161
+		return
162
+	}
163
+	this.ServeSuccessJSON(map[string]interface{}{
164
+		"standard": standard,
165
+	})
166
+}
167
+
168
+func (this *CommonApiController) DeleteConfiguration() {
169
+	id, _ := this.GetInt64("id")
170
+	err := service.DeleteConfiguration(id)
171
+	if err != nil {
172
+		this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
173
+		return
174
+	}
175
+	returnData := make(map[string]interface{}, 0)
176
+	returnData["msg"] = "ok"
177
+	this.ServeSuccessJSON(returnData)
178
+	return
179
+}
180
+
181
+func (this *CommonApiController) GetAllInspectiondata() {
182
+	adminUser := this.GetAdminUserInfo()
183
+	orgid := adminUser.CurrentOrgId
184
+
185
+	//查询该机构是否有数据
186
+	_, errcode := service.GetAllInspectionData(orgid)
187
+	if errcode == gorm.ErrRecordNotFound {
188
+		inspection, err := service.GetAllInspectiondatatwo(0)
189
+		if err != nil {
190
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
191
+			return
192
+		}
193
+		this.ServeSuccessJSON(map[string]interface{}{
194
+			"inspection": inspection,
195
+		})
196
+	} else if errcode == nil {
197
+		inspection, err := service.GetAllInspectiondatatwo(orgid)
198
+		if err != nil {
199
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
200
+			return
201
+		}
202
+		this.ServeSuccessJSON(map[string]interface{}{
203
+			"inspection": inspection,
204
+		})
205
+	}
206
+
207
+}
208
+
209
+func (this *CommonApiController) SaveCheckConfiguration() {
210
+	dataBody := make(map[string]interface{}, 0)
211
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
212
+	fmt.Println("err", err)
213
+	adminUser := this.GetAdminUserInfo()
214
+	orgid := adminUser.CurrentOrgId
215
+	inspectionmajor := int64(dataBody["inspectionMajor"].(float64))
216
+	fmt.Println("大项", inspectionmajor)
217
+	frequency := dataBody["frequency"].(string)
218
+	fmt.Println("凭次", frequency)
219
+	sort := dataBody["sort"].(string)
220
+	sorts, err := strconv.ParseInt(sort, 10, 64)
221
+	fmt.Println("sort", sort)
222
+	_, errcode := service.GetInspectionMajorById(inspectionmajor)
223
+	if errcode == gorm.ErrRecordNotFound {
224
+		configuration := models.XtCheckConfiguration{
225
+			InspectionMajor:     inspectionmajor,
226
+			InspectionFrequency: frequency,
227
+			Sort:                sorts,
228
+			UserOrgId:           orgid,
229
+			Status:              1,
230
+			CreatedTime:         time.Now().Unix(),
231
+		}
232
+		err := service.CreateCheckConfiguration(&configuration)
233
+		if err != nil {
234
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
235
+			return
236
+		}
237
+		this.ServeSuccessJSON(map[string]interface{}{
238
+			"configuration": configuration,
239
+		})
240
+	} else if errcode == nil {
241
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
242
+		return
243
+	}
244
+}
245
+
246
+func (this *CommonApiController) GetAllCheckList() {
247
+	adminUser := this.GetAdminUserInfo()
248
+	orgid := adminUser.CurrentOrgId
249
+	fmt.Println("org", orgid)
250
+	page, _ := this.GetInt64("page")
251
+	limit, _ := this.GetInt64("limit")
252
+	checkList, total, err := service.GetAllCheckList(orgid, page, limit)
253
+	if err != nil {
254
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
255
+		return
256
+	}
257
+	this.ServeSuccessJSON(map[string]interface{}{
258
+		"checklist": checkList,
259
+		"total":     total,
260
+	})
261
+}
262
+
263
+func (this *CommonApiController) GetCheckdetail() {
264
+
265
+	id, _ := this.GetInt64("id")
266
+	detail, err := service.GetCheckDetail(id)
267
+	if err != nil {
268
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
269
+		return
270
+	}
271
+	this.ServeSuccessJSON(map[string]interface{}{
272
+		"checkdetail": detail,
273
+	})
274
+}
275
+
276
+func (this *CommonApiController) UpdateCheck() {
277
+	id, _ := this.GetInt64("id")
278
+	fmt.Println(id)
279
+	dataBody := make(map[string]interface{}, 0)
280
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
281
+	fmt.Println(err)
282
+	inspectionmajor := int64(dataBody["inspectionMajor"].(float64))
283
+	fmt.Println("大项", inspectionmajor)
284
+	frequency := dataBody["frequency"].(string)
285
+	fmt.Println("凭次", frequency)
286
+	sort := int64(dataBody["sort"].(float64))
287
+	fmt.Println("sort", sort)
288
+
289
+	Inspection, err := service.GetInspectionMajorById(inspectionmajor)
290
+	if Inspection.ID > 0 && Inspection.ID != id {
291
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
292
+		return
293
+	}
294
+
295
+	configuration := models.XtCheckConfiguration{
296
+		InspectionMajor:     inspectionmajor,
297
+		InspectionFrequency: frequency,
298
+		Sort:                sort,
299
+	}
300
+
301
+	err = service.UpdateCheck(&configuration, id)
302
+	if err != nil {
303
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
304
+		return
305
+	}
306
+	this.ServeSuccessJSON(map[string]interface{}{
307
+		"configuration": configuration,
308
+	})
309
+}
310
+
311
+func (this *CommonApiController) DeleteCheck() {
312
+	id, _ := this.GetInt64("id")
313
+	err := service.DeleteCheck(id)
314
+	if err != nil {
315
+		this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
316
+		return
317
+	}
318
+	returnData := make(map[string]interface{}, 0)
319
+	returnData["msg"] = "ok"
320
+	this.ServeSuccessJSON(returnData)
321
+	return
322
+}

+ 10 - 0
controllers/new_mobile_api_controllers/common_api_router.go View File

@@ -11,4 +11,14 @@ func CommonApiControllersRegisterRouters() {
11 11
 	beego.Router("/com/api/getinspectionrange", &CommonApiController{}, "Get:GetInspectionRange")
12 12
 	beego.Router("/com/api/saveconfiguration", &CommonApiController{}, "Post:SaveConfiguration")
13 13
 	beego.Router("com/api/getconfigurationlist", &CommonApiController{}, "Get:GetConfigurationlist")
14
+	beego.Router("com/api/getconfigurationdetail", &CommonApiController{}, "Get:GetConfigurationDetail")
15
+	beego.Router("com/api/getallinspectionminor", &CommonApiController{}, "Get:GetAllInspectionminor")
16
+	beego.Router("com/api/updateconfiguration", &CommonApiController{}, "Post:UpdateConfiguration")
17
+	beego.Router("com/api/deleteconfiguration", &CommonApiController{}, "Delete:DeleteConfiguration")
18
+	beego.Router("com/api/getallinspectiondata", &CommonApiController{}, "Get:GetAllInspectiondata")
19
+	beego.Router("/com/api/savecheckconfiguration", &CommonApiController{}, "Post:SaveCheckConfiguration")
20
+	beego.Router("/com/api/getallchecklist", &CommonApiController{}, "Get:GetAllCheckList")
21
+	beego.Router("/com/api/getcheckdetail", &CommonApiController{}, "Get:GetCheckdetail")
22
+	beego.Router("/com/api/updatecheck", &CommonApiController{}, "Post:UpdateCheck")
23
+	beego.Router("/com/api/deletecheck", &CommonApiController{}, "Delete:DeleteCheck")
14 24
 }

+ 29 - 2
models/common_models.go View File

@@ -5,7 +5,7 @@ type QualityControlStandard struct {
5 5
 	InspectionMajor int64  `gorm:"column:inspection_major" json:"inspection_major" form:"inspection_major"`
6 6
 	InspectionMinor int64  `gorm:"column:inspection_minor" json:"inspection_minor" form:"inspection_minor"`
7 7
 	MinRange        string `gorm:"column:min_range" json:"min_range" form:"min_range"`
8
-	Sort            string `gorm:"column:sort" json:"sort" form:"sort"`
8
+	Sort            int64  `gorm:"column:sort" json:"sort" form:"sort"`
9 9
 	UserOrgId       int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
10 10
 	Status          int64  `gorm:"column:status" json:"status" form:"status"`
11 11
 	CreatedTime     int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
@@ -21,7 +21,7 @@ type XtQualityControlStandard struct {
21 21
 	InspectionMajor int64  `gorm:"column:inspection_major" json:"inspection_major" form:"inspection_major"`
22 22
 	InspectionMinor int64  `gorm:"column:inspection_minor" json:"inspection_minor" form:"inspection_minor"`
23 23
 	MinRange        string `gorm:"column:min_range" json:"min_range" form:"min_range"`
24
-	Sort            string `gorm:"column:sort" json:"sort" form:"sort"`
24
+	Sort            int64  `gorm:"column:sort" json:"sort" form:"sort"`
25 25
 	UserOrgId       int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
26 26
 	Status          int64  `gorm:"column:status" json:"status" form:"status"`
27 27
 	CreatedTime     int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
@@ -32,3 +32,30 @@ type XtQualityControlStandard struct {
32 32
 func (XtQualityControlStandard) TableName() string {
33 33
 	return "xt_quality_control_standard"
34 34
 }
35
+
36
+type CheckConfiguration struct {
37
+	ID                  int64  `gorm:"column:id" json:"id" form:"id"`
38
+	InspectionMajor     int64  `gorm:"column:inspection_major" json:"inspection_major" form:"inspection_major"`
39
+	InspectionFrequency string `gorm:"column:inspection_frequency" json:"inspection_frequency" form:"inspection_frequency"`
40
+	Sort                int64  `gorm:"column:sort" json:"sort" form:"sort"`
41
+	UserOrgId           int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
42
+	Status              int64  `gorm:"column:status" json:"status" form:"status"`
43
+	CreatedTime         int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
44
+	UpdatedTime         int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
45
+	ProjectName         string `gorm:"column:project_name" json:"project_name" form:"project_name"`
46
+}
47
+
48
+type XtCheckConfiguration struct {
49
+	ID                  int64  `gorm:"column:id" json:"id" form:"id"`
50
+	InspectionMajor     int64  `gorm:"column:inspection_major" json:"inspection_major" form:"inspection_major"`
51
+	InspectionFrequency string `gorm:"column:inspection_frequency" json:"inspection_frequency" form:"inspection_frequency"`
52
+	Sort                int64  `gorm:"column:sort" json:"sort" form:"sort"`
53
+	UserOrgId           int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
54
+	Status              int64  `gorm:"column:status" json:"status" form:"status"`
55
+	CreatedTime         int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
56
+	UpdatedTime         int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
57
+}
58
+
59
+func (XtCheckConfiguration) TableName() string {
60
+	return "xt_check_configuration"
61
+}

+ 95 - 4
service/common_service.go View File

@@ -3,6 +3,8 @@ package service
3 3
 import (
4 4
 	"XT_New/models"
5 5
 	"fmt"
6
+	"github.com/jinzhu/gorm"
7
+	"time"
6 8
 )
7 9
 
8 10
 func GetInspectionMajor(orgid int64) (inspection []*models.XtInspectionReference, err error) {
@@ -31,9 +33,6 @@ func SaveInspection(standard *models.XtQualityControlStandard) error {
31 33
 
32 34
 func GetConfigurationlist(orgid int64, limit int64, page int64) (standard []*models.QualityControlStandard, total int64, err error) {
33 35
 
34
-	//err = XTReadDB().Model(&standard).Where("user_org_id = ? and status =1", orgid).Order("sort asc,created_time desc").Find(&standard).Error
35
-	//return standard,err
36
-
37 36
 	db := XTReadDB().Table("xt_quality_control_standard as x").Where("x.status =1")
38 37
 	if orgid > 0 {
39 38
 		db = db.Where("x.user_org_id = ?", orgid)
@@ -41,7 +40,99 @@ func GetConfigurationlist(orgid int64, limit int64, page int64) (standard []*mod
41 40
 	table := XTReadDB().Table("xt_inspection_reference as s")
42 41
 	fmt.Println(table)
43 42
 	offset := (page - 1) * limit
44
-	err = db.Order("x.sort asc").Group("x.id").Select("x.id,x.inspection_major,x.inspection_minor,x.min_range,x.large_range,x.sort,x.user_org_id,s.unit,s.project_name,s.item_name").Count(&total).
43
+	err = db.Order("x.sort asc,x.created_time desc").Group("x.id").Select("x.id,x.inspection_major,x.inspection_minor,x.min_range,x.large_range,x.sort,x.user_org_id,s.unit,s.project_name,s.item_name").Count(&total).
45 44
 		Joins("left join xt_inspection_reference as s on s.id = x.inspection_minor").Offset(offset).Limit(limit).Scan(&standard).Error
46 45
 	return standard, total, err
47 46
 }
47
+
48
+func GetConfigurationDetail(id int64) (models.XtQualityControlStandard, error) {
49
+	standard := models.XtQualityControlStandard{}
50
+	err := XTReadDB().Model(&standard).Where("id=? and status = 1", id).Find(&standard).Error
51
+	return standard, err
52
+}
53
+
54
+func GetAllInspectionMinor(orgid int64) (standard []*models.XtInspectionReference, err error) {
55
+
56
+	err = XTReadDB().Model(&standard).Where("org_id = ? and status = 1", orgid).Find(&standard).Error
57
+	return standard, err
58
+}
59
+
60
+func UpdarteConfiguration(st *models.XtQualityControlStandard, id int64) error {
61
+
62
+	err := XTWriteDB().Model(&st).Where("id = ?", id).Updates(map[string]interface{}{"inspection_major": st.InspectionMajor, "inspection_minor": st.InspectionMinor, "min_range": st.MinRange, "large_range": st.LargeRange, "sort": st.Sort, "updated_time": time.Now().Unix()}).Error
63
+	return err
64
+}
65
+
66
+func DeleteConfiguration(id int64) (err error) {
67
+
68
+	err = XTWriteDB().Model(models.XtQualityControlStandard{}).Where("id=?", id).Updates(map[string]interface{}{"status": 0, "updated_time": time.Now().Unix()}).Error
69
+	return err
70
+}
71
+
72
+func GetAllInspectionData(orgid int64) (*models.XtInspectionReference, error) {
73
+	diseases := models.XtInspectionReference{}
74
+	err := XTReadDB().Model(&diseases).Where("org_id = ? and status = 1", orgid).Find(&diseases).Error
75
+	if err == gorm.ErrRecordNotFound {
76
+		return nil, err
77
+	}
78
+	if err != nil {
79
+		return nil, err
80
+	}
81
+	return &diseases, nil
82
+}
83
+
84
+func GetAllInspectiondatatwo(orgid int64) (reference []*models.XtInspectionReference, err error) {
85
+
86
+	err = XTReadDB().Model(&reference).Where("org_id = ? and status = 1", orgid).Group("project_name").Find(&reference).Error
87
+	return reference, err
88
+}
89
+
90
+func GetInspectionMajorById(marjor int64) (*models.XtCheckConfiguration, error) {
91
+	configuration := models.XtCheckConfiguration{}
92
+	err := XTReadDB().Model(&configuration).Where("inspection_major = ? and status =1", marjor).Find(&configuration).Error
93
+	if err == gorm.ErrRecordNotFound {
94
+		return nil, err
95
+	}
96
+	if err != nil {
97
+		return nil, err
98
+	}
99
+	return &configuration, nil
100
+}
101
+
102
+func CreateCheckConfiguration(configuration *models.XtCheckConfiguration) error {
103
+	err := XTWriteDB().Create(&configuration).Error
104
+	return err
105
+}
106
+
107
+func GetAllCheckList(orgid int64, page int64, limit int64) (check []*models.CheckConfiguration, total int64, err error) {
108
+
109
+	db := XTReadDB().Table("xt_check_configuration as x").Where("x.status =1")
110
+	table := XTReadDB().Table("xt_inspection_reference as r")
111
+	fmt.Println(table)
112
+	if orgid > 0 {
113
+		db = db.Where("x.user_org_id = ?", orgid)
114
+	}
115
+	offset := (page - 1) * limit
116
+	err = db.Group("x.id").Order("x.sort asc,x.created_time desc").Select("x.id,x.inspection_major,x.inspection_frequency,x.sort,x.user_org_id,r.project_name").Count(&total).
117
+		Joins("left join xt_inspection_reference as r on r.project_id = x.inspection_major").Offset(offset).Limit(limit).Scan(&check).Error
118
+	return check, total, err
119
+}
120
+
121
+func GetCheckDetail(id int64) (models.XtCheckConfiguration, error) {
122
+
123
+	configuration := models.XtCheckConfiguration{}
124
+	err := XTReadDB().Model(&configuration).Where("id=? and status =1", id).Find(&configuration).Error
125
+	return configuration, err
126
+}
127
+
128
+func UpdateCheck(con *models.XtCheckConfiguration, id int64) error {
129
+
130
+	err := XTWriteDB().Model(&con).Where("id=?", id).Updates(map[string]interface{}{"inspection_major": con.InspectionMajor, "inspection_frequency": con.InspectionFrequency, "sort": con.Sort, "updated_time": time.Now().Unix()}).Error
131
+	return err
132
+}
133
+
134
+func DeleteCheck(id int64) error {
135
+
136
+	err := XTWriteDB().Model(models.XtCheckConfiguration{}).Where("id=?", id).Updates(map[string]interface{}{"status": 0, "updated_time": time.Now().Unix()}).Error
137
+	return err
138
+}

+ 26 - 0
service/patient_service.go View File

@@ -1267,6 +1267,32 @@ func CreateExportPatient(patient *models.Patients, contagions []int64, org_creat
1267 1267
 			return
1268 1268
 		}
1269 1269
 	}
1270
+	patientsNew := models.XtPatientsNew{
1271
+		Name:              patient.Name,
1272
+		Gender:            patient.Gender,
1273
+		Phone:             patient.Phone,
1274
+		IdCardNo:          patient.IdCardNo,
1275
+		FirstDialysisDate: patient.FirstDialysisDate,
1276
+		Source:            patient.Source,
1277
+		Lapseto:           patient.Lapseto,
1278
+		IsInfectious:      patient.IsInfectious,
1279
+		DialysisNo:        patient.DialysisNo,
1280
+		Height:            patient.Height,
1281
+		HomeAddress:       patient.HomeAddress,
1282
+		IsExcelExport:     1,
1283
+		BloodPatients:     1,
1284
+		Status:            1,
1285
+		CreatedTime:       time.Now().Unix(),
1286
+		UserOrgId:         patient.UserOrgId,
1287
+		BloodId:           patient.ID,
1288
+		Avatar:            "https://images.shengws.com/201809182128111.png",
1289
+	}
1290
+	err = utx.Create(&patientsNew).Error
1291
+	if err != nil {
1292
+		utx.Rollback()
1293
+		btx.Rollback()
1294
+		return
1295
+	}
1270 1296
 	utx.Commit()
1271 1297
 	btx.Commit()
1272 1298