瀏覽代碼

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

csx 4 年之前
父節點
當前提交
33a8bb9a70
共有 4 個文件被更改,包括 59 次插入6 次删除
  1. 43 2
      controllers/his_project_api_controller.go
  2. 8 4
      controllers/role_controller.go
  3. 2 0
      models/his_models.go
  4. 6 0
      service/his_project_service.go

+ 43 - 2
controllers/his_project_api_controller.go 查看文件

@@ -76,6 +76,9 @@ func HisProjectRouters() {
76 76
 	beego.Router("/api/hispatient/getchargeprint", &HisProjectApiController{}, "Get:GetChargePrint")
77 77
 	beego.Router("/api/hispatient/gettodayschedulepatient", &HisProjectApiController{}, "Get:GetTodaySchedulePatient")
78 78
 	beego.Router("/api/hispatient/gethispatientdetail", &HisProjectApiController{}, "Get:GetHisPatientDetail")
79
+
80
+	beego.Router("/api/hispatient/getalldepartmentlist", &HisProjectApiController{}, "Get:GetAllDepartmentList")
81
+	beego.Router("/api/hispatient/getprescription", &HisProjectApiController{}, "Get:GetPrescription")
79 82
 }
80 83
 
81 84
 func (this *HisProjectApiController) SaveProject() {
@@ -729,7 +732,8 @@ func (this *HisProjectApiController) SaveHisPatient() {
729 732
 	recordDateStr := time.Now().Format("2006-01-02")
730 733
 	recordDate, _ := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
731 734
 	nowtime := recordDate.Unix()
732
-
735
+	phone := this.GetString("phone")
736
+	social_type, _ := this.GetInt64("social_type")
733 737
 	bloodPatient, errcode := service.GetBloodPatientByIdCard(idcard, orgId)
734 738
 	if errcode == gorm.ErrRecordNotFound {
735 739
 		patient := models.XtHisPatient{
@@ -756,13 +760,15 @@ func (this *HisProjectApiController) SaveHisPatient() {
756 760
 			RecordDate:          nowtime,
757 761
 			IsReturn:            1,
758 762
 			Ctime:               time.Now().Unix(),
763
+			Phone:               phone,
764
+			SocialType:          social_type,
759 765
 		}
760 766
 		err := service.CreateHisPatient(&patient)
761 767
 		lastPatient, err := service.GetLastPatient(orgId)
762 768
 		timeStr := time.Now().Format("2006-01-02")
763 769
 		timeArr := strings.Split(timeStr, "-")
764 770
 		var str = timeArr[0] + timeArr[1] + timeArr[2] + strconv.FormatInt(lastPatient.ID, 10)
765
-		fmt.Println("str--------", str)
771
+
766 772
 		hisPatient := models.HisPatient{
767 773
 			Number: str,
768 774
 		}
@@ -797,6 +803,8 @@ func (this *HisProjectApiController) SaveHisPatient() {
797 803
 			UserOrgId:           orgId,
798 804
 			PatientId:           bloodPatient.ID,
799 805
 			Ctime:               time.Now().Unix(),
806
+			Phone:               phone,
807
+			SocialType:          social_type,
800 808
 		}
801 809
 		err := service.CreateHisPatient(&patient)
802 810
 		if err != nil {
@@ -1316,3 +1324,36 @@ func (this *HisProjectApiController) GetHisPatientDetail() {
1316 1324
 		"hisPatient": hisPatient,
1317 1325
 	})
1318 1326
 }
1327
+
1328
+func (this *HisProjectApiController) GetAllDepartmentList() {
1329
+
1330
+	adminUserInfo := this.GetAdminUserInfo()
1331
+	orgId := adminUserInfo.CurrentOrgId
1332
+	departMent, err := service.GetAllDepartMent(orgId)
1333
+	if err != nil {
1334
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
1335
+		return
1336
+	}
1337
+	this.ServeSuccessJSON(map[string]interface{}{
1338
+		"departMent": departMent,
1339
+	})
1340
+}
1341
+
1342
+func (this *HisProjectApiController) GetPrescription() {
1343
+
1344
+	patient_id, _ := this.GetInt64("patient_id")
1345
+	fmt.Println("patient_id", patient_id)
1346
+	timeStr := time.Now().Format("2006-01-02")
1347
+	timeLayout := "2006-01-02 15:04:05"
1348
+	fmt.Println("timeStr:", timeStr)
1349
+	timeStringToTime, _ := utils.ParseTimeStringToTime(timeLayout, timeStr+" 00:00:00")
1350
+	timenow := timeStringToTime.Unix()
1351
+	list, err := service.GetPrescriptionByPatientId(patient_id, timenow)
1352
+	if err != nil {
1353
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
1354
+		return
1355
+	}
1356
+	this.ServeSuccessJSON(map[string]interface{}{
1357
+		"list": list,
1358
+	})
1359
+}

+ 8 - 4
controllers/role_controller.go 查看文件

@@ -874,9 +874,8 @@ func (this *RoleAPIController) AddAdmin() {
874 874
 	userTitle, _ := this.GetInt("title")
875 875
 	roleIds := this.GetString("role")
876 876
 	user_title_name := this.GetString("user_title_name")
877
-	department_name := this.GetString("department_name")
877
+	department := this.GetString("department")
878 878
 	department_id, _ := this.GetInt64("department_id")
879
-
880 879
 	if len(mobile) == 0 || len(name) == 0 || (userType != 2 && userType != 3 && userType != 4) || len(roleIds) <= 0 {
881 880
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
882 881
 		return
@@ -889,7 +888,7 @@ func (this *RoleAPIController) AddAdmin() {
889 888
 		return
890 889
 	} else {
891 890
 		if adminUser == nil { //新增账号和用户
892
-			_, password, createErr := service.CreateGeneralAdminUser(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, mobile, name, user_title_name, roleIds, userType, userTitle, department_id, department_name)
891
+			_, password, createErr := service.CreateGeneralAdminUser(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, mobile, name, user_title_name, roleIds, userType, userTitle, department_id, department)
893 892
 			if createErr != nil {
894 893
 				//beego.Error("创建管理员失败:", createErr)
895 894
 				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBCreate)
@@ -922,6 +921,8 @@ func (this *RoleAPIController) AddAdmin() {
922 921
 					CreateTime:    time.Now().Unix(),
923 922
 					ModifyTime:    time.Now().Unix(),
924 923
 					RoleIds:       roleIds,
924
+					Department:    department,
925
+					DepartmentId:  department_id,
925 926
 				}
926 927
 				err := service.CreateUserRole(app_role)
927 928
 				if err != nil {
@@ -1022,6 +1023,8 @@ func (this *RoleAPIController) EditAdmin() {
1022 1023
 	roleIds := this.GetString("role")
1023 1024
 	intro := this.GetString("intro")
1024 1025
 	user_title_name := this.GetString("user_title_name")
1026
+	department := this.GetString("department")
1027
+	department_id, _ := this.GetInt64("department_id")
1025 1028
 	sort, _ := this.GetInt64("sort")
1026 1029
 	_, titleExist := models.UserTitle[userTitle]
1027 1030
 	if adminUserId <= 0 || len(name) == 0 || (userType != 2 && userType != 3 && userType != 4) || !titleExist || len(roleIds) <= 0 {
@@ -1039,7 +1042,8 @@ func (this *RoleAPIController) EditAdmin() {
1039 1042
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdminUserNotExist)
1040 1043
 		return
1041 1044
 	}
1042
-
1045
+	appRole.Department = department
1046
+	appRole.DepartmentId = department_id
1043 1047
 	appRole.UserName = name
1044 1048
 	appRole.UserType = int8(userType)
1045 1049
 	appRole.UserTitle = int8(userTitle)

+ 2 - 0
models/his_models.go 查看文件

@@ -526,6 +526,8 @@ type XtHisPatient struct {
526 526
 	Number                 string  `gorm:"column:number" json:"number" form:"number"`
527 527
 	Doctor                 int64   `gorm:"column:doctor" json:"doctor" form:"doctor"`
528 528
 	IsReturn               int64   `gorm:"column:is_return" json:"is_return" form:"is_return"`
529
+	Phone                  string  `gorm:"column:phone" json:"phone" form:"phone"`
530
+	SocialType             int64   `gorm:"column:social_type" json:"social_type" form:"social_type"`
529 531
 }
530 532
 
531 533
 func (XtHisPatient) TableName() string {

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

@@ -581,3 +581,9 @@ func GetPrscriptionInfo(patientid int64, recorddata int64) (info []*models.HisPr
581 581
 	return info, err
582 582
 
583 583
 }
584
+
585
+func GetPrescriptionByPatientId(patient_id int64, startime int64) (prescritpion []*models.HisPrescription, err error) {
586
+
587
+	err = XTReadDB().Model(&prescritpion).Where("patient_id = ? and record_date =?", patient_id, startime).Find(&prescritpion).Error
588
+	return prescritpion, err
589
+}