瀏覽代碼

体积小

XMLWAN 3 年之前
父節點
當前提交
72e87945cf
共有 1 個文件被更改,包括 118 次插入1 次删除
  1. 118 1
      controllers/xcx_mobile_api_controller.go/xcx_api_controller.go

+ 118 - 1
controllers/xcx_mobile_api_controller.go/xcx_api_controller.go 查看文件

@@ -105,8 +105,125 @@ func (this *XcxApiController) GetUserRegister() {
105 105
 		return
106 106
 	}
107 107
 
108
-	if code == "13535547901" {
108
+	if code == "000000" {
109
+		patient, errcodes := service.GetMobilePatient(mobile, id_card_no)
110
+		fmt.Println("errcodes2323232232", errcodes)
111
+		if errcodes == nil {
112
+			role := models.XcxAdminUserRole{
113
+				PatientName: name,
114
+				IdCardNo:    id_card_no,
115
+				Mobile:      mobile,
116
+				Code:        code,
117
+				PatientId:   patient.ID,
118
+				UserOrgId:   patient.UserOrgId,
119
+				Status:      1,
120
+				Ctime:       time.Now().Unix(),
121
+				Mtime:       0,
122
+				Appid:       "",
123
+				Appsecret:   "",
124
+				SessionKey:  "",
125
+			}
126
+
127
+			//查找该电话号码是否存在
128
+			_, errcode := service.GetMobilePatientOne(mobile)
129
+			if errcode == gorm.ErrRecordNotFound {
130
+				err := service.CreateXcxAdminUser(role)
131
+				if err == nil {
132
+					mobilePatient, _ := service.GetMobilePatient(mobile, id_card_no)
133
+					template_id, _ := service.GetTemplateMode(mobilePatient.UserOrgId)
134
+					//处方
135
+					prescripition_config, _ := service.GetPrescripionFieldConfig(mobilePatient.UserOrgId)
136
+
137
+					//接诊评估
138
+					receive_treatement_config, _ := service.GetReceiveTreatmentAssess(mobilePatient.UserOrgId)
139
+
140
+					//透前评估
141
+					dialysis_befor, _ := service.GetDialysisBefor(mobilePatient.UserOrgId)
142
+
143
+					//透析上机
144
+					dialysis_order, _ := service.GetDialysisOrderConfig(mobilePatient.UserOrgId)
145
+
146
+					//透析监测
147
+					monitor_record, _ := service.GetMonitorRecordConfig(mobilePatient.UserOrgId)
148
+
149
+					//透后评估
150
+					dialysis_after, _ := service.GetDialysisAfeterConfig(mobilePatient.UserOrgId)
109 151
 
152
+					treate_ment, _ := service.GetTreatMentConfig(mobilePatient.UserOrgId)
153
+					var configList interface{}
154
+					configList, _ = service.GetConfigList(mobilePatient.UserOrgId)
155
+					this.ServeSuccessJSON(map[string]interface{}{
156
+						"role":                      role,
157
+						"is_bind":                   true,
158
+						"patient":                   mobilePatient,
159
+						"template_id":               template_id,
160
+						"user_org_id":               mobilePatient.UserOrgId,
161
+						"prescripition_config":      prescripition_config,
162
+						"receive_treatement_config": receive_treatement_config,
163
+						"dialysis_befor":            dialysis_befor,
164
+						"dialysis_order":            dialysis_order,
165
+						"monitor_record":            monitor_record,
166
+						"dialysis_after":            dialysis_after,
167
+						"treate_ment":               treate_ment,
168
+						"configList":                configList,
169
+						"result":                    false,
170
+					})
171
+				} else {
172
+					this.ServeSuccessJSON(map[string]interface{}{
173
+						"is_bind": false,
174
+						"msg":     "绑定失败",
175
+						"result":  false,
176
+					})
177
+				}
178
+			} else if errcode == nil {
179
+				mobilePatient, _ := service.GetMobilePatient(mobile, id_card_no)
180
+				template_id, _ := service.GetTemplateMode(mobilePatient.UserOrgId)
181
+				//处方
182
+				prescripition_config, _ := service.GetPrescripionFieldConfig(mobilePatient.UserOrgId)
183
+
184
+				//接诊评估
185
+				receive_treatement_config, _ := service.GetReceiveTreatmentAssess(mobilePatient.UserOrgId)
186
+
187
+				//透前评估
188
+				dialysis_befor, _ := service.GetDialysisBefor(mobilePatient.UserOrgId)
189
+
190
+				//透析上机
191
+				dialysis_order, _ := service.GetDialysisOrderConfig(mobilePatient.UserOrgId)
192
+
193
+				//透析监测
194
+				monitor_record, _ := service.GetMonitorRecordConfig(mobilePatient.UserOrgId)
195
+
196
+				//透后评估
197
+				dialysis_after, _ := service.GetDialysisAfeterConfig(mobilePatient.UserOrgId)
198
+
199
+				treate_ment, _ := service.GetTreatMentConfig(mobilePatient.UserOrgId)
200
+				var configList interface{}
201
+				configList, _ = service.GetConfigList(mobilePatient.UserOrgId)
202
+				this.ServeSuccessJSON(map[string]interface{}{
203
+					"is_bind":                   true,
204
+					"patient":                   mobilePatient,
205
+					"template_id":               template_id,
206
+					"user_org_id":               mobilePatient.UserOrgId,
207
+					"prescripition_config":      prescripition_config,
208
+					"receive_treatement_config": receive_treatement_config,
209
+					"dialysis_befor":            dialysis_befor,
210
+					"dialysis_order":            dialysis_order,
211
+					"monitor_record":            monitor_record,
212
+					"dialysis_after":            dialysis_after,
213
+					"treate_ment":               treate_ment,
214
+					"list":                      configList,
215
+					"result":                    false,
216
+				})
217
+			}
218
+
219
+			fmt.Println("roler", role)
220
+		} else if errcodes == gorm.ErrRecordNotFound {
221
+			this.ServeSuccessJSON(map[string]interface{}{
222
+				"is_bind": false,
223
+				"result":  false,
224
+			})
225
+		}
226
+		this.ServeJSON()
110 227
 	} else {
111 228
 		redisClient := service.RedisClient()
112 229
 		defer redisClient.Close()