Bläddra i källkod

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

csx 4 år sedan
förälder
incheckning
0091f9dabc

+ 3 - 3
controllers/manage_api_controller.go Visa fil

@@ -3029,10 +3029,10 @@ func (this *MachineApiController) GetTimeData() {
3029 3029
 	adminUserInfo := this.GetAdminUserInfo()
3030 3030
 	orgid := adminUserInfo.CurrentOrgId
3031 3031
 	timeData, err := service.GetTimeData(equitid, orgid, theTime.Unix())
3032
-	fmt.Print("报错----------------", err)
3032
+	fmt.Print("报错", err)
3033 3033
 	timeDataTwo, err := service.GetTimeTwo(equitid, orgid, theTime.Unix())
3034 3034
 	timeDataThree, err := service.GetTimeThree(equitid, orgid, theTime.Unix())
3035
-	fmt.Print("err报错了没有-------------------------------", err)
3035
+	fmt.Print("err报错了没有", err)
3036 3036
 	if err != nil {
3037 3037
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
3038 3038
 		return
@@ -3047,7 +3047,7 @@ func (this *MachineApiController) GetTimeData() {
3047 3047
 func (this *MachineApiController) DeleteImages() {
3048 3048
 	id, _ := this.GetInt64("id")
3049 3049
 	err := service.DeleteImages(id)
3050
-	fmt.Print("err========", err)
3050
+	fmt.Print("err", err)
3051 3051
 	if err != nil {
3052 3052
 		this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
3053 3053
 		return

+ 67 - 20
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Visa fil

@@ -719,9 +719,11 @@ func (this *NewDialysisApiController) GetAllBloodDialysisPatient() {
719 719
 	fmt.Print("page", page)
720 720
 	limit, _ := this.GetInt64("limit")
721 721
 	fmt.Print("limit", limit)
722
+	lapseto, _ := this.GetInt64("patientstatus")
723
+	source, _ := this.GetInt64("source")
722 724
 	adminUserInfo := this.GetMobileAdminUserInfo()
723 725
 	orgid := adminUserInfo.Org.Id
724
-	patient, total, err := service.GetAllBloodDialysisPatient(orgid, page, limit)
726
+	patient, total, err := service.GetAllBloodDialysisPatient(orgid, page, limit, lapseto, source)
725 727
 	if err != nil {
726 728
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
727 729
 		return
@@ -1546,14 +1548,15 @@ func (this *NewDialysisApiController) GetInspection() {
1546 1548
 }
1547 1549
 
1548 1550
 func (this *NewDialysisApiController) GetMyInformation() {
1549
-	adminUserInfo := this.GetMobileAdminUserInfo()
1550
-
1551
-	roleInfo := adminUserInfo.AppRole
1552
-	es, _ := service.GetAdminUserElectronicSignature(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id)
1553
-
1551
+	id, _ := this.GetInt64("id")
1552
+	fmt.Println("id--------------", id)
1553
+	roleInfo, err := service.GetPosition(id)
1554
+	if err != nil {
1555
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1556
+		return
1557
+	}
1554 1558
 	this.ServeSuccessJSON(map[string]interface{}{
1555
-		"electronic_signature": es,
1556
-		"roleInfo":             roleInfo,
1559
+		"roleInfo": roleInfo,
1557 1560
 	})
1558 1561
 	return
1559 1562
 }
@@ -1661,16 +1664,14 @@ func (this *NewDialysisApiController) DeleteChildInspection() {
1661 1664
 }
1662 1665
 
1663 1666
 func (this *NewDialysisApiController) SaveMessage() {
1664
-	orgid := this.GetMobileAdminUserInfo().Org.Id
1665
-	appid := this.GetMobileAdminUserInfo().App.Id
1666 1667
 	id, _ := this.GetInt64("id")
1667 1668
 	fmt.Println("id", id)
1668 1669
 	message := this.GetString("message")
1669 1670
 	fmt.Println("message", message)
1670
-	role := models.App_Role{
1671
+	role := models.SgjUserAdminRole{
1671 1672
 		Message: message,
1672 1673
 	}
1673
-	err := service.SaveMessage(orgid, appid, id, &role)
1674
+	err := service.SaveMessage(id, &role)
1674 1675
 	if err != nil {
1675 1676
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1676 1677
 		return
@@ -1681,16 +1682,14 @@ func (this *NewDialysisApiController) SaveMessage() {
1681 1682
 }
1682 1683
 
1683 1684
 func (this *NewDialysisApiController) SaveSex() {
1684
-	orgid := this.GetMobileAdminUserInfo().Org.Id
1685
-	appid := this.GetMobileAdminUserInfo().App.Id
1686 1685
 	sex, _ := this.GetInt64("sex")
1687 1686
 	fmt.Println("sex", sex)
1688 1687
 	id, _ := this.GetInt64("id")
1689 1688
 	fmt.Println("id", id)
1690
-	role := models.App_Role{
1689
+	role := models.SgjUserAdminRole{
1691 1690
 		Sex: sex,
1692 1691
 	}
1693
-	err := service.SaveSex(id, orgid, appid, &role)
1692
+	err := service.SaveSex(id, &role)
1694 1693
 	if err != nil {
1695 1694
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1696 1695
 		return
@@ -1701,8 +1700,6 @@ func (this *NewDialysisApiController) SaveSex() {
1701 1700
 }
1702 1701
 
1703 1702
 func (this *NewDialysisApiController) SaveBirthday() {
1704
-	orgid := this.GetMobileAdminUserInfo().Org.Id
1705
-	appid := this.GetMobileAdminUserInfo().App.Id
1706 1703
 	dataBody := make(map[string]interface{}, 0)
1707 1704
 	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
1708 1705
 	fmt.Println(err)
@@ -1713,10 +1710,10 @@ func (this *NewDialysisApiController) SaveBirthday() {
1713 1710
 	timeLayout := "2006-01-02 15:04:05"
1714 1711
 	theTime, err := utils.ParseTimeStringToTime(timeLayout, birthday+" 00:00:00")
1715 1712
 	birth := theTime.Unix()
1716
-	role := models.App_Role{
1713
+	role := models.SgjUserAdminRole{
1717 1714
 		Birthday: birth,
1718 1715
 	}
1719
-	err = service.SaveBirthday(ids, orgid, appid, &role)
1716
+	err = service.SaveBirthday(ids, &role)
1720 1717
 	if err != nil {
1721 1718
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1722 1719
 		return
@@ -1934,3 +1931,53 @@ func (this *NewDialysisApiController) DeleteBed() {
1934 1931
 	this.ServeSuccessJSON(returnData)
1935 1932
 	return
1936 1933
 }
1934
+
1935
+func (this *NewDialysisApiController) LoginOut() {
1936
+
1937
+	this.DelSession("mobile_admin_user_info")
1938
+	this.Ctx.SetCookie("token_cookie", "")
1939
+	returnData := make(map[string]interface{}, 0)
1940
+	returnData["msg"] = "删除失败"
1941
+	this.ServeSuccessJSON(returnData)
1942
+	return
1943
+}
1944
+
1945
+func (this *NewDialysisApiController) GetMemberPatient() {
1946
+
1947
+	adminUser := this.GetMobileAdminUserInfo()
1948
+	orgid := adminUser.Org.Id
1949
+	patient, err := service.GetMemberPatient(orgid)
1950
+	if err != nil {
1951
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1952
+		return
1953
+	}
1954
+	this.ServeSuccessJSON(map[string]interface{}{
1955
+		"patient": patient,
1956
+	})
1957
+}
1958
+
1959
+func (this *NewDialysisApiController) GetSlowPatient() {
1960
+	adminUser := this.GetMobileAdminUserInfo()
1961
+	orgid := adminUser.Org.Id
1962
+	patient, err := service.GetSlowPatient(orgid)
1963
+	if err != nil {
1964
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1965
+		return
1966
+	}
1967
+	this.ServeSuccessJSON(map[string]interface{}{
1968
+		"patient": patient,
1969
+	})
1970
+}
1971
+
1972
+func (this *NewDialysisApiController) GetBloodPatient() {
1973
+	adminUser := this.GetMobileAdminUserInfo()
1974
+	orgid := adminUser.Org.Id
1975
+	patient, err := service.GetBloodPatient(orgid)
1976
+	if err != nil {
1977
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1978
+		return
1979
+	}
1980
+	this.ServeSuccessJSON(map[string]interface{}{
1981
+		"patient": patient,
1982
+	})
1983
+}

+ 4 - 0
controllers/new_mobile_api_controllers/new_mobile_api_router_register.go Visa fil

@@ -123,4 +123,8 @@ func NewMobileAPIControllersRegisterRouters() {
123 123
 	beego.Router("/m/api/patient/savebed", &NewDialysisApiController{}, "Get:SaveBed")
124 124
 	beego.Router("/m/api/patient/getallnumber", &NewDialysisApiController{}, "Get:GetAllNumber")
125 125
 	beego.Router("/m/api/patient/deletebed", &NewDialysisApiController{}, "Delete:DeleteBed")
126
+	beego.Router("/m/api/patient/loginout", &NewDialysisApiController{}, "Get:LoginOut")
127
+	beego.Router("/m/api/patient/getmemberpatient", &NewDialysisApiController{}, "Get:GetMemberPatient")
128
+	beego.Router("/m/api/patient/getslowpatient", &NewDialysisApiController{}, "Get:GetSlowPatient")
129
+	beego.Router("/m/api/patient/getbloodpatient", &NewDialysisApiController{}, "Get:GetBloodPatient")
126 130
 }

+ 3 - 0
models/dialysis.go Visa fil

@@ -817,6 +817,9 @@ type SgjUserAdminRole struct {
817 817
 	Status      int64  `gorm:"column:status" json:"status" form:"status"`
818 818
 	Ctime       int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
819 819
 	Mtime       int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
820
+	Message     string `gorm:"column:message" json:"message" form:"message"`
821
+	Sex         int64  `gorm:"column:sex" json:"sex" form:"sex"`
822
+	Birthday    int64  `gorm:"column:birthday" json:"birthday" form:"birthday"`
820 823
 }
821 824
 
822 825
 func (SgjUserAdminRole) TableName() string {

+ 6 - 0
service/manage_service.go Visa fil

@@ -1064,3 +1064,9 @@ func GetPositionName(adminid int64, orgid int64, appid int64) (models.App_Role,
1064 1064
 	err := UserReadDB().Model(&role).Where("admin_user_id = ? and org_id = ? and app_id = ?", adminid, orgid, appid).Find(&role).Error
1065 1065
 	return role, err
1066 1066
 }
1067
+
1068
+func GetPosition(id int64) (models.SgjUserAdminRole, error) {
1069
+	roles := models.SgjUserAdminRole{}
1070
+	err = UserReadDB().Model(&roles).Where("id=? and status = 1", id).Find(&roles).Error
1071
+	return roles, err
1072
+}

+ 31 - 7
service/patientmanage_service.go Visa fil

@@ -26,11 +26,17 @@ func GetBloodDialysisPatient(orgid int64, page int64, limit int64) (patients []*
26 26
 	return
27 27
 }
28 28
 
29
-func GetAllBloodDialysisPatient(orgid int64, page int64, limit int64) (patients []*models.XtPatientsNew, total int64, err error) {
29
+func GetAllBloodDialysisPatient(orgid int64, page int64, limit int64, lapseto int64, source int64) (patients []*models.XtPatientsNew, total int64, err error) {
30 30
 	db := XTReadDB().Table("xt_patients_new as x").Where("x.status = 1")
31 31
 	if orgid > 0 {
32 32
 		db = db.Where("x.user_org_id = ? and x.blood_patients = 1", orgid)
33 33
 	}
34
+	if lapseto > 0 {
35
+		db = db.Where("x.lapseto = ?", lapseto)
36
+	}
37
+	if source > 0 {
38
+		db = db.Where("x.source = ?", source)
39
+	}
34 40
 	offset := (page - 1) * limit
35 41
 	err = db.Count(&total).Order("x.created_time desc").Offset(offset).Limit(limit).
36 42
 		Select("x.id,x.user_org_id,x.user_id,x.avatar,x.patient_type,x.dialysis_no,x.admission_number,x.source,x.lapseto,x.partition_id,x.bed_id,x.name,x.alias,x.gender,x.marital_status,x.id_card_no,x.birthday,x.reimbursement_way_id,x.health_care_type,x.health_care_no,x.health_care_due_date,x.height,x.blood_type,x.rh,x.health_care_due_alert_date,x.education_level,x.profession,x.phone,x.home_telephone,x.relative_phone,x.relative_relations,x.home_address,x.work_unit,x.unit_address,x.children,x.receiving_date,x.is_hospital_first_dialysis,x.first_dialysis_date,x.first_dialysis_hospital,x.predialysis_condition,x.pre_hospital_dialysis_frequency,x.pre_hospital_dialysis_times,x.hospital_first_dialysis_date,x.induction_period,x.initial_dialysis,x.total_dialysis,x.attending_doctor_id,x.head_nurse_id,x.evaluate,x.diagnose,x.remark,x.registrars_id,x.registrars,x.qr_code,x.binding_state,x.patient_complains,x.present_history,x.past_history,x.temperature,x.pulse,x.respiratory,x.sbp,x.dbp,x.status,x.created_time,x.updated_time,x.nation,x.native_place,x.age,x.blood_patients,x.slow_patients,x.member_patients,x.ecommer_patients,x.blood_id,x.slow_id,x.member_id").Find(&patients).Error
@@ -986,19 +992,19 @@ func DeleteChildInspection(name string, date int64, orgid int64) error {
986 992
 	return err
987 993
 }
988 994
 
989
-func SaveMessage(orgid int64, appid int64, id int64, role *models.App_Role) error {
995
+func SaveMessage(id int64, role *models.SgjUserAdminRole) error {
990 996
 
991
-	err := UserWriteDB().Model(models.App_Role{}).Where("org_id = ? and app_id = ? and admin_user_id = ?", orgid, appid, id).Update(map[string]interface{}{"message": role.Message, "mtime": time.Now().Unix()}).Error
997
+	err := UserWriteDB().Model(models.SgjUserAdminRole{}).Where("id = ?", id).Update(map[string]interface{}{"message": role.Message, "mtime": time.Now().Unix()}).Error
992 998
 	return err
993 999
 }
994 1000
 
995
-func SaveSex(id int64, orgid int64, appid int64, role *models.App_Role) error {
996
-	err := UserWriteDB().Model(models.App_Role{}).Where("org_id = ? and app_id = ? and admin_user_id = ?", orgid, appid, id).Update(map[string]interface{}{"sex": role.Sex, "mtime": time.Now().Unix()}).Error
1001
+func SaveSex(id int64, role *models.SgjUserAdminRole) error {
1002
+	err := UserWriteDB().Model(models.SgjUserAdminRole{}).Where("id = ?", id).Update(map[string]interface{}{"sex": role.Sex, "mtime": time.Now().Unix()}).Error
997 1003
 	return err
998 1004
 }
999 1005
 
1000
-func SaveBirthday(id int64, orgid int64, appid int64, role *models.App_Role) error {
1001
-	err := UserWriteDB().Model(models.App_Role{}).Where("org_id = ? and app_id = ? and admin_user_id = ?", orgid, appid, id).Update(map[string]interface{}{"birthday": role.Birthday, "mtime": time.Now().Unix()}).Error
1006
+func SaveBirthday(id int64, role *models.SgjUserAdminRole) error {
1007
+	err := UserWriteDB().Model(models.SgjUserAdminRole{}).Where("id = ?", id).Update(map[string]interface{}{"birthday": role.Birthday, "mtime": time.Now().Unix()}).Error
1002 1008
 	return err
1003 1009
 }
1004 1010
 
@@ -1079,3 +1085,21 @@ func DeleteBed(id int64) error {
1079 1085
 	err := XTWriteDB().Model(models.DeviceNumber{}).Where("id=?", id).Update(map[string]interface{}{"status": 0, "ctime": time.Now().Unix()}).Error
1080 1086
 	return err
1081 1087
 }
1088
+
1089
+func GetMemberPatient(orgid int64) (patients []*models.XtPatientsNew, err error) {
1090
+
1091
+	err = XTReadDB().Model(&patients).Where("user_org_id = ? AND member_patients = ? AND status = 1", orgid, 1).Find(&patients).Error
1092
+	return patients, err
1093
+}
1094
+
1095
+func GetSlowPatient(orgid int64) (patients []*models.XtPatientsNew, err error) {
1096
+
1097
+	err = XTReadDB().Model(&patients).Where("user_org_id = ? AND slow_patients = ? AND status = 1", orgid, 1).Find(&patients).Error
1098
+	return patients, err
1099
+
1100
+}
1101
+
1102
+func GetBloodPatient(orgid int64) (patients []*models.XtPatientsNew, err error) {
1103
+	err = XTReadDB().Model(&patients).Where("user_org_id = ? AND blood_patients = ? AND status = 1", orgid, 1).Find(&patients).Error
1104
+	return patients, err
1105
+}