XMLWAN 4 年之前
父節點
當前提交
6183f08a2c

+ 1 - 1
conf/app.conf 查看文件

@@ -1,5 +1,5 @@
1 1
 appname = 血透
2
-httpport = 9529
2
+httpport = 9531
3 3
 runmode = dev
4 4
 
5 5
 # 1

+ 8 - 1
controllers/gobal_config_api_controller.go 查看文件

@@ -1027,12 +1027,19 @@ func (this *GobalConfigApiController) ChangeOrg() {
1027 1027
 			}
1028 1028
 		}
1029 1029
 
1030
+		//产寻该机构是否有收缩压和舒张压
1031
+		pressure, err := service.GetDefaultSystolicPressure(tempOrg.Id)
1032
+		fmt.Println(err)
1033
+		if len(pressure) == 0 {
1034
+			err = service.BathInsertQualityControlTwo(tempOrg.Id)
1035
+		} else {
1036
+			utils.ErrorLog("字段批量插入失败:%v", err)
1037
+		}
1030 1038
 		major, err := service.GetInspectionMajor(tempOrg.Id)
1031 1039
 		if len(major) == 0 {
1032 1040
 			QualityeList, err := service.FindQualityByOrgId(tempOrg.Id)
1033 1041
 			if len(QualityeList) == 0 {
1034 1042
 				err = service.BatchInsertQualityControl(tempOrg.Id)
1035
-				err = service.BathInsertQualityControlTwo(tempOrg.Id)
1036 1043
 			} else {
1037 1044
 				utils.ErrorLog("字段批量插入失败:%v", err)
1038 1045
 			}

+ 9 - 1
controllers/mobile_api_controllers/login_api_controller.go 查看文件

@@ -6,6 +6,7 @@ import (
6 6
 	"XT_New/service"
7 7
 	"XT_New/utils"
8 8
 	"encoding/json"
9
+	"fmt"
9 10
 	"io/ioutil"
10 11
 	"net/http"
11 12
 	"net/url"
@@ -168,6 +169,14 @@ func (this *LoginAPIController) LoginByPwd() {
168 169
 				FiledList = make([]*models.FiledConfig, 0)
169 170
 			}
170 171
 		}
172
+		//产寻该机构是否有收缩压和舒张压
173
+		pressure, err := service.GetDefaultSystolicPressure(org.Id)
174
+		fmt.Println(err)
175
+		if len(pressure) == 0 {
176
+			err = service.BathInsertQualityControlTwo(org.Id)
177
+		} else {
178
+			utils.ErrorLog("字段批量插入失败:%v", err)
179
+		}
171 180
 
172 181
 		//批量插入质控达标统计配置
173 182
 		major, requestErr := service.GetInspectionMajor(org.Id)
@@ -175,7 +184,6 @@ func (this *LoginAPIController) LoginByPwd() {
175 184
 			QualityeList, err := service.FindQualityByOrgId(org.Id)
176 185
 			if len(QualityeList) == 0 {
177 186
 				err = service.BatchInsertQualityControl(org.Id)
178
-				err = service.BathInsertQualityControlTwo(org.Id)
179 187
 			} else {
180 188
 				utils.ErrorLog("字段批量插入失败:%v", err)
181 189
 			}

+ 25 - 0
controllers/new_mobile_api_controllers/common_api_controller.go 查看文件

@@ -2032,3 +2032,28 @@ func (this *CommonApiController) GetMonthBloodList() {
2032 2032
 		})
2033 2033
 	}
2034 2034
 }
2035
+
2036
+func (this *CommonApiController) GetIdsListTwo() {
2037
+	dataBody := make(map[string]interface{}, 0)
2038
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
2039
+	fmt.Println(err)
2040
+	adminInfo := this.GetAdminUserInfo()
2041
+	orgId := adminInfo.CurrentOrgId
2042
+	patientid, _ := this.GetInt64("patientid")
2043
+	idlist := dataBody["ids"].([]interface{})
2044
+
2045
+	var vlist []interface{}
2046
+	for _, contagion := range idlist {
2047
+		id := int64(contagion.(float64))
2048
+		list, _ := service.GetInspectionMoninList(id, orgId, patientid)
2049
+		vlist = append(vlist, list)
2050
+	}
2051
+	if err != nil {
2052
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2053
+		return
2054
+	}
2055
+	this.ServeSuccessJSON(map[string]interface{}{
2056
+		"vlist": vlist,
2057
+	})
2058
+
2059
+}

+ 1 - 0
controllers/new_mobile_api_controllers/common_api_router.go 查看文件

@@ -55,4 +55,5 @@ func CommonApiControllersRegisterRouters() {
55 55
 	beego.Router("/com/api/updatebloodprussre", &CommonApiController{}, "Post:UpdateBloodPrussre")
56 56
 	beego.Router("/com/api/getbloodpressurelist", &CommonApiController{}, "Get:GetBloodPressureList")
57 57
 	beego.Router("/com/api/getmonthbloodlist", &CommonApiController{}, "Get:GetMonthBloodList")
58
+	beego.Router("/com/api/getidslist", &CommonApiController{}, "Post:GetIdsListTwo")
58 59
 }

+ 9 - 1
controllers/new_mobile_api_controllers/forget_password_controller.go 查看文件

@@ -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"
@@ -180,12 +181,19 @@ func (this *ForgetPwdController) ModifyPassword() {
180 181
 			}
181 182
 
182 183
 			if org.Id > 0 {
184
+				//产寻该机构是否有收缩压和舒张压
185
+				pressure, err := service.GetDefaultSystolicPressure(org.Id)
186
+				fmt.Println(err)
187
+				if len(pressure) == 0 {
188
+					err = service.BathInsertQualityControlTwo(org.Id)
189
+				} else {
190
+					utils.ErrorLog("字段批量插入失败:%v", err)
191
+				}
183 192
 				major, requestErr := service.GetInspectionMajor(org.Id)
184 193
 				if len(major) == 0 {
185 194
 					QualityeList, err := service.FindQualityByOrgId(org.Id)
186 195
 					if len(QualityeList) == 0 {
187 196
 						err = service.BatchInsertQualityControl(org.Id)
188
-						err = service.BathInsertQualityControlTwo(org.Id)
189 197
 					} else {
190 198
 						utils.ErrorLog("字段批量插入失败:%v", err)
191 199
 					}

+ 9 - 1
controllers/new_mobile_api_controllers/home_api_controller.go 查看文件

@@ -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"
@@ -233,12 +234,19 @@ func (this *HomeController) ChangeOrg() {
233 234
 			}
234 235
 
235 236
 			if org.Id > 0 {
237
+				//产寻该机构是否有收缩压和舒张压
238
+				pressure, err := service.GetDefaultSystolicPressure(org.Id)
239
+				fmt.Println(err)
240
+				if len(pressure) == 0 {
241
+					err = service.BathInsertQualityControlTwo(org.Id)
242
+				} else {
243
+					utils.ErrorLog("字段批量插入失败:%v", err)
244
+				}
236 245
 				major, err := service.GetInspectionMajor(org.Id)
237 246
 				if len(major) == 0 {
238 247
 					QualityeList, err := service.FindQualityByOrgId(org.Id)
239 248
 					if len(QualityeList) == 0 {
240 249
 						err = service.BatchInsertQualityControl(org.Id)
241
-						err = service.BathInsertQualityControlTwo(org.Id)
242 250
 					} else {
243 251
 						utils.ErrorLog("字段批量插入失败:%v", err)
244 252
 					}

+ 25 - 0
controllers/new_mobile_api_controllers/new_common_api_controller.go 查看文件

@@ -5,6 +5,7 @@ import (
5 5
 	"XT_New/enums"
6 6
 	"XT_New/service"
7 7
 	"XT_New/utils"
8
+	"encoding/json"
8 9
 	"fmt"
9 10
 	"time"
10 11
 )
@@ -1956,3 +1957,27 @@ func (this *NewCommonApiController) GetSystolicBloodStand() {
1956 1957
 		"bloodPressure": bloodPressure,
1957 1958
 	})
1958 1959
 }
1960
+
1961
+func (this *NewCommonApiController) GetMobileIdsList() {
1962
+	dataBody := make(map[string]interface{}, 0)
1963
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
1964
+	fmt.Println(err)
1965
+	admin := this.GetMobileAdminUserInfo()
1966
+	orgId := admin.Org.Id
1967
+	patientid, _ := this.GetInt64("patientid")
1968
+	idlist := dataBody["ids"].([]interface{})
1969
+
1970
+	var vlist []interface{}
1971
+	for _, contagion := range idlist {
1972
+		id := int64(contagion.(float64))
1973
+		list, _ := service.GetInspectionMoninList(id, orgId, patientid)
1974
+		vlist = append(vlist, list)
1975
+	}
1976
+	if err != nil {
1977
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1978
+		return
1979
+	}
1980
+	this.ServeSuccessJSON(map[string]interface{}{
1981
+		"vlist": vlist,
1982
+	})
1983
+}

+ 1 - 0
controllers/new_mobile_api_controllers/new_common_api_router.go 查看文件

@@ -40,4 +40,5 @@ func NewCommonApiControllersRegisterRouters() {
40 40
 	beego.Router("/m/api/gettargetnostanddetail", &NewCommonApiController{}, "Get:GetTargetNoStandDetail")
41 41
 	beego.Router("/m/api/gettargestanddetail", &NewCommonApiController{}, "Get:GetTargetStandDetail")
42 42
 	beego.Router("/m/api/getsystolicbloodstand", &NewCommonApiController{}, "Get:GetSystolicBloodStand")
43
+	beego.Router("/m/api/getmobileidslist", &NewCommonApiController{}, "post:GetMobileIdsList")
43 44
 }

+ 9 - 1
controllers/new_mobile_api_controllers/new_login_api_controller.go 查看文件

@@ -296,12 +296,20 @@ func (this *NewLoginApiController) LoginByCs() {
296 296
 			}
297 297
 
298 298
 			if org.Id > 0 {
299
+				//产寻该机构是否有收缩压和舒张压
300
+				pressure, err := service.GetDefaultSystolicPressure(org.Id)
301
+				fmt.Println(err)
302
+				if len(pressure) == 0 {
303
+					err = service.BathInsertQualityControlTwo(org.Id)
304
+				} else {
305
+					utils.ErrorLog("字段批量插入失败:%v", err)
306
+				}
299 307
 				major, requestErr := service.GetInspectionMajor(org.Id)
300 308
 				if len(major) == 0 {
301 309
 					QualityeList, err := service.FindQualityByOrgId(org.Id)
302 310
 					if len(QualityeList) == 0 {
303 311
 						err = service.BatchInsertQualityControl(org.Id)
304
-						err = service.BathInsertQualityControlTwo(org.Id)
312
+
305 313
 					} else {
306 314
 						utils.ErrorLog("字段批量插入失败0:%v", err)
307 315
 					}

+ 8 - 2
controllers/verify_login_controller.go 查看文件

@@ -157,13 +157,19 @@ func (this *VerifyUserLoginAPIController) VerifyToken() {
157 157
 					utils.ErrorLog("字段批量插入失败:%v", err)
158 158
 				}
159 159
 			}
160
-
160
+			//产寻该机构是否有收缩压和舒张压
161
+			pressure, err := service.GetDefaultSystolicPressure(curOrg.Id)
162
+			fmt.Println(err)
163
+			if len(pressure) == 0 {
164
+				err = service.BathInsertQualityControlTwo(curOrg.Id)
165
+			} else {
166
+				utils.ErrorLog("字段批量插入失败:%v", err)
167
+			}
161 168
 			major, err := service.GetInspectionMajor(curOrg.Id)
162 169
 			if len(major) == 0 {
163 170
 				QualityeList, err := service.FindQualityByOrgId(curOrg.Id)
164 171
 				if len(QualityeList) == 0 {
165 172
 					err = service.BatchInsertQualityControl(curOrg.Id)
166
-					err = service.BathInsertQualityControlTwo(curOrg.Id)
167 173
 				} else {
168 174
 					utils.ErrorLog("字段批量插入失败:%v", err)
169 175
 				}

+ 6 - 0
service/common_service.go 查看文件

@@ -3220,3 +3220,9 @@ func GetDiastolicStand(orgid int64, startime int64, endtime int64) (record []*mo
3220 3220
 	err = db.Select("x.id,x.systolic_blood_pressure,x.diastolic_blood_pressure,x.patient_id,x.monitoring_date,s.name").Joins("left join xt_patients as s on s.id = x.patient_id").Where("x.user_org_id = ? and x.monitoring_date >=? and x.monitoring_date<=? and x.status = 1 and (x.systolic_blood_pressure <> 0 or x.diastolic_blood_pressure)", orgid, startime, endtime).Group("x.monitoring_date,x.patient_id").Scan(&record).Error
3221 3221
 	return record, err
3222 3222
 }
3223
+
3224
+func GetInspectionMoninList(id int64, orgid int64, patientid int64) (models.XtInspection, error) {
3225
+	inspection := models.XtInspection{}
3226
+	err = XTReadDB().Model(&inspection).Where("item_id=? and org_id = ? and status = 1 and patient_id = ?", id, orgid, patientid).Last(&inspection).Error
3227
+	return inspection, err
3228
+}

+ 7 - 1
service/data.go 查看文件

@@ -173,7 +173,13 @@ func FindFiledByOrgId(org_id int64) (filedConfig []*models.FiledConfig, err erro
173 173
 
174 174
 func FindQualityByOrgId(orgid int64) (xtquality []*models.XtQualityControlStandard, err error) {
175 175
 
176
-	err = readDb.Model(&models.XtQualityControlStandard{}).Where("user_org_id =? and status =1", orgid).Find(&xtquality).Error
176
+	err = readDb.Model(&models.XtQualityControlStandard{}).Where("user_org_id =? and status =1 and is_status = 1", orgid).Find(&xtquality).Error
177
+	return
178
+}
179
+
180
+func GetDefaultSystolicPressure(orgid int64) (xtquality []*models.XtQualityControlStandard, err error) {
181
+
182
+	err = readDb.Model(&models.XtQualityControlStandard{}).Where("user_org_id = ? and status = 1 and is_status =0", orgid).Find(&xtquality).Error
177 183
 	return
178 184
 }
179 185