浏览代码

耗材参数

XMLWAN 4 年前
父节点
当前提交
0e121e11c6

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

@@ -78,6 +78,9 @@ func HisProjectRouters() {
78 78
 	beego.Router("/api/hispatient/getchargeprint", &HisProjectApiController{}, "Get:GetChargePrint")
79 79
 	beego.Router("/api/hispatient/gettodayschedulepatient", &HisProjectApiController{}, "Get:GetTodaySchedulePatient")
80 80
 	beego.Router("/api/hispatient/gethispatientdetail", &HisProjectApiController{}, "Get:GetHisPatientDetail")
81
+
82
+	beego.Router("/api/hispatient/getalldepartmentlist", &HisProjectApiController{}, "Get:GetAllDepartmentList")
83
+	beego.Router("/api/hispatient/getprescription", &HisProjectApiController{}, "Get:GetPrescription")
81 84
 }
82 85
 
83 86
 func (this *HisProjectApiController) SaveProject() {
@@ -776,7 +779,8 @@ func (this *HisProjectApiController) SaveHisPatient() {
776 779
 	recordDateStr := time.Now().Format("2006-01-02")
777 780
 	recordDate, _ := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
778 781
 	nowtime := recordDate.Unix()
779
-
782
+	phone := this.GetString("phone")
783
+	social_type, _ := this.GetInt64("social_type")
780 784
 	bloodPatient, errcode := service.GetBloodPatientByIdCard(idcard, orgId)
781 785
 	if errcode == gorm.ErrRecordNotFound {
782 786
 		patient := models.XtHisPatient{
@@ -803,13 +807,15 @@ func (this *HisProjectApiController) SaveHisPatient() {
803 807
 			RecordDate:             nowtime,
804 808
 			IsReturn:               1,
805 809
 			Ctime:                  time.Now().Unix(),
810
+			Phone:                  phone,
811
+			SocialType:             social_type,
806 812
 		}
807 813
 		err := service.CreateHisPatient(&patient)
808 814
 		lastPatient, err := service.GetLastPatient(orgId)
809 815
 		timeStr := time.Now().Format("2006-01-02")
810 816
 		timeArr := strings.Split(timeStr, "-")
811 817
 		var str = timeArr[0] + timeArr[1] + timeArr[2] + strconv.FormatInt(lastPatient.ID, 10)
812
-		fmt.Println("str--------", str)
818
+
813 819
 		hisPatient := models.HisPatient{
814 820
 			Number: str,
815 821
 		}
@@ -844,6 +850,8 @@ func (this *HisProjectApiController) SaveHisPatient() {
844 850
 			UserOrgId:              orgId,
845 851
 			PatientId:              bloodPatient.ID,
846 852
 			Ctime:                  time.Now().Unix(),
853
+			Phone:                  phone,
854
+			SocialType:             social_type,
847 855
 		}
848 856
 		err := service.CreateHisPatient(&patient)
849 857
 		if err != nil {
@@ -1363,3 +1371,36 @@ func (this *HisProjectApiController) GetHisPatientDetail() {
1363 1371
 		"hisPatient": hisPatient,
1364 1372
 	})
1365 1373
 }
1374
+
1375
+func (this *HisProjectApiController) GetAllDepartmentList() {
1376
+
1377
+	adminUserInfo := this.GetAdminUserInfo()
1378
+	orgId := adminUserInfo.CurrentOrgId
1379
+	departMent, err := service.GetAllDepartMent(orgId)
1380
+	if err != nil {
1381
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
1382
+		return
1383
+	}
1384
+	this.ServeSuccessJSON(map[string]interface{}{
1385
+		"departMent": departMent,
1386
+	})
1387
+}
1388
+
1389
+func (this *HisProjectApiController) GetPrescription() {
1390
+
1391
+	patient_id, _ := this.GetInt64("patient_id")
1392
+	fmt.Println("patient_id", patient_id)
1393
+	timeStr := time.Now().Format("2006-01-02")
1394
+	timeLayout := "2006-01-02 15:04:05"
1395
+	fmt.Println("timeStr:", timeStr)
1396
+	timeStringToTime, _ := utils.ParseTimeStringToTime(timeLayout, timeStr+" 00:00:00")
1397
+	timenow := timeStringToTime.Unix()
1398
+	list, err := service.GetPrescriptionByPatientId(patient_id, timenow)
1399
+	if err != nil {
1400
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
1401
+		return
1402
+	}
1403
+	this.ServeSuccessJSON(map[string]interface{}{
1404
+		"list": list,
1405
+	})
1406
+}

+ 10 - 0
controllers/role_controller.go 查看文件

@@ -1,6 +1,7 @@
1 1
 package controllers
2 2
 
3 3
 import (
4
+	"fmt"
4 5
 	"github.com/jinzhu/gorm"
5 6
 	"strconv"
6 7
 	"strings"
@@ -874,6 +875,9 @@ func (this *RoleAPIController) AddAdmin() {
874 875
 	userTitle, _ := this.GetInt("title")
875 876
 	roleIds := this.GetString("role")
876 877
 	user_title_name := this.GetString("user_title_name")
878
+	department := this.GetString("department")
879
+	department_id, _ := this.GetInt64("department_id")
880
+	fmt.Println("deparment-------", department, department_id)
877 881
 	if len(mobile) == 0 || len(name) == 0 || (userType != 2 && userType != 3 && userType != 4) || len(roleIds) <= 0 {
878 882
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
879 883
 		return
@@ -919,6 +923,8 @@ func (this *RoleAPIController) AddAdmin() {
919 923
 					CreateTime:    time.Now().Unix(),
920 924
 					ModifyTime:    time.Now().Unix(),
921 925
 					RoleIds:       roleIds,
926
+					Department:    department,
927
+					DepartmentId:  department_id,
922 928
 				}
923 929
 				err := service.CreateUserRole(app_role)
924 930
 				if err != nil {
@@ -1019,6 +1025,8 @@ func (this *RoleAPIController) EditAdmin() {
1019 1025
 	roleIds := this.GetString("role")
1020 1026
 	intro := this.GetString("intro")
1021 1027
 	user_title_name := this.GetString("user_title_name")
1028
+	department := this.GetString("department")
1029
+	department_id, _ := this.GetInt64("department_id")
1022 1030
 	sort, _ := this.GetInt64("sort")
1023 1031
 	_, titleExist := models.UserTitle[userTitle]
1024 1032
 	if adminUserId <= 0 || len(name) == 0 || (userType != 2 && userType != 3 && userType != 4) || !titleExist || len(roleIds) <= 0 {
@@ -1045,6 +1053,8 @@ func (this *RoleAPIController) EditAdmin() {
1045 1053
 	appRole.UserTitleName = user_title_name
1046 1054
 	appRole.ModifyTime = time.Now().Unix()
1047 1055
 	appRole.Sort = sort
1056
+	appRole.DepartmentId = department_id
1057
+	appRole.Department = department
1048 1058
 	saveErr := service.SaveAppRole(appRole)
1049 1059
 	if saveErr != nil {
1050 1060
 		//beego.Error("修改App_Role失败:", saveErr)

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

@@ -515,6 +515,8 @@ type XtHisPatient struct {
515 515
 	Number                 string  `gorm:"column:number" json:"number" form:"number"`
516 516
 	Doctor                 int64   `gorm:"column:doctor" json:"doctor" form:"doctor"`
517 517
 	IsReturn               int64   `gorm:"column:is_return" json:"is_return" form:"is_return"`
518
+	Phone                  string  `gorm:"column:phone" json:"phone" form:"phone"`
519
+	SocialType             int64   `gorm:"column:social_type" json:"social_type" form:"social_type"`
518 520
 }
519 521
 
520 522
 func (XtHisPatient) TableName() string {

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

@@ -61,6 +61,8 @@ type App_Role struct {
61 61
 	Birthday        int64  `gorm:"column:birthday" json:"birthday" form:"birthday"`
62 62
 	Sort            int64  `gorm:"column:sort" json:"sort" form:"sort"`
63 63
 	IsSort          int64  `gorm:"column:is_sort" json:"is_sort" form:"is_sort"`
64
+	Department      string `gorm:"column:department" json:"department" form:"department"`
65
+	DepartmentId    int64  `gorm:"column:department_id" json:"department_id" form:"department_id"`
64 66
 }
65 67
 
66 68
 func (App_Role) 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
+}